jsimd_set_ycc_rgb:
  241|  14.3k|{
  242|  14.3k|  init_simd((j_common_ptr)cinfo);
  243|       |
  244|  14.3k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  14.3k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (244:7): [Folded, False: 14.3k]
  ------------------
  245|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  246|  14.3k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (246:7): [Folded, False: 14.3k]
  ------------------
  247|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  248|  14.3k|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|  14.3k|#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: 14.3k]
  |  Branch (248:31): [True: 0, Folded]
  ------------------
  249|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  250|  14.3k|  if (!cinfo->cconvert)
  ------------------
  |  Branch (250:7): [True: 0, False: 14.3k]
  ------------------
  251|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  252|       |
  253|  14.3k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  254|  14.3k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  14.3k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (254:7): [True: 14.3k, False: 0]
  ------------------
  255|  14.3k|      IS_ALIGNED_AVX(jconst_ycc_rgb_convert_avx2)) {
  ------------------
  |  |   46|  14.3k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  14.3k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 14.3k, False: 0]
  |  |  ------------------
  ------------------
  256|  14.3k|    SET_SIMD_EXTRGB_COLOR_DECONVERTER(avx2);
  ------------------
  |  |  128|  14.3k|#define SET_SIMD_EXTRGB_COLOR_DECONVERTER(instrset) { \
  |  |  129|  14.3k|  switch (cinfo->out_color_space) { \
  |  |  130|      0|    case JCS_EXT_RGB: \
  |  |  ------------------
  |  |  |  Branch (130:5): [True: 0, False: 14.3k]
  |  |  ------------------
  |  |  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: 14.3k]
  |  |  ------------------
  |  |  135|      0|    case JCS_EXT_RGBA: \
  |  |  ------------------
  |  |  |  Branch (135:5): [True: 0, False: 14.3k]
  |  |  ------------------
  |  |  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: 14.3k]
  |  |  ------------------
  |  |  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: 14.3k]
  |  |  ------------------
  |  |  144|      0|    case JCS_EXT_BGRA: \
  |  |  ------------------
  |  |  |  Branch (144:5): [True: 0, False: 14.3k]
  |  |  ------------------
  |  |  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: 14.3k]
  |  |  ------------------
  |  |  149|      0|    case JCS_EXT_ABGR: \
  |  |  ------------------
  |  |  |  Branch (149:5): [True: 0, False: 14.3k]
  |  |  ------------------
  |  |  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: 14.3k]
  |  |  ------------------
  |  |  154|      0|    case JCS_EXT_ARGB: \
  |  |  ------------------
  |  |  |  Branch (154:5): [True: 0, False: 14.3k]
  |  |  ------------------
  |  |  155|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  156|      0|        jsimd_ycc_extxrgb_convert_##instrset; \
  |  |  157|      0|      break; \
  |  |  158|  14.3k|    default: \
  |  |  ------------------
  |  |  |  Branch (158:5): [True: 14.3k, False: 0]
  |  |  ------------------
  |  |  159|  14.3k|      cinfo->cconvert->color_convert_simd = \
  |  |  160|  14.3k|        jsimd_ycc_rgb_convert_##instrset; \
  |  |  161|  14.3k|  } \
  |  |  162|  14.3k|}
  ------------------
  257|  14.3k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  14.3k|#define JSIMD_AVX2       0x80
  ------------------
  258|  14.3k|  }
  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|   646k|{
  324|   646k|  cinfo->cconvert->color_convert_simd(cinfo->output_width, input_buf,
  325|   646k|                                      input_row, output_buf, num_rows);
  326|   646k|}
jsimd_set_h2v1_upsample:
  456|    748|{
  457|    748|  init_simd((j_common_ptr)cinfo);
  458|       |
  459|    748|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    748|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (459:7): [Folded, False: 748]
  ------------------
  460|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  461|    748|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (461:7): [Folded, False: 748]
  ------------------
  462|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  463|    748|  if (!cinfo->upsample)
  ------------------
  |  Branch (463:7): [True: 0, False: 748]
  ------------------
  464|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  465|       |
  466|    748|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  467|    748|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|    748|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (467:7): [True: 748, False: 0]
  ------------------
  468|    748|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_avx2;
  469|    748|    return JSIMD_AVX2;
  ------------------
  |  |   46|    748|#define JSIMD_AVX2       0x80
  ------------------
  470|    748|  }
  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|  46.6k|{
  506|  46.6k|  cinfo->upsample->h2v1_upsample_simd(cinfo->max_v_samp_factor,
  507|  46.6k|                                      cinfo->output_width, input_data,
  508|  46.6k|                                      output_data_ptr);
  509|  46.6k|}
jsimd_set_h2v2_upsample:
  514|  1.42k|{
  515|  1.42k|  init_simd((j_common_ptr)cinfo);
  516|       |
  517|  1.42k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.42k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (517:7): [Folded, False: 1.42k]
  ------------------
  518|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  519|  1.42k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (519:7): [Folded, False: 1.42k]
  ------------------
  520|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  521|  1.42k|  if (!cinfo->upsample)
  ------------------
  |  Branch (521:7): [True: 0, False: 1.42k]
  ------------------
  522|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  523|       |
  524|  1.42k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  525|  1.42k|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|  1.42k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (525:7): [True: 1.42k, False: 0]
  ------------------
  526|  1.42k|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_avx2;
  527|  1.42k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  1.42k|#define JSIMD_AVX2       0x80
  ------------------
  528|  1.42k|  }
  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|  70.9k|{
  564|  70.9k|  cinfo->upsample->h2v2_upsample_simd(cinfo->max_v_samp_factor,
  565|  70.9k|                                      cinfo->output_width, input_data,
  566|  70.9k|                                      output_data_ptr);
  567|  70.9k|}
jsimd_set_h2v1_fancy_upsample:
  572|  9.33k|{
  573|  9.33k|  init_simd((j_common_ptr)cinfo);
  574|       |
  575|  9.33k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  9.33k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (575:7): [Folded, False: 9.33k]
  ------------------
  576|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  577|  9.33k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (577:7): [Folded, False: 9.33k]
  ------------------
  578|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  579|  9.33k|  if (!cinfo->upsample)
  ------------------
  |  Branch (579:7): [True: 0, False: 9.33k]
  ------------------
  580|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  581|       |
  582|  9.33k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  583|  9.33k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  9.33k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (583:7): [True: 9.33k, False: 0]
  ------------------
  584|  9.33k|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2)) {
  ------------------
  |  |   46|  9.33k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  9.33k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 9.33k, False: 0]
  |  |  ------------------
  ------------------
  585|  9.33k|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_avx2;
  586|  9.33k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  9.33k|#define JSIMD_AVX2       0x80
  ------------------
  587|  9.33k|  }
  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|  48.9k|{
  629|  48.9k|  cinfo->upsample->h2v1_upsample_simd(cinfo->max_v_samp_factor,
  630|  48.9k|                                      compptr->downsampled_width, input_data,
  631|  48.9k|                                      output_data_ptr);
  632|  48.9k|}
jsimd_set_h2v2_fancy_upsample:
  637|  11.7k|{
  638|  11.7k|  init_simd((j_common_ptr)cinfo);
  639|       |
  640|  11.7k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  11.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (640:7): [Folded, False: 11.7k]
  ------------------
  641|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  642|  11.7k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (642:7): [Folded, False: 11.7k]
  ------------------
  643|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  644|  11.7k|  if (!cinfo->upsample)
  ------------------
  |  Branch (644:7): [True: 0, False: 11.7k]
  ------------------
  645|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  646|       |
  647|  11.7k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  648|  11.7k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  11.7k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (648:7): [True: 11.7k, False: 0]
  ------------------
  649|  11.7k|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2)) {
  ------------------
  |  |   46|  11.7k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  11.7k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 11.7k, False: 0]
  |  |  ------------------
  ------------------
  650|  11.7k|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_avx2;
  651|  11.7k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  11.7k|#define JSIMD_AVX2       0x80
  ------------------
  652|  11.7k|  }
  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|   434k|{
  694|   434k|  cinfo->upsample->h2v2_upsample_simd(cinfo->max_v_samp_factor,
  695|   434k|                                      compptr->downsampled_width, input_data,
  696|   434k|                                      output_data_ptr);
  697|   434k|}
jsimd_set_idct_islow:
 1153|  95.7k|{
 1154|  95.7k|  init_simd((j_common_ptr)cinfo);
 1155|       |
 1156|  95.7k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1156:7): [Folded, False: 95.7k]
  ------------------
 1157|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1158|  95.7k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  95.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (1158:7): [Folded, False: 95.7k]
  ------------------
 1159|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1160|  95.7k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (1160:7): [Folded, False: 95.7k]
  ------------------
 1161|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1162|  95.7k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (1162:7): [Folded, False: 95.7k]
  ------------------
 1163|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1164|  95.7k|  if (!cinfo->idct)
  ------------------
  |  Branch (1164:7): [True: 0, False: 95.7k]
  ------------------
 1165|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1166|       |
 1167|  95.7k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1168|  95.7k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  95.7k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (1168:7): [True: 95.7k, False: 0]
  ------------------
 1169|  95.7k|      IS_ALIGNED_AVX(jconst_idct_islow_avx2)) {
  ------------------
  |  |   46|  95.7k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  95.7k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 95.7k, False: 0]
  |  |  ------------------
  ------------------
 1170|  95.7k|    cinfo->idct->idct_simd = jsimd_idct_islow_avx2;
 1171|  95.7k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  95.7k|#define JSIMD_AVX2       0x80
  ------------------
 1172|  95.7k|  }
 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|   129M|{
 1215|   129M|  cinfo->idct->idct_simd(compptr->dct_table, coef_block, output_buf,
 1216|   129M|                         output_col);
 1217|   129M|}
jsimd.c:init_simd:
   56|   133k|{
   57|   133k|#ifndef NO_GETENV
   58|   133k|  char env[2] = { 0 };
   59|   133k|#endif
   60|   133k|  unsigned int simd_support = cinfo->is_decompressor ?
  ------------------
  |  Branch (60:31): [True: 133k, False: 0]
  ------------------
   61|   133k|                              ((j_decompress_ptr)cinfo)->master->simd_support :
   62|   133k|                              ((j_compress_ptr)cinfo)->master->simd_support;
   63|   133k|  unsigned int simd_huffman = cinfo->is_decompressor ?
  ------------------
  |  Branch (63:31): [True: 133k, False: 0]
  ------------------
   64|   133k|                              ((j_decompress_ptr)cinfo)->master->simd_huffman :
   65|   133k|                              ((j_compress_ptr)cinfo)->master->simd_huffman;
   66|       |
   67|   133k|  if (simd_support != JSIMD_UNDEFINED)
  ------------------
  |  |   49|   133k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|   133k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  |  Branch (67:7): [True: 91.3k, False: 41.9k]
  ------------------
   68|  91.3k|    return;
   69|       |
   70|  41.9k|  simd_support = jpeg_simd_cpu_support();
   71|       |
   72|  41.9k|#ifndef NO_GETENV
   73|       |  /* Force different settings through environment variables */
   74|  41.9k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
   75|  41.9k|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (75:7): [True: 41.9k, False: 0]
  |  Branch (75:47): [True: 0, False: 41.9k]
  ------------------
   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|  41.9k|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (95:7): [True: 41.9k, False: 0]
  |  Branch (95:47): [True: 0, False: 41.9k]
  ------------------
   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|  41.9k|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (101:7): [True: 41.9k, False: 0]
  |  Branch (101:47): [True: 0, False: 41.9k]
  ------------------
  102|      0|    simd_huffman = 0;
  103|  41.9k|#endif
  104|  41.9k|#endif
  105|       |
  106|  41.9k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (106:7): [True: 41.9k, False: 0]
  ------------------
  107|  41.9k|    ((j_decompress_ptr)cinfo)->master->simd_support = simd_support;
  108|  41.9k|    ((j_decompress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  109|  41.9k|  } 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|  41.9k|}

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

jpeg_CreateDecompress:
   40|  43.1k|{
   41|  43.1k|  int i;
   42|       |
   43|       |  /* Guard against version mismatches between library and caller. */
   44|  43.1k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   45|  43.1k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  43.1k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (45:7): [True: 0, False: 43.1k]
  ------------------
   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|  43.1k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (47:7): [True: 0, False: 43.1k]
  ------------------
   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|  43.1k|             (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|  43.1k|  {
   58|  43.1k|    struct jpeg_error_mgr *err = cinfo->err;
   59|  43.1k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   60|  43.1k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   61|  43.1k|    cinfo->err = err;
   62|  43.1k|    cinfo->client_data = client_data;
   63|  43.1k|  }
   64|  43.1k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  210|  43.1k|#define TRUE    1
  ------------------
   65|       |
   66|       |  /* Initialize a memory manager instance for this object */
   67|  43.1k|  jinit_memory_mgr((j_common_ptr)cinfo);
   68|       |
   69|       |  /* Zero out pointers to permanent structures. */
   70|  43.1k|  cinfo->progress = NULL;
   71|  43.1k|  cinfo->src = NULL;
   72|       |
   73|   215k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|   215k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 172k, False: 43.1k]
  ------------------
   74|   172k|    cinfo->quant_tbl_ptrs[i] = NULL;
   75|       |
   76|   215k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   215k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (76:15): [True: 172k, False: 43.1k]
  ------------------
   77|   172k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   78|   172k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   79|   172k|  }
   80|       |
   81|       |  /* Initialize marker processor so application can override methods
   82|       |   * for COM, APPn markers before calling jpeg_read_header.
   83|       |   */
   84|  43.1k|  cinfo->marker_list = NULL;
   85|  43.1k|  jinit_marker_reader(cinfo);
   86|       |
   87|       |  /* And initialize the overall input controller. */
   88|  43.1k|  jinit_input_controller(cinfo);
   89|       |
   90|  43.1k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  43.1k|#define BITS_IN_JSAMPLE  8
  ------------------
   91|       |
   92|       |  /* OK, I'm ready */
   93|  43.1k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  43.1k|#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|  43.1k|  cinfo->master = (struct jpeg_decomp_master *)
   99|  43.1k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  43.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  100|  43.1k|                                sizeof(my_decomp_master));
  101|  43.1k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
  102|  43.1k|#ifdef WITH_SIMD
  103|  43.1k|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|  43.1k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  43.1k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  104|  43.1k|#ifndef WITH_SIMDE
  105|  43.1k|  cinfo->master->simd_huffman = 1;
  106|  43.1k|#endif
  107|  43.1k|#endif
  108|  43.1k|}
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: 91.3k, False: 85.1k]
  ------------------
  287|  86.0k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1111|  86.0k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (287:3): [True: 86.0k, False: 90.3k]
  ------------------
  288|  86.0k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1066|  86.0k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  289|  86.0k|    break;
  290|  5.25k|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1112|  5.25k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (290:3): [True: 5.25k, False: 171k]
  ------------------
  291|  5.25k|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (291:9): [True: 4.38k, False: 870]
  ------------------
  292|  4.38k|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|  4.38k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  4.38k|   (*(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|  5.25k|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  298|  5.25k|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1067|  5.25k|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  299|  5.25k|    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|  86.9k|  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: 86.0k, False: 90.3k]
  ------------------
  338|       |      /* Set up default parameters based on header data */
  339|  86.0k|      default_decompress_parms(cinfo);
  340|       |      /* Set global state: ready for start_decompress */
  341|  86.0k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|  86.0k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  342|  86.0k|    }
  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|  91.3k|  return retcode;
  361|   176k|}
jpeg_has_multiple_scans:
  385|  41.5k|{
  386|       |  /* Only valid after jpeg_read_header completes */
  387|  41.5k|  if (cinfo->global_state < DSTATE_READY ||
  ------------------
  |  |   50|  83.0k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (387:7): [True: 0, False: 41.5k]
  ------------------
  388|  41.5k|      cinfo->global_state > DSTATE_STOPPING)
  ------------------
  |  |   58|  41.5k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (388:7): [True: 0, False: 41.5k]
  ------------------
  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|  41.5k|  return cinfo->inputctl->has_multiple_scans;
  391|  41.5k|}
jpeg_finish_decompress:
  405|  30.9k|{
  406|  30.9k|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  61.8k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (406:8): [True: 30.9k, False: 0]
  ------------------
  407|  30.9k|       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: 30.9k, False: 0]
  ------------------
  408|       |    /* Terminate final pass of non-buffered mode */
  409|  30.9k|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (409:9): [True: 0, False: 30.9k]
  ------------------
  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|  30.9k|    (*cinfo->master->finish_output_pass) (cinfo);
  412|  30.9k|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|  30.9k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  413|  30.9k|  } 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|  45.6k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (421:10): [True: 14.6k, False: 30.9k]
  ------------------
  422|  14.6k|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  14.6k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (422:9): [True: 0, False: 14.6k]
  ------------------
  423|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  424|  14.6k|  }
  425|       |  /* Do final cleanup */
  426|  30.9k|  (*cinfo->src->term_source) (cinfo);
  427|       |  /* We can use jpeg_abort to release memory and reset global_state */
  428|  30.9k|  jpeg_abort((j_common_ptr)cinfo);
  429|  30.9k|  return TRUE;
  ------------------
  |  |  210|  30.9k|#define TRUE    1
  ------------------
  430|  30.9k|}
jdapimin.c:default_decompress_parms:
  140|  86.0k|{
  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|  86.0k|  switch (cinfo->num_components) {
  145|  67.6k|  case 1:
  ------------------
  |  Branch (145:3): [True: 67.6k, False: 18.3k]
  ------------------
  146|  67.6k|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  147|  67.6k|    cinfo->out_color_space = JCS_GRAYSCALE;
  148|  67.6k|    break;
  149|       |
  150|  17.3k|  case 3:
  ------------------
  |  Branch (150:3): [True: 17.3k, False: 68.7k]
  ------------------
  151|  17.3k|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (151:9): [True: 31, False: 17.2k]
  ------------------
  152|     31|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  153|  17.2k|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (153:16): [True: 767, False: 16.5k]
  ------------------
  154|    767|      switch (cinfo->Adobe_transform) {
  155|    230|      case 0:
  ------------------
  |  Branch (155:7): [True: 230, False: 537]
  ------------------
  156|    230|        cinfo->jpeg_color_space = JCS_RGB;
  157|    230|        break;
  158|    318|      case 1:
  ------------------
  |  Branch (158:7): [True: 318, False: 449]
  ------------------
  159|    318|        cinfo->jpeg_color_space = JCS_YCbCr;
  160|    318|        break;
  161|    219|      default:
  ------------------
  |  Branch (161:7): [True: 219, False: 548]
  ------------------
  162|    219|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|    219|  ((cinfo)->err->msg_code = (code), \
  |  |  287|    219|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|    219|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  163|    219|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  164|    219|        break;
  165|    767|      }
  166|  16.5k|    } else {
  167|       |      /* Saw no special markers, try to guess from the component IDs */
  168|  16.5k|      int cid0 = cinfo->comp_info[0].component_id;
  169|  16.5k|      int cid1 = cinfo->comp_info[1].component_id;
  170|  16.5k|      int cid2 = cinfo->comp_info[2].component_id;
  171|       |
  172|  16.5k|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (172:11): [True: 8.47k, False: 8.04k]
  |  Branch (172:24): [True: 585, False: 7.89k]
  |  Branch (172:37): [True: 386, False: 199]
  ------------------
  173|    386|#ifdef D_LOSSLESS_SUPPORTED
  174|    386|        if (cinfo->master->lossless)
  ------------------
  |  Branch (174:13): [True: 207, False: 179]
  ------------------
  175|    207|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  176|    179|        else
  177|    179|#endif
  178|    179|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  179|  16.1k|      } else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (179:18): [True: 6.45k, False: 9.68k]
  |  Branch (179:32): [True: 6.19k, False: 252]
  |  Branch (179:46): [True: 5.70k, False: 490]
  ------------------
  180|  5.70k|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  181|  10.4k|      else {
  182|  10.4k|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|  10.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  10.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 10.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  10.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  10.4k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  10.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  183|  10.4k|#ifdef D_LOSSLESS_SUPPORTED
  184|  10.4k|        if (cinfo->master->lossless)
  ------------------
  |  Branch (184:13): [True: 241, False: 10.1k]
  ------------------
  185|    241|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  186|  10.1k|        else
  187|  10.1k|#endif
  188|  10.1k|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  189|  10.4k|      }
  190|  16.5k|    }
  191|       |    /* Always guess RGB is proper output colorspace. */
  192|  17.3k|    cinfo->out_color_space = JCS_RGB;
  193|  17.3k|    break;
  194|       |
  195|  1.07k|  case 4:
  ------------------
  |  Branch (195:3): [True: 1.07k, False: 84.9k]
  ------------------
  196|  1.07k|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (196:9): [True: 240, False: 830]
  ------------------
  197|    240|      switch (cinfo->Adobe_transform) {
  198|     78|      case 0:
  ------------------
  |  Branch (198:7): [True: 78, False: 162]
  ------------------
  199|     78|        cinfo->jpeg_color_space = JCS_CMYK;
  200|     78|        break;
  201|     75|      case 2:
  ------------------
  |  Branch (201:7): [True: 75, False: 165]
  ------------------
  202|     75|        cinfo->jpeg_color_space = JCS_YCCK;
  203|     75|        break;
  204|     87|      default:
  ------------------
  |  Branch (204:7): [True: 87, False: 153]
  ------------------
  205|     87|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|     87|  ((cinfo)->err->msg_code = (code), \
  |  |  287|     87|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|     87|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  206|     87|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  207|     87|        break;
  208|    240|      }
  209|    830|    } else {
  210|       |      /* No special markers, assume straight CMYK. */
  211|    830|      cinfo->jpeg_color_space = JCS_CMYK;
  212|    830|    }
  213|  1.07k|    cinfo->out_color_space = JCS_CMYK;
  214|  1.07k|    break;
  215|       |
  216|      3|  default:
  ------------------
  |  Branch (216:3): [True: 3, False: 86.0k]
  ------------------
  217|      3|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  218|      3|    cinfo->out_color_space = JCS_UNKNOWN;
  219|      3|    break;
  220|  86.0k|  }
  221|       |
  222|       |  /* Set defaults for other decompression parameters. */
  223|  86.0k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  224|  86.0k|  cinfo->scale_denom = 1;
  225|  86.0k|  cinfo->output_gamma = 1.0;
  226|  86.0k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  207|  86.0k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  86.0k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|  86.0k|#define FALSE   0               /* values of boolean */
  ------------------
  228|  86.0k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|  86.0k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  229|  86.0k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  210|  86.0k|#define TRUE    1
  ------------------
  230|  86.0k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  210|  86.0k|#define TRUE    1
  ------------------
  231|  86.0k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  207|  86.0k|#define FALSE   0               /* values of boolean */
  ------------------
  232|       |  /* We set these in case application only sets quantize_colors. */
  233|  86.0k|  cinfo->dither_mode = JDITHER_FS;
  234|  86.0k|#ifdef QUANT_2PASS_SUPPORTED
  235|  86.0k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  210|  86.0k|#define TRUE    1
  ------------------
  236|       |#else
  237|       |  cinfo->two_pass_quantize = FALSE;
  238|       |#endif
  239|  86.0k|  cinfo->desired_number_of_colors = 256;
  240|  86.0k|  cinfo->colormap = NULL;
  241|       |  /* Initialize for no mode change in buffered-image mode. */
  242|  86.0k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|  86.0k|#define FALSE   0               /* values of boolean */
  ------------------
  243|  86.0k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|  86.0k|#define FALSE   0               /* values of boolean */
  ------------------
  244|  86.0k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|  86.0k|#define FALSE   0               /* values of boolean */
  ------------------
  245|  86.0k|}

jpeg_start_decompress:
   56|  82.0k|{
   57|  82.0k|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|  82.0k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (57:7): [True: 82.0k, False: 0]
  ------------------
   58|       |    /* First call: initialize master control, select active modules */
   59|  82.0k|    jinit_master_decompress(cinfo);
   60|  82.0k|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (60:9): [True: 0, False: 82.0k]
  ------------------
   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|  82.0k|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   51|  82.0k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   66|  82.0k|  }
   67|  82.0k|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   51|  82.0k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (67:7): [True: 78.5k, False: 3.43k]
  ------------------
   68|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   69|  78.5k|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (69:9): [True: 22.9k, False: 55.6k]
  ------------------
   70|  22.9k|#ifdef D_MULTISCAN_FILES_SUPPORTED
   71|  1.37M|      for (;;) {
   72|  1.37M|        int retcode;
   73|       |        /* Call progress monitor hook if present */
   74|  1.37M|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (74:13): [True: 1.37M, False: 0]
  ------------------
   75|  1.37M|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   76|       |        /* Absorb some more input */
   77|  1.37M|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   78|  1.37M|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  1.37M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (78:13): [True: 0, False: 1.37M]
  ------------------
   79|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   80|  1.37M|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1112|  1.37M|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (80:13): [True: 16.6k, False: 1.36M]
  ------------------
   81|  16.6k|          break;
   82|       |        /* Advance progress counter if appropriate */
   83|  1.36M|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (83:13): [True: 1.35M, False: 6.27k]
  ------------------
   84|  1.35M|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1113|  2.70M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1111|  39.0k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (84:14): [True: 1.31M, False: 39.0k]
  |  Branch (84:47): [True: 8.06k, False: 30.9k]
  ------------------
   85|  1.32M|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (85:15): [True: 1.16k, False: 1.32M]
  ------------------
   86|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   87|  1.16k|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   88|  1.16k|          }
   89|  1.32M|        }
   90|  1.36M|      }
   91|       |#else
   92|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   93|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   94|  22.9k|    }
   95|  78.5k|    cinfo->output_scan_number = cinfo->input_scan_number;
   96|  78.5k|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|  3.43k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (96:14): [True: 0, False: 3.43k]
  ------------------
   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|  82.0k|  return output_pass_setup(cinfo);
  100|  82.0k|}
jpeg_read_scanlines:
  328|   193M|{
  329|   193M|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  330|   193M|  JDIMENSION row_ctr;
  331|       |
  332|   193M|#ifdef D_LOSSLESS_SUPPORTED
  333|   193M|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (333:7): [True: 133k, False: 192M]
  ------------------
  334|   133k|#if BITS_IN_JSAMPLE == 8
  335|   133k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|   266k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (335:9): [True: 0, False: 133k]
  |  Branch (335:52): [True: 0, False: 133k]
  ------------------
  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|   133k|  } else
  342|   192M|#endif
  343|   192M|  {
  344|   192M|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|   192M|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (344:9): [True: 0, False: 192M]
  ------------------
  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|   192M|  }
  347|       |
  348|   193M|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|   193M|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (348:7): [True: 9, False: 193M]
  ------------------
  349|      9|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      9|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  350|   193M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (350:7): [True: 175M, False: 17.1M]
  ------------------
  351|   175M|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  283|   175M|  ((cinfo)->err->msg_code = (code), \
  |  |  284|   175M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  352|   175M|    return 0;
  353|   175M|  }
  354|       |
  355|       |  /* Call progress monitor hook if present */
  356|  17.1M|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (356:7): [True: 3.68M, False: 13.4M]
  ------------------
  357|  3.68M|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  358|  3.68M|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  359|  3.68M|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  360|  3.68M|  }
  361|       |
  362|       |  /* Process some data */
  363|  17.1M|  row_ctr = 0;
  364|  17.1M|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  256|  17.1M|#define _process_data  process_data
  ------------------
  |  Branch (364:7): [True: 0, False: 17.1M]
  ------------------
  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|  17.1M|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  256|  17.1M|#define _process_data  process_data
  ------------------
  367|  17.1M|  cinfo->output_scanline += row_ctr;
  368|  17.1M|  return row_ctr;
  369|       |#else
  370|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  371|       |  return 0;
  372|       |#endif
  373|   193M|}
jpeg_read_raw_data:
  720|  1.10M|{
  721|  1.10M|  JDIMENSION lines_per_iMCU_row;
  722|       |
  723|  1.10M|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.10M|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (723:7): [True: 0, False: 1.10M]
  ------------------
  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.10M|  if (cinfo->master->lossless)
  ------------------
  |  Branch (726:7): [True: 0, False: 1.10M]
  ------------------
  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.10M|  if (cinfo->global_state != DSTATE_RAW_OK)
  ------------------
  |  |   54|  1.10M|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (729:7): [True: 0, False: 1.10M]
  ------------------
  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.10M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (731:7): [True: 76.6k, False: 1.02M]
  ------------------
  732|  76.6k|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  283|  76.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  76.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  733|  76.6k|    return 0;
  734|  76.6k|  }
  735|       |
  736|       |  /* Call progress monitor hook if present */
  737|  1.02M|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (737:7): [True: 0, False: 1.02M]
  ------------------
  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|  1.02M|  lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.02M|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  745|  1.02M|  if (max_lines < lines_per_iMCU_row)
  ------------------
  |  Branch (745:7): [True: 0, False: 1.02M]
  ------------------
  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|  1.02M|  if (cinfo->coef->_decompress_data == NULL)
  ------------------
  |  |  258|  1.02M|#define _decompress_data  decompress_data
  ------------------
  |  Branch (749:7): [True: 0, False: 1.02M]
  ------------------
  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|  1.02M|  if (!(*cinfo->coef->_decompress_data) (cinfo, data))
  ------------------
  |  |  258|  1.02M|#define _decompress_data  decompress_data
  ------------------
  |  Branch (751:7): [True: 0, False: 1.02M]
  ------------------
  752|      0|    return 0;                   /* suspension forced, can do nothing more */
  753|       |
  754|       |  /* OK, we processed one iMCU row. */
  755|  1.02M|  cinfo->output_scanline += lines_per_iMCU_row;
  756|  1.02M|  return lines_per_iMCU_row;
  757|  1.02M|}
jdapistd-8.c:output_pass_setup:
  113|  72.3k|{
  114|  72.3k|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   52|  72.3k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (114:7): [True: 72.3k, False: 0]
  ------------------
  115|       |    /* First call: do pass setup */
  116|  72.3k|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  117|  72.3k|    cinfo->output_scanline = 0;
  118|  72.3k|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   52|  72.3k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  119|  72.3k|  }
  120|       |  /* Loop over any required dummy passes */
  121|  72.3k|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (121:10): [True: 0, False: 72.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|  72.3k|  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   54|  1.11k|#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|   143k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (170:25): [True: 1.11k, False: 71.2k]
  ------------------
  171|  72.3k|  return TRUE;
  ------------------
  |  |  210|  72.3k|#define TRUE    1
  ------------------
  172|  72.3k|}
jpeg12_read_scanlines:
  328|  1.90M|{
  329|  1.90M|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  330|  1.90M|  JDIMENSION row_ctr;
  331|       |
  332|  1.90M|#ifdef D_LOSSLESS_SUPPORTED
  333|  1.90M|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (333:7): [True: 73.3k, False: 1.83M]
  ------------------
  334|       |#if BITS_IN_JSAMPLE == 8
  335|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  336|       |#else
  337|  73.3k|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|   146k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (337:9): [True: 0, False: 73.3k]
  ------------------
  338|  73.3k|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|  73.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (338:9): [True: 0, False: 73.3k]
  ------------------
  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|  73.3k|  } else
  342|  1.83M|#endif
  343|  1.83M|  {
  344|  1.83M|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.83M|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (344:9): [True: 0, False: 1.83M]
  ------------------
  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.83M|  }
  347|       |
  348|  1.90M|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|  1.90M|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (348:7): [True: 202, False: 1.90M]
  ------------------
  349|    202|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|    202|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    202|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    202|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  350|  1.90M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (350:7): [True: 0, False: 1.90M]
  ------------------
  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.90M|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (356:7): [True: 1.90M, False: 202]
  ------------------
  357|  1.90M|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  358|  1.90M|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  359|  1.90M|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  360|  1.90M|  }
  361|       |
  362|       |  /* Process some data */
  363|  1.90M|  row_ctr = 0;
  364|  1.90M|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  140|  1.90M|#define _process_data  process_data_12
  ------------------
  |  Branch (364:7): [True: 0, False: 1.90M]
  ------------------
  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.90M|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  140|  1.90M|#define _process_data  process_data_12
  ------------------
  367|  1.90M|  cinfo->output_scanline += row_ctr;
  368|  1.90M|  return row_ctr;
  369|       |#else
  370|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  371|       |  return 0;
  372|       |#endif
  373|  1.90M|}

jinit_arith_decoder:
  751|  19.0k|{
  752|  19.0k|  arith_entropy_ptr entropy;
  753|  19.0k|  int i;
  754|       |
  755|  19.0k|  entropy = (arith_entropy_ptr)
  756|  19.0k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  19.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  19.0k|                                sizeof(arith_entropy_decoder));
  758|  19.0k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  19.0k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|   323k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   323k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 304k, False: 19.0k]
  ------------------
  763|   304k|    entropy->dc_stats[i] = NULL;
  764|   304k|    entropy->ac_stats[i] = NULL;
  765|   304k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  19.0k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  19.0k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 11.9k, False: 7.11k]
  ------------------
  771|       |    /* Create progression status table */
  772|  11.9k|    int *coef_bit_ptr, ci;
  773|  11.9k|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|  11.9k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  11.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|  11.9k|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  11.9k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|  11.9k|                                  sizeof(int));
  777|  11.9k|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  38.2k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 26.3k, False: 11.9k]
  ------------------
  779|  1.71M|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  1.71M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 1.68M, False: 26.3k]
  ------------------
  780|  1.68M|        *coef_bit_ptr++ = -1;
  781|  11.9k|  }
  782|  19.0k|}
jdarith.c:start_pass:
  633|  22.7k|{
  634|  22.7k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  22.7k|  int ci, tbl;
  636|  22.7k|  jpeg_component_info *compptr;
  637|       |
  638|  22.7k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 15.5k, False: 7.21k]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  15.5k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 11.1k, False: 4.34k]
  ------------------
  641|  11.1k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 215, False: 10.9k]
  ------------------
  642|    215|        goto bad;
  643|  11.1k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|  4.34k|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|  4.11k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 227, False: 4.11k]
  |  Branch (645:36): [True: 231, False: 3.88k]
  ------------------
  646|    458|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|  3.88k|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 221, False: 3.66k]
  ------------------
  649|    221|        goto bad;
  650|  3.88k|    }
  651|  14.6k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 4.89k, False: 9.72k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|  4.89k|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 257, False: 4.63k]
  ------------------
  654|    257|        goto bad;
  655|  4.89k|    }
  656|  14.3k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 257, False: 14.1k]
  ------------------
  657|  1.40k|bad:
  658|  1.40k|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.40k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.40k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.40k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.40k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.40k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.40k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|  1.40k|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|  1.40k|    }
  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|  36.6k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 21.1k, False: 15.5k]
  ------------------
  666|  21.1k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  21.1k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  21.1k|      int *prev_coef_bit_ptr =
  669|  21.1k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  21.1k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 3.44k, False: 17.7k]
  |  Branch (670:24): [True: 2.53k, False: 906]
  ------------------
  671|  2.53k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  2.53k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  2.53k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  2.53k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  2.53k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|   358k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  21.1k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 17.7k, False: 3.44k]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|   358k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 161k, False: 196k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 337k, False: 21.1k]
  ------------------
  673|   337k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 64.5k, False: 272k]
  ------------------
  674|  64.5k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|   272k|        else
  676|   272k|          prev_coef_bit_ptr[coefi] = 0;
  677|   337k|      }
  678|   132k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 110k, False: 21.1k]
  ------------------
  679|   110k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 97.7k, False: 13.1k]
  ------------------
  680|   110k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 25.1k, False: 85.8k]
  ------------------
  681|  25.1k|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  25.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  25.1k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  25.1k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  25.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|   110k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|   110k|      }
  684|  21.1k|    }
  685|       |    /* Select MCU decoding routine */
  686|  15.5k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 9.70k, False: 5.80k]
  ------------------
  687|  9.70k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 7.14k, False: 2.56k]
  ------------------
  688|  7.14k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|  2.56k|      else
  690|  2.56k|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  9.70k|    } else {
  692|  5.80k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 3.52k, False: 2.28k]
  ------------------
  693|  3.52k|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|  2.28k|      else
  695|  2.28k|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|  5.80k|    }
  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|  7.21k|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  4.74k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 2.47k, False: 4.74k]
  |  Branch (701:27): [True: 4.22k, False: 513]
  ------------------
  702|    513|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 215, False: 298]
  |  Branch (702:27): [True: 167, False: 131]
  ------------------
  703|  7.08k|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  7.08k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  7.08k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|  7.21k|    entropy->pub.decode_mcu = decode_mcu;
  706|  7.21k|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  51.7k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 29.0k, False: 22.7k]
  ------------------
  710|  29.0k|    compptr = cinfo->cur_comp_info[ci];
  711|  29.0k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 7.83k, False: 21.1k]
  |  Branch (711:38): [True: 17.7k, False: 3.44k]
  |  Branch (711:56): [True: 13.2k, False: 4.47k]
  ------------------
  712|  21.0k|      tbl = compptr->dc_tbl_no;
  713|  21.0k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  21.0k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 21.0k]
  |  Branch (713:22): [True: 0, False: 21.0k]
  ------------------
  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|  21.0k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 13.6k, False: 7.41k]
  ------------------
  716|  13.6k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  13.6k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  13.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  13.6k|#define DC_STAT_BINS  64
  ------------------
  718|  21.0k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  21.0k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  21.0k|      entropy->last_dc_val[ci] = 0;
  721|  21.0k|      entropy->dc_context[ci] = 0;
  722|  21.0k|    }
  723|  29.0k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 7.83k, False: 21.1k]
  |  Branch (723:37): [True: 3.44k, False: 17.7k]
  ------------------
  724|  11.2k|      tbl = compptr->ac_tbl_no;
  725|  11.2k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  11.2k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 11.2k]
  |  Branch (725:22): [True: 0, False: 11.2k]
  ------------------
  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|  11.2k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 10.2k, False: 1.00k]
  ------------------
  728|  10.2k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|  10.2k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|  10.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  10.2k|#define AC_STAT_BINS  256
  ------------------
  730|  11.2k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  11.2k|#define AC_STAT_BINS  256
  ------------------
  731|  11.2k|    }
  732|  29.0k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  22.7k|  entropy->c = 0;
  736|  22.7k|  entropy->a = 0;
  737|  22.7k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  22.7k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  22.7k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  22.7k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  22.7k|}
jdarith.c:decode_mcu_DC_first:
  251|  20.3M|{
  252|  20.3M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  20.3M|  JBLOCKROW block;
  254|  20.3M|  unsigned char *st;
  255|  20.3M|  int blkn, ci, tbl, sign;
  256|  20.3M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  20.3M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 56.9k, False: 20.2M]
  ------------------
  260|  56.9k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 33.5k, False: 23.3k]
  ------------------
  261|  33.5k|      process_restart(cinfo);
  262|  56.9k|    entropy->restarts_to_go--;
  263|  56.9k|  }
  264|       |
  265|  20.3M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   280k|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 280k, False: 20.0M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  40.3M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 20.3M, False: 20.0M]
  ------------------
  270|  20.3M|    block = MCU_data[blkn];
  271|  20.3M|    ci = cinfo->MCU_membership[blkn];
  272|  20.3M|    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|  20.3M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  20.3M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 8.56M, False: 11.7M]
  ------------------
  281|  8.56M|      entropy->dc_context[ci] = 0;
  282|  11.7M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  11.7M|      sign = arith_decode(cinfo, st + 1);
  286|  11.7M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  11.7M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 7.17M, False: 4.58M]
  ------------------
  289|  7.17M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  14.4M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 7.30M, False: 7.17M]
  ------------------
  291|  7.30M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 142, False: 7.30M]
  ------------------
  292|    142|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    142|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    142|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|    142|            entropy->ct = -1;                   /* magnitude overflow */
  294|    142|            return TRUE;
  ------------------
  |  |  210|    142|#define TRUE    1
  ------------------
  295|    142|          }
  296|  7.30M|          st += 1;
  297|  7.30M|        }
  298|  7.17M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  11.7M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 0, False: 11.7M]
  ------------------
  301|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  11.7M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 3.55M, False: 8.20M]
  ------------------
  303|  3.55M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  8.20M|      else
  305|  8.20M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  11.7M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  11.7M|      st += 14;
  309|  19.0M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 7.30M, False: 11.7M]
  ------------------
  310|  7.30M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 3.31M, False: 3.99M]
  ------------------
  311|  11.7M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 5.03M, False: 6.72M]
  ------------------
  312|  11.7M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  11.7M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  20.3M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  20.3M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  20.3M|  }
  318|       |
  319|  20.0M|  return TRUE;
  ------------------
  |  |  210|  20.0M|#define TRUE    1
  ------------------
  320|  20.0M|}
jdarith.c:process_restart:
  200|  97.1k|{
  201|  97.1k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  202|  97.1k|  int ci;
  203|  97.1k|  jpeg_component_info *compptr;
  204|       |
  205|       |  /* Advance past the RSTn marker */
  206|  97.1k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (206:7): [True: 0, False: 97.1k]
  ------------------
  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|   329k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (210:16): [True: 231k, False: 97.1k]
  ------------------
  211|   231k|    compptr = cinfo->cur_comp_info[ci];
  212|   231k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (212:9): [True: 48.2k, False: 183k]
  |  Branch (212:38): [True: 154k, False: 29.4k]
  |  Branch (212:56): [True: 100k, False: 53.4k]
  ------------------
  213|   149k|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|   149k|#define DC_STAT_BINS  64
  ------------------
  214|       |      /* Reset DC predictions to 0 */
  215|   149k|      entropy->last_dc_val[ci] = 0;
  216|   149k|      entropy->dc_context[ci] = 0;
  217|   149k|    }
  218|   231k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (218:9): [True: 48.2k, False: 183k]
  |  Branch (218:37): [True: 29.4k, False: 154k]
  ------------------
  219|  77.6k|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  77.6k|#define AC_STAT_BINS  256
  ------------------
  220|  77.6k|    }
  221|   231k|  }
  222|       |
  223|       |  /* Reset arithmetic decoding variables */
  224|  97.1k|  entropy->c = 0;
  225|  97.1k|  entropy->a = 0;
  226|  97.1k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  227|       |
  228|       |  /* Reset restart counter */
  229|  97.1k|  entropy->restarts_to_go = cinfo->restart_interval;
  230|  97.1k|}
jdarith.c:arith_decode:
  116|   195M|{
  117|   195M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|   195M|  register unsigned char nl, nm;
  119|   195M|  register JLONG qe, temp;
  120|   195M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|   268M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 73.6M, False: 195M]
  ------------------
  124|  73.6M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 9.48M, False: 64.1M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  9.48M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 9.16M, False: 321k]
  ------------------
  127|  9.16M|        data = 0;               /* stuff zero data */
  128|   321k|      else {
  129|   321k|        data = get_byte(cinfo); /* read next input byte */
  130|   321k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 15.0k, False: 306k]
  ------------------
  131|  40.6k|          do data = get_byte(cinfo);
  132|  40.6k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 25.6k, False: 15.0k]
  ------------------
  133|  15.0k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 2.88k, False: 12.1k]
  ------------------
  134|  2.88k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  12.1k|          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|  12.1k|            cinfo->unread_marker = data;
  143|  12.1k|            data = 0;
  144|  12.1k|          }
  145|  15.0k|        }
  146|   321k|      }
  147|  9.48M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  9.48M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 236k, False: 9.25M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|   236k|        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|  9.48M|    }
  154|  73.6M|    e->a <<= 1;
  155|  73.6M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|   195M|  sv = *st;
  161|   195M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|   195M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|   195M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|   195M|  temp = e->a - qe;
  167|   195M|  e->a = temp;
  168|   195M|  temp <<= e->ct;
  169|   195M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 24.1M, False: 171M]
  ------------------
  170|  24.1M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  24.1M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 6.48M, False: 17.7M]
  ------------------
  173|  6.48M|      e->a = qe;
  174|  6.48M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  17.7M|    } else {
  176|  17.7M|      e->a = qe;
  177|  17.7M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  17.7M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  17.7M|    }
  180|   171M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 29.7M, False: 141M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  29.7M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 8.16M, False: 21.6M]
  ------------------
  183|  8.16M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  8.16M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  21.6M|    } else {
  186|  21.6M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  21.6M|    }
  188|  29.7M|  }
  189|       |
  190|   195M|  return sv >> 7;
  191|   195M|}
jdarith.c:get_byte:
   76|   362k|{
   77|   362k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   362k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 4.48k, False: 357k]
  ------------------
   80|  4.48k|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 4.48k]
  ------------------
   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|   362k|  src->bytes_in_buffer--;
   83|   362k|  return *src->next_input_byte++;
   84|   362k|}
jdarith.c:decode_mcu_AC_first:
  330|  4.15M|{
  331|  4.15M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  4.15M|  JBLOCKROW block;
  333|  4.15M|  unsigned char *st;
  334|  4.15M|  int tbl, sign, k;
  335|  4.15M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  4.15M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 112, False: 4.14M]
  ------------------
  339|    112|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 1, False: 111]
  ------------------
  340|      1|      process_restart(cinfo);
  341|    112|    entropy->restarts_to_go--;
  342|    112|  }
  343|       |
  344|  4.15M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|  1.81M|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 1.81M, False: 2.33M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  2.33M|  block = MCU_data[0];
  348|  2.33M|  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|  4.95M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 4.95M, False: 1.72k]
  ------------------
  354|  4.95M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  4.95M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 2.33M, False: 2.62M]
  ------------------
  356|  5.38M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 2.75M, False: 2.62M]
  ------------------
  357|  2.75M|      st += 3;  k++;
  358|  2.75M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 441, False: 2.75M]
  ------------------
  359|    441|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    441|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    441|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|    441|        entropy->ct = -1;                       /* spectral overflow */
  361|    441|        return TRUE;
  ------------------
  |  |  210|    441|#define TRUE    1
  ------------------
  362|    441|      }
  363|  2.75M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  2.62M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  2.62M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  2.62M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 1.89M, False: 726k]
  ------------------
  370|  1.89M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 1.77M, False: 125k]
  ------------------
  371|  1.77M|        m <<= 1;
  372|  1.77M|        st = entropy->ac_stats[tbl] +
  373|  1.77M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 1.38M, False: 389k]
  ------------------
  374|  2.68M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 908k, False: 1.77M]
  ------------------
  375|   908k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 129, False: 908k]
  ------------------
  376|    129|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    129|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    129|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|    129|            entropy->ct = -1;                   /* magnitude overflow */
  378|    129|            return TRUE;
  ------------------
  |  |  210|    129|#define TRUE    1
  ------------------
  379|    129|          }
  380|   908k|          st += 1;
  381|   908k|        }
  382|  1.77M|      }
  383|  1.89M|    }
  384|  2.62M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  2.62M|    st += 14;
  387|  5.30M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 2.67M, False: 2.62M]
  ------------------
  388|  2.67M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 642k, False: 2.03M]
  ------------------
  389|  2.62M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 1.33M, False: 1.29M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  2.62M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  2.62M|  }
  393|       |
  394|  2.33M|  return TRUE;
  ------------------
  |  |  210|  2.33M|#define TRUE    1
  ------------------
  395|  2.33M|}
jdarith.c:decode_mcu_DC_refine:
  404|   412k|{
  405|   412k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  406|   412k|  unsigned char *st;
  407|   412k|  int p1, blkn;
  408|       |
  409|       |  /* Process restart marker if needed */
  410|   412k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (410:7): [True: 48.9k, False: 363k]
  ------------------
  411|  48.9k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (411:9): [True: 17.9k, False: 30.9k]
  ------------------
  412|  17.9k|      process_restart(cinfo);
  413|  48.9k|    entropy->restarts_to_go--;
  414|  48.9k|  }
  415|       |
  416|   412k|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  417|   412k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  418|       |
  419|       |  /* Outer loop handles each block in the MCU */
  420|       |
  421|   877k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (421:18): [True: 465k, False: 412k]
  ------------------
  422|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  423|   465k|    if (arith_decode(cinfo, st))
  ------------------
  |  Branch (423:9): [True: 257k, False: 207k]
  ------------------
  424|   257k|      MCU_data[blkn][0][0] |= p1;
  425|   465k|  }
  426|       |
  427|   412k|  return TRUE;
  ------------------
  |  |  210|   412k|#define TRUE    1
  ------------------
  428|   412k|}
jdarith.c:decode_mcu_AC_refine:
  437|   503k|{
  438|   503k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|   503k|  JBLOCKROW block;
  440|   503k|  JCOEFPTR thiscoef;
  441|   503k|  unsigned char *st;
  442|   503k|  int tbl, k, kex;
  443|   503k|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|   503k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 148k, False: 354k]
  ------------------
  447|   148k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 29.4k, False: 119k]
  ------------------
  448|  29.4k|      process_restart(cinfo);
  449|   148k|    entropy->restarts_to_go--;
  450|   148k|  }
  451|       |
  452|   503k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   165k|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 165k, False: 337k]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|   337k|  block = MCU_data[0];
  456|   337k|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|   337k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|   337k|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|   337k|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|  12.3M|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 12.0M, False: 305k]
  ------------------
  463|  12.0M|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 32.2k, False: 12.0M]
  ------------------
  464|       |
  465|   768k|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 767k, False: 1.20k]
  ------------------
  466|   767k|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|   767k|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 685k, False: 81.9k]
  ------------------
  468|   685k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 336k, False: 349k]
  ------------------
  469|   739k|    for (;;) {
  470|   739k|      thiscoef = *block + jpeg_natural_order[k];
  471|   739k|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 63.0k, False: 676k]
  ------------------
  472|  63.0k|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 26.7k, False: 36.3k]
  ------------------
  473|  26.7k|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 13.2k, False: 13.5k]
  ------------------
  474|  13.2k|            *thiscoef += (JCOEF)m1;
  475|  13.5k|          else
  476|  13.5k|            *thiscoef += (JCOEF)p1;
  477|  26.7k|        }
  478|  63.0k|        break;
  479|  63.0k|      }
  480|   676k|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 367k, False: 308k]
  ------------------
  481|   367k|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 206k, False: 161k]
  ------------------
  482|   206k|          *thiscoef = (JCOEF)m1;
  483|   161k|        else
  484|   161k|          *thiscoef = (JCOEF)p1;
  485|   367k|        break;
  486|   367k|      }
  487|   308k|      st += 3;  k++;
  488|   308k|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 169, False: 308k]
  ------------------
  489|    169|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    169|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    169|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|    169|        entropy->ct = -1;                       /* spectral overflow */
  491|    169|        return TRUE;
  ------------------
  |  |  210|    169|#define TRUE    1
  ------------------
  492|    169|      }
  493|   308k|    }
  494|   431k|  }
  495|       |
  496|   337k|  return TRUE;
  ------------------
  |  |  210|   337k|#define TRUE    1
  ------------------
  497|   337k|}
jdarith.c:decode_mcu:
  506|  10.2M|{
  507|  10.2M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  10.2M|  jpeg_component_info *compptr;
  509|  10.2M|  JBLOCKROW block;
  510|  10.2M|  unsigned char *st;
  511|  10.2M|  int blkn, ci, tbl, sign, k;
  512|  10.2M|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  10.2M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 79.4k, False: 10.2M]
  ------------------
  516|  79.4k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 16.1k, False: 63.3k]
  ------------------
  517|  16.1k|      process_restart(cinfo);
  518|  79.4k|    entropy->restarts_to_go--;
  519|  79.4k|  }
  520|       |
  521|  10.2M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   679k|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 679k, False: 9.60M]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|  19.2M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 9.65M, False: 9.60M]
  ------------------
  526|  9.65M|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 9.65M, False: 0]
  ------------------
  527|  9.65M|    ci = cinfo->MCU_membership[blkn];
  528|  9.65M|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|  9.65M|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|  9.65M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|  9.65M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 3.65M, False: 5.99M]
  ------------------
  539|  3.65M|      entropy->dc_context[ci] = 0;
  540|  5.99M|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|  5.99M|      sign = arith_decode(cinfo, st + 1);
  544|  5.99M|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|  5.99M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 3.48M, False: 2.51M]
  ------------------
  547|  3.48M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|  10.1M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 6.62M, False: 3.48M]
  ------------------
  549|  6.62M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 259, False: 6.62M]
  ------------------
  550|    259|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    259|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    259|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|    259|            entropy->ct = -1;                   /* magnitude overflow */
  552|    259|            return TRUE;
  ------------------
  |  |  210|    259|#define TRUE    1
  ------------------
  553|    259|          }
  554|  6.62M|          st += 1;
  555|  6.62M|        }
  556|  3.48M|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|  5.99M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 0, False: 5.99M]
  ------------------
  559|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|  5.99M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 2.53M, False: 3.46M]
  ------------------
  561|  2.53M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|  3.46M|      else
  563|  3.46M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|  5.99M|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|  5.99M|      st += 14;
  567|  12.6M|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 6.62M, False: 5.99M]
  ------------------
  568|  6.62M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 1.46M, False: 5.15M]
  ------------------
  569|  5.99M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 3.59M, False: 2.39M]
  ------------------
  570|  5.99M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|  5.99M|    }
  572|       |
  573|  9.65M|    if (block)
  ------------------
  |  Branch (573:9): [True: 9.65M, False: 0]
  ------------------
  574|  9.65M|      (*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|  9.65M|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  17.4M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|  17.4M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 17.4M, False: 192]
  ------------------
  582|  17.4M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  17.4M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 9.65M, False: 7.83M]
  ------------------
  584|  17.1M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 9.30M, False: 7.83M]
  ------------------
  585|  9.30M|        st += 3;  k++;
  586|  9.30M|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|  9.30M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 210, False: 9.30M]
  ------------------
  587|    210|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    210|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    210|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|    210|          entropy->ct = -1;                     /* spectral overflow */
  589|    210|          return TRUE;
  ------------------
  |  |  210|    210|#define TRUE    1
  ------------------
  590|    210|        }
  591|  9.30M|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|  7.83M|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|  7.83M|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|  7.83M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 4.15M, False: 3.68M]
  ------------------
  598|  4.15M|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 3.21M, False: 939k]
  ------------------
  599|  3.21M|          m <<= 1;
  600|  3.21M|          st = entropy->ac_stats[tbl] +
  601|  3.21M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 2.51M, False: 697k]
  ------------------
  602|  5.87M|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 2.65M, False: 3.21M]
  ------------------
  603|  2.65M|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 269, False: 2.65M]
  ------------------
  604|    269|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    269|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    269|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|    269|              entropy->ct = -1;                 /* magnitude overflow */
  606|    269|              return TRUE;
  ------------------
  |  |  210|    269|#define TRUE    1
  ------------------
  607|    269|            }
  608|  2.65M|            st += 1;
  609|  2.65M|          }
  610|  3.21M|        }
  611|  4.15M|      }
  612|  7.83M|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|  7.83M|      st += 14;
  615|  13.7M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 5.86M, False: 7.83M]
  ------------------
  616|  5.86M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 2.76M, False: 3.10M]
  ------------------
  617|  7.83M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 3.41M, False: 4.42M]
  ------------------
  618|  7.83M|      if (block)
  ------------------
  |  Branch (618:11): [True: 7.83M, False: 0]
  ------------------
  619|  7.83M|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|  7.83M|    }
  621|  9.65M|  }
  622|       |
  623|  9.60M|  return TRUE;
  ------------------
  |  |  210|  9.60M|#define TRUE    1
  ------------------
  624|  9.60M|}

jinit_d_coef_controller:
  869|  78.0k|{
  870|  78.0k|  my_coef_ptr coef;
  871|       |
  872|  78.0k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  78.0k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 78.0k]
  ------------------
  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|  78.0k|  coef = (my_coef_ptr)
  876|  78.0k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  78.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  78.0k|                                sizeof(my_coef_controller));
  878|  78.0k|  memset(coef, 0, sizeof(my_coef_controller));
  879|  78.0k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|  78.0k|  coef->pub.start_input_pass = start_input_pass;
  881|  78.0k|  coef->pub.start_output_pass = start_output_pass;
  882|  78.0k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|  78.0k|  coef->coef_bits_latch = NULL;
  884|  78.0k|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|  78.0k|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 22.9k, False: 55.0k]
  ------------------
  888|  22.9k|#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.9k|    int ci, access_rows;
  893|  22.9k|    jpeg_component_info *compptr;
  894|       |
  895|  73.9k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 50.9k, False: 22.9k]
  ------------------
  896|  50.9k|         ci++, compptr++) {
  897|  50.9k|      access_rows = compptr->v_samp_factor;
  898|  50.9k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|  50.9k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 44.0k, False: 6.88k]
  ------------------
  901|  44.0k|        access_rows *= 5;
  902|  50.9k|#endif
  903|  50.9k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|  50.9k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  50.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  50.9k|#define TRUE    1
  ------------------
  905|  50.9k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|  50.9k|                               (long)compptr->h_samp_factor),
  907|  50.9k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|  50.9k|                               (long)compptr->v_samp_factor),
  909|  50.9k|         (JDIMENSION)access_rows);
  910|  50.9k|    }
  911|  22.9k|    coef->pub.consume_data = consume_data;
  912|  22.9k|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  22.9k|#define _decompress_data  decompress_data
  ------------------
  913|  22.9k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|  55.0k|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|  55.0k|    JBLOCKROW buffer;
  920|  55.0k|    int i;
  921|       |
  922|  55.0k|    buffer = (JBLOCKROW)
  923|  55.0k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  55.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|  55.0k|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|  55.0k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|   605k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|   605k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 550k, False: 55.0k]
  ------------------
  926|   550k|      coef->MCU_buffer[i] = buffer + i;
  927|   550k|    }
  928|  55.0k|    coef->pub.consume_data = dummy_consume_data;
  929|  55.0k|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|  55.0k|#define _decompress_data  decompress_data
  ------------------
  930|  55.0k|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|  55.0k|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|  78.0k|  coef->workspace = (JCOEF *)
  935|  78.0k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  78.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|  78.0k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  78.0k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|  78.0k|}
jdcoefct-8.c:start_input_pass:
   50|  84.0k|{
   51|  84.0k|  cinfo->input_iMCU_row = 0;
   52|  84.0k|  start_iMCU_row(cinfo);
   53|  84.0k|}
jdcoefct-8.c:start_output_pass:
   62|  70.3k|{
   63|  70.3k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|  70.3k|  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|  70.3k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 16.0k, False: 54.2k]
  ------------------
   68|  16.0k|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 16.0k, False: 0]
  |  Branch (68:38): [True: 3.37k, False: 12.7k]
  ------------------
   69|  3.37k|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|  3.37k|#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|  16.0k|  }
   73|  70.3k|#endif
   74|  70.3k|  cinfo->output_iMCU_row = 0;
   75|  70.3k|}
jdcoefct-8.c:smoothing_ok:
  405|  16.0k|{
  406|  16.0k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|  16.0k|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|  16.0k|#define FALSE   0               /* values of boolean */
  ------------------
  408|  16.0k|  int ci, coefi;
  409|  16.0k|  jpeg_component_info *compptr;
  410|  16.0k|  JQUANT_TBL *qtable;
  411|  16.0k|  int *coef_bits, *prev_coef_bits;
  412|  16.0k|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|  16.0k|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 2.17k, False: 13.9k]
  |  Branch (414:35): [True: 0, False: 13.9k]
  ------------------
  415|  2.17k|    return FALSE;
  ------------------
  |  |  207|  2.17k|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|  13.9k|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 13.9k, False: 0]
  ------------------
  419|  13.9k|    coef->coef_bits_latch = (int *)
  420|  13.9k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  13.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|  13.9k|                                  cinfo->num_components * 2 *
  422|  13.9k|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|  13.9k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|  13.9k|  coef_bits_latch = coef->coef_bits_latch;
  424|  13.9k|  prev_coef_bits_latch =
  425|  13.9k|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|  13.9k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|  22.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 18.6k, False: 3.51k]
  ------------------
  428|  18.6k|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|  18.6k|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 1.05k, False: 17.6k]
  ------------------
  431|  1.05k|      return FALSE;
  ------------------
  |  |  207|  1.05k|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|  17.6k|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 2.35k, False: 15.2k]
  ------------------
  434|  15.2k|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|  15.2k|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 768, False: 14.5k]
  ------------------
  435|  14.5k|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|  14.5k|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 943, False: 13.5k]
  ------------------
  436|  13.5k|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|  13.5k|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 1.74k, False: 11.8k]
  ------------------
  437|  11.8k|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|  11.8k|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 350, False: 11.4k]
  ------------------
  438|  11.4k|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|  11.4k|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 407, False: 11.0k]
  ------------------
  439|  11.0k|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|  11.0k|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 765, False: 10.3k]
  ------------------
  440|  10.3k|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|  10.3k|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 378, False: 9.93k]
  ------------------
  441|  9.93k|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|  9.93k|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 416, False: 9.51k]
  ------------------
  442|  9.51k|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|  9.51k|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 536, False: 8.98k]
  ------------------
  443|  8.65k|      return FALSE;
  ------------------
  |  |  207|  8.65k|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|  8.98k|    coef_bits = cinfo->coef_bits[ci];
  446|  8.98k|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|  8.98k|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 682, False: 8.29k]
  ------------------
  448|    682|      return FALSE;
  ------------------
  |  |  207|    682|#define FALSE   0               /* values of boolean */
  ------------------
  449|  8.29k|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  82.9k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  82.9k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 74.6k, False: 8.29k]
  ------------------
  452|  74.6k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 18.0k, False: 56.6k]
  ------------------
  453|  18.0k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  56.6k|      else
  455|  56.6k|        prev_coef_bits_latch[coefi] = -1;
  456|  74.6k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  74.6k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 71.1k, False: 3.52k]
  ------------------
  458|  71.1k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  71.1k|#define TRUE    1
  ------------------
  459|  74.6k|    }
  460|  8.29k|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  8.29k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|  8.29k|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  8.29k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|  8.29k|  }
  463|       |
  464|  3.51k|  return smoothing_useful;
  465|  13.9k|}
jdcoefct-8.c:decompress_smooth_data:
  474|  42.8k|{
  475|  42.8k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|  42.8k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|  42.8k|  JDIMENSION block_num, last_block_column;
  478|  42.8k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|  42.8k|    image_block_rows;
  480|  42.8k|  JBLOCKARRAY buffer;
  481|  42.8k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|  42.8k|  JBLOCKROW next_block_row, next_next_block_row;
  483|  42.8k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  42.8k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  484|  42.8k|  JDIMENSION output_col;
  485|  42.8k|  jpeg_component_info *compptr;
  486|  42.8k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  42.8k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  487|  42.8k|  boolean change_dc;
  488|  42.8k|  JCOEF *workspace;
  489|  42.8k|  int *coef_bits;
  490|  42.8k|  JQUANT_TBL *quanttbl;
  491|  42.8k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|  42.8k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|  42.8k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|  42.8k|      DC25;
  495|  42.8k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|  42.8k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|  42.8k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 42.8k, False: 0]
  ------------------
  502|  42.8k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 42.8k]
  ------------------
  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|  98.0k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 55.2k, False: 42.8k]
  ------------------
  519|  55.2k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|  55.2k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 55.2k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|  55.2k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 45.8k, False: 9.41k]
  ------------------
  525|  45.8k|      block_rows = compptr->v_samp_factor;
  526|  45.8k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|  45.8k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 1.84k, False: 7.57k]
  ------------------
  528|  1.84k|      block_rows = compptr->v_samp_factor;
  529|  1.84k|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|  7.57k|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|  7.57k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|  7.57k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 7.40k, False: 168]
  ------------------
  534|  7.57k|      access_rows = block_rows; /* this iMCU row only */
  535|  7.57k|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|  55.2k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 45.8k, False: 9.41k]
  ------------------
  538|  45.8k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|  45.8k|      buffer = (*cinfo->mem->access_virt_barray)
  540|  45.8k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|  45.8k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|  45.8k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  45.8k|#define FALSE   0               /* values of boolean */
  ------------------
  543|  45.8k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|  45.8k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 1.84k, False: 7.57k]
  ------------------
  545|  1.84k|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|  1.84k|      buffer = (*cinfo->mem->access_virt_barray)
  547|  1.84k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|  1.84k|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|  1.84k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  1.84k|#define FALSE   0               /* values of boolean */
  ------------------
  550|  1.84k|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|  7.57k|    } else {
  552|  7.57k|      buffer = (*cinfo->mem->access_virt_barray)
  553|  7.57k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|  7.57k|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  7.57k|#define FALSE   0               /* values of boolean */
  ------------------
  555|  7.57k|    }
  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|  55.2k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 19.2k, False: 35.9k]
  ------------------
  561|  19.2k|      coef_bits =
  562|  19.2k|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|  19.2k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|  35.9k|    else
  564|  35.9k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|  35.9k|#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|  55.2k|    change_dc =
  568|  55.2k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 51.6k, False: 3.61k]
  |  Branch (568:29): [True: 51.5k, False: 31]
  |  Branch (568:51): [True: 47.2k, False: 4.33k]
  ------------------
  569|  47.2k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 47.2k, False: 0]
  |  Branch (569:29): [True: 47.2k, False: 0]
  |  Branch (569:51): [True: 47.2k, False: 0]
  ------------------
  570|  47.2k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 47.2k, False: 0]
  |  Branch (570:29): [True: 47.0k, False: 160]
  |  Branch (570:51): [True: 47.0k, False: 0]
  ------------------
  571|       |
  572|  55.2k|    quanttbl = compptr->quant_table;
  573|  55.2k|    Q00 = quanttbl->quantval[0];
  574|  55.2k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|  55.2k|#define Q01_POS  1
  ------------------
  575|  55.2k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|  55.2k|#define Q10_POS  8
  ------------------
  576|  55.2k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|  55.2k|#define Q20_POS  16
  ------------------
  577|  55.2k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|  55.2k|#define Q11_POS  9
  ------------------
  578|  55.2k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|  55.2k|#define Q02_POS  2
  ------------------
  579|  55.2k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 47.0k, False: 8.13k]
  ------------------
  580|  47.0k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  47.0k|#define Q03_POS  3
  ------------------
  581|  47.0k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  47.0k|#define Q12_POS  10
  ------------------
  582|  47.0k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  47.0k|#define Q21_POS  17
  ------------------
  583|  47.0k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  47.0k|#define Q30_POS  24
  ------------------
  584|  47.0k|    }
  585|  55.2k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  55.2k|#define _inverse_DCT  inverse_DCT
  ------------------
  586|  55.2k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|  55.2k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|   110k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 55.2k, False: 55.2k]
  ------------------
  590|  55.2k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|  55.2k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|  55.2k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 47.7k, False: 7.57k]
  ------------------
  594|  47.7k|        prev_block_row =
  595|  47.7k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|  7.57k|      else
  597|  7.57k|        prev_block_row = buffer_ptr;
  598|       |
  599|  55.2k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 45.8k, False: 9.42k]
  ------------------
  600|  45.8k|        prev_prev_block_row =
  601|  45.8k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|  9.42k|      else
  603|  9.42k|        prev_prev_block_row = prev_block_row;
  604|       |
  605|  55.2k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 47.7k, False: 7.57k]
  ------------------
  606|  47.7k|        next_block_row =
  607|  47.7k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|  7.57k|      else
  609|  7.57k|        next_block_row = buffer_ptr;
  610|       |
  611|  55.2k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 45.8k, False: 9.42k]
  ------------------
  612|  45.8k|        next_next_block_row =
  613|  45.8k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|  9.42k|      else
  615|  9.42k|        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|  55.2k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|  55.2k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|  55.2k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|  55.2k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|  55.2k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|  55.2k|      output_col = 0;
  626|  55.2k|      last_block_column = compptr->width_in_blocks - 1;
  627|  55.2k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  3.49M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 3.44M, False: 55.2k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  3.44M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  3.44M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 55.2k, False: 3.38M]
  ------------------
  633|  55.2k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 42.0k, False: 13.2k]
  ------------------
  634|  42.0k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|  42.0k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|  42.0k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|  42.0k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|  42.0k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|  42.0k|        }
  640|  3.44M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 3.34M, False: 97.2k]
  ------------------
  641|  3.34M|          DC05 = (int)prev_prev_block_row[2][0];
  642|  3.34M|          DC10 = (int)prev_block_row[2][0];
  643|  3.34M|          DC15 = (int)buffer_ptr[2][0];
  644|  3.34M|          DC20 = (int)next_block_row[2][0];
  645|  3.34M|          DC25 = (int)next_next_block_row[2][0];
  646|  3.34M|        }
  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.44M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 3.17M, False: 264k]
  |  Branch (658:41): [True: 3.14M, False: 35.8k]
  ------------------
  659|  3.14M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 2.84M, False: 296k]
  ------------------
  660|  2.84M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|  2.84M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|  2.84M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|  2.84M|                 DC21 - DC22 + DC24 + DC25) :
  664|  3.14M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  3.14M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 1.44M, False: 1.70M]
  ------------------
  666|  1.44M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|  1.44M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 81.2k, False: 1.35M]
  |  Branch (667:27): [True: 10.6k, False: 70.5k]
  ------------------
  668|  10.6k|              pred = (1 << Al) - 1;
  669|  1.70M|          } else {
  670|  1.70M|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|  1.70M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 140k, False: 1.55M]
  |  Branch (671:27): [True: 18.9k, False: 121k]
  ------------------
  672|  18.9k|              pred = (1 << Al) - 1;
  673|  1.70M|            pred = -pred;
  674|  1.70M|          }
  675|  3.14M|          workspace[1] = (JCOEF)pred;
  676|  3.14M|        }
  677|       |        /* AC10 */
  678|  3.44M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 3.38M, False: 54.7k]
  |  Branch (678:41): [True: 3.33M, False: 50.1k]
  ------------------
  679|  3.33M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 2.84M, False: 491k]
  ------------------
  680|  2.84M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|  2.84M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|  2.84M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|  2.84M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|  3.33M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|  3.33M|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 1.55M, False: 1.78M]
  ------------------
  686|  1.55M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|  1.55M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 9.68k, False: 1.54M]
  |  Branch (687:27): [True: 9.43k, False: 247]
  ------------------
  688|  9.43k|              pred = (1 << Al) - 1;
  689|  1.78M|          } else {
  690|  1.78M|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|  1.78M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 97.9k, False: 1.68M]
  |  Branch (691:27): [True: 94.4k, False: 3.47k]
  ------------------
  692|  94.4k|              pred = (1 << Al) - 1;
  693|  1.78M|            pred = -pred;
  694|  1.78M|          }
  695|  3.33M|          workspace[8] = (JCOEF)pred;
  696|  3.33M|        }
  697|       |        /* AC20 */
  698|  3.44M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 3.31M, False: 126k]
  |  Branch (698:41): [True: 3.28M, False: 32.6k]
  ------------------
  699|  3.28M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 2.84M, False: 436k]
  ------------------
  700|  2.84M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|  2.84M|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|  3.28M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|  3.28M|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 1.99M, False: 1.29M]
  ------------------
  704|  1.99M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|  1.99M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 67.6k, False: 1.92M]
  |  Branch (705:27): [True: 55.1k, False: 12.5k]
  ------------------
  706|  55.1k|              pred = (1 << Al) - 1;
  707|  1.99M|          } else {
  708|  1.29M|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|  1.29M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 58.8k, False: 1.23M]
  |  Branch (709:27): [True: 49.7k, False: 9.10k]
  ------------------
  710|  49.7k|              pred = (1 << Al) - 1;
  711|  1.29M|            pred = -pred;
  712|  1.29M|          }
  713|  3.28M|          workspace[16] = (JCOEF)pred;
  714|  3.28M|        }
  715|       |        /* AC11 */
  716|  3.44M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 3.31M, False: 126k]
  |  Branch (716:41): [True: 3.31M, False: 1.32k]
  ------------------
  717|  3.31M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 2.84M, False: 468k]
  ------------------
  718|  2.84M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|  2.84M|                 9 * DC19 + DC21 - DC25) :
  720|  3.31M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   468k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|  3.31M|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 2.38M, False: 931k]
  ------------------
  723|  2.38M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|  2.38M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 85.2k, False: 2.29M]
  |  Branch (724:27): [True: 431, False: 84.8k]
  ------------------
  725|    431|              pred = (1 << Al) - 1;
  726|  2.38M|          } else {
  727|   931k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   931k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 72.6k, False: 859k]
  |  Branch (728:27): [True: 445, False: 72.2k]
  ------------------
  729|    445|              pred = (1 << Al) - 1;
  730|   931k|            pred = -pred;
  731|   931k|          }
  732|  3.31M|          workspace[9] = (JCOEF)pred;
  733|  3.31M|        }
  734|       |        /* AC02 */
  735|  3.44M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 3.31M, False: 126k]
  |  Branch (735:41): [True: 3.31M, False: 333]
  ------------------
  736|  3.31M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 2.84M, False: 469k]
  ------------------
  737|  2.84M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|  2.84M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|  3.31M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|  3.31M|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 1.92M, False: 1.39M]
  ------------------
  741|  1.92M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|  1.92M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 78.8k, False: 1.84M]
  |  Branch (742:27): [True: 176, False: 78.6k]
  ------------------
  743|    176|              pred = (1 << Al) - 1;
  744|  1.92M|          } else {
  745|  1.39M|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|  1.39M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 80.0k, False: 1.31M]
  |  Branch (746:27): [True: 176, False: 79.8k]
  ------------------
  747|    176|              pred = (1 << Al) - 1;
  748|  1.39M|            pred = -pred;
  749|  1.39M|          }
  750|  3.31M|          workspace[2] = (JCOEF)pred;
  751|  3.31M|        }
  752|  3.44M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 2.84M, False: 596k]
  ------------------
  753|       |          /* AC03 */
  754|  2.84M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 2.84M, False: 0]
  |  Branch (754:43): [True: 2.84M, False: 0]
  ------------------
  755|  2.84M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|  2.84M|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 1.27M, False: 1.57M]
  ------------------
  757|  1.27M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|  1.27M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 1.27M]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|  1.57M|            } else {
  761|  1.57M|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|  1.57M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 1.57M]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|  1.57M|              pred = -pred;
  765|  1.57M|            }
  766|  2.84M|            workspace[3] = (JCOEF)pred;
  767|  2.84M|          }
  768|       |          /* AC12 */
  769|  2.84M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 2.84M, False: 0]
  |  Branch (769:43): [True: 2.84M, False: 0]
  ------------------
  770|  2.84M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|  2.84M|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 1.85M, False: 990k]
  ------------------
  772|  1.85M|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|  1.85M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 1.85M]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|  1.85M|            } else {
  776|   990k|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|   990k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 990k]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|   990k|              pred = -pred;
  780|   990k|            }
  781|  2.84M|            workspace[10] = (JCOEF)pred;
  782|  2.84M|          }
  783|       |          /* AC21 */
  784|  2.84M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 2.84M, False: 0]
  |  Branch (784:43): [True: 2.84M, False: 0]
  ------------------
  785|  2.84M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|  2.84M|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 1.86M, False: 978k]
  ------------------
  787|  1.86M|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|  1.86M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 1.86M]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|  1.86M|            } else {
  791|   978k|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|   978k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 978k]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|   978k|              pred = -pred;
  795|   978k|            }
  796|  2.84M|            workspace[17] = (JCOEF)pred;
  797|  2.84M|          }
  798|       |          /* AC30 */
  799|  2.84M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 2.84M, False: 0]
  |  Branch (799:43): [True: 2.84M, False: 0]
  ------------------
  800|  2.84M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|  2.84M|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 1.33M, False: 1.51M]
  ------------------
  802|  1.33M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|  1.33M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 1.33M]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|  1.51M|            } else {
  806|  1.51M|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|  1.51M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 1.51M]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|  1.51M|              pred = -pred;
  810|  1.51M|            }
  811|  2.84M|            workspace[24] = (JCOEF)pred;
  812|  2.84M|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|  2.84M|          num = Q00 *
  817|  2.84M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|  2.84M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|  2.84M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|  2.84M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|  2.84M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|  2.84M|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 1.96M, False: 882k]
  ------------------
  823|  1.96M|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|  1.96M|          } else {
  825|   882k|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|   882k|            pred = -pred;
  827|   882k|          }
  828|  2.84M|          workspace[0] = (JCOEF)pred;
  829|  2.84M|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  3.44M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  3.44M|                        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.44M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  3.44M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  3.44M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  3.44M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  3.44M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  3.44M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  3.44M|          prev_prev_block_row++, next_next_block_row++;
  849|  3.44M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  3.44M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  3.44M|      }
  851|  55.2k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  55.2k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|  55.2k|    }
  853|  55.2k|  }
  854|       |
  855|  42.8k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 39.4k, False: 3.37k]
  ------------------
  856|  39.4k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  39.4k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|  3.37k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  3.37k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|  42.8k|}
jdcoefct-8.c:consume_data:
  218|   332k|{
  219|   332k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|   332k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|   332k|  int blkn, ci, xindex, yindex, yoffset;
  222|   332k|  JDIMENSION start_col;
  223|   332k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|   332k|  JBLOCKROW buffer_ptr;
  225|   332k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|   777k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 445k, False: 332k]
  ------------------
  229|   445k|    compptr = cinfo->cur_comp_info[ci];
  230|   445k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|   445k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|   445k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|   445k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   445k|#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|   445k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|   702k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 369k, False: 332k]
  ------------------
  242|   369k|       yoffset++) {
  243|  22.6M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 22.2M, False: 369k]
  ------------------
  244|  22.2M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  22.2M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  44.9M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 22.6M, False: 22.2M]
  ------------------
  248|  22.6M|        compptr = cinfo->cur_comp_info[ci];
  249|  22.6M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  45.2M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 22.6M, False: 22.6M]
  ------------------
  251|  22.6M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  45.3M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 22.6M, False: 22.6M]
  ------------------
  253|  22.6M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  22.6M|          }
  255|  22.6M|        }
  256|  22.6M|      }
  257|  22.2M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 20.2M, False: 2.01M]
  ------------------
  258|  20.2M|        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|  22.2M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 22.2M]
  ------------------
  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|  22.2M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|   369k|    coef->MCU_ctr = 0;
  282|   369k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|   332k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 302k, False: 29.8k]
  ------------------
  285|   302k|    start_iMCU_row(cinfo);
  286|   302k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   302k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|   302k|  }
  288|       |  /* Completed the scan */
  289|  29.8k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  29.8k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  29.8k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|   332k|}
jdcoefct-8.c:decompress_data:
  304|   127k|{
  305|   127k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|   127k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|   127k|  JDIMENSION block_num;
  308|   127k|  int ci, block_row, block_rows;
  309|   127k|  JBLOCKARRAY buffer;
  310|   127k|  JBLOCKROW buffer_ptr;
  311|   127k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|   127k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  312|   127k|  JDIMENSION output_col;
  313|   127k|  jpeg_component_info *compptr;
  314|   127k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|   127k|#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|   127k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 127k]
  ------------------
  318|   127k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 127k, False: 0]
  ------------------
  319|   127k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 127k]
  ------------------
  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|   350k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 222k, False: 127k]
  ------------------
  326|   222k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|   222k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 222k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|   222k|    buffer = (*cinfo->mem->access_virt_barray)
  332|   222k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|   222k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|   222k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|   222k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|   222k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 192k, False: 30.4k]
  ------------------
  337|   192k|      block_rows = compptr->v_samp_factor;
  338|  30.4k|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|  30.4k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|  30.4k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 27.2k, False: 3.20k]
  ------------------
  342|  30.4k|    }
  343|   222k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|   222k|#define _inverse_DCT  inverse_DCT
  ------------------
  344|   222k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|   482k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 259k, False: 222k]
  ------------------
  347|   259k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|   259k|      output_col = 0;
  349|   259k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|  4.88M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 4.62M, False: 259k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|  4.62M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|  4.62M|                        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|  4.62M|        buffer_ptr++;
  361|  4.62M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  4.62M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|  4.62M|      }
  363|   259k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   259k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|   259k|    }
  365|   222k|  }
  366|       |
  367|   127k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 114k, False: 12.7k]
  ------------------
  368|   114k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   114k|#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|   127k|}
jdcoefct-8.c:decompress_onepass:
   90|  2.98M|{
   91|  2.98M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  2.98M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  2.98M|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  2.98M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  2.98M|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  2.98M|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  2.98M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  2.98M|  JDIMENSION start_col, output_col;
   98|  2.98M|  jpeg_component_info *compptr;
   99|  2.98M|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  2.98M|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  5.96M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 2.98M, False: 2.98M]
  ------------------
  103|  2.98M|       yoffset++) {
  104|   120M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 117M, False: 2.98M]
  ------------------
  105|   117M|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   117M|      jzero_far((void *)coef->MCU_buffer[0],
  108|   117M|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   117M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 11.1M, False: 106M]
  ------------------
  110|  11.1M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   117M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 117M]
  ------------------
  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|   117M|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 117M, False: 3.99k]
  ------------------
  135|   117M|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 117M, 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|   117M|        blkn = 0;               /* index of current DCT block within MCU */
  142|   238M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 121M, False: 117M]
  ------------------
  143|   121M|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   121M|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 121M]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   121M|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|   121M|#define _inverse_DCT  inverse_DCT
  ------------------
  150|   121M|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 116M, False: 5.04M]
  ------------------
  151|   116M|                         compptr->MCU_width : compptr->last_col_width;
  152|   121M|          output_ptr = output_buf[compptr->component_index] +
  153|   121M|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   121M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   121M|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   121M|                      compptr->MCU_sample_width;
  156|   242M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 121M, False: 121M]
  ------------------
  157|   121M|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 118M, False: 3.33M]
  ------------------
  158|   121M|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 3.32M, False: 13.5k]
  ------------------
  159|   121M|              output_col = start_col;
  160|   242M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 121M, False: 121M]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   121M|                (*inverse_DCT) (cinfo, compptr,
  165|   121M|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   121M|                                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|   121M|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   121M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   121M|              }
  174|   121M|            }
  175|   121M|            blkn += compptr->MCU_width;
  176|   121M|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   121M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   121M|          }
  178|   121M|        }
  179|   117M|      }
  180|   117M|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  2.98M|    coef->MCU_ctr = 0;
  183|  2.98M|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  2.98M|  cinfo->output_iMCU_row++;
  186|  2.98M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 2.92M, False: 53.8k]
  ------------------
  187|  2.92M|    start_iMCU_row(cinfo);
  188|  2.92M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.92M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  2.92M|  }
  190|       |  /* Completed the scan */
  191|  53.8k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|  53.8k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  53.8k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  2.98M|}
j12init_d_coef_controller:
  869|    583|{
  870|    583|  my_coef_ptr coef;
  871|       |
  872|    583|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    583|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 583]
  ------------------
  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|    583|  coef = (my_coef_ptr)
  876|    583|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    583|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|    583|                                sizeof(my_coef_controller));
  878|    583|  memset(coef, 0, sizeof(my_coef_controller));
  879|    583|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|    583|  coef->pub.start_input_pass = start_input_pass;
  881|    583|  coef->pub.start_output_pass = start_output_pass;
  882|    583|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|    583|  coef->coef_bits_latch = NULL;
  884|    583|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|    583|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 530, False: 53]
  ------------------
  888|    530|#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|    530|    int ci, access_rows;
  893|    530|    jpeg_component_info *compptr;
  894|       |
  895|  1.06k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 530, False: 530]
  ------------------
  896|    530|         ci++, compptr++) {
  897|    530|      access_rows = compptr->v_samp_factor;
  898|    530|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|    530|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 530, False: 0]
  ------------------
  901|    530|        access_rows *= 5;
  902|    530|#endif
  903|    530|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|    530|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|    530|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|    530|#define TRUE    1
  ------------------
  905|    530|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|    530|                               (long)compptr->h_samp_factor),
  907|    530|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|    530|                               (long)compptr->v_samp_factor),
  909|    530|         (JDIMENSION)access_rows);
  910|    530|    }
  911|    530|    coef->pub.consume_data = consume_data;
  912|    530|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    530|#define _decompress_data  decompress_data_12
  ------------------
  913|    530|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    530|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|     53|    JBLOCKROW buffer;
  920|     53|    int i;
  921|       |
  922|     53|    buffer = (JBLOCKROW)
  923|     53|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     53|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|     53|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|     53|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|    583|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|    583|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 530, False: 53]
  ------------------
  926|    530|      coef->MCU_buffer[i] = buffer + i;
  927|    530|    }
  928|     53|    coef->pub.consume_data = dummy_consume_data;
  929|     53|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|     53|#define _decompress_data  decompress_data_12
  ------------------
  930|     53|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|     53|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|    583|  coef->workspace = (JCOEF *)
  935|    583|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    583|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|    583|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|    583|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|    583|}
jdcoefct-12.c:start_input_pass:
   50|    944|{
   51|    944|  cinfo->input_iMCU_row = 0;
   52|    944|  start_iMCU_row(cinfo);
   53|    944|}
jdcoefct-12.c:start_output_pass:
   62|    573|{
   63|    573|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|    573|  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|    573|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 521, False: 52]
  ------------------
   68|    521|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 521, False: 0]
  |  Branch (68:38): [True: 345, False: 176]
  ------------------
   69|    345|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|    345|#define _decompress_data  decompress_data_12
  ------------------
   70|    176|    else
   71|    176|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    176|#define _decompress_data  decompress_data_12
  ------------------
   72|    521|  }
   73|    573|#endif
   74|    573|  cinfo->output_iMCU_row = 0;
   75|    573|}
jdcoefct-12.c:smoothing_ok:
  405|    521|{
  406|    521|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|    521|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|    521|#define FALSE   0               /* values of boolean */
  ------------------
  408|    521|  int ci, coefi;
  409|    521|  jpeg_component_info *compptr;
  410|    521|  JQUANT_TBL *qtable;
  411|    521|  int *coef_bits, *prev_coef_bits;
  412|    521|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|    521|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 521]
  |  Branch (414:35): [True: 0, False: 521]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|    521|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 521, False: 0]
  ------------------
  419|    521|    coef->coef_bits_latch = (int *)
  420|    521|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    521|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|    521|                                  cinfo->num_components * 2 *
  422|    521|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|    521|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|    521|  coef_bits_latch = coef->coef_bits_latch;
  424|    521|  prev_coef_bits_latch =
  425|    521|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|    521|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|    870|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 521, False: 349]
  ------------------
  428|    521|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    521|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 521]
  ------------------
  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|    521|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 7, False: 514]
  ------------------
  434|    514|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    514|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 8, False: 506]
  ------------------
  435|    506|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    506|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 10, False: 496]
  ------------------
  436|    496|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    496|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 6, False: 490]
  ------------------
  437|    490|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    490|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 13, False: 477]
  ------------------
  438|    477|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    477|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 19, False: 458]
  ------------------
  439|    458|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    458|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 15, False: 443]
  ------------------
  440|    443|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    443|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 10, False: 433]
  ------------------
  441|    433|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    433|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 12, False: 421]
  ------------------
  442|    421|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    421|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 10, False: 411]
  ------------------
  443|    110|      return FALSE;
  ------------------
  |  |  207|    110|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    411|    coef_bits = cinfo->coef_bits[ci];
  446|    411|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    411|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 62, False: 349]
  ------------------
  448|     62|      return FALSE;
  ------------------
  |  |  207|     62|#define FALSE   0               /* values of boolean */
  ------------------
  449|    349|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  3.49k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  3.49k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 3.14k, False: 349]
  ------------------
  452|  3.14k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 1.49k, False: 1.64k]
  ------------------
  453|  1.49k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  1.64k|      else
  455|  1.64k|        prev_coef_bits_latch[coefi] = -1;
  456|  3.14k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  3.14k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 2.91k, False: 224]
  ------------------
  458|  2.91k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  2.91k|#define TRUE    1
  ------------------
  459|  3.14k|    }
  460|    349|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    349|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    349|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    349|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    349|  }
  463|       |
  464|    349|  return smoothing_useful;
  465|    521|}
jdcoefct-12.c:decompress_smooth_data:
  474|   128k|{
  475|   128k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|   128k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|   128k|  JDIMENSION block_num, last_block_column;
  478|   128k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|   128k|    image_block_rows;
  480|   128k|  JBLOCKARRAY buffer;
  481|   128k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|   128k|  JBLOCKROW next_block_row, next_next_block_row;
  483|   128k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|   128k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  484|   128k|  JDIMENSION output_col;
  485|   128k|  jpeg_component_info *compptr;
  486|   128k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|   128k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  487|   128k|  boolean change_dc;
  488|   128k|  JCOEF *workspace;
  489|   128k|  int *coef_bits;
  490|   128k|  JQUANT_TBL *quanttbl;
  491|   128k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|   128k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|   128k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|   128k|      DC25;
  495|   128k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|   128k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|   128k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 128k, False: 0]
  ------------------
  502|   128k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 128k]
  ------------------
  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|   257k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 128k, False: 128k]
  ------------------
  519|   128k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|   128k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 128k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|   128k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 128k, False: 130]
  ------------------
  525|   128k|      block_rows = compptr->v_samp_factor;
  526|   128k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|   128k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 61, False: 69]
  ------------------
  528|     61|      block_rows = compptr->v_samp_factor;
  529|     61|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|     69|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|     69|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|     69|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 69, False: 0]
  ------------------
  534|     69|      access_rows = block_rows; /* this iMCU row only */
  535|     69|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|   128k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 128k, False: 652]
  ------------------
  538|   128k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|   128k|      buffer = (*cinfo->mem->access_virt_barray)
  540|   128k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|   128k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|   128k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|   128k|#define FALSE   0               /* values of boolean */
  ------------------
  543|   128k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|   128k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 307, False: 345]
  ------------------
  545|    307|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|    307|      buffer = (*cinfo->mem->access_virt_barray)
  547|    307|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|    307|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|    307|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    307|#define FALSE   0               /* values of boolean */
  ------------------
  550|    307|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|    345|    } else {
  552|    345|      buffer = (*cinfo->mem->access_virt_barray)
  553|    345|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|    345|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    345|#define FALSE   0               /* values of boolean */
  ------------------
  555|    345|    }
  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|   128k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 2.68k, False: 126k]
  ------------------
  561|  2.68k|      coef_bits =
  562|  2.68k|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|  2.68k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|   126k|    else
  564|   126k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|   126k|#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|   128k|    change_dc =
  568|   128k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 97.6k, False: 31.0k]
  |  Branch (568:29): [True: 94.7k, False: 2.88k]
  |  Branch (568:51): [True: 94.4k, False: 312]
  ------------------
  569|  94.4k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 90.7k, False: 3.72k]
  |  Branch (569:29): [True: 88.1k, False: 2.58k]
  |  Branch (569:51): [True: 83.7k, False: 4.43k]
  ------------------
  570|  83.7k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 82.6k, False: 1.07k]
  |  Branch (570:29): [True: 80.3k, False: 2.29k]
  |  Branch (570:51): [True: 80.3k, False: 0]
  ------------------
  571|       |
  572|   128k|    quanttbl = compptr->quant_table;
  573|   128k|    Q00 = quanttbl->quantval[0];
  574|   128k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|   128k|#define Q01_POS  1
  ------------------
  575|   128k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|   128k|#define Q10_POS  8
  ------------------
  576|   128k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|   128k|#define Q20_POS  16
  ------------------
  577|   128k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|   128k|#define Q11_POS  9
  ------------------
  578|   128k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|   128k|#define Q02_POS  2
  ------------------
  579|   128k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 80.3k, False: 48.3k]
  ------------------
  580|  80.3k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  80.3k|#define Q03_POS  3
  ------------------
  581|  80.3k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  80.3k|#define Q12_POS  10
  ------------------
  582|  80.3k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  80.3k|#define Q21_POS  17
  ------------------
  583|  80.3k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  80.3k|#define Q30_POS  24
  ------------------
  584|  80.3k|    }
  585|   128k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  147|   128k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  586|   128k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|   128k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|   257k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 128k, False: 128k]
  ------------------
  590|   128k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|   128k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|   128k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 128k, False: 345]
  ------------------
  594|   128k|        prev_block_row =
  595|   128k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|    345|      else
  597|    345|        prev_block_row = buffer_ptr;
  598|       |
  599|   128k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 128k, False: 652]
  ------------------
  600|   128k|        prev_prev_block_row =
  601|   128k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|    652|      else
  603|    652|        prev_prev_block_row = prev_block_row;
  604|       |
  605|   128k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 128k, False: 69]
  ------------------
  606|   128k|        next_block_row =
  607|   128k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|     69|      else
  609|     69|        next_block_row = buffer_ptr;
  610|       |
  611|   128k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 128k, False: 130]
  ------------------
  612|   128k|        next_next_block_row =
  613|   128k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|    130|      else
  615|    130|        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|   128k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|   128k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|   128k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|   128k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|   128k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|   128k|      output_col = 0;
  626|   128k|      last_block_column = compptr->width_in_blocks - 1;
  627|   128k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  3.12M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 2.99M, False: 128k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  2.99M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  2.99M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 128k, False: 2.86M]
  ------------------
  633|   128k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 128k, False: 83]
  ------------------
  634|   128k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|   128k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|   128k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|   128k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|   128k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|   128k|        }
  640|  2.99M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 2.73M, False: 257k]
  ------------------
  641|  2.73M|          DC05 = (int)prev_prev_block_row[2][0];
  642|  2.73M|          DC10 = (int)prev_block_row[2][0];
  643|  2.73M|          DC15 = (int)buffer_ptr[2][0];
  644|  2.73M|          DC20 = (int)next_block_row[2][0];
  645|  2.73M|          DC25 = (int)next_next_block_row[2][0];
  646|  2.73M|        }
  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|  2.99M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 2.99M, False: 1.24k]
  |  Branch (658:41): [True: 2.95M, False: 31.8k]
  ------------------
  659|  2.95M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 2.65M, False: 304k]
  ------------------
  660|  2.65M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|  2.65M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|  2.65M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|  2.65M|                 DC21 - DC22 + DC24 + DC25) :
  664|  2.95M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  2.95M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 2.58M, False: 376k]
  ------------------
  666|  2.58M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|  2.58M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 100k, False: 2.48M]
  |  Branch (667:27): [True: 61.2k, False: 38.8k]
  ------------------
  668|  61.2k|              pred = (1 << Al) - 1;
  669|  2.58M|          } else {
  670|   376k|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|   376k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 83.9k, False: 292k]
  |  Branch (671:27): [True: 69.4k, False: 14.5k]
  ------------------
  672|  69.4k|              pred = (1 << Al) - 1;
  673|   376k|            pred = -pred;
  674|   376k|          }
  675|  2.95M|          workspace[1] = (JCOEF)pred;
  676|  2.95M|        }
  677|       |        /* AC10 */
  678|  2.99M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 2.99M, False: 1.29k]
  |  Branch (678:41): [True: 2.95M, False: 38.7k]
  ------------------
  679|  2.95M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 2.65M, False: 297k]
  ------------------
  680|  2.65M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|  2.65M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|  2.65M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|  2.65M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|  2.95M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|  2.95M|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 2.55M, False: 392k]
  ------------------
  686|  2.55M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|  2.55M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 99.6k, False: 2.45M]
  |  Branch (687:27): [True: 56.9k, False: 42.6k]
  ------------------
  688|  56.9k|              pred = (1 << Al) - 1;
  689|  2.55M|          } else {
  690|   392k|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|   392k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 97.5k, False: 295k]
  |  Branch (691:27): [True: 31.1k, False: 66.3k]
  ------------------
  692|  31.1k|              pred = (1 << Al) - 1;
  693|   392k|            pred = -pred;
  694|   392k|          }
  695|  2.95M|          workspace[8] = (JCOEF)pred;
  696|  2.95M|        }
  697|       |        /* AC20 */
  698|  2.99M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 2.98M, False: 3.08k]
  |  Branch (698:41): [True: 2.97M, False: 18.4k]
  ------------------
  699|  2.97M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 2.65M, False: 315k]
  ------------------
  700|  2.65M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|  2.65M|                 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.59M, False: 380k]
  ------------------
  704|  2.59M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|  2.59M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 124k, False: 2.46M]
  |  Branch (705:27): [True: 29.7k, False: 94.8k]
  ------------------
  706|  29.7k|              pred = (1 << Al) - 1;
  707|  2.59M|          } else {
  708|   380k|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|   380k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 93.0k, False: 287k]
  |  Branch (709:27): [True: 32.3k, False: 60.6k]
  ------------------
  710|  32.3k|              pred = (1 << Al) - 1;
  711|   380k|            pred = -pred;
  712|   380k|          }
  713|  2.97M|          workspace[16] = (JCOEF)pred;
  714|  2.97M|        }
  715|       |        /* AC11 */
  716|  2.99M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 2.98M, False: 2.20k]
  |  Branch (716:41): [True: 2.95M, False: 37.6k]
  ------------------
  717|  2.95M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 2.65M, False: 297k]
  ------------------
  718|  2.65M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|  2.65M|                 9 * DC19 + DC21 - DC25) :
  720|  2.95M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   297k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|  2.95M|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 2.64M, False: 308k]
  ------------------
  723|  2.64M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|  2.64M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 150k, False: 2.49M]
  |  Branch (724:27): [True: 25.6k, False: 125k]
  ------------------
  725|  25.6k|              pred = (1 << Al) - 1;
  726|  2.64M|          } else {
  727|   308k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   308k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 73.8k, False: 234k]
  |  Branch (728:27): [True: 25.5k, False: 48.3k]
  ------------------
  729|  25.5k|              pred = (1 << Al) - 1;
  730|   308k|            pred = -pred;
  731|   308k|          }
  732|  2.95M|          workspace[9] = (JCOEF)pred;
  733|  2.95M|        }
  734|       |        /* AC02 */
  735|  2.99M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 2.98M, False: 10.1k]
  |  Branch (735:41): [True: 2.95M, False: 31.8k]
  ------------------
  736|  2.95M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 2.65M, False: 295k]
  ------------------
  737|  2.65M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|  2.65M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|  2.95M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|  2.95M|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 2.58M, False: 368k]
  ------------------
  741|  2.58M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|  2.58M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 139k, False: 2.44M]
  |  Branch (742:27): [True: 34.5k, False: 104k]
  ------------------
  743|  34.5k|              pred = (1 << Al) - 1;
  744|  2.58M|          } else {
  745|   368k|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|   368k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 101k, False: 267k]
  |  Branch (746:27): [True: 36.3k, False: 64.6k]
  ------------------
  747|  36.3k|              pred = (1 << Al) - 1;
  748|   368k|            pred = -pred;
  749|   368k|          }
  750|  2.95M|          workspace[2] = (JCOEF)pred;
  751|  2.95M|        }
  752|  2.99M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 2.65M, False: 337k]
  ------------------
  753|       |          /* AC03 */
  754|  2.65M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 2.65M, False: 0]
  |  Branch (754:43): [True: 2.65M, False: 22]
  ------------------
  755|  2.65M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|  2.65M|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 2.41M, False: 234k]
  ------------------
  757|  2.41M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|  2.41M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 2.41M]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|  2.41M|            } else {
  761|   234k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|   234k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 234k]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|   234k|              pred = -pred;
  765|   234k|            }
  766|  2.65M|            workspace[3] = (JCOEF)pred;
  767|  2.65M|          }
  768|       |          /* AC12 */
  769|  2.65M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 2.65M, False: 0]
  |  Branch (769:43): [True: 2.65M, False: 22]
  ------------------
  770|  2.65M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|  2.65M|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 2.41M, False: 238k]
  ------------------
  772|  2.41M|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|  2.41M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 2.41M]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|  2.41M|            } else {
  776|   238k|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|   238k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 238k]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|   238k|              pred = -pred;
  780|   238k|            }
  781|  2.65M|            workspace[10] = (JCOEF)pred;
  782|  2.65M|          }
  783|       |          /* AC21 */
  784|  2.65M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 2.65M, False: 0]
  |  Branch (784:43): [True: 2.65M, False: 22]
  ------------------
  785|  2.65M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|  2.65M|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 2.41M, False: 237k]
  ------------------
  787|  2.41M|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|  2.41M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 2.41M]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|  2.41M|            } else {
  791|   237k|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|   237k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 237k]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|   237k|              pred = -pred;
  795|   237k|            }
  796|  2.65M|            workspace[17] = (JCOEF)pred;
  797|  2.65M|          }
  798|       |          /* AC30 */
  799|  2.65M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 2.65M, False: 0]
  |  Branch (799:43): [True: 2.65M, False: 22]
  ------------------
  800|  2.65M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|  2.65M|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 2.40M, False: 252k]
  ------------------
  802|  2.40M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|  2.40M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 2.40M]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|  2.40M|            } else {
  806|   252k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|   252k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 252k]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|   252k|              pred = -pred;
  810|   252k|            }
  811|  2.65M|            workspace[24] = (JCOEF)pred;
  812|  2.65M|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|  2.65M|          num = Q00 *
  817|  2.65M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|  2.65M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|  2.65M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|  2.65M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|  2.65M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|  2.65M|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 2.39M, False: 264k]
  ------------------
  823|  2.39M|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|  2.39M|          } else {
  825|   264k|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|   264k|            pred = -pred;
  827|   264k|          }
  828|  2.65M|          workspace[0] = (JCOEF)pred;
  829|  2.65M|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  2.99M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  2.99M|                        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|  2.99M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  2.99M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  2.99M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  2.99M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  2.99M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  2.99M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  2.99M|          prev_prev_block_row++, next_next_block_row++;
  849|  2.99M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  2.99M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  2.99M|      }
  851|   128k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   128k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|   128k|    }
  853|   128k|  }
  854|       |
  855|   128k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 128k, False: 69]
  ------------------
  856|   128k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   128k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|     69|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     69|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|   128k|}
jdcoefct-12.c:consume_data:
  218|   788k|{
  219|   788k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|   788k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|   788k|  int blkn, ci, xindex, yindex, yoffset;
  222|   788k|  JDIMENSION start_col;
  223|   788k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|   788k|  JBLOCKROW buffer_ptr;
  225|   788k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  1.57M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 788k, False: 788k]
  ------------------
  229|   788k|    compptr = cinfo->cur_comp_info[ci];
  230|   788k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|   788k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|   788k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|   788k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   788k|#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|   788k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  1.57M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 788k, False: 788k]
  ------------------
  242|   788k|       yoffset++) {
  243|  8.39M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 7.60M, False: 788k]
  ------------------
  244|  7.60M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  7.60M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  15.2M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 7.60M, False: 7.60M]
  ------------------
  248|  7.60M|        compptr = cinfo->cur_comp_info[ci];
  249|  7.60M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  15.2M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 7.60M, False: 7.60M]
  ------------------
  251|  7.60M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  15.2M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 7.60M, False: 7.60M]
  ------------------
  253|  7.60M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  7.60M|          }
  255|  7.60M|        }
  256|  7.60M|      }
  257|  7.60M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 5.44M, False: 2.16M]
  ------------------
  258|  5.44M|        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|  7.60M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 7.60M]
  ------------------
  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|  7.60M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|   788k|    coef->MCU_ctr = 0;
  282|   788k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|   788k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 787k, False: 892]
  ------------------
  285|   787k|    start_iMCU_row(cinfo);
  286|   787k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   787k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|   787k|  }
  288|       |  /* Completed the scan */
  289|    892|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|    892|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    892|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|   788k|}
jdcoefct-12.c:decompress_data:
  304|  77.2k|{
  305|  77.2k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  77.2k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  77.2k|  JDIMENSION block_num;
  308|  77.2k|  int ci, block_row, block_rows;
  309|  77.2k|  JBLOCKARRAY buffer;
  310|  77.2k|  JBLOCKROW buffer_ptr;
  311|  77.2k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|  77.2k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  312|  77.2k|  JDIMENSION output_col;
  313|  77.2k|  jpeg_component_info *compptr;
  314|  77.2k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|  77.2k|#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|  77.2k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 77.2k]
  ------------------
  318|  77.2k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 77.2k, False: 0]
  ------------------
  319|  77.2k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 77.2k]
  ------------------
  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|   154k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 77.2k, False: 77.2k]
  ------------------
  326|  77.2k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  77.2k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 77.2k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  77.2k|    buffer = (*cinfo->mem->access_virt_barray)
  332|  77.2k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  77.2k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  77.2k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  77.2k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  77.2k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 77.1k, False: 71]
  ------------------
  337|  77.1k|      block_rows = compptr->v_samp_factor;
  338|     71|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|     71|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|     71|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 71, False: 0]
  ------------------
  342|     71|    }
  343|  77.2k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  147|  77.2k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  344|  77.2k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|   154k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 77.2k, False: 77.2k]
  ------------------
  347|  77.2k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  77.2k|      output_col = 0;
  349|  77.2k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|   616k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 539k, False: 77.2k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|   539k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|   539k|                        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|   539k|        buffer_ptr++;
  361|   539k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   539k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|   539k|      }
  363|  77.2k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  77.2k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  77.2k|    }
  365|  77.2k|  }
  366|       |
  367|  77.2k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 77.1k, False: 71]
  ------------------
  368|  77.1k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  77.1k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|     71|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     71|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  77.2k|}
jdcoefct-12.c:decompress_onepass:
   90|  23.4k|{
   91|  23.4k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  23.4k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  23.4k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  23.4k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  23.4k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  23.4k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|  23.4k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
   97|  23.4k|  JDIMENSION start_col, output_col;
   98|  23.4k|  jpeg_component_info *compptr;
   99|  23.4k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|  23.4k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  46.8k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 23.4k, False: 23.4k]
  ------------------
  103|  23.4k|       yoffset++) {
  104|   196k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 173k, False: 23.4k]
  ------------------
  105|   173k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   173k|      jzero_far((void *)coef->MCU_buffer[0],
  108|   173k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   173k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 36.1k, False: 137k]
  ------------------
  110|  36.1k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   173k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 173k]
  ------------------
  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|   173k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 173k, False: 0]
  ------------------
  135|   173k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 173k, 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|   173k|        blkn = 0;               /* index of current DCT block within MCU */
  142|   346k|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 173k, False: 173k]
  ------------------
  143|   173k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   173k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 173k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   173k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  147|   173k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  150|   173k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 149k, False: 23.4k]
  ------------------
  151|   149k|                         compptr->MCU_width : compptr->last_col_width;
  152|   173k|          output_ptr = output_buf[compptr->component_index] +
  153|   173k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   173k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   173k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   173k|                      compptr->MCU_sample_width;
  156|   346k|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 173k, False: 173k]
  ------------------
  157|   173k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 165k, False: 8.24k]
  ------------------
  158|   173k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 8.24k, False: 0]
  ------------------
  159|   173k|              output_col = start_col;
  160|   346k|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 173k, False: 173k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   173k|                (*inverse_DCT) (cinfo, compptr,
  165|   173k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   173k|                                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|   173k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   173k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   173k|              }
  174|   173k|            }
  175|   173k|            blkn += compptr->MCU_width;
  176|   173k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   173k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   173k|          }
  178|   173k|        }
  179|   173k|      }
  180|   173k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  23.4k|    coef->MCU_ctr = 0;
  183|  23.4k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  23.4k|  cinfo->output_iMCU_row++;
  186|  23.4k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 23.4k, False: 32]
  ------------------
  187|  23.4k|    start_iMCU_row(cinfo);
  188|  23.4k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  23.4k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  23.4k|  }
  190|       |  /* Completed the scan */
  191|     32|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|     32|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     32|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  23.4k|}

jdcoefct-8.c:start_iMCU_row:
   68|  3.31M|{
   69|  3.31M|  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|  3.31M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 1.09M, False: 2.22M]
  ------------------
   76|  1.09M|    coef->MCU_rows_per_iMCU_row = 1;
   77|  2.22M|  } else {
   78|  2.22M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 2.14M, False: 75.0k]
  ------------------
   79|  2.14M|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  75.0k|    else
   81|  75.0k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  2.22M|  }
   83|       |
   84|  3.31M|  coef->MCU_ctr = 0;
   85|  3.31M|  coef->MCU_vert_offset = 0;
   86|  3.31M|}
jdcoefct-12.c:start_iMCU_row:
   68|   811k|{
   69|   811k|  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|   811k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 0, False: 811k]
  ------------------
   76|      0|    coef->MCU_rows_per_iMCU_row = 1;
   77|   811k|  } else {
   78|   811k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 810k, False: 924]
  ------------------
   79|   810k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|    924|    else
   81|    924|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|   811k|  }
   83|       |
   84|   811k|  coef->MCU_ctr = 0;
   85|   811k|  coef->MCU_vert_offset = 0;
   86|   811k|}

jinit_color_deconverter:
  625|  80.0k|{
  626|  80.0k|  my_cconvert_ptr cconvert;
  627|  80.0k|  int ci;
  628|       |
  629|  80.0k|#ifdef D_LOSSLESS_SUPPORTED
  630|  80.0k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 3.09k, False: 76.9k]
  ------------------
  631|  3.09k|#if BITS_IN_JSAMPLE == 8
  632|  3.09k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.19k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 3.09k]
  |  Branch (632:52): [True: 0, False: 3.09k]
  ------------------
  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.09k|  } else
  639|  76.9k|#endif
  640|  76.9k|  {
  641|  76.9k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  76.9k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 76.9k]
  ------------------
  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|  76.9k|  }
  644|       |
  645|  80.0k|  cconvert = (my_cconvert_ptr)
  646|  80.0k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  80.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|  80.0k|                                sizeof(my_color_deconverter));
  648|  80.0k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|  80.0k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|  80.0k|  switch (cinfo->jpeg_color_space) {
  653|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 0, False: 80.0k]
  ------------------
  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: 80.0k]
  ------------------
  659|  14.3k|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 14.3k, False: 65.6k]
  ------------------
  660|  14.3k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 14.3k]
  ------------------
  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|  14.3k|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 80.0k]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 80.0k]
  ------------------
  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|  65.6k|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 65.6k, False: 14.3k]
  ------------------
  671|  65.6k|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 65.6k]
  ------------------
  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|  65.6k|    break;
  674|  80.0k|  }
  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|  80.0k|  switch (cinfo->out_color_space) {
  684|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 0, False: 80.0k]
  ------------------
  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|  14.3k|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 14.3k, False: 65.6k]
  ------------------
  705|  14.3k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 80.0k]
  ------------------
  706|  14.3k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 80.0k]
  ------------------
  707|  14.3k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 80.0k]
  ------------------
  708|  14.3k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 80.0k]
  ------------------
  709|  14.3k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 80.0k]
  ------------------
  710|  14.3k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 80.0k]
  ------------------
  711|  14.3k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 80.0k]
  ------------------
  712|  14.3k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 80.0k]
  ------------------
  713|  14.3k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 80.0k]
  ------------------
  714|  14.3k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 80.0k]
  ------------------
  715|  14.3k|#ifdef D_LOSSLESS_SUPPORTED
  716|  14.3k|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 10, False: 14.3k]
  |  Branch (716:36): [True: 9, False: 1]
  ------------------
  717|      9|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|  14.3k|#endif
  719|  14.3k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|  14.3k|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 14.3k, False: 10]
  ------------------
  721|  14.3k|#ifdef WITH_SIMD
  722|  14.3k|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 14.3k, False: 0]
  ------------------
  723|  14.3k|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|  14.3k|#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|  14.3k|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 10]
  ------------------
  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|     10|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 1, False: 9]
  ------------------
  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|      9|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|  14.3k|    break;
  819|       |
  820|  14.3k|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 80.0k]
  ------------------
  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: 80.0k]
  ------------------
  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|  65.6k|  default:
  ------------------
  |  Branch (873:3): [True: 65.6k, False: 14.3k]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|  65.6k|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 65.6k, False: 0]
  ------------------
  876|  65.6k|      cinfo->out_color_components = cinfo->num_components;
  877|  65.6k|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|  65.6k|#define _color_convert  color_convert
  ------------------
  878|  65.6k|    } 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|  65.6k|    break;
  881|  80.0k|  }
  882|       |
  883|  80.0k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 80.0k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|  80.0k|  else
  886|  80.0k|    cinfo->output_components = cinfo->out_color_components;
  887|  80.0k|}
jdcolor-8.c:start_pass_dcolor:
  614|  70.3k|{
  615|       |  /* no work needed */
  616|  70.3k|}
jdcolor-8.c:null_convert:
  336|  16.5M|{
  337|  16.5M|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|  16.5M|  register JDIMENSION col;
  339|  16.5M|  register int num_components = cinfo->num_components;
  340|  16.5M|  JDIMENSION num_cols = cinfo->output_width;
  341|  16.5M|  int ci;
  342|       |
  343|  16.5M|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 173k, False: 16.3M]
  ------------------
  344|   347k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (344:12): [True: 173k, False: 173k]
  ------------------
  345|   173k|      inptr0 = input_buf[0][input_row];
  346|   173k|      inptr1 = input_buf[1][input_row];
  347|   173k|      inptr2 = input_buf[2][input_row];
  348|   173k|      input_row++;
  349|   173k|      outptr = *output_buf++;
  350|  6.29M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (350:21): [True: 6.12M, False: 173k]
  ------------------
  351|  6.12M|        *outptr++ = inptr0[col];
  352|  6.12M|        *outptr++ = inptr1[col];
  353|  6.12M|        *outptr++ = inptr2[col];
  354|  6.12M|      }
  355|   173k|    }
  356|  16.3M|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 310, False: 16.3M]
  ------------------
  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|  39.2k|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (364:21): [True: 38.9k, False: 310]
  ------------------
  365|  38.9k|        *outptr++ = inptr0[col];
  366|  38.9k|        *outptr++ = inptr1[col];
  367|  38.9k|        *outptr++ = inptr2[col];
  368|  38.9k|        *outptr++ = inptr3[col];
  369|  38.9k|      }
  370|    310|    }
  371|  16.3M|  } else {
  372|  32.6M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 16.3M, False: 16.3M]
  ------------------
  373|  32.6M|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 16.3M, False: 16.3M]
  ------------------
  374|  16.3M|        inptr = input_buf[ci][input_row];
  375|  16.3M|        outptr = *output_buf;
  376|  7.70G|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 7.69G, False: 16.3M]
  ------------------
  377|  7.69G|          outptr[ci] = inptr[col];
  378|  7.69G|          outptr += num_components;
  379|  7.69G|        }
  380|  16.3M|      }
  381|  16.3M|      output_buf++;
  382|  16.3M|      input_row++;
  383|  16.3M|    }
  384|  16.3M|  }
  385|  16.5M|}
j12init_color_deconverter:
  625|    892|{
  626|    892|  my_cconvert_ptr cconvert;
  627|    892|  int ci;
  628|       |
  629|    892|#ifdef D_LOSSLESS_SUPPORTED
  630|    892|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 309, False: 583]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|    309|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    618|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 309]
  ------------------
  635|    309|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    309|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 309]
  ------------------
  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|    309|  } else
  639|    583|#endif
  640|    583|  {
  641|    583|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    583|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 583]
  ------------------
  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|    583|  }
  644|       |
  645|    892|  cconvert = (my_cconvert_ptr)
  646|    892|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    892|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|    892|                                sizeof(my_color_deconverter));
  648|    892|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|    892|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|    892|  switch (cinfo->jpeg_color_space) {
  653|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 0, False: 892]
  ------------------
  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: 892]
  ------------------
  659|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 0, False: 892]
  ------------------
  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: 892]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 892]
  ------------------
  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|    892|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 892, False: 0]
  ------------------
  671|    892|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 892]
  ------------------
  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|    892|    break;
  674|    892|  }
  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|    892|  switch (cinfo->out_color_space) {
  684|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 0, False: 892]
  ------------------
  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: 892]
  ------------------
  705|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 892]
  ------------------
  706|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 892]
  ------------------
  707|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 892]
  ------------------
  708|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 892]
  ------------------
  709|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 892]
  ------------------
  710|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 892]
  ------------------
  711|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 892]
  ------------------
  712|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 892]
  ------------------
  713|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 892]
  ------------------
  714|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 892]
  ------------------
  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: 892]
  ------------------
  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: 892]
  ------------------
  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|    892|  default:
  ------------------
  |  Branch (873:3): [True: 892, False: 0]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|    892|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 892, False: 0]
  ------------------
  876|    892|      cinfo->out_color_components = cinfo->num_components;
  877|    892|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|    892|#define _color_convert  color_convert_12
  ------------------
  878|    892|    } 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|    892|    break;
  881|    892|  }
  882|       |
  883|    892|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 892]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|    892|  else
  886|    892|    cinfo->output_components = cinfo->out_color_components;
  887|    892|}
jdcolor-12.c:start_pass_dcolor:
  614|    873|{
  615|       |  /* no work needed */
  616|    873|}
jdcolor-12.c:null_convert:
  336|  1.90M|{
  337|  1.90M|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|  1.90M|  register JDIMENSION col;
  339|  1.90M|  register int num_components = cinfo->num_components;
  340|  1.90M|  JDIMENSION num_cols = cinfo->output_width;
  341|  1.90M|  int ci;
  342|       |
  343|  1.90M|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 0, False: 1.90M]
  ------------------
  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.90M|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 0, False: 1.90M]
  ------------------
  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.90M|  } else {
  372|  3.81M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 1.90M, False: 1.90M]
  ------------------
  373|  3.81M|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 1.90M, False: 1.90M]
  ------------------
  374|  1.90M|        inptr = input_buf[ci][input_row];
  375|  1.90M|        outptr = *output_buf;
  376|   228M|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 226M, False: 1.90M]
  ------------------
  377|   226M|          outptr[ci] = inptr[col];
  378|   226M|          outptr += num_components;
  379|   226M|        }
  380|  1.90M|      }
  381|  1.90M|      output_buf++;
  382|  1.90M|      input_row++;
  383|  1.90M|    }
  384|  1.90M|  }
  385|  1.90M|}

jinit_inverse_dct:
  335|  78.0k|{
  336|  78.0k|  my_idct_ptr idct;
  337|  78.0k|  int ci;
  338|  78.0k|  jpeg_component_info *compptr;
  339|       |
  340|  78.0k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  78.0k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (340:7): [True: 0, False: 78.0k]
  ------------------
  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|  78.0k|  idct = (my_idct_ptr)
  344|  78.0k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  78.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  345|  78.0k|                                sizeof(my_idct_controller));
  346|  78.0k|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  347|  78.0k|  idct->pub.start_pass = start_pass;
  348|       |
  349|   187k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (349:44): [True: 109k, False: 78.0k]
  ------------------
  350|   109k|       ci++, compptr++) {
  351|       |    /* Allocate and pre-zero a multiplier table for each component */
  352|   109k|    compptr->dct_table =
  353|   109k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   109k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  354|   109k|                                  sizeof(multiplier_table));
  355|   109k|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  356|       |    /* Mark multiplier table not yet set up for any method */
  357|   109k|    idct->cur_method[ci] = -1;
  358|   109k|  }
  359|  78.0k|}
jddctmgr-8.c:start_pass:
  102|  70.3k|{
  103|  70.3k|  my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
  104|  70.3k|  int ci, i;
  105|  70.3k|  jpeg_component_info *compptr;
  106|  70.3k|  int method = 0;
  107|  70.3k|  _inverse_DCT_method_ptr method_ptr = NULL;
  ------------------
  |  |  262|  70.3k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  108|  70.3k|  JQUANT_TBL *qtbl;
  109|       |
  110|   166k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (110:44): [True: 95.7k, False: 70.3k]
  ------------------
  111|  95.7k|       ci++, compptr++) {
  112|       |    /* Select the proper IDCT routine for this component's scaling */
  113|  95.7k|    switch (compptr->_DCT_scaled_size) {
  ------------------
  |  |   24|  95.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  114|      0|#ifdef IDCT_SCALING_SUPPORTED
  115|      0|    case 1:
  ------------------
  |  Branch (115:5): [True: 0, False: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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|  95.7k|    case DCTSIZE:
  ------------------
  |  |   66|  95.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (154:5): [True: 95.7k, False: 0]
  ------------------
  155|  95.7k|      switch (cinfo->dct_method) {
  156|      0|#ifdef DCT_ISLOW_SUPPORTED
  157|  95.7k|      case JDCT_ISLOW:
  ------------------
  |  Branch (157:7): [True: 95.7k, False: 0]
  ------------------
  158|  95.7k|#ifdef WITH_SIMD
  159|  95.7k|        if (jsimd_set_idct_islow(cinfo))
  ------------------
  |  Branch (159:13): [True: 95.7k, False: 0]
  ------------------
  160|  95.7k|          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|  95.7k|        method = JDCT_ISLOW;
  165|  95.7k|        break;
  166|      0|#endif
  167|      0|#ifdef DCT_IFAST_SUPPORTED
  168|      0|      case JDCT_IFAST:
  ------------------
  |  Branch (168:7): [True: 0, False: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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|  95.7k|      }
  193|  95.7k|      break;
  194|  95.7k|#ifdef IDCT_SCALING_SUPPORTED
  195|  95.7k|    case 9:
  ------------------
  |  Branch (195:5): [True: 0, False: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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: 95.7k]
  ------------------
  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|  95.7k|    }
  232|  95.7k|    idct->pub._inverse_DCT[ci] = method_ptr;
  ------------------
  |  |  263|  95.7k|#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|  95.7k|    if (!compptr->component_needed || idct->cur_method[ci] == method)
  ------------------
  |  Branch (240:9): [True: 0, False: 95.7k]
  |  Branch (240:39): [True: 0, False: 95.7k]
  ------------------
  241|      0|      continue;
  242|  95.7k|    qtbl = compptr->quant_table;
  243|  95.7k|    if (qtbl == NULL)           /* happens if no data yet for component */
  ------------------
  |  Branch (243:9): [True: 16.5k, False: 79.1k]
  ------------------
  244|  16.5k|      continue;
  245|  79.1k|    idct->cur_method[ci] = method;
  246|  79.1k|    switch (method) {
  247|      0|#ifdef PROVIDE_ISLOW_TABLES
  248|  79.1k|    case JDCT_ISLOW:
  ------------------
  |  Branch (248:5): [True: 79.1k, False: 0]
  ------------------
  249|  79.1k|      {
  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|  79.1k|        ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
  254|  5.14M|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  5.14M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (254:21): [True: 5.06M, False: 79.1k]
  ------------------
  255|  5.06M|          ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
  256|  5.06M|        }
  257|  79.1k|      }
  258|  79.1k|      break;
  259|      0|#endif
  260|      0|#ifdef DCT_IFAST_SUPPORTED
  261|      0|    case JDCT_IFAST:
  ------------------
  |  Branch (261:5): [True: 0, False: 79.1k]
  ------------------
  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: 79.1k]
  ------------------
  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: 79.1k]
  ------------------
  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|  79.1k|    }
  325|  79.1k|  }
  326|  70.3k|}
j12init_inverse_dct:
  335|    583|{
  336|    583|  my_idct_ptr idct;
  337|    583|  int ci;
  338|    583|  jpeg_component_info *compptr;
  339|       |
  340|    583|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    583|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (340:7): [True: 0, False: 583]
  ------------------
  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|    583|  idct = (my_idct_ptr)
  344|    583|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    583|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  345|    583|                                sizeof(my_idct_controller));
  346|    583|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  347|    583|  idct->pub.start_pass = start_pass;
  348|       |
  349|  1.16k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (349:44): [True: 583, False: 583]
  ------------------
  350|    583|       ci++, compptr++) {
  351|       |    /* Allocate and pre-zero a multiplier table for each component */
  352|    583|    compptr->dct_table =
  353|    583|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    583|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  354|    583|                                  sizeof(multiplier_table));
  355|    583|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  356|       |    /* Mark multiplier table not yet set up for any method */
  357|    583|    idct->cur_method[ci] = -1;
  358|    583|  }
  359|    583|}
jddctmgr-12.c:start_pass:
  102|    573|{
  103|    573|  my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
  104|    573|  int ci, i;
  105|    573|  jpeg_component_info *compptr;
  106|    573|  int method = 0;
  107|    573|  _inverse_DCT_method_ptr method_ptr = NULL;
  ------------------
  |  |  146|    573|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  108|    573|  JQUANT_TBL *qtbl;
  109|       |
  110|  1.14k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (110:44): [True: 573, False: 573]
  ------------------
  111|    573|       ci++, compptr++) {
  112|       |    /* Select the proper IDCT routine for this component's scaling */
  113|    573|    switch (compptr->_DCT_scaled_size) {
  ------------------
  |  |   24|    573|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  114|      0|#ifdef IDCT_SCALING_SUPPORTED
  115|      0|    case 1:
  ------------------
  |  Branch (115:5): [True: 0, False: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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|    573|    case DCTSIZE:
  ------------------
  |  |   66|    573|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (154:5): [True: 573, False: 0]
  ------------------
  155|    573|      switch (cinfo->dct_method) {
  156|      0|#ifdef DCT_ISLOW_SUPPORTED
  157|    573|      case JDCT_ISLOW:
  ------------------
  |  Branch (157:7): [True: 573, False: 0]
  ------------------
  158|       |#ifdef WITH_SIMD
  159|       |        if (jsimd_set_idct_islow(cinfo))
  160|       |          method_ptr = jsimd_idct_islow;
  161|       |        else
  162|       |#endif
  163|    573|          method_ptr = _jpeg_idct_islow;
  ------------------
  |  |  187|    573|#define _jpeg_idct_islow  jpeg12_idct_islow
  ------------------
  164|    573|        method = JDCT_ISLOW;
  165|    573|        break;
  166|      0|#endif
  167|      0|#ifdef DCT_IFAST_SUPPORTED
  168|      0|      case JDCT_IFAST:
  ------------------
  |  Branch (168:7): [True: 0, False: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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|    573|      }
  193|    573|      break;
  194|    573|#ifdef IDCT_SCALING_SUPPORTED
  195|    573|    case 9:
  ------------------
  |  Branch (195:5): [True: 0, False: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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|    573|    }
  232|    573|    idct->pub._inverse_DCT[ci] = method_ptr;
  ------------------
  |  |  147|    573|#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|    573|    if (!compptr->component_needed || idct->cur_method[ci] == method)
  ------------------
  |  Branch (240:9): [True: 0, False: 573]
  |  Branch (240:39): [True: 0, False: 573]
  ------------------
  241|      0|      continue;
  242|    573|    qtbl = compptr->quant_table;
  243|    573|    if (qtbl == NULL)           /* happens if no data yet for component */
  ------------------
  |  Branch (243:9): [True: 0, False: 573]
  ------------------
  244|      0|      continue;
  245|    573|    idct->cur_method[ci] = method;
  246|    573|    switch (method) {
  247|      0|#ifdef PROVIDE_ISLOW_TABLES
  248|    573|    case JDCT_ISLOW:
  ------------------
  |  Branch (248:5): [True: 573, False: 0]
  ------------------
  249|    573|      {
  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|    573|        ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
  254|  37.2k|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  37.2k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (254:21): [True: 36.6k, False: 573]
  ------------------
  255|  36.6k|          ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
  256|  36.6k|        }
  257|    573|      }
  258|    573|      break;
  259|      0|#endif
  260|      0|#ifdef DCT_IFAST_SUPPORTED
  261|      0|    case JDCT_IFAST:
  ------------------
  |  Branch (261:5): [True: 0, False: 573]
  ------------------
  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: 573]
  ------------------
  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: 573]
  ------------------
  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|    573|    }
  325|    573|  }
  326|    573|}

jinit_d_diff_controller:
  348|  2.87k|{
  349|  2.87k|  my_diff_ptr diff;
  350|  2.87k|  int ci;
  351|  2.87k|  jpeg_component_info *compptr;
  352|       |
  353|  2.87k|#if BITS_IN_JSAMPLE == 8
  354|  2.87k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  5.75k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (354:7): [True: 0, False: 2.87k]
  |  Branch (354:50): [True: 0, False: 2.87k]
  ------------------
  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|  2.87k|  diff = (my_diff_ptr)
  362|  2.87k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.87k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|  2.87k|                                sizeof(my_diff_controller));
  364|  2.87k|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|  2.87k|  diff->pub.start_input_pass = start_input_pass;
  366|  2.87k|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  5.97k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 3.09k, False: 2.87k]
  ------------------
  370|  3.09k|       ci++, compptr++) {
  371|  3.09k|    diff->diff_buf[ci] =
  372|  3.09k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  3.09k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  3.09k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  3.09k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  3.09k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  3.09k|                                         (long)compptr->h_samp_factor),
  375|  3.09k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  3.09k|    diff->undiff_buf[ci] =
  377|  3.09k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  3.09k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  3.09k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  3.09k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  3.09k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  3.09k|                                         (long)compptr->h_samp_factor),
  380|  3.09k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  3.09k|  }
  382|       |
  383|  2.87k|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 75, False: 2.80k]
  ------------------
  384|     75|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|     75|    int access_rows;
  387|       |
  388|    300|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 225, False: 75]
  ------------------
  389|    225|         ci++, compptr++) {
  390|    225|      access_rows = compptr->v_samp_factor;
  391|    225|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|    225|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|    225|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|    225|#define FALSE   0               /* values of boolean */
  ------------------
  393|    225|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|    225|                               (long)compptr->h_samp_factor),
  395|    225|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|    225|                               (long)compptr->v_samp_factor),
  397|    225|         (JDIMENSION)access_rows);
  398|    225|    }
  399|     75|    diff->pub.consume_data = consume_data;
  400|     75|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  258|     75|#define _decompress_data  decompress_data
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|  2.80k|  } else {
  405|  2.80k|    diff->pub.consume_data = dummy_consume_data;
  406|  2.80k|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  2.80k|#define _decompress_data  decompress_data
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|  2.80k|  }
  409|  2.87k|}
jddiffct-8.c:start_input_pass:
   94|  2.63k|{
   95|  2.63k|  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|  2.63k|  (*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|  2.63k|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 20, False: 2.61k]
  ------------------
  108|     20|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     20|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     20|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     20|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  2.63k|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|  2.63k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|  2.63k|  cinfo->input_iMCU_row = 0;
  115|  2.63k|  start_iMCU_row(cinfo);
  116|  2.63k|}
jddiffct-8.c:start_iMCU_row:
   67|   291k|{
   68|   291k|  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|   291k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 72.6k, False: 218k]
  ------------------
   75|  72.6k|    diff->MCU_rows_per_iMCU_row = 1;
   76|   218k|  } else {
   77|   218k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 217k, False: 1.13k]
  ------------------
   78|   217k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|  1.13k|    else
   80|  1.13k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|   218k|  }
   82|       |
   83|   291k|  diff->MCU_ctr = 0;
   84|   291k|  diff->MCU_vert_offset = 0;
   85|   291k|}
jddiffct-8.c:start_output_pass:
  147|  1.06k|{
  148|  1.06k|  cinfo->output_iMCU_row = 0;
  149|  1.06k|}
jddiffct-8.c:consume_data:
  266|   225k|{
  267|   225k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|   225k|  int ci, compi;
  269|   225k|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |  230|   225k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  270|   225k|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|   595k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 369k, False: 225k]
  ------------------
  274|   369k|    compptr = cinfo->cur_comp_info[ci];
  275|   369k|    compi = compptr->component_index;
  276|   369k|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|   369k|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|   369k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|   369k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   369k|#define TRUE    1
  ------------------
  280|   369k|  }
  281|       |
  282|   225k|  return decompress_data(cinfo, buffer);
  283|   225k|}
jddiffct-8.c:output_data:
  296|  67.4k|{
  297|  67.4k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  298|  67.4k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  299|  67.4k|  int ci, samp_rows, row;
  300|  67.4k|  _JSAMPARRAY buffer;
  ------------------
  |  |  230|  67.4k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  301|  67.4k|  jpeg_component_info *compptr;
  302|       |
  303|       |  /* Force some input to be done if we are getting ahead of the input. */
  304|  67.4k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (304:10): [True: 0, False: 67.4k]
  ------------------
  305|  67.4k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (305:11): [True: 67.4k, False: 0]
  ------------------
  306|  67.4k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (306:11): [True: 0, False: 67.4k]
  ------------------
  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|   269k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (312:44): [True: 202k, False: 67.4k]
  ------------------
  313|   202k|       ci++, compptr++) {
  314|       |    /* Align the virtual buffer for this component. */
  315|   202k|    buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  316|   202k|      ((j_common_ptr)cinfo, diff->whole_image[ci],
  317|   202k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  318|   202k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|   202k|#define FALSE   0               /* values of boolean */
  ------------------
  319|       |
  320|   202k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (320:9): [True: 202k, False: 97]
  ------------------
  321|   202k|      samp_rows = compptr->v_samp_factor;
  322|     97|    else {
  323|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  324|     97|      samp_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  325|     97|      if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (325:11): [True: 76, False: 21]
  ------------------
  326|     97|    }
  327|       |
  328|   404k|    for (row = 0; row < samp_rows; row++) {
  ------------------
  |  Branch (328:19): [True: 202k, False: 202k]
  ------------------
  329|   202k|      memcpy(output_buf[ci][row], buffer[row],
  330|   202k|             compptr->width_in_blocks * sizeof(_JSAMPLE));
  331|   202k|    }
  332|   202k|  }
  333|       |
  334|  67.4k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (334:7): [True: 67.4k, False: 45]
  ------------------
  335|  67.4k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  67.4k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  336|     45|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     45|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  337|  67.4k|}
jddiffct-8.c:decompress_data:
  164|   291k|{
  165|   291k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|   291k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|   291k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|   291k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|   291k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|   291k|  int ci, compi, row, prev_row;
  171|   291k|  unsigned int yoffset;
  172|   291k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|   583k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 291k, False: 291k]
  ------------------
  176|   291k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|   291k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 28.1k, False: 263k]
  ------------------
  180|  28.1k|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 1.56k, False: 26.6k]
  ------------------
  181|  1.56k|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 1.56k]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|  28.1k|    }
  184|       |
  185|   291k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|   291k|    MCU_count =
  188|   291k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|   291k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|   291k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|   291k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 291k]
  ------------------
  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|   291k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 28.1k, False: 263k]
  ------------------
  200|  28.1k|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|   291k|    diff->MCU_ctr = 0;
  204|   291k|  }
  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|   728k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 437k, False: 291k]
  ------------------
  212|   437k|    compptr = cinfo->cur_comp_info[ci];
  213|   437k|    compi = compptr->component_index;
  214|   437k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|   874k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 437k, False: 437k]
  |  Branch (215:17): [True: 3.38k, False: 870k]
  ------------------
  216|   870k|                compptr->last_row_height : compptr->v_samp_factor);
  217|   437k|         prev_row = row, row++) {
  218|   437k|      (*losslessd->predict_undifference[compi])
  219|   437k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|   437k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|   437k|          compptr->width_in_blocks);
  222|   437k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|   437k|                                  output_buf[compi][row],
  224|   437k|                                  compptr->width_in_blocks);
  225|   437k|    }
  226|   437k|  }
  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|   291k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 290k, False: 1.31k]
  ------------------
  235|   290k|    start_iMCU_row(cinfo);
  236|   290k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   290k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|   290k|  }
  238|       |  /* Completed the scan */
  239|  1.31k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|  1.31k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.31k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|   291k|}
jddiffct-8.c:process_restart:
  126|  1.56k|{
  127|  1.56k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|  1.56k|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 1.56k]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|  1.56k|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|  1.56k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|  1.56k|  return TRUE;
  ------------------
  |  |  210|  1.56k|#define TRUE    1
  ------------------
  138|  1.56k|}
j12init_d_diff_controller:
  348|    308|{
  349|    308|  my_diff_ptr diff;
  350|    308|  int ci;
  351|    308|  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|    308|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    616|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (356:7): [True: 0, False: 308]
  ------------------
  357|    308|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    308|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (357:7): [True: 0, False: 308]
  ------------------
  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|    308|  diff = (my_diff_ptr)
  362|    308|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    308|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    308|                                sizeof(my_diff_controller));
  364|    308|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    308|  diff->pub.start_input_pass = start_input_pass;
  366|    308|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|    616|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 308, False: 308]
  ------------------
  370|    308|       ci++, compptr++) {
  371|    308|    diff->diff_buf[ci] =
  372|    308|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    308|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    308|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    308|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|    308|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|    308|                                         (long)compptr->h_samp_factor),
  375|    308|                   (JDIMENSION)compptr->v_samp_factor);
  376|    308|    diff->undiff_buf[ci] =
  377|    308|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    308|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    308|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    308|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|    308|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|    308|                                         (long)compptr->h_samp_factor),
  380|    308|                   (JDIMENSION)compptr->v_samp_factor);
  381|    308|  }
  382|       |
  383|    308|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 308]
  ------------------
  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|    308|  } else {
  405|    308|    diff->pub.consume_data = dummy_consume_data;
  406|    308|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    308|#define _decompress_data  decompress_data_12
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|    308|  }
  409|    308|}
jddiffct-12.c:start_input_pass:
   94|    307|{
   95|    307|  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|    307|  (*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|    307|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 2, False: 305]
  ------------------
  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|    307|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|    307|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|    307|  cinfo->input_iMCU_row = 0;
  115|    307|  start_iMCU_row(cinfo);
  116|    307|}
jddiffct-12.c:start_iMCU_row:
   67|  73.2k|{
   68|  73.2k|  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|  73.2k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 0, False: 73.2k]
  ------------------
   75|      0|    diff->MCU_rows_per_iMCU_row = 1;
   76|  73.2k|  } else {
   77|  73.2k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 73.0k, False: 247]
  ------------------
   78|  73.0k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|    247|    else
   80|    247|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  73.2k|  }
   82|       |
   83|  73.2k|  diff->MCU_ctr = 0;
   84|  73.2k|  diff->MCU_vert_offset = 0;
   85|  73.2k|}
jddiffct-12.c:start_output_pass:
  147|    300|{
  148|    300|  cinfo->output_iMCU_row = 0;
  149|    300|}
jddiffct-12.c:decompress_data:
  164|  73.2k|{
  165|  73.2k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  73.2k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  73.2k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  73.2k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  73.2k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  73.2k|  int ci, compi, row, prev_row;
  171|  73.2k|  unsigned int yoffset;
  172|  73.2k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|   146k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 73.2k, False: 73.2k]
  ------------------
  176|  73.2k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  73.2k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 14.3k, False: 58.8k]
  ------------------
  180|  14.3k|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 311, False: 14.0k]
  ------------------
  181|    311|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 311]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|  14.3k|    }
  184|       |
  185|  73.2k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  73.2k|    MCU_count =
  188|  73.2k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  73.2k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  73.2k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  73.2k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 73.2k]
  ------------------
  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|  73.2k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 14.3k, False: 58.8k]
  ------------------
  200|  14.3k|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  73.2k|    diff->MCU_ctr = 0;
  204|  73.2k|  }
  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|   146k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 73.2k, False: 73.2k]
  ------------------
  212|  73.2k|    compptr = cinfo->cur_comp_info[ci];
  213|  73.2k|    compi = compptr->component_index;
  214|  73.2k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|   146k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 73.2k, False: 73.2k]
  |  Branch (215:17): [True: 492, False: 145k]
  ------------------
  216|   145k|                compptr->last_row_height : compptr->v_samp_factor);
  217|  73.2k|         prev_row = row, row++) {
  218|  73.2k|      (*losslessd->predict_undifference[compi])
  219|  73.2k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  73.2k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  73.2k|          compptr->width_in_blocks);
  222|  73.2k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  73.2k|                                  output_buf[compi][row],
  224|  73.2k|                                  compptr->width_in_blocks);
  225|  73.2k|    }
  226|  73.2k|  }
  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|  73.2k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 72.9k, False: 246]
  ------------------
  235|  72.9k|    start_iMCU_row(cinfo);
  236|  72.9k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  72.9k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  72.9k|  }
  238|       |  /* Completed the scan */
  239|    246|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|    246|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    246|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  73.2k|}
jddiffct-12.c:process_restart:
  126|    311|{
  127|    311|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|    311|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 311]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|    311|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|    311|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|    311|  return TRUE;
  ------------------
  |  |  210|    311|#define TRUE    1
  ------------------
  138|    311|}

jpeg_make_d_derived_tbl:
  145|   126k|{
  146|   126k|  JHUFF_TBL *htbl;
  147|   126k|  d_derived_tbl *dtbl;
  148|   126k|  int p, i, l, si, numsymbols;
  149|   126k|  int lookbits, ctr;
  150|   126k|  char huffsize[257];
  151|   126k|  unsigned int huffcode[257];
  152|   126k|  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|   126k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|   126k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 126k]
  |  Branch (159:20): [True: 217, False: 126k]
  ------------------
  160|    217|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|    217|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    217|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    217|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|   126k|  htbl =
  162|   126k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 65.5k, False: 61.4k]
  ------------------
  163|   126k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 226, False: 126k]
  ------------------
  164|    226|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|    226|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    226|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    226|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|   126k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 110k, False: 16.7k]
  ------------------
  168|   110k|    *pdtbl = (d_derived_tbl *)
  169|   110k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   110k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|   110k|                                  sizeof(d_derived_tbl));
  171|   126k|  dtbl = *pdtbl;
  172|   126k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|   126k|  p = 0;
  177|  2.15M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 2.02M, False: 126k]
  ------------------
  178|  2.02M|    i = (int)htbl->bits[l];
  179|  2.02M|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 2.02M]
  |  Branch (179:18): [True: 0, False: 2.02M]
  ------------------
  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|  10.0M|    while (i--)
  ------------------
  |  Branch (181:12): [True: 8.00M, False: 2.02M]
  ------------------
  182|  8.00M|      huffsize[p++] = (char)l;
  183|  2.02M|  }
  184|   126k|  huffsize[p] = 0;
  185|   126k|  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|   126k|  code = 0;
  191|   126k|  si = huffsize[0];
  192|   126k|  p = 0;
  193|  1.52M|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 1.39M, False: 126k]
  ------------------
  194|  9.38M|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 7.99M, False: 1.39M]
  ------------------
  195|  7.99M|      huffcode[p++] = code;
  196|  7.99M|      code++;
  197|  7.99M|    }
  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.39M|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 332, False: 1.39M]
  ------------------
  202|    332|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    332|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    332|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  1.39M|    code <<= 1;
  204|  1.39M|    si++;
  205|  1.39M|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|   126k|  p = 0;
  210|  2.14M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 2.01M, False: 126k]
  ------------------
  211|  2.01M|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 915k, False: 1.10M]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|   915k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|   915k|      p += htbl->bits[l];
  217|   915k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|  1.10M|    } else {
  219|  1.10M|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  1.10M|    }
  221|  2.01M|  }
  222|   126k|  dtbl->valoffset[17] = 0;
  223|   126k|  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|  32.4M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|  32.4M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 32.3M, False: 126k]
  ------------------
  233|  32.3M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  32.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  32.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|   126k|  p = 0;
  236|  1.13M|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  1.13M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 1.00M, False: 126k]
  ------------------
  237|  2.88M|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 1.87M, False: 1.00M]
  ------------------
  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.87M|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  1.87M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  19.6M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  1.87M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 17.7M, False: 1.87M]
  ------------------
  242|  17.7M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|  17.7M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|  17.7M|        lookbits++;
  244|  17.7M|      }
  245|  1.87M|    }
  246|  1.00M|  }
  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|   126k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 65.1k, False: 61.8k]
  ------------------
  255|   914k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 849k, False: 65.1k]
  ------------------
  256|   849k|      int sym = htbl->huffval[i];
  257|   849k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 849k]
  |  Branch (257:22): [True: 170, False: 849k]
  |  Branch (257:29): [True: 25.7k, False: 823k]
  ------------------
  258|    170|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    170|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    170|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|   849k|    }
  260|  65.1k|  }
  261|   126k|}
jpeg_fill_bit_buffer:
  291|   677k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|   677k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|   677k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|   677k|  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|   677k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 304k, False: 373k]
  ------------------
  302|  2.29M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  2.29M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  2.29M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 2.04M, False: 250k]
  ------------------
  303|  2.04M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  2.04M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 52.6k, False: 1.99M]
  ------------------
  307|  52.6k|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 52.6k]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|  52.6k|        next_input_byte = cinfo->src->next_input_byte;
  310|  52.6k|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|  52.6k|      }
  312|  2.04M|      bytes_in_buffer--;
  313|  2.04M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  2.04M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 98.2k, False: 1.94M]
  ------------------
  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|   253k|        do {
  323|   253k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 2.81k, False: 250k]
  ------------------
  324|  2.81k|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 2.81k]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|  2.81k|            next_input_byte = cinfo->src->next_input_byte;
  327|  2.81k|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|  2.81k|          }
  329|   253k|          bytes_in_buffer--;
  330|   253k|          c = *next_input_byte++;
  331|   253k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 154k, False: 98.2k]
  ------------------
  332|       |
  333|  98.2k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 44.0k, False: 54.1k]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  44.0k|          c = 0xFF;
  336|  54.1k|        } 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|  54.1k|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|  54.1k|          goto no_more_bytes;
  348|  54.1k|        }
  349|  98.2k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  1.99M|      get_buffer = (get_buffer << 8) | c;
  353|  1.99M|      bits_left += 8;
  354|  1.99M|    } /* end while */
  355|   373k|  } else {
  356|   427k|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|   427k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 182k, False: 245k]
  ------------------
  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|   182k|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 52.7k, False: 129k]
  ------------------
  368|  52.7k|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|  52.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  52.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|  52.7k|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|  52.7k|#define TRUE    1
  ------------------
  370|  52.7k|      }
  371|       |      /* Fill the buffer with zero bits */
  372|   182k|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|   182k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   182k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|   182k|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|   182k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   182k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|   182k|    }
  375|   427k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|   677k|  state->next_input_byte = next_input_byte;
  379|   677k|  state->bytes_in_buffer = bytes_in_buffer;
  380|   677k|  state->get_buffer = get_buffer;
  381|   677k|  state->bits_left = bits_left;
  382|       |
  383|   677k|  return TRUE;
  ------------------
  |  |  210|   677k|#define TRUE    1
  ------------------
  384|   677k|}
jpeg_huff_decode:
  439|   610k|{
  440|   610k|  register int l = min_bits;
  441|   610k|  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|   610k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|   610k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   610k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 36.9k, False: 573k]
  |  |  ------------------
  |  |  162|  36.9k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 36.9k]
  |  |  ------------------
  |  |  163|  36.9k|      { action; } \
  |  |  164|  36.9k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  36.9k|  } \
  |  |  166|   610k|}
  ------------------
  447|   610k|  code = GET_BITS(l);
  ------------------
  |  |  169|   610k|  (((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|  3.91M|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 3.30M, False: 610k]
  ------------------
  453|  3.30M|    code <<= 1;
  454|  3.30M|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  3.30M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  3.30M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 110k, False: 3.19M]
  |  |  ------------------
  |  |  162|   110k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 110k]
  |  |  ------------------
  |  |  163|   110k|      { action; } \
  |  |  164|   110k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|   110k|  } \
  |  |  166|  3.30M|}
  ------------------
  455|  3.30M|    code |= GET_BITS(1);
  ------------------
  |  |  169|  3.30M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  3.30M|    l++;
  457|  3.30M|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|   610k|  state->get_buffer = get_buffer;
  461|   610k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|   610k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 336k, False: 274k]
  ------------------
  466|   336k|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|   336k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|   336k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|   336k|    return 0;                   /* fake a zero as the safest result */
  468|   336k|  }
  469|       |
  470|   274k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|   610k|}
jinit_huff_decoder:
  815|  50.2k|{
  816|  50.2k|  huff_entropy_ptr entropy;
  817|  50.2k|  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|  50.2k|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|  50.2k|  entropy = (huff_entropy_ptr)
  826|  50.2k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  50.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|  50.2k|                                sizeof(huff_entropy_decoder));
  828|  50.2k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|  50.2k|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|  50.2k|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|   251k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   251k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 201k, False: 50.2k]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|   201k|  }
  836|  50.2k|}
jdhuff.c:start_pass_huff_decoder:
   80|  52.6k|{
   81|  52.6k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|  52.6k|  int ci, blkn, dctbl, actbl;
   83|  52.6k|  d_derived_tbl **pdtbl;
   84|  52.6k|  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|  52.6k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  48.9k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 3.70k, False: 48.9k]
  |  Branch (90:25): [True: 7.45k, False: 41.4k]
  ------------------
   91|  41.4k|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 170, False: 41.2k]
  |  Branch (91:25): [True: 321, False: 40.9k]
  ------------------
   92|  11.6k|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  11.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  11.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|   109k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 56.5k, False: 52.6k]
  ------------------
   95|  56.5k|    compptr = cinfo->cur_comp_info[ci];
   96|  56.5k|    dctbl = compptr->dc_tbl_no;
   97|  56.5k|    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|  56.5k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  56.5k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|  56.5k|#define TRUE    1
  ------------------
  102|  56.5k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  56.5k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|  56.5k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  56.5k|    entropy->saved.last_dc_val[ci] = 0;
  106|  56.5k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|   109k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 56.4k, False: 52.6k]
  ------------------
  110|  56.4k|    ci = cinfo->MCU_membership[blkn];
  111|  56.4k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  56.4k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  56.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|  56.4k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 56.4k, False: 0]
  ------------------
  117|  56.4k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|  56.4k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  56.4k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  56.4k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  56.4k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  56.4k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|  52.6k|  entropy->bitstate.bits_left = 0;
  127|  52.6k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|  52.6k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  52.6k|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|  52.6k|  entropy->restarts_to_go = cinfo->restart_interval;
  132|  52.6k|}
jdhuff.c:decode_mcu:
  771|   107M|{
  772|   107M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   107M|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   107M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 4.34M, False: 103M]
  ------------------
  777|  4.34M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 6.08k, False: 4.34M]
  ------------------
  778|  6.08k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 6.08k]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|  4.34M|    usefast = 0;
  781|  4.34M|  }
  782|       |
  783|   107M|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   107M|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   107M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 55.6M, False: 51.8M]
  ------------------
  784|  51.8M|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 51.5M, False: 263k]
  ------------------
  785|   107M|    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|   107M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 879k, False: 106M]
  ------------------
  791|       |
  792|   879k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 262k, False: 616k]
  ------------------
  793|   262k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 6.04k, False: 256k]
  ------------------
  794|   616k|    } else {
  795|   622k|use_slow:
  796|   622k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 622k]
  ------------------
  797|   622k|    }
  798|       |
  799|   879k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   107M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 4.34M, False: 103M]
  ------------------
  803|  4.34M|    entropy->restarts_to_go--;
  804|       |
  805|   107M|  return TRUE;
  ------------------
  |  |  210|   107M|#define TRUE    1
  ------------------
  806|   107M|}
jdhuff.c:process_restart:
  513|  6.08k|{
  514|  6.08k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  515|  6.08k|  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|  6.08k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  520|  6.08k|  entropy->bitstate.bits_left = 0;
  521|       |
  522|       |  /* Advance past the RSTn marker */
  523|  6.08k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (523:7): [True: 0, False: 6.08k]
  ------------------
  524|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  525|       |
  526|       |  /* Re-initialize DC predictions to 0 */
  527|  11.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (527:16): [True: 5.47k, False: 6.08k]
  ------------------
  528|  5.47k|    entropy->saved.last_dc_val[ci] = 0;
  529|       |
  530|       |  /* Reset restart counter */
  531|  6.08k|  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|  6.08k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (538:7): [True: 2.25k, False: 3.82k]
  ------------------
  539|  2.25k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  2.25k|#define FALSE   0               /* values of boolean */
  ------------------
  540|       |
  541|  6.08k|  return TRUE;
  ------------------
  |  |  210|  6.08k|#define TRUE    1
  ------------------
  542|  6.08k|}
jdhuff.c:decode_mcu_fast:
  664|   262k|{
  665|   262k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   262k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   262k|  register bit_buf_type get_buffer; \
  |  |  126|   262k|  register int bits_left; \
  |  |  127|   262k|  bitread_working_state br_state
  ------------------
  667|   262k|  JOCTET *buffer;
  668|   262k|  int blkn;
  669|   262k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   262k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   262k|  br_state.cinfo = cinfop; \
  |  |  131|   262k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   262k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   262k|  get_buffer = permstate.get_buffer; \
  |  |  134|   262k|  bits_left = permstate.bits_left;
  ------------------
  674|   262k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   262k|  state = entropy->saved;
  676|       |
  677|   529k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 266k, False: 262k]
  ------------------
  678|   266k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 266k, False: 0]
  ------------------
  679|   266k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   266k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   266k|    register int s, k, r, l;
  682|       |
  683|   266k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   266k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   266k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 58.3k, False: 208k]
  |  |  |  |  ------------------
  |  |  |  |  416|  58.3k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  58.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  58.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  58.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  58.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  58.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  58.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  58.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  58.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.21k, False: 57.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.21k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.21k|    buffer++; \
  |  |  |  |  |  |  401|  1.21k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 759, False: 458]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    759|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    759|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    759|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    759|      buffer -= 2; \
  |  |  |  |  |  |  406|    759|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    759|    } \
  |  |  |  |  |  |  408|  1.21k|  } \
  |  |  |  |  |  |  409|  58.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  58.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  58.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  58.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  58.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  58.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  58.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  58.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  58.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.63k, False: 56.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.63k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.63k|    buffer++; \
  |  |  |  |  |  |  401|  1.63k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 966, False: 673]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    966|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    966|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    966|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    966|      buffer -= 2; \
  |  |  |  |  |  |  406|    966|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    966|    } \
  |  |  |  |  |  |  408|  1.63k|  } \
  |  |  |  |  |  |  409|  58.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  58.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  58.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  58.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  58.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  58.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  58.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  58.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  58.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.67k, False: 55.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.67k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.67k|    buffer++; \
  |  |  |  |  |  |  401|  2.67k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.45k, False: 1.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.45k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.45k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.45k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.45k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.45k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.45k|    } \
  |  |  |  |  |  |  408|  2.67k|  } \
  |  |  |  |  |  |  409|  58.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  58.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  58.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  58.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  58.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  58.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  58.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  58.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  58.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.21k, False: 56.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.21k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.21k|    buffer++; \
  |  |  |  |  |  |  401|  2.21k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.56k, False: 644]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.56k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.56k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.56k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.56k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.56k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.56k|    } \
  |  |  |  |  |  |  408|  2.21k|  } \
  |  |  |  |  |  |  409|  58.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  58.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  58.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  58.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  58.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  58.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  58.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  58.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  58.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.67k, False: 55.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.67k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.67k|    buffer++; \
  |  |  |  |  |  |  401|  2.67k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.86k, False: 811]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.86k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.86k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.86k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.86k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.86k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.86k|    } \
  |  |  |  |  |  |  408|  2.67k|  } \
  |  |  |  |  |  |  409|  58.3k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  58.3k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  58.3k|  register int c0, c1; \
  |  |  |  |  |  |  393|  58.3k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  58.3k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  58.3k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  58.3k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  58.3k|  bits_left += 8; \
  |  |  |  |  |  |  398|  58.3k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.58k, False: 55.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.58k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.58k|    buffer++; \
  |  |  |  |  |  |  401|  2.58k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.01k, False: 566]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.01k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.01k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.01k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.01k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.01k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.01k|    } \
  |  |  |  |  |  |  408|  2.58k|  } \
  |  |  |  |  |  |  409|  58.3k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  58.3k|  }
  |  |  ------------------
  |  |  225|   266k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   266k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   266k|  s = htbl->lookup[s]; \
  |  |  227|   266k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   266k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   266k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   266k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   266k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   266k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   266k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   266k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   533k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 64.4k, False: 202k]
  |  |  ------------------
  |  |  232|  64.4k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  64.4k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  64.4k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   571k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 507k, False: 64.4k]
  |  |  ------------------
  |  |  236|   507k|      s <<= 1; \
  |  |  237|   507k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   507k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   507k|      nb++; \
  |  |  239|   507k|    } \
  |  |  240|  64.4k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 63.3k, False: 1.10k]
  |  |  ------------------
  |  |  241|  64.4k|      s = 0; \
  |  |  242|  64.4k|    else \
  |  |  243|  64.4k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  64.4k|  }
  ------------------
  684|   266k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 11.5k, False: 255k]
  ------------------
  685|  11.5k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  11.5k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 3.60k, False: 7.98k]
  |  |  ------------------
  |  |  416|  3.60k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.60k|#define GET_BYTE { \
  |  |  |  |  392|  3.60k|  register int c0, c1; \
  |  |  |  |  393|  3.60k|  c0 = *buffer++; \
  |  |  |  |  394|  3.60k|  c1 = *buffer; \
  |  |  |  |  395|  3.60k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.60k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.60k|  bits_left += 8; \
  |  |  |  |  398|  3.60k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 775, False: 2.83k]
  |  |  |  |  ------------------
  |  |  |  |  399|    775|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    775|    buffer++; \
  |  |  |  |  401|    775|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 406, False: 369]
  |  |  |  |  ------------------
  |  |  |  |  402|    406|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    406|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    406|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    406|      buffer -= 2; \
  |  |  |  |  406|    406|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    406|    } \
  |  |  |  |  408|    775|  } \
  |  |  |  |  409|  3.60k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.60k|#define GET_BYTE { \
  |  |  |  |  392|  3.60k|  register int c0, c1; \
  |  |  |  |  393|  3.60k|  c0 = *buffer++; \
  |  |  |  |  394|  3.60k|  c1 = *buffer; \
  |  |  |  |  395|  3.60k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.60k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.60k|  bits_left += 8; \
  |  |  |  |  398|  3.60k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 927, False: 2.68k]
  |  |  |  |  ------------------
  |  |  |  |  399|    927|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    927|    buffer++; \
  |  |  |  |  401|    927|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 629, False: 298]
  |  |  |  |  ------------------
  |  |  |  |  402|    629|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    629|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    629|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    629|      buffer -= 2; \
  |  |  |  |  406|    629|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    629|    } \
  |  |  |  |  408|    927|  } \
  |  |  |  |  409|  3.60k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.60k|#define GET_BYTE { \
  |  |  |  |  392|  3.60k|  register int c0, c1; \
  |  |  |  |  393|  3.60k|  c0 = *buffer++; \
  |  |  |  |  394|  3.60k|  c1 = *buffer; \
  |  |  |  |  395|  3.60k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.60k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.60k|  bits_left += 8; \
  |  |  |  |  398|  3.60k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.05k, False: 2.55k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.05k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.05k|    buffer++; \
  |  |  |  |  401|  1.05k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 708, False: 346]
  |  |  |  |  ------------------
  |  |  |  |  402|    708|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    708|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    708|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    708|      buffer -= 2; \
  |  |  |  |  406|    708|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    708|    } \
  |  |  |  |  408|  1.05k|  } \
  |  |  |  |  409|  3.60k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.60k|#define GET_BYTE { \
  |  |  |  |  392|  3.60k|  register int c0, c1; \
  |  |  |  |  393|  3.60k|  c0 = *buffer++; \
  |  |  |  |  394|  3.60k|  c1 = *buffer; \
  |  |  |  |  395|  3.60k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.60k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.60k|  bits_left += 8; \
  |  |  |  |  398|  3.60k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.26k, False: 2.34k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.26k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.26k|    buffer++; \
  |  |  |  |  401|  1.26k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 792, False: 475]
  |  |  |  |  ------------------
  |  |  |  |  402|    792|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    792|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    792|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    792|      buffer -= 2; \
  |  |  |  |  406|    792|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    792|    } \
  |  |  |  |  408|  1.26k|  } \
  |  |  |  |  409|  3.60k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.60k|#define GET_BYTE { \
  |  |  |  |  392|  3.60k|  register int c0, c1; \
  |  |  |  |  393|  3.60k|  c0 = *buffer++; \
  |  |  |  |  394|  3.60k|  c1 = *buffer; \
  |  |  |  |  395|  3.60k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.60k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.60k|  bits_left += 8; \
  |  |  |  |  398|  3.60k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.61k, False: 1.99k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.61k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.61k|    buffer++; \
  |  |  |  |  401|  1.61k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 810, False: 804]
  |  |  |  |  ------------------
  |  |  |  |  402|    810|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    810|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    810|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    810|      buffer -= 2; \
  |  |  |  |  406|    810|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    810|    } \
  |  |  |  |  408|  1.61k|  } \
  |  |  |  |  409|  3.60k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.60k|#define GET_BYTE { \
  |  |  |  |  392|  3.60k|  register int c0, c1; \
  |  |  |  |  393|  3.60k|  c0 = *buffer++; \
  |  |  |  |  394|  3.60k|  c1 = *buffer; \
  |  |  |  |  395|  3.60k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.60k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.60k|  bits_left += 8; \
  |  |  |  |  398|  3.60k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.07k, False: 2.53k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.07k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.07k|    buffer++; \
  |  |  |  |  401|  1.07k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 814, False: 259]
  |  |  |  |  ------------------
  |  |  |  |  402|    814|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    814|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    814|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    814|      buffer -= 2; \
  |  |  |  |  406|    814|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    814|    } \
  |  |  |  |  408|  1.07k|  } \
  |  |  |  |  409|  3.60k|}
  |  |  ------------------
  |  |  417|  3.60k|  }
  ------------------
  686|  11.5k|      r = GET_BITS(s);
  ------------------
  |  |  169|  11.5k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|  11.5k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  11.5k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  11.5k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|  11.5k|    }
  689|       |
  690|   266k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 266k, False: 0]
  ------------------
  691|   266k|      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|   266k|      s += state.last_dc_val[ci];
  696|   266k|      state.last_dc_val[ci] = s;
  697|   266k|      if (block)
  ------------------
  |  Branch (697:11): [True: 266k, False: 0]
  ------------------
  698|   266k|        (*block)[0] = (JCOEF)s;
  699|   266k|    }
  700|       |
  701|   266k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 266k, False: 0]
  |  Branch (701:37): [True: 266k, False: 0]
  ------------------
  702|       |
  703|   665k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   665k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 659k, False: 5.12k]
  ------------------
  704|   659k|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|   659k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   659k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 63.8k, False: 596k]
  |  |  |  |  ------------------
  |  |  |  |  416|  63.8k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  63.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  63.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  63.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  63.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  63.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  63.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  63.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  63.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 9.46k, False: 54.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  9.46k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  9.46k|    buffer++; \
  |  |  |  |  |  |  401|  9.46k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 8.22k, False: 1.24k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  8.22k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  8.22k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  8.22k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  8.22k|      buffer -= 2; \
  |  |  |  |  |  |  406|  8.22k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  8.22k|    } \
  |  |  |  |  |  |  408|  9.46k|  } \
  |  |  |  |  |  |  409|  63.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  63.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  63.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  63.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  63.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  63.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  63.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  63.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  63.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 9.46k, False: 54.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  9.46k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  9.46k|    buffer++; \
  |  |  |  |  |  |  401|  9.46k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 8.82k, False: 641]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  8.82k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  8.82k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  8.82k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  8.82k|      buffer -= 2; \
  |  |  |  |  |  |  406|  8.82k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  8.82k|    } \
  |  |  |  |  |  |  408|  9.46k|  } \
  |  |  |  |  |  |  409|  63.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  63.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  63.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  63.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  63.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  63.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  63.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  63.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  63.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 10.1k, False: 53.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  10.1k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  10.1k|    buffer++; \
  |  |  |  |  |  |  401|  10.1k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 9.50k, False: 625]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  9.50k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  9.50k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  9.50k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  9.50k|      buffer -= 2; \
  |  |  |  |  |  |  406|  9.50k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  9.50k|    } \
  |  |  |  |  |  |  408|  10.1k|  } \
  |  |  |  |  |  |  409|  63.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  63.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  63.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  63.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  63.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  63.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  63.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  63.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  63.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 11.2k, False: 52.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  11.2k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  11.2k|    buffer++; \
  |  |  |  |  |  |  401|  11.2k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 9.58k, False: 1.65k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  9.58k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  9.58k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  9.58k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  9.58k|      buffer -= 2; \
  |  |  |  |  |  |  406|  9.58k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  9.58k|    } \
  |  |  |  |  |  |  408|  11.2k|  } \
  |  |  |  |  |  |  409|  63.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  63.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  63.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  63.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  63.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  63.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  63.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  63.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  63.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 10.0k, False: 53.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  10.0k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  10.0k|    buffer++; \
  |  |  |  |  |  |  401|  10.0k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 9.78k, False: 310]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  9.78k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  9.78k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  9.78k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  9.78k|      buffer -= 2; \
  |  |  |  |  |  |  406|  9.78k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  9.78k|    } \
  |  |  |  |  |  |  408|  10.0k|  } \
  |  |  |  |  |  |  409|  63.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  63.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  63.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  63.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  63.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  63.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  63.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  63.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  63.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 10.6k, False: 53.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  10.6k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  10.6k|    buffer++; \
  |  |  |  |  |  |  401|  10.6k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 9.88k, False: 748]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  9.88k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  9.88k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  9.88k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  9.88k|      buffer -= 2; \
  |  |  |  |  |  |  406|  9.88k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  9.88k|    } \
  |  |  |  |  |  |  408|  10.6k|  } \
  |  |  |  |  |  |  409|  63.8k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  63.8k|  }
  |  |  ------------------
  |  |  225|   659k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   659k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   659k|  s = htbl->lookup[s]; \
  |  |  227|   659k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   659k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   659k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   659k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   659k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   659k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   659k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   659k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.31M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 176k, False: 483k]
  |  |  ------------------
  |  |  232|   176k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|   176k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|   176k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  1.49M|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 1.31M, False: 176k]
  |  |  ------------------
  |  |  236|  1.31M|      s <<= 1; \
  |  |  237|  1.31M|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  1.31M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  1.31M|      nb++; \
  |  |  239|  1.31M|    } \
  |  |  240|   176k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 155k, False: 21.5k]
  |  |  ------------------
  |  |  241|   176k|      s = 0; \
  |  |  242|   176k|    else \
  |  |  243|   176k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|   176k|  }
  ------------------
  705|   659k|        r = s >> 4;
  706|   659k|        s &= 15;
  707|       |
  708|   659k|        if (s) {
  ------------------
  |  Branch (708:13): [True: 397k, False: 262k]
  ------------------
  709|   397k|          k += r;
  710|   397k|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   397k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 26.1k, False: 371k]
  |  |  ------------------
  |  |  416|  26.1k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  26.1k|#define GET_BYTE { \
  |  |  |  |  392|  26.1k|  register int c0, c1; \
  |  |  |  |  393|  26.1k|  c0 = *buffer++; \
  |  |  |  |  394|  26.1k|  c1 = *buffer; \
  |  |  |  |  395|  26.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  26.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  26.1k|  bits_left += 8; \
  |  |  |  |  398|  26.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.49k, False: 20.6k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.49k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.49k|    buffer++; \
  |  |  |  |  401|  5.49k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.88k, False: 1.61k]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.88k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.88k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.88k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.88k|      buffer -= 2; \
  |  |  |  |  406|  3.88k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.88k|    } \
  |  |  |  |  408|  5.49k|  } \
  |  |  |  |  409|  26.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  26.1k|#define GET_BYTE { \
  |  |  |  |  392|  26.1k|  register int c0, c1; \
  |  |  |  |  393|  26.1k|  c0 = *buffer++; \
  |  |  |  |  394|  26.1k|  c1 = *buffer; \
  |  |  |  |  395|  26.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  26.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  26.1k|  bits_left += 8; \
  |  |  |  |  398|  26.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.30k, False: 21.8k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.30k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.30k|    buffer++; \
  |  |  |  |  401|  4.30k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.92k, False: 375]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.92k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.92k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.92k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.92k|      buffer -= 2; \
  |  |  |  |  406|  3.92k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.92k|    } \
  |  |  |  |  408|  4.30k|  } \
  |  |  |  |  409|  26.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  26.1k|#define GET_BYTE { \
  |  |  |  |  392|  26.1k|  register int c0, c1; \
  |  |  |  |  393|  26.1k|  c0 = *buffer++; \
  |  |  |  |  394|  26.1k|  c1 = *buffer; \
  |  |  |  |  395|  26.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  26.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  26.1k|  bits_left += 8; \
  |  |  |  |  398|  26.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.15k, False: 21.0k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.15k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.15k|    buffer++; \
  |  |  |  |  401|  5.15k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 4.04k, False: 1.10k]
  |  |  |  |  ------------------
  |  |  |  |  402|  4.04k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  4.04k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  4.04k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  4.04k|      buffer -= 2; \
  |  |  |  |  406|  4.04k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  4.04k|    } \
  |  |  |  |  408|  5.15k|  } \
  |  |  |  |  409|  26.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  26.1k|#define GET_BYTE { \
  |  |  |  |  392|  26.1k|  register int c0, c1; \
  |  |  |  |  393|  26.1k|  c0 = *buffer++; \
  |  |  |  |  394|  26.1k|  c1 = *buffer; \
  |  |  |  |  395|  26.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  26.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  26.1k|  bits_left += 8; \
  |  |  |  |  398|  26.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.77k, False: 21.3k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.77k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.77k|    buffer++; \
  |  |  |  |  401|  4.77k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 4.47k, False: 295]
  |  |  |  |  ------------------
  |  |  |  |  402|  4.47k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  4.47k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  4.47k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  4.47k|      buffer -= 2; \
  |  |  |  |  406|  4.47k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  4.47k|    } \
  |  |  |  |  408|  4.77k|  } \
  |  |  |  |  409|  26.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  26.1k|#define GET_BYTE { \
  |  |  |  |  392|  26.1k|  register int c0, c1; \
  |  |  |  |  393|  26.1k|  c0 = *buffer++; \
  |  |  |  |  394|  26.1k|  c1 = *buffer; \
  |  |  |  |  395|  26.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  26.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  26.1k|  bits_left += 8; \
  |  |  |  |  398|  26.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 5.36k, False: 20.8k]
  |  |  |  |  ------------------
  |  |  |  |  399|  5.36k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  5.36k|    buffer++; \
  |  |  |  |  401|  5.36k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 4.60k, False: 760]
  |  |  |  |  ------------------
  |  |  |  |  402|  4.60k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  4.60k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  4.60k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  4.60k|      buffer -= 2; \
  |  |  |  |  406|  4.60k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  4.60k|    } \
  |  |  |  |  408|  5.36k|  } \
  |  |  |  |  409|  26.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  26.1k|#define GET_BYTE { \
  |  |  |  |  392|  26.1k|  register int c0, c1; \
  |  |  |  |  393|  26.1k|  c0 = *buffer++; \
  |  |  |  |  394|  26.1k|  c1 = *buffer; \
  |  |  |  |  395|  26.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  26.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  26.1k|  bits_left += 8; \
  |  |  |  |  398|  26.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.96k, False: 21.1k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.96k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.96k|    buffer++; \
  |  |  |  |  401|  4.96k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 4.63k, False: 332]
  |  |  |  |  ------------------
  |  |  |  |  402|  4.63k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  4.63k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  4.63k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  4.63k|      buffer -= 2; \
  |  |  |  |  406|  4.63k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  4.63k|    } \
  |  |  |  |  408|  4.96k|  } \
  |  |  |  |  409|  26.1k|}
  |  |  ------------------
  |  |  417|  26.1k|  }
  ------------------
  711|   397k|          r = GET_BITS(s);
  ------------------
  |  |  169|   397k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|   397k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   397k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   397k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|   397k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|   397k|        } else {
  715|   262k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 261k, False: 502]
  ------------------
  716|    502|          k += 15;
  717|    502|        }
  718|   659k|      }
  719|       |
  720|   266k|    } 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|   266k|  }
  738|       |
  739|   262k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 6.04k, False: 256k]
  ------------------
  740|  6.04k|    cinfo->unread_marker = 0;
  741|  6.04k|    return FALSE;
  ------------------
  |  |  207|  6.04k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  6.04k|  }
  743|       |
  744|   256k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   256k|  br_state.next_input_byte = buffer;
  746|   256k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   256k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   256k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   256k|  permstate.get_buffer = get_buffer; \
  |  |  140|   256k|  permstate.bits_left = bits_left
  ------------------
  747|   256k|  entropy->saved = state;
  748|   256k|  return TRUE;
  ------------------
  |  |  210|   256k|#define TRUE    1
  ------------------
  749|   262k|}
jdhuff.c:decode_mcu_slow:
  553|   622k|{
  554|   622k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|   622k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   622k|  register bit_buf_type get_buffer; \
  |  |  126|   622k|  register int bits_left; \
  |  |  127|   622k|  bitread_working_state br_state
  ------------------
  556|   622k|  int blkn;
  557|   622k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|   622k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   622k|  br_state.cinfo = cinfop; \
  |  |  131|   622k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   622k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   622k|  get_buffer = permstate.get_buffer; \
  |  |  134|   622k|  bits_left = permstate.bits_left;
  ------------------
  562|   622k|  state = entropy->saved;
  563|       |
  564|  1.25M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 631k, False: 620k]
  ------------------
  565|   631k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 631k, False: 0]
  ------------------
  566|   631k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|   631k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|   631k|    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|   631k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|   631k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   631k|  register int nb, look; \
  |  |  202|   631k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   631k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 118k, False: 512k]
  |  |  ------------------
  |  |  203|   118k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 118k]
  |  |  ------------------
  |  |  204|   118k|      { failaction; } \
  |  |  205|   118k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   118k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   118k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 22.1k, False: 96.3k]
  |  |  ------------------
  |  |  207|  22.1k|      nb = 1;  goto slowlabel; \
  |  |  208|  22.1k|    } \
  |  |  209|   118k|  } \
  |  |  210|   631k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   609k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   609k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   609k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   609k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 493k, False: 115k]
  |  |  ------------------
  |  |  212|   493k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   493k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   493k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   493k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   493k|  } else { \
  |  |  215|   136k|slowlabel: \
  |  |  216|   136k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 136k]
  |  |  ------------------
  |  |  217|   136k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   136k|      { failaction; } \
  |  |  219|   136k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   136k|  } \
  |  |  221|   609k|}
  ------------------
  574|   629k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 81.1k, False: 548k]
  ------------------
  575|  81.1k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  81.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  81.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 4.49k, False: 76.6k]
  |  |  ------------------
  |  |  162|  4.49k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 4.49k]
  |  |  ------------------
  |  |  163|  4.49k|      { action; } \
  |  |  164|  4.49k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  4.49k|  } \
  |  |  166|  81.1k|}
  ------------------
  576|  81.1k|      r = GET_BITS(s);
  ------------------
  |  |  169|  81.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  81.1k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  81.1k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  81.1k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  81.1k|    }
  579|       |
  580|   629k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 629k, False: 131]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|   629k|      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|   629k|      s += state.last_dc_val[ci];
  592|   629k|      state.last_dc_val[ci] = s;
  593|   629k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 629k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|   629k|        (*block)[0] = (JCOEF)s;
  596|   629k|      }
  597|   629k|    }
  598|       |
  599|   629k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 629k, False: 131]
  |  Branch (599:37): [True: 629k, 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.63M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  2.63M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 2.60M, False: 30.1k]
  ------------------
  604|  2.60M|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  2.60M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  2.60M|  register int nb, look; \
  |  |  202|  2.60M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.60M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 260k, False: 2.34M]
  |  |  ------------------
  |  |  203|   260k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 260k]
  |  |  ------------------
  |  |  204|   260k|      { failaction; } \
  |  |  205|   260k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   260k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   260k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 162k, False: 97.6k]
  |  |  ------------------
  |  |  207|   162k|      nb = 1;  goto slowlabel; \
  |  |  208|   162k|    } \
  |  |  209|   260k|  } \
  |  |  210|  2.60M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  2.44M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  2.44M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.44M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.44M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 2.16M, False: 276k]
  |  |  ------------------
  |  |  212|  2.16M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  2.16M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  2.16M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  2.16M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  2.16M|  } else { \
  |  |  215|   438k|slowlabel: \
  |  |  216|   438k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 438k]
  |  |  ------------------
  |  |  217|   438k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   438k|      { failaction; } \
  |  |  219|   438k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   438k|  } \
  |  |  221|  2.44M|}
  ------------------
  605|       |
  606|  2.60M|        r = s >> 4;
  607|  2.60M|        s &= 15;
  608|       |
  609|  2.60M|        if (s) {
  ------------------
  |  Branch (609:13): [True: 2.00M, False: 601k]
  ------------------
  610|  2.00M|          k += r;
  611|  2.00M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  2.00M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  2.00M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 77.2k, False: 1.92M]
  |  |  ------------------
  |  |  162|  77.2k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 77.2k]
  |  |  ------------------
  |  |  163|  77.2k|      { action; } \
  |  |  164|  77.2k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  77.2k|  } \
  |  |  166|  2.00M|}
  ------------------
  612|  2.00M|          r = GET_BITS(s);
  ------------------
  |  |  169|  2.00M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  2.00M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  2.00M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  2.00M|#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|  2.00M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  2.00M|        } else {
  620|   601k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 598k, False: 2.51k]
  ------------------
  621|   598k|            break;
  622|  2.51k|          k += 15;
  623|  2.51k|        }
  624|  2.60M|      }
  625|       |
  626|   629k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|    131|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|    131|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 131]
  ------------------
  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|    131|    }
  647|   629k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|   620k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   620k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   620k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   620k|  permstate.get_buffer = get_buffer; \
  |  |  140|   620k|  permstate.bits_left = bits_left
  ------------------
  651|   620k|  entropy->saved = state;
  652|   620k|  return TRUE;
  ------------------
  |  |  210|   620k|#define TRUE    1
  ------------------
  653|   622k|}

jinit_input_controller:
  405|  43.1k|{
  406|  43.1k|  my_inputctl_ptr inputctl;
  407|       |
  408|       |  /* Create subobject in permanent pool */
  409|  43.1k|  inputctl = (my_inputctl_ptr)
  410|  43.1k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  43.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  411|  43.1k|                                sizeof(my_input_controller));
  412|  43.1k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  413|       |  /* Initialize method pointers */
  414|  43.1k|  inputctl->pub.consume_input = consume_markers;
  415|  43.1k|  inputctl->pub.reset_input_controller = reset_input_controller;
  416|  43.1k|  inputctl->pub.start_input_pass = start_input_pass;
  417|  43.1k|  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|  43.1k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|  43.1k|#define FALSE   0               /* values of boolean */
  ------------------
  422|  43.1k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|  43.1k|#define FALSE   0               /* values of boolean */
  ------------------
  423|  43.1k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|  43.1k|#define TRUE    1
  ------------------
  424|  43.1k|}
jdinput.c:consume_markers:
  332|   222k|{
  333|   222k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  334|   222k|  int val;
  335|       |
  336|   222k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (336:7): [True: 0, False: 222k]
  ------------------
  337|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  338|       |
  339|   222k|  val = (*cinfo->marker->read_markers) (cinfo);
  340|       |
  341|   222k|  switch (val) {
  ------------------
  |  Branch (341:11): [True: 130k, False: 91.8k]
  ------------------
  342|  99.0k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1111|  99.0k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (342:3): [True: 99.0k, False: 123k]
  ------------------
  343|  99.0k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (343:9): [True: 88.2k, False: 10.7k]
  ------------------
  344|  88.2k|      initial_setup(cinfo);
  345|  88.2k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  207|  88.2k|#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|  88.2k|    } else {                    /* 2nd or later SOS marker */
  351|  10.7k|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (351:11): [True: 172, False: 10.5k]
  ------------------
  352|    172|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|    172|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    172|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  353|  10.7k|      start_input_pass(cinfo);
  354|  10.7k|    }
  355|  99.0k|    break;
  356|  31.2k|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1112|  31.2k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (356:3): [True: 31.2k, False: 190k]
  ------------------
  357|  31.2k|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  210|  31.2k|#define TRUE    1
  ------------------
  358|  31.2k|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (358:9): [True: 6.43k, False: 24.7k]
  ------------------
  359|  6.43k|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (359:11): [True: 1.18k, False: 5.25k]
  ------------------
  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.7k|    } 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.7k|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (365:11): [True: 149, False: 24.6k]
  ------------------
  366|    149|        cinfo->output_scan_number = cinfo->input_scan_number;
  367|  24.7k|    }
  368|  31.2k|    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: 222k]
  ------------------
  370|      0|    break;
  371|   222k|  }
  372|       |
  373|   124k|  return val;
  374|   222k|}
jdinput.c:initial_setup:
   49|  88.2k|{
   50|  88.2k|  int ci;
   51|  88.2k|  jpeg_component_info *compptr;
   52|  88.2k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  81.5k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 6.71k, False: 81.5k]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|  88.2k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|   176k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 256, False: 88.0k]
  ------------------
   56|  88.0k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  88.0k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 205, False: 87.8k]
  ------------------
   57|    461|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|    461|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    461|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    461|   (*(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|  88.2k|#ifdef D_LOSSLESS_SUPPORTED
   63|  88.2k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (63:7): [True: 6.51k, False: 81.7k]
  ------------------
   64|  6.51k|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (64:9): [True: 235, False: 6.28k]
  |  Branch (64:38): [True: 254, False: 6.02k]
  ------------------
   65|    489|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|    489|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    489|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    489|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   66|  6.51k|  } else
   67|  81.7k|#endif
   68|  81.7k|  {
   69|  81.7k|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (69:9): [True: 1.06k, False: 80.6k]
  |  Branch (69:39): [True: 222, False: 840]
  ------------------
   70|    222|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|    222|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    222|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    222|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   71|  81.7k|  }
   72|       |
   73|       |  /* Check that number of components won't exceed internal array sizes */
   74|  88.2k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|  88.2k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (74:7): [True: 205, False: 88.0k]
  ------------------
   75|    205|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|    205|  ((cinfo)->err->msg_code = (code), \
  |  |  248|    205|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|    205|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|    205|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   76|  88.2k|             MAX_COMPONENTS);
   77|       |
   78|       |  /* Compute maximum sampling factors; check factor validity */
   79|  88.2k|  cinfo->max_h_samp_factor = 1;
   80|  88.2k|  cinfo->max_v_samp_factor = 1;
   81|   213k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (81:44): [True: 124k, False: 88.2k]
  ------------------
   82|   124k|       ci++, compptr++) {
   83|   124k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (83:9): [True: 223, False: 124k]
  ------------------
   84|   124k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|   249k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (84:9): [True: 207, False: 124k]
  ------------------
   85|   124k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (85:9): [True: 210, False: 124k]
  ------------------
   86|   124k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|   124k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (86:9): [True: 198, False: 123k]
  ------------------
   87|    838|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|    838|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    838|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   88|   124k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|   124k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 32.0k, False: 92.7k]
  |  |  ------------------
  ------------------
   89|   124k|                                   compptr->h_samp_factor);
   90|   124k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|   124k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 24.2k, False: 100k]
  |  |  ------------------
  ------------------
   91|   124k|                                   compptr->v_samp_factor);
   92|   124k|  }
   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|  88.2k|  cinfo->min_DCT_scaled_size = data_unit;
  108|  88.2k|#endif
  109|       |
  110|       |  /* Compute dimensions of components */
  111|   212k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (111:44): [True: 123k, False: 88.2k]
  ------------------
  112|   123k|       ci++, compptr++) {
  113|       |#if JPEG_LIB_VERSION >= 70
  114|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  115|       |#else
  116|   123k|    compptr->DCT_scaled_size = data_unit;
  117|   123k|#endif
  118|       |    /* Size in data units */
  119|   123k|    compptr->width_in_blocks = (JDIMENSION)
  120|   123k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  121|   123k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  122|   123k|    compptr->height_in_blocks = (JDIMENSION)
  123|   123k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  124|   123k|                    (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|   123k|    cinfo->master->first_MCU_col[ci] = 0;
  129|   123k|    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|   123k|    compptr->downsampled_width = (JDIMENSION)
  136|   123k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  137|   123k|                    (long)cinfo->max_h_samp_factor);
  138|   123k|    compptr->downsampled_height = (JDIMENSION)
  139|   123k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  140|   123k|                    (long)cinfo->max_v_samp_factor);
  141|       |    /* Mark component needed, until color conversion says otherwise */
  142|   123k|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|   123k|#define TRUE    1
  ------------------
  143|       |    /* Mark no quantization table yet saved for component */
  144|   123k|    compptr->quant_table = NULL;
  145|   123k|  }
  146|       |
  147|       |  /* Compute number of fully interleaved MCU rows. */
  148|  88.2k|  cinfo->total_iMCU_rows = (JDIMENSION)
  149|  88.2k|    jdiv_round_up((long)cinfo->image_height,
  150|  88.2k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  151|       |
  152|       |  /* Decide whether file contains multiple scans */
  153|  88.2k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (153:7): [True: 13.8k, False: 74.3k]
  |  Branch (153:55): [True: 14.5k, False: 59.7k]
  ------------------
  154|  26.2k|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  210|  26.2k|#define TRUE    1
  ------------------
  155|  61.9k|  else
  156|  61.9k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  207|  61.9k|#define FALSE   0               /* values of boolean */
  ------------------
  157|  88.2k|}
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|  92.4k|{
  298|  92.4k|  per_scan_setup(cinfo);
  299|  92.4k|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (299:7): [True: 88.9k, False: 3.42k]
  ------------------
  300|  88.9k|    latch_quant_tables(cinfo);
  301|  92.4k|  (*cinfo->entropy->start_pass) (cinfo);
  302|  92.4k|  (*cinfo->coef->start_input_pass) (cinfo);
  303|  92.4k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  304|  92.4k|}
jdinput.c:per_scan_setup:
  164|  92.4k|{
  165|  92.4k|  int ci, mcublks, tmp;
  166|  92.4k|  jpeg_component_info *compptr;
  167|  92.4k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  88.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (167:19): [True: 3.42k, False: 88.9k]
  ------------------
  168|       |
  169|  92.4k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (169:7): [True: 83.4k, False: 8.90k]
  ------------------
  170|       |
  171|       |    /* Noninterleaved (single-component) scan */
  172|  83.4k|    compptr = cinfo->cur_comp_info[0];
  173|       |
  174|       |    /* Overall image size in MCUs */
  175|  83.4k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  176|  83.4k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  177|       |
  178|       |    /* For noninterleaved scan, always one data unit per MCU */
  179|  83.4k|    compptr->MCU_width = 1;
  180|  83.4k|    compptr->MCU_height = 1;
  181|  83.4k|    compptr->MCU_blocks = 1;
  182|  83.4k|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  83.4k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  183|  83.4k|    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|  83.4k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  188|  83.4k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (188:9): [True: 80.0k, False: 3.45k]
  ------------------
  189|  83.4k|    compptr->last_row_height = tmp;
  190|       |
  191|       |    /* Prepare array describing MCU composition */
  192|  83.4k|    cinfo->blocks_in_MCU = 1;
  193|  83.4k|    cinfo->MCU_membership[0] = 0;
  194|       |
  195|  83.4k|  } else {
  196|       |
  197|       |    /* Interleaved (multi-component) scan */
  198|  8.90k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  8.90k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (198:9): [True: 0, False: 8.90k]
  |  Branch (198:38): [True: 0, False: 8.90k]
  ------------------
  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.90k|               MAX_COMPS_IN_SCAN);
  201|       |
  202|       |    /* Overall image size in MCUs */
  203|  8.90k|    cinfo->MCUs_per_row = (JDIMENSION)
  204|  8.90k|      jdiv_round_up((long)cinfo->image_width,
  205|  8.90k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  206|  8.90k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  207|  8.90k|      jdiv_round_up((long)cinfo->image_height,
  208|  8.90k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  209|       |
  210|  8.90k|    cinfo->blocks_in_MCU = 0;
  211|       |
  212|  35.6k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (212:18): [True: 26.7k, False: 8.90k]
  ------------------
  213|  26.7k|      compptr = cinfo->cur_comp_info[ci];
  214|       |      /* Sampling factors give # of data units of component in each MCU */
  215|  26.7k|      compptr->MCU_width = compptr->h_samp_factor;
  216|  26.7k|      compptr->MCU_height = compptr->v_samp_factor;
  217|  26.7k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  218|  26.7k|      compptr->MCU_sample_width = compptr->MCU_width *
  219|  26.7k|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  26.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  220|       |      /* Figure number of non-dummy data units in last MCU column & row */
  221|  26.7k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  222|  26.7k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (222:11): [True: 24.8k, False: 1.85k]
  ------------------
  223|  26.7k|      compptr->last_col_width = tmp;
  224|  26.7k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  225|  26.7k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (225:11): [True: 25.8k, False: 875]
  ------------------
  226|  26.7k|      compptr->last_row_height = tmp;
  227|       |      /* Prepare array describing MCU composition */
  228|  26.7k|      mcublks = compptr->MCU_blocks;
  229|  26.7k|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   82|  26.7k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (229:11): [True: 6, False: 26.7k]
  ------------------
  230|      6|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  231|  63.3k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (231:14): [True: 36.5k, False: 26.7k]
  ------------------
  232|  36.5k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  233|  36.5k|      }
  234|  26.7k|    }
  235|       |
  236|  8.90k|  }
  237|  92.4k|}
jdinput.c:latch_quant_tables:
  263|  88.9k|{
  264|  88.9k|  int ci, qtblno;
  265|  88.9k|  jpeg_component_info *compptr;
  266|  88.9k|  JQUANT_TBL *qtbl;
  267|       |
  268|   195k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (268:16): [True: 106k, False: 88.9k]
  ------------------
  269|   106k|    compptr = cinfo->cur_comp_info[ci];
  270|       |    /* No work if we already saved Q-table for this component */
  271|   106k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (271:9): [True: 14.2k, False: 92.1k]
  ------------------
  272|  14.2k|      continue;
  273|       |    /* Make sure specified quantization table is present */
  274|  92.1k|    qtblno = compptr->quant_tbl_no;
  275|  92.1k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|   184k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (275:9): [True: 0, False: 92.1k]
  |  Branch (275:23): [True: 215, False: 91.9k]
  ------------------
  276|  91.9k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (276:9): [True: 211, False: 91.7k]
  ------------------
  277|    426|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|    426|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    426|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    426|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |    /* OK, save away the quantization table */
  279|  92.1k|    qtbl = (JQUANT_TBL *)
  280|  92.1k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  92.1k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  281|  92.1k|                                  sizeof(JQUANT_TBL));
  282|  92.1k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  283|  92.1k|    compptr->quant_table = qtbl;
  284|  92.1k|  }
  285|  88.9k|}
jdinput.c:finish_input_pass:
  315|  82.1k|{
  316|  82.1k|  cinfo->inputctl->consume_input = consume_markers;
  317|  82.1k|}

jinit_lhuff_decoder:
  284|  3.18k|{
  285|  3.18k|  lhuff_entropy_ptr entropy;
  286|  3.18k|  int i;
  287|       |
  288|  3.18k|  entropy = (lhuff_entropy_ptr)
  289|  3.18k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.18k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  290|  3.18k|                                sizeof(lhuff_entropy_decoder));
  291|  3.18k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  292|  3.18k|  entropy->pub.start_pass = start_pass_lhuff_decoder;
  293|  3.18k|  entropy->pub.decode_mcus = decode_mcus;
  294|  3.18k|  entropy->pub.process_restart = process_restart;
  295|       |
  296|       |  /* Mark tables unallocated */
  297|  15.9k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  15.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (297:15): [True: 12.7k, False: 3.18k]
  ------------------
  298|       |    entropy->derived_tbls[i] = NULL;
  299|  12.7k|  }
  300|  3.18k|}
jdlhuff.c:start_pass_lhuff_decoder:
   84|  3.41k|{
   85|  3.41k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
   86|  3.41k|  int ci, dctbl, sampn, ptrn, yoffset, xoffset;
   87|  3.41k|  jpeg_component_info *compptr;
   88|       |
   89|  7.22k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (89:16): [True: 3.81k, False: 3.41k]
  ------------------
   90|  3.81k|    compptr = cinfo->cur_comp_info[ci];
   91|  3.81k|    dctbl = compptr->dc_tbl_no;
   92|       |    /* Make sure requested tables are present */
   93|  3.81k|    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
  ------------------
  |  |   69|  7.62k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (93:9): [True: 0, False: 3.81k]
  |  Branch (93:22): [True: 211, False: 3.59k]
  ------------------
   94|  3.59k|        cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (94:9): [True: 262, False: 3.33k]
  ------------------
   95|    473|      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  243|    473|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    473|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    473|   (*(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|  3.81k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  210|  3.81k|#define TRUE    1
  ------------------
   99|  3.81k|                            &entropy->derived_tbls[dctbl]);
  100|  3.81k|  }
  101|       |
  102|       |  /* Precalculate decoding info for each sample in an MCU of this scan */
  103|  6.75k|  for (sampn = 0, ptrn = 0; sampn < cinfo->blocks_in_MCU;) {
  ------------------
  |  Branch (103:29): [True: 3.33k, False: 3.41k]
  ------------------
  104|  3.33k|    compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]];
  105|  3.33k|    ci = compptr->component_index;
  106|  6.68k|    for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) {
  ------------------
  |  Branch (106:23): [True: 3.35k, False: 3.33k]
  ------------------
  107|       |      /* Precalculate the setup info for each output pointer */
  108|  3.35k|      entropy->output_ptr_info[ptrn].ci = ci;
  109|  3.35k|      entropy->output_ptr_info[ptrn].yoffset = yoffset;
  110|  3.35k|      entropy->output_ptr_info[ptrn].MCU_width = compptr->MCU_width;
  111|  6.72k|      for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) {
  ------------------
  |  Branch (111:25): [True: 3.36k, False: 3.35k]
  ------------------
  112|       |        /* Precalculate the output pointer index for each sample */
  113|  3.36k|        entropy->output_ptr_index[sampn] = ptrn;
  114|       |        /* Precalculate which table to use for each sample */
  115|  3.36k|        entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no];
  116|  3.36k|      }
  117|  3.35k|    }
  118|  3.33k|  }
  119|  3.41k|  entropy->num_output_ptrs = ptrn;
  120|       |
  121|       |  /* Initialize bitread state variables */
  122|  3.41k|  entropy->bitstate.bits_left = 0;
  123|  3.41k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  124|  3.41k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  3.41k|#define FALSE   0               /* values of boolean */
  ------------------
  125|  3.41k|}
jdlhuff.c:decode_mcus:
  209|   364k|{
  210|   364k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  211|   364k|  int sampn, ci, yoffset, MCU_width, ptrn;
  212|   364k|  JDIMENSION mcu_num;
  213|   364k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   364k|  register bit_buf_type get_buffer; \
  |  |  126|   364k|  register int bits_left; \
  |  |  127|   364k|  bitread_working_state br_state
  ------------------
  214|       |
  215|       |  /* Set output pointer locations based on MCU_col_num */
  216|   875k|  for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++) {
  ------------------
  |  Branch (216:18): [True: 510k, False: 364k]
  ------------------
  217|   510k|    ci = entropy->output_ptr_info[ptrn].ci;
  218|   510k|    yoffset = entropy->output_ptr_info[ptrn].yoffset;
  219|   510k|    MCU_width = entropy->output_ptr_info[ptrn].MCU_width;
  220|   510k|    entropy->output_ptr[ptrn] =
  221|   510k|      diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width);
  222|   510k|  }
  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|   364k|  if (entropy->pub.insufficient_data) {
  ------------------
  |  Branch (231:7): [True: 347k, False: 17.4k]
  ------------------
  232|   837k|    for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++)
  ------------------
  |  Branch (232:20): [True: 490k, False: 347k]
  ------------------
  233|   490k|      jzero_far((void FAR *)entropy->output_ptr[ptrn],
  234|   490k|                nMCU * entropy->output_ptr_info[ptrn].MCU_width *
  235|   490k|                sizeof(JDIFF));
  236|       |
  237|   347k|    (*cinfo->idct->start_pass) (cinfo);
  238|       |
  239|   347k|  } else {
  240|       |
  241|       |    /* Load up working state */
  242|  17.4k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  17.4k|  br_state.cinfo = cinfop; \
  |  |  131|  17.4k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  17.4k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  17.4k|  get_buffer = permstate.get_buffer; \
  |  |  134|  17.4k|  bits_left = permstate.bits_left;
  ------------------
  243|       |
  244|       |    /* Outer loop handles the number of MCUs requested */
  245|       |
  246|   168k|    for (mcu_num = 0; mcu_num < nMCU; mcu_num++) {
  ------------------
  |  Branch (246:23): [True: 151k, False: 17.4k]
  ------------------
  247|       |
  248|       |      /* Inner loop handles the samples in the MCU */
  249|   326k|      for (sampn = 0; sampn < cinfo->blocks_in_MCU; sampn++) {
  ------------------
  |  Branch (249:23): [True: 174k, False: 151k]
  ------------------
  250|   174k|        d_derived_tbl *dctbl = entropy->cur_tbls[sampn];
  251|   174k|        register int s, r;
  252|       |
  253|       |        /* Section H.2.2: decode the sample difference */
  254|   174k|        HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1);
  ------------------
  |  |  200|   174k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   174k|  register int nb, look; \
  |  |  202|   174k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   174k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 13.2k, False: 161k]
  |  |  ------------------
  |  |  203|  13.2k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 13.2k]
  |  |  ------------------
  |  |  204|  13.2k|      { failaction; } \
  |  |  205|  13.2k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  13.2k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  13.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 5.05k, False: 8.23k]
  |  |  ------------------
  |  |  207|  5.05k|      nb = 1;  goto slowlabel; \
  |  |  208|  5.05k|    } \
  |  |  209|  13.2k|  } \
  |  |  210|   174k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   169k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   169k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   169k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   169k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 161k, False: 8.81k]
  |  |  ------------------
  |  |  212|   161k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   161k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   161k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   161k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   161k|  } else { \
  |  |  215|  13.8k|slowlabel: \
  |  |  216|  13.8k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 13.8k]
  |  |  ------------------
  |  |  217|  13.8k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  13.8k|      { failaction; } \
  |  |  219|  13.8k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  13.8k|  } \
  |  |  221|   169k|}
  ------------------
  255|   174k|        if (s) {
  ------------------
  |  Branch (255:13): [True: 47.0k, False: 127k]
  ------------------
  256|  47.0k|          if (s == 16)  /* special case: always output 32768 */
  ------------------
  |  Branch (256:15): [True: 3.46k, False: 43.5k]
  ------------------
  257|  3.46k|            s = 32768;
  258|  43.5k|          else {        /* normal case: fetch subsequent bits */
  259|  43.5k|            CHECK_BIT_BUFFER(br_state, s, return mcu_num);
  ------------------
  |  |  160|  43.5k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  43.5k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 3.10k, False: 40.4k]
  |  |  ------------------
  |  |  162|  3.10k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 3.10k]
  |  |  ------------------
  |  |  163|  3.10k|      { action; } \
  |  |  164|  3.10k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  3.10k|  } \
  |  |  166|  43.5k|}
  ------------------
  260|  43.5k|            r = GET_BITS(s);
  ------------------
  |  |  169|  43.5k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  261|  43.5k|            s = HUFF_EXTEND(r, s);
  ------------------
  |  |  138|  43.5k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  136|  43.5k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  262|  43.5k|          }
  263|  47.0k|        }
  264|       |
  265|       |        /* Output the sample difference */
  266|   174k|        *entropy->output_ptr[entropy->output_ptr_index[sampn]]++ = (JDIFF)s;
  267|   174k|      }
  268|       |
  269|       |      /* Completed MCU, so update state */
  270|   151k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   151k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   151k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   151k|  permstate.get_buffer = get_buffer; \
  |  |  140|   151k|  permstate.bits_left = bits_left
  ------------------
  271|   151k|    }
  272|  17.4k|  }
  273|       |
  274|   364k| return nMCU;
  275|   364k|}
jdlhuff.c:process_restart:
  167|  1.87k|{
  168|  1.87k|  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|  1.87k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  173|  1.87k|  entropy->bitstate.bits_left = 0;
  174|       |
  175|       |  /* Advance past the RSTn marker */
  176|  1.87k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (176:7): [True: 0, False: 1.87k]
  ------------------
  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|  1.87k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (184:7): [True: 136, False: 1.73k]
  ------------------
  185|    136|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    136|#define FALSE   0               /* values of boolean */
  ------------------
  186|       |
  187|  1.87k|  return TRUE;
  ------------------
  |  |  210|  1.87k|#define TRUE    1
  ------------------
  188|  1.87k|}

jinit_lossless_decompressor:
  281|  3.08k|{
  282|  3.08k|  lossless_decomp_ptr losslessd;
  283|       |
  284|  3.08k|#if BITS_IN_JSAMPLE == 8
  285|  3.08k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.16k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 3.08k]
  |  Branch (285:50): [True: 0, False: 3.08k]
  ------------------
  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.08k|  losslessd = (lossless_decomp_ptr)
  294|  3.08k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  3.08k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|  3.08k|                                sizeof(jpeg_lossless_decompressor));
  296|  3.08k|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|  3.08k|  losslessd->pub.start_pass = start_pass_lossless;
  298|  3.08k|}
jdlossls-8.c:start_pass_lossless:
  243|   286k|{
  244|   286k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|   286k|  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|   286k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 231, False: 286k]
  |  Branch (257:24): [True: 393, False: 286k]
  ------------------
  258|   286k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 188, False: 285k]
  |  Branch (258:25): [True: 271, False: 285k]
  ------------------
  259|   285k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 285k]
  |  Branch (259:24): [True: 214, False: 285k]
  ------------------
  260|  1.29k|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.29k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.29k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.29k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.29k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.29k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.29k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|   286k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  1.01M|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 733k, False: 286k]
  ------------------
  265|   733k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|   286k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 102k, False: 184k]
  ------------------
  269|   102k|    losslessd->scaler_scale = simple_upscale;
  270|   184k|  else
  271|   184k|    losslessd->scaler_scale = noscale;
  272|   286k|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|   426k|{
  178|   426k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|   426k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|   426k|  int Ra; \
  |  |   60|   426k|  \
  |  |   61|   426k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|   426k|  *undiff_buf++ = Ra; \
  |  |   63|   426k|  \
  |  |   64|  11.8M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 11.4M, False: 426k]
  |  |  ------------------
  |  |   65|  11.4M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  11.4M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  11.4M|    *undiff_buf++ = Ra; \
  |  |   67|  11.4M|  }
  ------------------
  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|   426k|  switch (cinfo->Ss) {
  188|  4.83k|  case 1:
  ------------------
  |  Branch (188:3): [True: 4.83k, False: 421k]
  ------------------
  189|  4.83k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|  4.83k|    break;
  191|  13.8k|  case 2:
  ------------------
  |  Branch (191:3): [True: 13.8k, False: 412k]
  ------------------
  192|  13.8k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|  13.8k|    break;
  194|   348k|  case 3:
  ------------------
  |  Branch (194:3): [True: 348k, False: 77.4k]
  ------------------
  195|   348k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|   348k|    break;
  197|  10.8k|  case 4:
  ------------------
  |  Branch (197:3): [True: 10.8k, False: 415k]
  ------------------
  198|  10.8k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|  10.8k|    break;
  200|  4.42k|  case 5:
  ------------------
  |  Branch (200:3): [True: 4.42k, False: 421k]
  ------------------
  201|  4.42k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|  4.42k|    break;
  203|  2.48k|  case 6:
  ------------------
  |  Branch (203:3): [True: 2.48k, False: 423k]
  ------------------
  204|  2.48k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|  2.48k|    break;
  206|  41.0k|  case 7:
  ------------------
  |  Branch (206:3): [True: 41.0k, False: 385k]
  ------------------
  207|  41.0k|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  41.0k|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 426k]
  ------------------
  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|   426k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|   426k|  }
  213|   426k|}
jdlossls-8.c:jpeg_undifference1:
  111|    475|{
  112|    475|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|    475|  int Ra; \
  |  |   60|    475|  \
  |  |   61|    475|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|    475|  *undiff_buf++ = Ra; \
  |  |   63|    475|  \
  |  |   64|  2.87k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 2.40k, False: 475]
  |  |  ------------------
  |  |   65|  2.40k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  2.40k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  2.40k|    *undiff_buf++ = Ra; \
  |  |   67|  2.40k|  }
  ------------------
  113|    475|}
jdlossls-8.c:jpeg_undifference2:
  119|    791|{
  120|    791|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|    791|  int Ra, Rb, Rc; \
  |  |   87|    791|  \
  |  |   88|    791|  Rb = *prev_row++; \
  |  |   89|    791|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    791|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    791|  *undiff_buf++ = Ra; \
  |  |   91|    791|  \
  |  |   92|  7.79k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 7.00k, False: 791]
  |  |  ------------------
  |  |   93|  7.00k|    Rc = Rb; \
  |  |   94|  7.00k|    Rb = *prev_row++; \
  |  |   95|  7.00k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  7.00k|    *undiff_buf++ = Ra; \
  |  |   97|  7.00k|  }
  ------------------
  121|    791|  (void)(Rc);
  122|    791|}
jdlossls-8.c:jpeg_undifference3:
  128|  5.33k|{
  129|  5.33k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  5.33k|  int Ra, Rb, Rc; \
  |  |   87|  5.33k|  \
  |  |   88|  5.33k|  Rb = *prev_row++; \
  |  |   89|  5.33k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  5.33k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  5.33k|  *undiff_buf++ = Ra; \
  |  |   91|  5.33k|  \
  |  |   92|  13.3k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 8.05k, False: 5.33k]
  |  |  ------------------
  |  |   93|  8.05k|    Rc = Rb; \
  |  |   94|  8.05k|    Rb = *prev_row++; \
  |  |   95|  8.05k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  8.05k|    *undiff_buf++ = Ra; \
  |  |   97|  8.05k|  }
  ------------------
  130|  5.33k|}
jdlossls-8.c:jpeg_undifference4:
  136|  1.86k|{
  137|  1.86k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  1.86k|  int Ra, Rb, Rc; \
  |  |   87|  1.86k|  \
  |  |   88|  1.86k|  Rb = *prev_row++; \
  |  |   89|  1.86k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.86k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.86k|  *undiff_buf++ = Ra; \
  |  |   91|  1.86k|  \
  |  |   92|  15.6k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 13.7k, False: 1.86k]
  |  |  ------------------
  |  |   93|  13.7k|    Rc = Rb; \
  |  |   94|  13.7k|    Rb = *prev_row++; \
  |  |   95|  13.7k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  13.7k|    *undiff_buf++ = Ra; \
  |  |   97|  13.7k|  }
  ------------------
  138|  1.86k|}
jdlossls-8.c:jpeg_undifference5:
  144|  1.39k|{
  145|  1.39k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  1.39k|  int Ra, Rb, Rc; \
  |  |   87|  1.39k|  \
  |  |   88|  1.39k|  Rb = *prev_row++; \
  |  |   89|  1.39k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.39k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.39k|  *undiff_buf++ = Ra; \
  |  |   91|  1.39k|  \
  |  |   92|  1.39k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 0, False: 1.39k]
  |  |  ------------------
  |  |   93|      0|    Rc = Rb; \
  |  |   94|      0|    Rb = *prev_row++; \
  |  |   95|      0|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|      0|    *undiff_buf++ = Ra; \
  |  |   97|      0|  }
  ------------------
  146|  1.39k|}
jdlossls-8.c:jpeg_undifference6:
  152|    326|{
  153|    326|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|    326|  int Ra, Rb, Rc; \
  |  |   87|    326|  \
  |  |   88|    326|  Rb = *prev_row++; \
  |  |   89|    326|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    326|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    326|  *undiff_buf++ = Ra; \
  |  |   91|    326|  \
  |  |   92|  2.41k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.08k, False: 326]
  |  |  ------------------
  |  |   93|  2.08k|    Rc = Rb; \
  |  |   94|  2.08k|    Rb = *prev_row++; \
  |  |   95|  2.08k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.08k|    *undiff_buf++ = Ra; \
  |  |   97|  2.08k|  }
  ------------------
  154|    326|}
jdlossls-8.c:jpeg_undifference7:
  160|    503|{
  161|    503|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|    503|  int Ra, Rb, Rc; \
  |  |   87|    503|  \
  |  |   88|    503|  Rb = *prev_row++; \
  |  |   89|    503|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    503|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    503|  *undiff_buf++ = Ra; \
  |  |   91|    503|  \
  |  |   92|  1.60k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.09k, False: 503]
  |  |  ------------------
  |  |   93|  1.09k|    Rc = Rb; \
  |  |   94|  1.09k|    Rb = *prev_row++; \
  |  |   95|  1.09k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.09k|    *undiff_buf++ = Ra; \
  |  |   97|  1.09k|  }
  ------------------
  162|    503|  (void)(Rc);
  163|    503|}
jdlossls-8.c:simple_upscale:
  221|   248k|{
  222|  1.17M|  do {
  223|  1.17M|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  1.17M|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 925k, False: 248k]
  ------------------
  225|   248k|}
jdlossls-8.c:noscale:
  230|   188k|{
  231|  10.7M|  do {
  232|  10.7M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  10.7M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 10.5M, False: 188k]
  ------------------
  234|   188k|}
j12init_lossless_decompressor:
  281|    309|{
  282|    309|  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|    309|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    618|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 309]
  ------------------
  288|    309|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    309|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 309]
  ------------------
  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|    309|  losslessd = (lossless_decomp_ptr)
  294|    309|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    309|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    309|                                sizeof(jpeg_lossless_decompressor));
  296|    309|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    309|  losslessd->pub.start_pass = start_pass_lossless;
  298|    309|}
jdlossls-12.c:start_pass_lossless:
  243|  66.9k|{
  244|  66.9k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|  66.9k|  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|  66.9k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 66.9k]
  |  Branch (257:24): [True: 1, False: 66.9k]
  ------------------
  258|  66.9k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 66.9k]
  |  Branch (258:25): [True: 1, False: 66.9k]
  ------------------
  259|  66.9k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 66.9k]
  |  Branch (259:24): [True: 1, False: 66.9k]
  ------------------
  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|  66.9k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|   133k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 66.9k, False: 66.9k]
  ------------------
  265|  66.9k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|  66.9k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 56.0k, False: 10.8k]
  ------------------
  269|  56.0k|    losslessd->scaler_scale = simple_upscale;
  270|  10.8k|  else
  271|  10.8k|    losslessd->scaler_scale = noscale;
  272|  66.9k|}
jdlossls-12.c:jpeg_undifference_first_row:
  177|  66.3k|{
  178|  66.3k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|  66.3k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|  66.3k|  int Ra; \
  |  |   60|  66.3k|  \
  |  |   61|  66.3k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  66.3k|  *undiff_buf++ = Ra; \
  |  |   63|  66.3k|  \
  |  |   64|   641k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 575k, False: 66.3k]
  |  |  ------------------
  |  |   65|   575k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|   575k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|   575k|    *undiff_buf++ = Ra; \
  |  |   67|   575k|  }
  ------------------
  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|  66.3k|  switch (cinfo->Ss) {
  188|  12.3k|  case 1:
  ------------------
  |  Branch (188:3): [True: 12.3k, False: 53.9k]
  ------------------
  189|  12.3k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|  12.3k|    break;
  191|  3.12k|  case 2:
  ------------------
  |  Branch (191:3): [True: 3.12k, False: 63.1k]
  ------------------
  192|  3.12k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|  3.12k|    break;
  194|  15.7k|  case 3:
  ------------------
  |  Branch (194:3): [True: 15.7k, False: 50.5k]
  ------------------
  195|  15.7k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|  15.7k|    break;
  197|  10.4k|  case 4:
  ------------------
  |  Branch (197:3): [True: 10.4k, False: 55.8k]
  ------------------
  198|  10.4k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|  10.4k|    break;
  200|  2.36k|  case 5:
  ------------------
  |  Branch (200:3): [True: 2.36k, False: 63.9k]
  ------------------
  201|  2.36k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|  2.36k|    break;
  203|  8.22k|  case 6:
  ------------------
  |  Branch (203:3): [True: 8.22k, False: 58.0k]
  ------------------
  204|  8.22k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|  8.22k|    break;
  206|  14.0k|  case 7:
  ------------------
  |  Branch (206:3): [True: 14.0k, False: 52.3k]
  ------------------
  207|  14.0k|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  14.0k|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 66.3k]
  ------------------
  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|  66.3k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|  66.3k|  }
  213|  66.3k|}
jdlossls-12.c:jpeg_undifference1:
  111|    967|{
  112|    967|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|    967|  int Ra; \
  |  |   60|    967|  \
  |  |   61|    967|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|    967|  *undiff_buf++ = Ra; \
  |  |   63|    967|  \
  |  |   64|  11.8k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 10.9k, False: 967]
  |  |  ------------------
  |  |   65|  10.9k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  10.9k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  10.9k|    *undiff_buf++ = Ra; \
  |  |   67|  10.9k|  }
  ------------------
  113|    967|}
jdlossls-12.c:jpeg_undifference2:
  119|  1.12k|{
  120|  1.12k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  1.12k|  int Ra, Rb, Rc; \
  |  |   87|  1.12k|  \
  |  |   88|  1.12k|  Rb = *prev_row++; \
  |  |   89|  1.12k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.12k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.12k|  *undiff_buf++ = Ra; \
  |  |   91|  1.12k|  \
  |  |   92|  16.2k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 15.1k, False: 1.12k]
  |  |  ------------------
  |  |   93|  15.1k|    Rc = Rb; \
  |  |   94|  15.1k|    Rb = *prev_row++; \
  |  |   95|  15.1k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  15.1k|    *undiff_buf++ = Ra; \
  |  |   97|  15.1k|  }
  ------------------
  121|  1.12k|  (void)(Rc);
  122|  1.12k|}
jdlossls-12.c:jpeg_undifference3:
  128|  1.04k|{
  129|  1.04k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  1.04k|  int Ra, Rb, Rc; \
  |  |   87|  1.04k|  \
  |  |   88|  1.04k|  Rb = *prev_row++; \
  |  |   89|  1.04k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.04k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.04k|  *undiff_buf++ = Ra; \
  |  |   91|  1.04k|  \
  |  |   92|  17.0k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 16.0k, False: 1.04k]
  |  |  ------------------
  |  |   93|  16.0k|    Rc = Rb; \
  |  |   94|  16.0k|    Rb = *prev_row++; \
  |  |   95|  16.0k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  16.0k|    *undiff_buf++ = Ra; \
  |  |   97|  16.0k|  }
  ------------------
  130|  1.04k|}
jdlossls-12.c:jpeg_undifference4:
  136|  1.01k|{
  137|  1.01k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  1.01k|  int Ra, Rb, Rc; \
  |  |   87|  1.01k|  \
  |  |   88|  1.01k|  Rb = *prev_row++; \
  |  |   89|  1.01k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.01k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.01k|  *undiff_buf++ = Ra; \
  |  |   91|  1.01k|  \
  |  |   92|  7.43k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 6.41k, False: 1.01k]
  |  |  ------------------
  |  |   93|  6.41k|    Rc = Rb; \
  |  |   94|  6.41k|    Rb = *prev_row++; \
  |  |   95|  6.41k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  6.41k|    *undiff_buf++ = Ra; \
  |  |   97|  6.41k|  }
  ------------------
  138|  1.01k|}
jdlossls-12.c:jpeg_undifference5:
  144|  1.04k|{
  145|  1.04k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  1.04k|  int Ra, Rb, Rc; \
  |  |   87|  1.04k|  \
  |  |   88|  1.04k|  Rb = *prev_row++; \
  |  |   89|  1.04k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.04k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.04k|  *undiff_buf++ = Ra; \
  |  |   91|  1.04k|  \
  |  |   92|  10.0k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 8.95k, False: 1.04k]
  |  |  ------------------
  |  |   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|  }
  ------------------
  146|  1.04k|}
jdlossls-12.c:jpeg_undifference6:
  152|  1.04k|{
  153|  1.04k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  1.04k|  int Ra, Rb, Rc; \
  |  |   87|  1.04k|  \
  |  |   88|  1.04k|  Rb = *prev_row++; \
  |  |   89|  1.04k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.04k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.04k|  *undiff_buf++ = Ra; \
  |  |   91|  1.04k|  \
  |  |   92|  7.20k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 6.16k, False: 1.04k]
  |  |  ------------------
  |  |   93|  6.16k|    Rc = Rb; \
  |  |   94|  6.16k|    Rb = *prev_row++; \
  |  |   95|  6.16k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  6.16k|    *undiff_buf++ = Ra; \
  |  |   97|  6.16k|  }
  ------------------
  154|  1.04k|}
jdlossls-12.c:jpeg_undifference7:
  160|    659|{
  161|    659|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|    659|  int Ra, Rb, Rc; \
  |  |   87|    659|  \
  |  |   88|    659|  Rb = *prev_row++; \
  |  |   89|    659|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    659|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    659|  *undiff_buf++ = Ra; \
  |  |   91|    659|  \
  |  |   92|  9.26k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 8.60k, False: 659]
  |  |  ------------------
  |  |   93|  8.60k|    Rc = Rb; \
  |  |   94|  8.60k|    Rb = *prev_row++; \
  |  |   95|  8.60k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  8.60k|    *undiff_buf++ = Ra; \
  |  |   97|  8.60k|  }
  ------------------
  162|    659|  (void)(Rc);
  163|    659|}
jdlossls-12.c:simple_upscale:
  221|  59.2k|{
  222|   246k|  do {
  223|   246k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|   246k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 187k, False: 59.2k]
  ------------------
  225|  59.2k|}
jdlossls-12.c:noscale:
  230|  13.9k|{
  231|   474k|  do {
  232|   474k|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|   474k|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 460k, False: 13.9k]
  ------------------
  234|  13.9k|}

jinit_d_main_controller:
  429|  79.7k|{
  430|  79.7k|  my_main_ptr main_ptr;
  431|  79.7k|  int ci, rgroup, ngroups;
  432|  79.7k|  jpeg_component_info *compptr;
  433|       |
  434|  79.7k|#ifdef D_LOSSLESS_SUPPORTED
  435|  79.7k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 2.87k, False: 76.9k]
  ------------------
  436|  2.87k|#if BITS_IN_JSAMPLE == 8
  437|  2.87k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  5.75k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (437:9): [True: 0, False: 2.87k]
  |  Branch (437:52): [True: 0, False: 2.87k]
  ------------------
  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|  2.87k|  } else
  444|  76.9k|#endif
  445|  76.9k|  {
  446|  76.9k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  76.9k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (446:9): [True: 0, False: 76.9k]
  ------------------
  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|  76.9k|  }
  449|       |
  450|  79.7k|  main_ptr = (my_main_ptr)
  451|  79.7k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  79.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|  79.7k|                                sizeof(my_main_controller));
  453|  79.7k|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|  79.7k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|  79.7k|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|  79.7k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 79.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|  79.7k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 6.65k, False: 73.1k]
  ------------------
  464|  6.65k|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|  6.65k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 6.65k]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|  6.65k|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|  6.65k|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|  6.65k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|  73.1k|  } else {
  469|  73.1k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  73.1k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  73.1k|  }
  471|       |
  472|   188k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 109k, False: 79.7k]
  ------------------
  473|   109k|       ci++, compptr++) {
  474|   109k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|   109k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|   109k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|   109k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|   109k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|   109k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   109k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|   109k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|   109k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|   109k|                         (JDIMENSION)(rgroup * ngroups));
  480|   109k|  }
  481|  79.7k|}
jdmainct-8.c:start_pass_main:
  259|  70.3k|{
  260|  70.3k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|  70.3k|  switch (pass_mode) {
  263|  70.3k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 70.3k, False: 0]
  ------------------
  264|  70.3k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 6.18k, False: 64.1k]
  ------------------
  265|  6.18k|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  256|  6.18k|#define _process_data  process_data
  ------------------
  266|  6.18k|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|  6.18k|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|  6.18k|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  6.18k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|  6.18k|      main_ptr->iMCU_row_ctr = 0;
  270|  64.1k|    } else {
  271|       |      /* Simple case with no context needed */
  272|  64.1k|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  256|  64.1k|#define _process_data  process_data
  ------------------
  273|  64.1k|    }
  274|  70.3k|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|  70.3k|#define FALSE   0               /* values of boolean */
  ------------------
  275|  70.3k|    main_ptr->rowgroup_ctr = 0;
  276|  70.3k|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 70.3k]
  ------------------
  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: 70.3k]
  ------------------
  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|  70.3k|  }
  287|  70.3k|}
jdmainct-8.c:process_data_context_main:
  337|   489k|{
  338|   489k|  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|   489k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (341:7): [True: 32.6k, False: 456k]
  ------------------
  342|  32.6k|    if (!(*cinfo->coef->_decompress_data) (cinfo,
  ------------------
  |  |  258|  32.6k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (342:9): [True: 0, False: 32.6k]
  ------------------
  343|  32.6k|                                           main_ptr->xbuffer[main_ptr->whichptr]))
  344|      0|      return;                   /* suspension forced, can do nothing more */
  345|  32.6k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  32.6k|#define TRUE    1
  ------------------
  346|  32.6k|    main_ptr->iMCU_row_ctr++;   /* count rows received */
  347|  32.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|   489k|  switch (main_ptr->context_state) {
  ------------------
  |  Branch (354:11): [True: 489k, False: 0]
  ------------------
  355|  52.9k|  case CTX_POSTPONED_ROW:
  ------------------
  |  |   48|  52.9k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  |  Branch (355:3): [True: 52.9k, False: 436k]
  ------------------
  356|       |    /* Call postprocessor using previously set pointers for postponed row */
  357|  52.9k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  260|  52.9k|#define _post_process_data  post_process_data
  ------------------
  358|  52.9k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  359|  52.9k|                                        &main_ptr->rowgroup_ctr,
  360|  52.9k|                                        main_ptr->rowgroups_avail, output_buf,
  361|  52.9k|                                        out_row_ctr, out_rows_avail);
  362|  52.9k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (362:9): [True: 26.4k, False: 26.4k]
  ------------------
  363|  26.4k|      return;                   /* Need to suspend */
  364|  26.4k|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  26.4k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  365|  26.4k|    if (*out_row_ctr >= out_rows_avail)
  ------------------
  |  Branch (365:9): [True: 26.4k, False: 0]
  ------------------
  366|  26.4k|      return;                   /* Postprocessor exactly filled output buf */
  367|      0|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  368|  32.6k|  case CTX_PREPARE_FOR_IMCU:
  ------------------
  |  |   46|  32.6k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  |  Branch (368:3): [True: 32.6k, False: 456k]
  ------------------
  369|       |    /* Prepare to process first M-1 row groups of this iMCU row */
  370|  32.6k|    main_ptr->rowgroup_ctr = 0;
  371|  32.6k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
  ------------------
  |  |   27|  32.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|  32.6k|    if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
  ------------------
  |  Branch (375:9): [True: 6.18k, False: 26.4k]
  ------------------
  376|  6.18k|      set_bottom_pointers(cinfo);
  377|  32.6k|    main_ptr->context_state = CTX_PROCESS_IMCU;
  ------------------
  |  |   47|  32.6k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  378|  32.6k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  32.6k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  379|   436k|  case CTX_PROCESS_IMCU:
  ------------------
  |  |   47|   436k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  |  Branch (379:3): [True: 403k, False: 85.5k]
  ------------------
  380|       |    /* Call postprocessor using previously set pointers */
  381|   436k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  260|   436k|#define _post_process_data  post_process_data
  ------------------
  382|   436k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  383|   436k|                                        &main_ptr->rowgroup_ctr,
  384|   436k|                                        main_ptr->rowgroups_avail, output_buf,
  385|   436k|                                        out_row_ctr, out_rows_avail);
  386|   436k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (386:9): [True: 406k, False: 29.6k]
  ------------------
  387|   406k|      return;                   /* Need to suspend */
  388|       |    /* After the first iMCU, change wraparound pointers to normal state */
  389|  29.6k|    if (main_ptr->iMCU_row_ctr == 1)
  ------------------
  |  Branch (389:9): [True: 6.01k, False: 23.6k]
  ------------------
  390|  6.01k|      set_wraparound_pointers(cinfo);
  391|       |    /* Prepare to load new iMCU row using other xbuffer list */
  392|  29.6k|    main_ptr->whichptr ^= 1;    /* 0=>1 or 1=>0 */
  393|  29.6k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  29.6k|#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|  29.6k|    main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
  ------------------
  |  |   27|  29.6k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  397|  29.6k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
  ------------------
  |  |   27|  29.6k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  398|  29.6k|    main_ptr->context_state = CTX_POSTPONED_ROW;
  ------------------
  |  |   48|  29.6k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  399|   489k|  }
  400|   489k|}
jdmainct-8.c:set_bottom_pointers:
  222|  6.18k|{
  223|  6.18k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  224|  6.18k|  int ci, i, rgroup, iMCUheight, rows_left;
  225|  6.18k|  jpeg_component_info *compptr;
  226|  6.18k|  _JSAMPARRAY xbuf;
  ------------------
  |  |  230|  6.18k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  227|       |
  228|  24.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (228:44): [True: 18.5k, False: 6.18k]
  ------------------
  229|  18.5k|       ci++, compptr++) {
  230|       |    /* Count sample rows in one iMCU row and in one row group */
  231|  18.5k|    iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  18.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  232|  18.5k|    rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  18.5k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  233|       |    /* Count nondummy sample rows remaining for this component */
  234|  18.5k|    rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
  235|  18.5k|    if (rows_left == 0) rows_left = iMCUheight;
  ------------------
  |  Branch (235:9): [True: 8.93k, False: 9.63k]
  ------------------
  236|       |    /* Count nondummy row groups.  Should get same answer for each component,
  237|       |     * so we need only do it once.
  238|       |     */
  239|  18.5k|    if (ci == 0) {
  ------------------
  |  Branch (239:9): [True: 6.18k, False: 12.3k]
  ------------------
  240|  6.18k|      main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
  241|  6.18k|    }
  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|  18.5k|    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
  246|  68.0k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (246:17): [True: 49.5k, False: 18.5k]
  ------------------
  247|  49.5k|      xbuf[rows_left + i] = xbuf[rows_left - 1];
  248|  49.5k|    }
  249|  18.5k|  }
  250|  6.18k|}
jdmainct-8.c:make_funny_pointers:
  181|  6.18k|{
  182|  6.18k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|  6.18k|  int ci, i, rgroup;
  184|  6.18k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  6.18k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|  6.18k|  jpeg_component_info *compptr;
  186|  6.18k|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  230|  6.18k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  187|       |
  188|  24.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 18.5k, False: 6.18k]
  ------------------
  189|  18.5k|       ci++, compptr++) {
  190|  18.5k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  18.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|  18.5k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  18.5k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|  18.5k|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|  18.5k|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|  18.5k|    buf = main_ptr->buffer[ci];
  196|   266k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 247k, False: 18.5k]
  ------------------
  197|   247k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|   247k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|  68.0k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 49.5k, False: 18.5k]
  ------------------
  201|  49.5k|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|  49.5k|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|  49.5k|    }
  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|  43.3k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 24.7k, False: 18.5k]
  ------------------
  210|  24.7k|      xbuf0[i - rgroup] = xbuf0[0];
  211|  24.7k|    }
  212|  18.5k|  }
  213|  6.18k|}
jdmainct-8.c:process_data_simple_main:
  298|  16.6M|{
  299|  16.6M|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|  16.6M|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|  16.6M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 2.22M, False: 14.4M]
  ------------------
  304|  2.22M|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  258|  2.22M|#define _decompress_data  decompress_data
  ------------------
  |  Branch (304:9): [True: 0, False: 2.22M]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|  2.22M|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  2.22M|#define TRUE    1
  ------------------
  307|  2.22M|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|  16.6M|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  16.6M|#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|  16.6M|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  260|  16.6M|#define _post_process_data  post_process_data
  ------------------
  318|  16.6M|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|  16.6M|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|  16.6M|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 2.16M, False: 14.4M]
  ------------------
  323|  2.16M|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  2.16M|#define FALSE   0               /* values of boolean */
  ------------------
  324|  2.16M|    main_ptr->rowgroup_ctr = 0;
  325|  2.16M|  }
  326|  16.6M|}
jdmainct-8.c:alloc_funny_pointers:
  139|  6.65k|{
  140|  6.65k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|  6.65k|  int ci, rgroup;
  142|  6.65k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  6.65k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|  6.65k|  jpeg_component_info *compptr;
  144|  6.65k|  _JSAMPARRAY xbuf;
  ------------------
  |  |  230|  6.65k|#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|  6.65k|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|  6.65k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  6.65k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|  6.65k|                                cinfo->num_components * 2 *
  152|  6.65k|                                sizeof(_JSAMPARRAY));
  153|  6.65k|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|  26.6k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 19.9k, False: 6.65k]
  ------------------
  156|  19.9k|       ci++, compptr++) {
  157|  19.9k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  19.9k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|  19.9k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  19.9k|#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|  19.9k|    xbuf = (_JSAMPARRAY)
  163|  19.9k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  19.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|  19.9k|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|  19.9k|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|  19.9k|    main_ptr->xbuffer[0][ci] = xbuf;
  167|  19.9k|    xbuf += rgroup * (M + 4);
  168|  19.9k|    main_ptr->xbuffer[1][ci] = xbuf;
  169|  19.9k|  }
  170|  6.65k|}
j12init_d_main_controller:
  429|    891|{
  430|    891|  my_main_ptr main_ptr;
  431|    891|  int ci, rgroup, ngroups;
  432|    891|  jpeg_component_info *compptr;
  433|       |
  434|    891|#ifdef D_LOSSLESS_SUPPORTED
  435|    891|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 308, False: 583]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|    308|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    616|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (439:9): [True: 0, False: 308]
  ------------------
  440|    308|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    308|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (440:9): [True: 0, False: 308]
  ------------------
  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|    308|  } else
  444|    583|#endif
  445|    583|  {
  446|    583|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    583|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (446:9): [True: 0, False: 583]
  ------------------
  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|    583|  }
  449|       |
  450|    891|  main_ptr = (my_main_ptr)
  451|    891|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    891|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|    891|                                sizeof(my_main_controller));
  453|    891|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|    891|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|    891|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|    891|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 891]
  ------------------
  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|    891|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 891]
  ------------------
  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|    891|  } else {
  469|    891|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    891|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|    891|  }
  471|       |
  472|  1.78k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 891, False: 891]
  ------------------
  473|    891|       ci++, compptr++) {
  474|    891|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    891|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|    891|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    891|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|    891|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|    891|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    891|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|    891|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|    891|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|    891|                         (JDIMENSION)(rgroup * ngroups));
  480|    891|  }
  481|    891|}
jdmainct-12.c:start_pass_main:
  259|    873|{
  260|    873|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|    873|  switch (pass_mode) {
  263|    873|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 873, False: 0]
  ------------------
  264|    873|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 873]
  ------------------
  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|    873|    } else {
  271|       |      /* Simple case with no context needed */
  272|    873|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  140|    873|#define _process_data  process_data_12
  ------------------
  273|    873|    }
  274|    873|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|    873|#define FALSE   0               /* values of boolean */
  ------------------
  275|    873|    main_ptr->rowgroup_ctr = 0;
  276|    873|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 873]
  ------------------
  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: 873]
  ------------------
  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|    873|  }
  287|    873|}
jdmainct-12.c:process_data_simple_main:
  298|  1.90M|{
  299|  1.90M|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|  1.90M|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|  1.90M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 302k, False: 1.60M]
  ------------------
  304|   302k|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  142|   302k|#define _decompress_data  decompress_data_12
  ------------------
  |  Branch (304:9): [True: 0, False: 302k]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|   302k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|   302k|#define TRUE    1
  ------------------
  307|   302k|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|  1.90M|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.90M|#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.90M|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  144|  1.90M|#define _post_process_data  post_process_data_12
  ------------------
  318|  1.90M|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|  1.90M|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|  1.90M|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 302k, False: 1.60M]
  ------------------
  323|   302k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|   302k|#define FALSE   0               /* values of boolean */
  ------------------
  324|   302k|    main_ptr->rowgroup_ctr = 0;
  325|   302k|  }
  326|  1.90M|}

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

jpeg_resync_to_restart:
 1218|   125k|{
 1219|   125k|  int marker = cinfo->unread_marker;
 1220|   125k|  int action = 1;
 1221|       |
 1222|       |  /* Always put up a warning. */
 1223|   125k|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  290|   125k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   125k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   125k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   125k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1224|       |
 1225|       |  /* Outer loop handles repeated decision after scanning forward. */
 1226|   128k|  for (;;) {
 1227|   128k|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1227:9): [True: 2.50k, False: 125k]
  ------------------
 1228|  2.50k|      action = 2;               /* invalid marker */
 1229|   125k|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1229:14): [True: 1.62k, False: 124k]
  |  Branch (1229:38): [True: 122k, False: 1.78k]
  ------------------
 1230|   124k|      action = 3;               /* valid non-restart marker */
 1231|  1.78k|    else {
 1232|  1.78k|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1232:11): [True: 600, False: 1.18k]
  ------------------
 1233|  1.18k|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1233:11): [True: 319, False: 867]
  ------------------
 1234|    919|        action = 3;             /* one of the next two expected restarts */
 1235|    867|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1235:16): [True: 167, False: 700]
  ------------------
 1236|    700|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1236:16): [True: 323, False: 377]
  ------------------
 1237|    490|        action = 2;             /* a prior restart, so advance */
 1238|    377|      else
 1239|    377|        action = 1;             /* desired restart or too far away */
 1240|  1.78k|    }
 1241|   128k|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  304|   128k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|   128k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|   128k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|   128k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1242|   128k|    switch (action) {
  ------------------
  |  Branch (1242:13): [True: 128k, False: 0]
  ------------------
 1243|    377|    case 1:
  ------------------
  |  Branch (1243:5): [True: 377, False: 128k]
  ------------------
 1244|       |      /* Discard marker and let entropy decoder resume processing. */
 1245|    377|      cinfo->unread_marker = 0;
 1246|    377|      return TRUE;
  ------------------
  |  |  210|    377|#define TRUE    1
  ------------------
 1247|  2.99k|    case 2:
  ------------------
  |  Branch (1247:5): [True: 2.99k, False: 125k]
  ------------------
 1248|       |      /* Scan to the next marker, and repeat the decision loop. */
 1249|  2.99k|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1249:11): [True: 0, False: 2.99k]
  ------------------
 1250|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1251|  2.99k|      marker = cinfo->unread_marker;
 1252|  2.99k|      break;
 1253|   125k|    case 3:
  ------------------
  |  Branch (1253:5): [True: 125k, False: 3.36k]
  ------------------
 1254|       |      /* Return without advancing past this marker. */
 1255|       |      /* Entropy decoder will be forced to process an empty segment. */
 1256|   125k|      return TRUE;
  ------------------
  |  |  210|   125k|#define TRUE    1
  ------------------
 1257|   128k|    }
 1258|   128k|  } /* end loop */
 1259|   125k|}
jinit_marker_reader:
 1288|  43.1k|{
 1289|  43.1k|  my_marker_ptr marker;
 1290|  43.1k|  int i;
 1291|       |
 1292|       |  /* Create subobject in permanent pool */
 1293|  43.1k|  marker = (my_marker_ptr)
 1294|  43.1k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  43.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1295|  43.1k|                                sizeof(my_marker_reader));
 1296|  43.1k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1297|       |  /* Initialize public method pointers */
 1298|  43.1k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1299|  43.1k|  marker->pub.read_markers = read_markers;
 1300|  43.1k|  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|  43.1k|  marker->process_COM = skip_variable;
 1306|  43.1k|  marker->length_limit_COM = 0;
 1307|   732k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1307:15): [True: 689k, False: 43.1k]
  ------------------
 1308|   689k|    marker->process_APPn[i] = skip_variable;
 1309|   689k|    marker->length_limit_APPn[i] = 0;
 1310|   689k|  }
 1311|  43.1k|  marker->process_APPn[0] = get_interesting_appn;
 1312|  43.1k|  marker->process_APPn[14] = get_interesting_appn;
 1313|       |  /* Reset marker processing state */
 1314|  43.1k|  reset_marker_reader(cinfo);
 1315|  43.1k|}
jdmarker.c:next_marker:
  892|   501k|{
  893|   501k|  int c;
  894|   501k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   501k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   501k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   501k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  895|       |
  896|   524k|  for (;;) {
  897|   524k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   524k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.38M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 287k]
  |  |  |  |  |  Branch (279:38): [True: 287k, False: 237k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 524k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   524k|            bytes_in_buffer--; \
  |  |  156|   524k|            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|  5.05M|    while (c != 0xFF) {
  ------------------
  |  Branch (903:12): [True: 4.52M, False: 524k]
  ------------------
  904|  4.52M|      cinfo->marker->discarded_bytes++;
  905|  4.52M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  4.52M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  4.52M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  906|  4.52M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  4.52M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.56M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 13.2k]
  |  |  |  |  |  Branch (279:38): [True: 13.2k, False: 4.51M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 4.52M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  4.52M|            bytes_in_buffer--; \
  |  |  156|  4.52M|            V = *next_input_byte++; )
  ------------------
  907|  4.52M|    }
  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|   882k|    do {
  914|   882k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   882k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   886k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.12k]
  |  |  |  |  |  Branch (279:38): [True: 1.12k, False: 881k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 882k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   882k|            bytes_in_buffer--; \
  |  |  156|   882k|            V = *next_input_byte++; )
  ------------------
  915|   882k|    } while (c == 0xFF);
  ------------------
  |  Branch (915:14): [True: 358k, False: 524k]
  ------------------
  916|   524k|    if (c != 0)
  ------------------
  |  Branch (916:9): [True: 501k, False: 23.5k]
  ------------------
  917|   501k|      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|  23.5k|    cinfo->marker->discarded_bytes += 2;
  922|  23.5k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  23.5k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  23.5k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  923|  23.5k|  }
  924|       |
  925|   501k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (925:7): [True: 149k, False: 351k]
  ------------------
  926|   149k|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|   149k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   149k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   149k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   149k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  927|   149k|    cinfo->marker->discarded_bytes = 0;
  928|   149k|  }
  929|       |
  930|   501k|  cinfo->unread_marker = c;
  931|       |
  932|   501k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   501k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   501k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  933|   501k|  return TRUE;
  ------------------
  |  |  210|   501k|#define TRUE    1
  ------------------
  934|   501k|}
jdmarker.c:reset_marker_reader:
 1268|   219k|{
 1269|   219k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1270|       |
 1271|   219k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1272|   219k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1273|   219k|  cinfo->unread_marker = 0;             /* no pending marker */
 1274|   219k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  207|   219k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|   219k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  207|   219k|#define FALSE   0               /* values of boolean */
  ------------------
 1276|   219k|  marker->pub.discarded_bytes = 0;
 1277|       |  marker->cur_marker = NULL;
 1278|   219k|}
jdmarker.c:read_markers:
  970|   222k|{
  971|       |  /* Outer loop repeats once for each marker. */
  972|   703k|  for (;;) {
  973|       |    /* Collect the marker proper, unless we already did. */
  974|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  975|   703k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (975:9): [True: 672k, False: 30.5k]
  ------------------
  976|   672k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (976:11): [True: 176k, False: 496k]
  ------------------
  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|   496k|      } else {
  980|   496k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (980:13): [True: 0, False: 496k]
  ------------------
  981|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  982|   496k|      }
  983|   672k|    }
  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|   703k|    switch (cinfo->unread_marker) {
  989|  98.7k|    case M_SOI:
  ------------------
  |  Branch (989:5): [True: 98.7k, False: 604k]
  ------------------
  990|  98.7k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (990:11): [True: 0, False: 98.7k]
  ------------------
  991|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  992|  98.7k|      break;
  993|       |
  994|  98.7k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (994:5): [True: 51.4k, False: 652k]
  ------------------
  995|  53.0k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (995:5): [True: 1.56k, False: 701k]
  ------------------
  996|  53.0k|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  53.0k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  53.0k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  53.0k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (996:11): [True: 0, False: 53.0k]
  ------------------
  997|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  998|  53.0k|      break;
  999|       |
 1000|  53.0k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (1000:5): [True: 10.7k, False: 692k]
  ------------------
 1001|  10.7k|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  210|  10.7k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  10.7k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  10.7k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1001:11): [True: 0, False: 10.7k]
  ------------------
 1002|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1003|  10.7k|      break;
 1004|       |
 1005|  10.7k|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1005:5): [True: 6.67k, False: 696k]
  ------------------
 1006|  6.67k|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  6.67k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  210|  6.67k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  6.67k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1006:11): [True: 0, False: 6.67k]
  ------------------
 1007|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1008|  6.67k|      break;
 1009|       |
 1010|  9.28k|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1010:5): [True: 9.28k, False: 694k]
  ------------------
 1011|  9.28k|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  9.28k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  9.28k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  210|  9.28k|#define TRUE    1
  ------------------
  |  Branch (1011:11): [True: 0, False: 9.28k]
  ------------------
 1012|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1013|  9.28k|      break;
 1014|       |
 1015|  12.1k|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1015:5): [True: 12.1k, False: 691k]
  ------------------
 1016|  12.1k|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  12.1k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  207|  12.1k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  12.1k|#define TRUE    1
  ------------------
  |  Branch (1016:11): [True: 0, False: 12.1k]
  ------------------
 1017|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1018|  12.1k|      break;
 1019|       |
 1020|  12.1k|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1020:5): [True: 789, False: 702k]
  ------------------
 1021|    789|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  207|    789|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|    789|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|    789|#define TRUE    1
  ------------------
  |  Branch (1021:11): [True: 0, False: 789]
  ------------------
 1022|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1023|    789|      break;
 1024|       |
 1025|       |    /* Currently unsupported SOFn types */
 1026|    789|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1026:5): [True: 136, False: 703k]
  ------------------
 1027|    277|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1027:5): [True: 141, False: 703k]
  ------------------
 1028|    544|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1028:5): [True: 267, False: 703k]
  ------------------
 1029|    840|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1029:5): [True: 296, False: 703k]
  ------------------
 1030|    988|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 148, False: 703k]
  ------------------
 1031|  1.20k|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 219, False: 703k]
  ------------------
 1032|  1.34k|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1032:5): [True: 136, False: 703k]
  ------------------
 1033|  1.34k|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|  1.34k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.34k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.34k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1034|  1.34k|      break;
 1035|       |
 1036|   101k|    case M_SOS:
  ------------------
  |  Branch (1036:5): [True: 101k, False: 601k]
  ------------------
 1037|   101k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1037:11): [True: 0, False: 101k]
  ------------------
 1038|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1039|   101k|      cinfo->unread_marker = 0; /* processed the marker */
 1040|   101k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1111|   101k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1041|       |
 1042|  31.2k|    case M_EOI:
  ------------------
  |  Branch (1042:5): [True: 31.2k, False: 672k]
  ------------------
 1043|  31.2k|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|  31.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  31.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1044|  31.2k|      cinfo->unread_marker = 0; /* processed the marker */
 1045|  31.2k|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|  31.2k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1046|       |
 1047|    952|    case M_DAC:
  ------------------
  |  Branch (1047:5): [True: 952, False: 702k]
  ------------------
 1048|    952|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1048:11): [True: 0, False: 952]
  ------------------
 1049|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1050|    952|      break;
 1051|       |
 1052|   172k|    case M_DHT:
  ------------------
  |  Branch (1052:5): [True: 172k, False: 531k]
  ------------------
 1053|   172k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1053:11): [True: 0, False: 172k]
  ------------------
 1054|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1055|   172k|      break;
 1056|       |
 1057|   172k|    case M_DQT:
  ------------------
  |  Branch (1057:5): [True: 89.4k, False: 614k]
  ------------------
 1058|  89.4k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1058:11): [True: 0, False: 89.4k]
  ------------------
 1059|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1060|  89.4k|      break;
 1061|       |
 1062|  89.4k|    case M_DRI:
  ------------------
  |  Branch (1062:5): [True: 5.89k, False: 697k]
  ------------------
 1063|  5.89k|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1063:11): [True: 0, False: 5.89k]
  ------------------
 1064|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1065|  5.89k|      break;
 1066|       |
 1067|  5.89k|    case M_APP0:
  ------------------
  |  Branch (1067:5): [True: 4.08k, False: 699k]
  ------------------
 1068|  5.23k|    case M_APP1:
  ------------------
  |  Branch (1068:5): [True: 1.15k, False: 702k]
  ------------------
 1069|  5.50k|    case M_APP2:
  ------------------
  |  Branch (1069:5): [True: 269, False: 703k]
  ------------------
 1070|  5.73k|    case M_APP3:
  ------------------
  |  Branch (1070:5): [True: 230, False: 703k]
  ------------------
 1071|  6.44k|    case M_APP4:
  ------------------
  |  Branch (1071:5): [True: 710, False: 702k]
  ------------------
 1072|  6.68k|    case M_APP5:
  ------------------
  |  Branch (1072:5): [True: 237, False: 703k]
  ------------------
 1073|  7.15k|    case M_APP6:
  ------------------
  |  Branch (1073:5): [True: 473, False: 703k]
  ------------------
 1074|  7.39k|    case M_APP7:
  ------------------
  |  Branch (1074:5): [True: 235, False: 703k]
  ------------------
 1075|  7.54k|    case M_APP8:
  ------------------
  |  Branch (1075:5): [True: 148, False: 703k]
  ------------------
 1076|  7.81k|    case M_APP9:
  ------------------
  |  Branch (1076:5): [True: 279, False: 703k]
  ------------------
 1077|  8.11k|    case M_APP10:
  ------------------
  |  Branch (1077:5): [True: 291, False: 703k]
  ------------------
 1078|  8.59k|    case M_APP11:
  ------------------
  |  Branch (1078:5): [True: 486, False: 703k]
  ------------------
 1079|  8.76k|    case M_APP12:
  ------------------
  |  Branch (1079:5): [True: 166, False: 703k]
  ------------------
 1080|  9.08k|    case M_APP13:
  ------------------
  |  Branch (1080:5): [True: 319, False: 703k]
  ------------------
 1081|  12.4k|    case M_APP14:
  ------------------
  |  Branch (1081:5): [True: 3.35k, False: 700k]
  ------------------
 1082|  12.6k|    case M_APP15:
  ------------------
  |  Branch (1082:5): [True: 246, False: 703k]
  ------------------
 1083|  12.6k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1083:11): [True: 0, False: 12.6k]
  ------------------
 1084|  12.6k|               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|  12.6k|      break;
 1087|       |
 1088|  12.6k|    case M_COM:
  ------------------
  |  Branch (1088:5): [True: 2.58k, False: 700k]
  ------------------
 1089|  2.58k|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1089:11): [True: 0, False: 2.58k]
  ------------------
 1090|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1091|  2.58k|      break;
 1092|       |
 1093|  2.58k|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1093:5): [True: 437, False: 703k]
  ------------------
 1094|    830|    case M_RST1:
  ------------------
  |  Branch (1094:5): [True: 393, False: 703k]
  ------------------
 1095|  2.37k|    case M_RST2:
  ------------------
  |  Branch (1095:5): [True: 1.54k, False: 701k]
  ------------------
 1096|  2.79k|    case M_RST3:
  ------------------
  |  Branch (1096:5): [True: 416, False: 703k]
  ------------------
 1097|  3.59k|    case M_RST4:
  ------------------
  |  Branch (1097:5): [True: 799, False: 702k]
  ------------------
 1098|  4.22k|    case M_RST5:
  ------------------
  |  Branch (1098:5): [True: 630, False: 702k]
  ------------------
 1099|  5.54k|    case M_RST6:
  ------------------
  |  Branch (1099:5): [True: 1.32k, False: 702k]
  ------------------
 1100|  7.33k|    case M_RST7:
  ------------------
  |  Branch (1100:5): [True: 1.79k, False: 701k]
  ------------------
 1101|  12.9k|    case M_TEM:
  ------------------
  |  Branch (1101:5): [True: 5.66k, False: 697k]
  ------------------
 1102|  12.9k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|  12.9k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  12.9k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  12.9k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1103|  12.9k|      break;
 1104|       |
 1105|    999|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1105:5): [True: 999, False: 702k]
  ------------------
 1106|    999|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1106:11): [True: 0, False: 999]
  ------------------
 1107|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1108|    999|      break;
 1109|       |
 1110|  2.30k|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1110:5): [True: 2.30k, False: 701k]
  ------------------
 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|  2.30k|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|  2.30k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  2.30k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  2.30k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1117|  2.30k|      break;
 1118|   703k|    }
 1119|       |    /* Successfully processed marker, so reset state variable */
 1120|   481k|    cinfo->unread_marker = 0;
 1121|   481k|  } /* end loop */
 1122|   222k|}
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|   299k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 41.0k]
  |  |  |  |  |  Branch (279:38): [True: 41.0k, False: 135k]
  |  |  |  |  |  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.7k]
  |  |  |  |  |  Branch (279:38): [True: 11.7k, 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: 73.5k, False: 102k]
  |  Branch (951:20): [True: 4.45k, False: 98.4k]
  ------------------
  952|  77.9k|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|  77.9k|  ((cinfo)->err->msg_code = (code), \
  |  |  248|  77.9k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|  77.9k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|  77.9k|   (*(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|  98.7k|{
  205|  98.7k|  int i;
  206|       |
  207|  98.7k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  98.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  98.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  98.7k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 317, False: 98.4k]
  ------------------
  210|    317|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|    317|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    317|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|  1.67M|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  1.67M|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 1.57M, False: 98.7k]
  ------------------
  215|  1.57M|    cinfo->arith_dc_L[i] = 0;
  216|  1.57M|    cinfo->arith_dc_U[i] = 1;
  217|  1.57M|    cinfo->arith_ac_K[i] = 5;
  218|  1.57M|  }
  219|  98.7k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  98.7k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  98.7k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  207|  98.7k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  98.7k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  207|  98.7k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  98.7k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  98.7k|  cinfo->JFIF_minor_version = 1;
  229|  98.7k|  cinfo->density_unit = 0;
  230|  98.7k|  cinfo->X_density = 1;
  231|  98.7k|  cinfo->Y_density = 1;
  232|  98.7k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  207|  98.7k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  98.7k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  98.7k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  210|  98.7k|#define TRUE    1
  ------------------
  236|       |
  237|  98.7k|  return TRUE;
  ------------------
  |  |  210|  98.7k|#define TRUE    1
  ------------------
  238|  98.7k|}
jdmarker.c:get_sof:
  245|  92.6k|{
  246|  92.6k|  JLONG length;
  247|  92.6k|  int c, ci;
  248|  92.6k|  jpeg_component_info *compptr;
  249|  92.6k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  92.6k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  92.6k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  92.6k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|  92.6k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 377, False: 92.2k]
  ------------------
  252|    377|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|    377|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    377|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|  92.6k|  cinfo->progressive_mode = is_prog;
  255|  92.6k|  cinfo->master->lossless = is_lossless;
  256|  92.6k|  cinfo->arith_code = is_arith;
  257|       |
  258|  92.6k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  92.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   186k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 202]
  |  |  |  |  |  Branch (279:38): [True: 202, False: 92.4k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 243]
  |  |  |  |  |  Branch (279:38): [True: 243, False: 92.3k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  92.6k|            bytes_in_buffer--; \
  |  |  164|  92.6k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  92.6k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  92.6k|            bytes_in_buffer--; \
  |  |  167|  92.6k|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|  92.6k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|  92.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  93.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 382]
  |  |  |  |  |  Branch (279:38): [True: 382, False: 92.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  92.6k|            bytes_in_buffer--; \
  |  |  156|  92.6k|            V = *next_input_byte++; )
  ------------------
  261|  92.6k|  cinfo->master->jpeg_data_precision = cinfo->data_precision;
  262|  92.6k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|  92.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   187k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 306]
  |  |  |  |  |  Branch (279:38): [True: 306, False: 92.3k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 451]
  |  |  |  |  |  Branch (279:38): [True: 451, False: 92.1k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  92.6k|            bytes_in_buffer--; \
  |  |  164|  92.6k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  92.6k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  92.6k|            bytes_in_buffer--; \
  |  |  167|  92.6k|            V += *next_input_byte++; )
  ------------------
  263|  92.6k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|  92.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   188k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 357]
  |  |  |  |  |  Branch (279:38): [True: 357, False: 92.2k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 672]
  |  |  |  |  |  Branch (279:38): [True: 672, False: 91.9k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  92.6k|            bytes_in_buffer--; \
  |  |  164|  92.6k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  92.6k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  92.6k|            bytes_in_buffer--; \
  |  |  167|  92.6k|            V += *next_input_byte++; )
  ------------------
  264|  92.6k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|  92.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  93.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 378]
  |  |  |  |  |  Branch (279:38): [True: 378, False: 92.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  92.6k|            bytes_in_buffer--; \
  |  |  156|  92.6k|            V = *next_input_byte++; )
  ------------------
  265|       |
  266|  92.6k|  length -= 8;
  267|       |
  268|  92.6k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|  92.6k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  92.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  92.6k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  92.6k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  92.6k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  269|  92.6k|           (int)cinfo->image_width, (int)cinfo->image_height,
  270|  92.6k|           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|  92.6k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (275:7): [True: 574, False: 92.0k]
  |  Branch (275:35): [True: 200, False: 91.8k]
  ------------------
  276|  91.8k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (276:7): [True: 204, False: 91.6k]
  ------------------
  277|    601|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|    601|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    601|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |
  279|  92.6k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (279:7): [True: 1.05k, False: 91.5k]
  ------------------
  280|  1.05k|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|  1.05k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.05k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|  92.6k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (282:7): [True: 90.5k, False: 2.02k]
  ------------------
  283|  90.5k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  284|  90.5k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  90.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  285|  90.5k|                         cinfo->num_components * sizeof(jpeg_component_info));
  286|       |
  287|   228k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:44): [True: 136k, False: 92.6k]
  ------------------
  288|   136k|       ci++, compptr++) {
  289|   136k|    compptr->component_index = ci;
  290|   136k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|   136k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   137k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 375]
  |  |  |  |  |  Branch (279:38): [True: 375, False: 135k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 136k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   136k|            bytes_in_buffer--; \
  |  |  156|   136k|            V = *next_input_byte++; )
  ------------------
  291|   136k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   136k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   137k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 369]
  |  |  |  |  |  Branch (279:38): [True: 369, False: 135k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 136k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   136k|            bytes_in_buffer--; \
  |  |  156|   136k|            V = *next_input_byte++; )
  ------------------
  292|   136k|    compptr->h_samp_factor = (c >> 4) & 15;
  293|   136k|    compptr->v_samp_factor = (c     ) & 15;
  294|   136k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|   136k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   138k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 621]
  |  |  |  |  |  Branch (279:38): [True: 621, False: 135k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 136k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   136k|            bytes_in_buffer--; \
  |  |  156|   136k|            V = *next_input_byte++; )
  ------------------
  295|       |
  296|   136k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|   136k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   136k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 136k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|   136k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|   136k|           (cinfo)->err->msg_code = (code); \
  |  |  317|   136k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  297|   136k|             compptr->component_id, compptr->h_samp_factor,
  298|   136k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  299|   136k|  }
  300|       |
  301|  92.6k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  210|  92.6k|#define TRUE    1
  ------------------
  302|       |
  303|  92.6k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  92.6k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  92.6k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  304|  92.6k|  return TRUE;
  ------------------
  |  |  210|  92.6k|#define TRUE    1
  ------------------
  305|  92.6k|}
jdmarker.c:get_sos:
  311|   101k|{
  312|   101k|  JLONG length;
  313|   101k|  int i, ci, n, c, cc, pi;
  314|   101k|  jpeg_component_info *compptr;
  315|   101k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   101k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   101k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   101k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  316|       |
  317|   101k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (317:7): [True: 204, False: 101k]
  ------------------
  318|    204|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|    204|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    204|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|   101k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   101k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   204k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 279]
  |  |  |  |  |  Branch (279:38): [True: 279, False: 101k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 158]
  |  |  |  |  |  Branch (279:38): [True: 158, False: 101k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 101k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   101k|            bytes_in_buffer--; \
  |  |  164|   101k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   101k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   101k|            bytes_in_buffer--; \
  |  |  167|   101k|            V += *next_input_byte++; )
  ------------------
  321|       |
  322|   101k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|   101k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   102k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 306]
  |  |  |  |  |  Branch (279:38): [True: 306, False: 101k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 101k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   101k|            bytes_in_buffer--; \
  |  |  156|   101k|            V = *next_input_byte++; )
  ------------------
  323|       |
  324|   101k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|   101k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|   101k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|   101k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  325|       |
  326|   101k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|   100k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (326:7): [True: 720, False: 100k]
  |  Branch (326:32): [True: 213, False: 100k]
  |  Branch (326:41): [True: 237, False: 100k]
  ------------------
  327|    966|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    966|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    966|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  328|       |
  329|   101k|  cinfo->comps_in_scan = n;
  330|       |
  331|       |  /* Collect the component-spec parameters */
  332|       |
  333|   503k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|   503k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (333:15): [True: 402k, False: 101k]
  ------------------
  334|   402k|    cinfo->cur_comp_info[i] = NULL;
  335|       |
  336|   220k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (336:15): [True: 119k, False: 100k]
  ------------------
  337|   119k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|   119k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   121k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 530]
  |  |  |  |  |  Branch (279:38): [True: 530, False: 119k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 119k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   119k|            bytes_in_buffer--; \
  |  |  156|   119k|            V = *next_input_byte++; )
  ------------------
  338|   119k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   119k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   122k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 836]
  |  |  |  |  |  Branch (279:38): [True: 836, False: 118k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 119k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   119k|            bytes_in_buffer--; \
  |  |  156|   119k|            V = *next_input_byte++; )
  ------------------
  339|       |
  340|   119k|    for (ci = 0, compptr = cinfo->comp_info;
  341|   158k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|   157k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (341:10): [True: 157k, False: 1.21k]
  |  Branch (341:40): [True: 157k, False: 73]
  ------------------
  342|   157k|         ci++, compptr++) {
  343|   157k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (343:11): [True: 118k, False: 38.4k]
  |  Branch (343:42): [True: 118k, False: 551]
  ------------------
  344|   118k|        goto id_found;
  345|   157k|    }
  346|       |
  347|  1.28k|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|  1.28k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.28k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.28k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|       |
  349|   118k|id_found:
  350|       |
  351|   118k|    cinfo->cur_comp_info[i] = compptr;
  352|   118k|    compptr->dc_tbl_no = (c >> 4) & 15;
  353|   118k|    compptr->ac_tbl_no = (c     ) & 15;
  354|       |
  355|   118k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|   118k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   118k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 118k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|   118k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|   118k|           (cinfo)->err->msg_code = (code); \
  |  |  312|   118k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  356|   118k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  357|       |
  358|       |    /* This CSi (cc) should differ from the previous CSi */
  359|   145k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (359:18): [True: 27.5k, False: 118k]
  ------------------
  360|  27.5k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (360:11): [True: 209, False: 27.3k]
  ------------------
  361|    209|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|    209|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    209|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    209|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  362|    209|      }
  363|  27.5k|    }
  364|   118k|  }
  365|       |
  366|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  367|   100k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   100k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   103k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 874]
  |  |  |  |  |  Branch (279:38): [True: 874, False: 99.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 100k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   100k|            bytes_in_buffer--; \
  |  |  156|   100k|            V = *next_input_byte++; )
  ------------------
  368|   100k|  cinfo->Ss = c;
  369|   100k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   100k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   104k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.43k]
  |  |  |  |  |  Branch (279:38): [True: 1.43k, False: 98.9k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 100k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   100k|            bytes_in_buffer--; \
  |  |  156|   100k|            V = *next_input_byte++; )
  ------------------
  370|   100k|  cinfo->Se = c;
  371|   100k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   100k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   105k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.53k]
  |  |  |  |  |  Branch (279:38): [True: 1.53k, False: 98.8k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 100k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   100k|            bytes_in_buffer--; \
  |  |  156|   100k|            V = *next_input_byte++; )
  ------------------
  372|   100k|  cinfo->Ah = (c >> 4) & 15;
  373|   100k|  cinfo->Al = (c     ) & 15;
  374|       |
  375|   100k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|   100k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   100k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 100k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|   100k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|   100k|           (cinfo)->err->msg_code = (code); \
  |  |  317|   100k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  376|   100k|           cinfo->Ah, cinfo->Al);
  377|       |
  378|       |  /* Prepare to scan data & restart markers */
  379|   100k|  cinfo->marker->next_restart_num = 0;
  380|       |
  381|       |  /* Count another SOS marker */
  382|   100k|  cinfo->input_scan_number++;
  383|       |
  384|   100k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   100k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   100k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  385|   100k|  return TRUE;
  ------------------
  |  |  210|   100k|#define TRUE    1
  ------------------
  386|   100k|}
jdmarker.c:get_dac:
  394|    952|{
  395|    952|  JLONG length;
  396|    952|  int index, val;
  397|    952|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    952|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    952|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    952|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  398|       |
  399|    952|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    952|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.69k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 131]
  |  |  |  |  |  Branch (279:38): [True: 131, False: 821]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 131]
  |  |  |  |  |  Branch (279:38): [True: 131, False: 821]
  |  |  |  |  |  Branch (279:53): [Folded, False: 952]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    952|            bytes_in_buffer--; \
  |  |  164|    952|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    952|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    952|            bytes_in_buffer--; \
  |  |  167|    952|            V += *next_input_byte++; )
  ------------------
  400|    952|  length -= 2;
  401|       |
  402|  1.80k|  while (length > 0) {
  ------------------
  |  Branch (402:10): [True: 850, False: 952]
  ------------------
  403|    850|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|    850|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.25k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 134]
  |  |  |  |  |  Branch (279:38): [True: 134, False: 716]
  |  |  |  |  |  Branch (279:53): [Folded, False: 850]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    850|            bytes_in_buffer--; \
  |  |  156|    850|            V = *next_input_byte++; )
  ------------------
  404|    850|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|    850|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.66k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 273]
  |  |  |  |  |  Branch (279:38): [True: 273, False: 577]
  |  |  |  |  |  Branch (279:53): [Folded, False: 850]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    850|            bytes_in_buffer--; \
  |  |  156|    850|            V = *next_input_byte++; )
  ------------------
  405|       |
  406|    850|    length -= 2;
  407|       |
  408|    850|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|    850|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    850|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    850|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    850|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  409|       |
  410|    850|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|    850|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (410:9): [True: 0, False: 850]
  |  Branch (410:22): [True: 427, False: 423]
  ------------------
  411|    427|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|    427|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    427|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    427|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|       |
  413|    850|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|    850|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (413:9): [True: 166, False: 684]
  ------------------
  414|    166|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|    166|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  415|    684|    } else {                    /* define DC table */
  416|    684|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  417|    684|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  418|    684|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (418:11): [True: 129, False: 555]
  ------------------
  419|    129|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  243|    129|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    129|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    129|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  420|    684|    }
  421|    850|  }
  422|       |
  423|    952|  if (length != 0)
  ------------------
  |  Branch (423:7): [True: 138, False: 814]
  ------------------
  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|    952|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    952|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    952|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  427|    952|  return TRUE;
  ------------------
  |  |  210|    952|#define TRUE    1
  ------------------
  428|    952|}
jdmarker.c:get_dht:
  440|   172k|{
  441|   172k|  JLONG length;
  442|   172k|  UINT8 bits[17];
  443|   172k|  UINT8 huffval[256];
  444|   172k|  int i, index, count;
  445|   172k|  JHUFF_TBL **htblptr;
  446|   172k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   172k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   172k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   172k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  447|       |
  448|   172k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   172k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   344k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 130]
  |  |  |  |  |  Branch (279:38): [True: 130, False: 171k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 135]
  |  |  |  |  |  Branch (279:38): [True: 135, False: 171k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 172k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   172k|            bytes_in_buffer--; \
  |  |  164|   172k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   172k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   172k|            bytes_in_buffer--; \
  |  |  167|   172k|            V += *next_input_byte++; )
  ------------------
  449|   172k|  length -= 2;
  450|       |
  451|   344k|  while (length > 16) {
  ------------------
  |  Branch (451:10): [True: 172k, False: 172k]
  ------------------
  452|   172k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|   172k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   173k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 289]
  |  |  |  |  |  Branch (279:38): [True: 289, False: 172k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 172k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   172k|            bytes_in_buffer--; \
  |  |  156|   172k|            V = *next_input_byte++; )
  ------------------
  453|       |
  454|   172k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|   172k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|   172k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|   172k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  455|       |
  456|   172k|    bits[0] = 0;
  457|   172k|    count = 0;
  458|  2.93M|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (458:17): [True: 2.76M, False: 172k]
  ------------------
  459|  2.76M|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|  2.76M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.77M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5.47k]
  |  |  |  |  |  Branch (279:38): [True: 5.47k, False: 2.75M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.76M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.76M|            bytes_in_buffer--; \
  |  |  156|  2.76M|            V = *next_input_byte++; )
  ------------------
  460|  2.76M|      count += bits[i];
  461|  2.76M|    }
  462|       |
  463|   172k|    length -= 1 + 16;
  464|       |
  465|   172k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|   172k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   172k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 172k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|   172k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|   172k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|   172k|           (cinfo)->err->msg_code = (code); \
  |  |  329|   172k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  466|   172k|             bits[1], bits[2], bits[3], bits[4],
  467|   172k|             bits[5], bits[6], bits[7], bits[8]);
  468|   172k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|   172k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   172k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 172k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|   172k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|   172k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|   172k|           (cinfo)->err->msg_code = (code); \
  |  |  329|   172k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  469|   172k|             bits[9], bits[10], bits[11], bits[12],
  470|   172k|             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|   172k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (475:9): [True: 981, False: 171k]
  |  Branch (475:24): [True: 179, False: 171k]
  ------------------
  476|  1.16k|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|  1.16k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.16k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  477|       |
  478|  15.1M|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (478:17): [True: 14.9M, False: 172k]
  ------------------
  479|  14.9M|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|  14.9M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  15.1M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 29.8k]
  |  |  |  |  |  Branch (279:38): [True: 29.8k, False: 14.9M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 14.9M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   172k|            bytes_in_buffer--; \
  |  |  156|   172k|            V = *next_input_byte++; )
  ------------------
  480|       |
  481|   172k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  482|       |
  483|   172k|    length -= count;
  484|       |
  485|   172k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (485:9): [True: 90.0k, False: 82.5k]
  ------------------
  486|  90.0k|      index -= 0x10;
  487|  90.0k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  90.0k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (487:11): [True: 0, False: 90.0k]
  |  Branch (487:24): [True: 223, False: 89.8k]
  ------------------
  488|    223|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|    223|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    223|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    223|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  489|  90.0k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  490|  90.0k|    } else {                    /* DC table definition */
  491|  82.5k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  81.3k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (491:11): [True: 1.16k, False: 81.3k]
  |  Branch (491:24): [True: 259, False: 81.0k]
  ------------------
  492|    259|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|    259|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    259|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    259|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  493|  82.5k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  494|  82.5k|    }
  495|       |
  496|   172k|    if (*htblptr == NULL)
  ------------------
  |  Branch (496:9): [True: 158k, False: 14.0k]
  ------------------
  497|   158k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  498|       |
  499|   172k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  500|   172k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  501|   172k|  }
  502|       |
  503|   172k|  if (length != 0)
  ------------------
  |  Branch (503:7): [True: 208, False: 171k]
  ------------------
  504|    208|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    208|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    208|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  505|       |
  506|   172k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   172k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   172k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  507|   172k|  return TRUE;
  ------------------
  |  |  210|   172k|#define TRUE    1
  ------------------
  508|   172k|}
jdmarker.c:get_dqt:
  514|  89.4k|{
  515|  89.4k|  JLONG length;
  516|  89.4k|  int n, i, prec;
  517|  89.4k|  unsigned int tmp;
  518|  89.4k|  JQUANT_TBL *quant_ptr;
  519|  89.4k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  89.4k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  89.4k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  89.4k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  520|       |
  521|  89.4k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  89.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   180k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 210]
  |  |  |  |  |  Branch (279:38): [True: 210, False: 89.2k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 219]
  |  |  |  |  |  Branch (279:38): [True: 219, False: 89.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 89.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  89.4k|            bytes_in_buffer--; \
  |  |  164|  89.4k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  89.4k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  89.4k|            bytes_in_buffer--; \
  |  |  167|  89.4k|            V += *next_input_byte++; )
  ------------------
  522|  89.4k|  length -= 2;
  523|       |
  524|   179k|  while (length > 0) {
  ------------------
  |  Branch (524:10): [True: 90.2k, False: 89.4k]
  ------------------
  525|  90.2k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  90.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  93.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.02k]
  |  |  |  |  |  Branch (279:38): [True: 1.02k, False: 89.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 90.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  90.2k|            bytes_in_buffer--; \
  |  |  156|  90.2k|            V = *next_input_byte++; )
  ------------------
  526|  90.2k|    prec = n >> 4;
  527|  90.2k|    n &= 0x0F;
  528|       |
  529|  90.2k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  90.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  90.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  90.2k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  90.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  530|       |
  531|  90.2k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  90.2k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (531:9): [True: 1.35k, False: 88.8k]
  ------------------
  532|  1.35k|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|  1.35k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.35k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.35k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  533|       |
  534|  90.2k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (534:9): [True: 45.2k, False: 44.9k]
  ------------------
  535|  45.2k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  536|  90.2k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  537|       |
  538|  5.77M|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  5.77M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (538:17): [True: 5.68M, False: 90.2k]
  ------------------
  539|  5.68M|      if (prec)
  ------------------
  |  Branch (539:11): [True: 69.6k, False: 5.61M]
  ------------------
  540|  5.68M|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  69.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   273k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 38.5k]
  |  |  |  |  |  Branch (279:38): [True: 38.5k, False: 31.0k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.22k]
  |  |  |  |  |  Branch (279:38): [True: 6.22k, False: 63.4k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 69.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.68M|            bytes_in_buffer--; \
  |  |  164|  5.68M|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.68M|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.68M|            bytes_in_buffer--; \
  |  |  167|  5.68M|            V += *next_input_byte++; )
  ------------------
  541|  5.61M|      else
  542|  5.68M|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|  5.61M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  5.77M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 51.5k]
  |  |  |  |  |  Branch (279:38): [True: 51.5k, False: 5.56M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.61M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.68M|            bytes_in_buffer--; \
  |  |  156|  5.68M|            V = *next_input_byte++; )
  ------------------
  543|       |      /* We convert the zigzag-order table to natural array order. */
  544|  5.68M|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  545|  5.68M|    }
  546|       |
  547|  90.2k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (547:9): [True: 0, False: 90.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|  90.2k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|  90.2k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  558|  90.2k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|  1.08k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (558:9): [True: 1.08k, False: 89.1k]
  ------------------
  559|  90.2k|  }
  560|       |
  561|  89.4k|  if (length != 0)
  ------------------
  |  Branch (561:7): [True: 827, False: 88.5k]
  ------------------
  562|    827|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    827|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    827|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|       |
  564|  89.4k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  89.4k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  89.4k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  565|  89.4k|  return TRUE;
  ------------------
  |  |  210|  89.4k|#define TRUE    1
  ------------------
  566|  89.4k|}
jdmarker.c:get_dri:
  572|  5.89k|{
  573|  5.89k|  JLONG length;
  574|  5.89k|  unsigned int tmp;
  575|  5.89k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  5.89k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  5.89k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  5.89k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  576|       |
  577|  5.89k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  5.89k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  12.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 161]
  |  |  |  |  |  Branch (279:38): [True: 161, False: 5.73k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 193]
  |  |  |  |  |  Branch (279:38): [True: 193, False: 5.70k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.89k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.89k|            bytes_in_buffer--; \
  |  |  164|  5.89k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.89k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.89k|            bytes_in_buffer--; \
  |  |  167|  5.89k|            V += *next_input_byte++; )
  ------------------
  578|       |
  579|  5.89k|  if (length != 4)
  ------------------
  |  Branch (579:7): [True: 485, False: 5.41k]
  ------------------
  580|    485|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    485|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    485|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  581|       |
  582|  5.89k|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  5.89k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  13.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 291]
  |  |  |  |  |  Branch (279:38): [True: 291, False: 5.60k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 164]
  |  |  |  |  |  Branch (279:38): [True: 164, False: 5.73k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.89k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.89k|            bytes_in_buffer--; \
  |  |  164|  5.89k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.89k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.89k|            bytes_in_buffer--; \
  |  |  167|  5.89k|            V += *next_input_byte++; )
  ------------------
  583|       |
  584|  5.89k|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|  5.89k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  5.89k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  5.89k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  585|       |
  586|  5.89k|  cinfo->restart_interval = tmp;
  587|       |
  588|  5.89k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  5.89k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  5.89k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  589|  5.89k|  return TRUE;
  ------------------
  |  |  210|  5.89k|#define TRUE    1
  ------------------
  590|  5.89k|}
jdmarker.c:read_restart_marker:
 1139|   129k|{
 1140|       |  /* Obtain a marker unless we already did. */
 1141|       |  /* Note that next_marker will complain if it skips any data. */
 1142|   129k|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1142:7): [True: 1.92k, False: 127k]
  ------------------
 1143|  1.92k|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1143:9): [True: 0, False: 1.92k]
  ------------------
 1144|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1145|  1.92k|  }
 1146|       |
 1147|   129k|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1147:7): [True: 2.80k, False: 126k]
  ------------------
 1148|   129k|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1149|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1150|  2.80k|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  300|  2.80k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.80k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.80k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1151|  2.80k|    cinfo->unread_marker = 0;
 1152|   126k|  } else {
 1153|       |    /* Uh-oh, the restart markers have been messed up. */
 1154|       |    /* Let the data source manager determine how to resync. */
 1155|   126k|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1155:9): [True: 0, False: 126k]
  ------------------
 1156|   126k|                                           cinfo->marker->next_restart_num))
 1157|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1158|   126k|  }
 1159|       |
 1160|       |  /* Update next-restart state */
 1161|   129k|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1162|       |
 1163|   129k|  return TRUE;
  ------------------
  |  |  210|   129k|#define TRUE    1
  ------------------
 1164|   129k|}
jdmarker.c:skip_variable:
  864|  8.82k|{
  865|  8.82k|  JLONG length;
  866|  8.82k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  8.82k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  8.82k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  8.82k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  867|       |
  868|  8.82k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  8.82k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  20.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 400]
  |  |  |  |  |  Branch (279:38): [True: 400, False: 8.42k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 601]
  |  |  |  |  |  Branch (279:38): [True: 601, False: 8.21k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 8.82k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  8.82k|            bytes_in_buffer--; \
  |  |  164|  8.82k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  8.82k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  8.82k|            bytes_in_buffer--; \
  |  |  167|  8.82k|            V += *next_input_byte++; )
  ------------------
  869|  8.82k|  length -= 2;
  870|       |
  871|  8.82k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  8.82k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  8.82k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  8.82k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  8.82k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  872|       |
  873|  8.82k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  8.82k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  8.82k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  874|  8.82k|  if (length > 0)
  ------------------
  |  Branch (874:7): [True: 5.57k, False: 3.25k]
  ------------------
  875|  5.57k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  876|       |
  877|  8.82k|  return TRUE;
  ------------------
  |  |  210|  8.82k|#define TRUE    1
  ------------------
  878|  8.82k|}
jdmarker.c:get_interesting_appn:
  712|  7.44k|{
  713|  7.44k|  JLONG length;
  714|  7.44k|  JOCTET b[APPN_DATA_LEN];
  715|  7.44k|  unsigned int i, numtoread;
  716|  7.44k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  7.44k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  7.44k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  7.44k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  717|       |
  718|  7.44k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  7.44k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  16.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 188]
  |  |  |  |  |  Branch (279:38): [True: 188, False: 7.25k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 192]
  |  |  |  |  |  Branch (279:38): [True: 192, False: 7.24k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 7.44k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  7.44k|            bytes_in_buffer--; \
  |  |  164|  7.44k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  7.44k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  7.44k|            bytes_in_buffer--; \
  |  |  167|  7.44k|            V += *next_input_byte++; )
  ------------------
  719|  7.44k|  length -= 2;
  720|       |
  721|       |  /* get the interesting part of the marker data */
  722|  7.44k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  602|  7.44k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (722:7): [True: 6.33k, False: 1.10k]
  ------------------
  723|  6.33k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  602|  6.33k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  724|  1.10k|  else if (length > 0)
  ------------------
  |  Branch (724:12): [True: 454, False: 652]
  ------------------
  725|    454|    numtoread = (unsigned int)length;
  726|    652|  else
  727|    652|    numtoread = 0;
  728|  98.1k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (728:15): [True: 90.7k, False: 7.44k]
  ------------------
  729|  90.7k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|  90.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   107k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5.61k]
  |  |  |  |  |  Branch (279:38): [True: 5.61k, False: 85.1k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 90.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  7.44k|            bytes_in_buffer--; \
  |  |  156|  7.44k|            V = *next_input_byte++; )
  ------------------
  730|  7.44k|  length -= numtoread;
  731|       |
  732|       |  /* process it */
  733|  7.44k|  switch (cinfo->unread_marker) {
  734|  4.08k|  case M_APP0:
  ------------------
  |  Branch (734:3): [True: 4.08k, False: 3.35k]
  ------------------
  735|  4.08k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  736|  4.08k|    break;
  737|  3.35k|  case M_APP14:
  ------------------
  |  Branch (737:3): [True: 3.35k, False: 4.08k]
  ------------------
  738|  3.35k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  739|  3.35k|    break;
  740|      0|  default:
  ------------------
  |  Branch (740:3): [True: 0, False: 7.44k]
  ------------------
  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.44k|  }
  745|       |
  746|       |  /* skip any remaining data -- could be lots */
  747|  7.44k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  7.44k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  7.44k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  748|  7.44k|  if (length > 0)
  ------------------
  |  Branch (748:7): [True: 5.41k, False: 2.03k]
  ------------------
  749|  5.41k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  750|       |
  751|  7.44k|  return TRUE;
  ------------------
  |  |  210|  7.44k|#define TRUE    1
  ------------------
  752|  7.44k|}
jdmarker.c:examine_app0:
  612|  4.08k|{
  613|  4.08k|  JLONG totallen = (JLONG)datalen + remaining;
  614|       |
  615|  4.08k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  600|  8.17k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (615:7): [True: 3.26k, False: 817]
  ------------------
  616|  3.26k|      data[0] == 0x4A &&
  ------------------
  |  Branch (616:7): [True: 2.09k, False: 1.17k]
  ------------------
  617|  2.09k|      data[1] == 0x46 &&
  ------------------
  |  Branch (617:7): [True: 1.95k, False: 138]
  ------------------
  618|  1.95k|      data[2] == 0x49 &&
  ------------------
  |  Branch (618:7): [True: 895, False: 1.05k]
  ------------------
  619|    895|      data[3] == 0x46 &&
  ------------------
  |  Branch (619:7): [True: 766, False: 129]
  ------------------
  620|    766|      data[4] == 0) {
  ------------------
  |  Branch (620:7): [True: 625, False: 141]
  ------------------
  621|       |    /* Found JFIF APP0 marker: save info */
  622|    625|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  210|    625|#define TRUE    1
  ------------------
  623|    625|    cinfo->JFIF_major_version = data[5];
  624|    625|    cinfo->JFIF_minor_version = data[6];
  625|    625|    cinfo->density_unit = data[7];
  626|    625|    cinfo->X_density = (data[8] << 8) + data[9];
  627|    625|    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|    625|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (634:9): [True: 466, False: 159]
  ------------------
  635|    466|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|    466|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    466|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    466|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    466|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  636|    625|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  637|       |    /* Generate trace messages */
  638|    625|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|    625|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    625|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 625]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|    625|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|    625|           _mp[4] = (p5); \
  |  |  322|    625|           (cinfo)->err->msg_code = (code); \
  |  |  323|    625|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  639|    625|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  640|    625|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  641|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  642|    625|    if (data[12] | data[13])
  ------------------
  |  Branch (642:9): [True: 436, False: 189]
  ------------------
  643|    436|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|    436|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    436|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    436|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    436|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  644|    625|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  600|    625|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  645|    625|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (645:9): [True: 134, False: 491]
  ------------------
  646|    134|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|    134|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    134|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    134|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  647|  3.46k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (647:14): [True: 2.93k, False: 524]
  ------------------
  648|  2.93k|             data[0] == 0x4A &&
  ------------------
  |  Branch (648:14): [True: 1.61k, False: 1.32k]
  ------------------
  649|  1.61k|             data[1] == 0x46 &&
  ------------------
  |  Branch (649:14): [True: 1.47k, False: 138]
  ------------------
  650|  1.47k|             data[2] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 933, False: 539]
  ------------------
  651|    933|             data[3] == 0x58 &&
  ------------------
  |  Branch (651:14): [True: 798, False: 135]
  ------------------
  652|    798|             data[4] == 0) {
  ------------------
  |  Branch (652:14): [True: 657, False: 141]
  ------------------
  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|    657|    switch (data[5]) {
  658|    194|    case 0x10:
  ------------------
  |  Branch (658:5): [True: 194, False: 463]
  ------------------
  659|    194|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  300|    194|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    194|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    194|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  660|    194|      break;
  661|    192|    case 0x11:
  ------------------
  |  Branch (661:5): [True: 192, False: 465]
  ------------------
  662|    192|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  300|    192|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    192|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    192|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  663|    192|      break;
  664|    128|    case 0x13:
  ------------------
  |  Branch (664:5): [True: 128, False: 529]
  ------------------
  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|    143|    default:
  ------------------
  |  Branch (667:5): [True: 143, False: 514]
  ------------------
  668|    143|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|    143|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    143|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    143|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    143|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  669|    143|      break;
  670|    657|    }
  671|  2.80k|  } else {
  672|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  673|  2.80k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|  2.80k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.80k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.80k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  674|  2.80k|  }
  675|  4.08k|}
jdmarker.c:examine_app14:
  685|  3.35k|{
  686|  3.35k|  unsigned int version, flags0, flags1, transform;
  687|       |
  688|  3.35k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  601|  6.70k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (688:7): [True: 3.06k, False: 289]
  ------------------
  689|  3.06k|      data[0] == 0x41 &&
  ------------------
  |  Branch (689:7): [True: 2.87k, False: 190]
  ------------------
  690|  2.87k|      data[1] == 0x64 &&
  ------------------
  |  Branch (690:7): [True: 2.63k, False: 240]
  ------------------
  691|  2.63k|      data[2] == 0x6F &&
  ------------------
  |  Branch (691:7): [True: 2.34k, False: 293]
  ------------------
  692|  2.34k|      data[3] == 0x62 &&
  ------------------
  |  Branch (692:7): [True: 2.13k, False: 209]
  ------------------
  693|  2.13k|      data[4] == 0x65) {
  ------------------
  |  Branch (693:7): [True: 1.84k, False: 290]
  ------------------
  694|       |    /* Found Adobe APP14 marker */
  695|  1.84k|    version = (data[5] << 8) + data[6];
  696|  1.84k|    flags0 = (data[7] << 8) + data[8];
  697|  1.84k|    flags1 = (data[9] << 8) + data[10];
  698|  1.84k|    transform = data[11];
  699|  1.84k|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|  1.84k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.84k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  1.84k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  1.84k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  1.84k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  700|  1.84k|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  210|  1.84k|#define TRUE    1
  ------------------
  701|  1.84k|    cinfo->Adobe_transform = (UINT8)transform;
  702|  1.84k|  } else {
  703|       |    /* Start of APP14 does not match "Adobe", or too short */
  704|  1.51k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|  1.51k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.51k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.51k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  705|  1.51k|  }
  706|  3.35k|}

jpeg_calc_output_dimensions:
  269|  82.0k|{
  270|  82.0k|#ifdef IDCT_SCALING_SUPPORTED
  271|  82.0k|  int ci;
  272|  82.0k|  jpeg_component_info *compptr;
  273|  82.0k|#endif
  274|       |
  275|       |  /* Prevent application from calling me at wrong times */
  276|  82.0k|  if (cinfo->global_state != DSTATE_READY)
  ------------------
  |  |   50|  82.0k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (276:7): [True: 0, False: 82.0k]
  ------------------
  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|  82.0k|  jpeg_core_output_dimensions(cinfo);
  281|       |
  282|  82.0k|#ifdef IDCT_SCALING_SUPPORTED
  283|       |
  284|  82.0k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (284:7): [True: 78.6k, False: 3.40k]
  ------------------
  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|   188k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (290:46): [True: 109k, False: 78.6k]
  ------------------
  291|   109k|         ci++, compptr++) {
  292|   109k|      int ssize = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   109k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  293|   109k|      while (ssize < DCTSIZE &&
  ------------------
  |  |   66|   219k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (293:14): [True: 0, False: 109k]
  ------------------
  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|   109k|      compptr->DCT_scaled_size = ssize;
  304|   109k|#endif
  305|   109k|    }
  306|       |
  307|       |    /* Recompute downsampled dimensions of components;
  308|       |     * application needs to know these if using raw downsampled data.
  309|       |     */
  310|   188k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (310:46): [True: 109k, False: 78.6k]
  ------------------
  311|   109k|         ci++, compptr++) {
  312|       |      /* Size in samples, after IDCT scaling */
  313|   109k|      compptr->downsampled_width = (JDIMENSION)
  314|   109k|        jdiv_round_up((long)cinfo->image_width *
  315|   109k|                      (long)(compptr->h_samp_factor *
  316|   109k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|   109k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  317|   109k|                      (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   66|   109k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  318|   109k|      compptr->downsampled_height = (JDIMENSION)
  319|   109k|        jdiv_round_up((long)cinfo->image_height *
  320|   109k|                      (long)(compptr->v_samp_factor *
  321|   109k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|   109k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  322|   109k|                      (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   66|   109k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  323|   109k|    }
  324|  78.6k|  } else
  325|  3.40k|#endif /* IDCT_SCALING_SUPPORTED */
  326|  3.40k|  {
  327|       |    /* Hardwire it to "no scaling" */
  328|  3.40k|    cinfo->output_width = cinfo->image_width;
  329|  3.40k|    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.40k|  }
  334|       |
  335|       |  /* Report number of components in selected colorspace. */
  336|       |  /* Probably this should be in the color conversion module... */
  337|  82.0k|  switch (cinfo->out_color_space) {
  338|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (338:3): [True: 0, False: 82.0k]
  ------------------
  339|      0|    cinfo->out_color_components = 1;
  340|      0|    break;
  341|  15.4k|  case JCS_RGB:
  ------------------
  |  Branch (341:3): [True: 15.4k, False: 66.5k]
  ------------------
  342|  15.4k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (342:3): [True: 0, False: 82.0k]
  ------------------
  343|  15.4k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (343:3): [True: 0, False: 82.0k]
  ------------------
  344|  15.4k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (344:3): [True: 0, False: 82.0k]
  ------------------
  345|  15.4k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (345:3): [True: 0, False: 82.0k]
  ------------------
  346|  15.4k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (346:3): [True: 0, False: 82.0k]
  ------------------
  347|  15.4k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (347:3): [True: 0, False: 82.0k]
  ------------------
  348|  15.4k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (348:3): [True: 0, False: 82.0k]
  ------------------
  349|  15.4k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (349:3): [True: 0, False: 82.0k]
  ------------------
  350|  15.4k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (350:3): [True: 0, False: 82.0k]
  ------------------
  351|  15.4k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (351:3): [True: 0, False: 82.0k]
  ------------------
  352|  15.4k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  353|  15.4k|    break;
  354|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (354:3): [True: 0, False: 82.0k]
  ------------------
  355|      0|  case JCS_RGB565:
  ------------------
  |  Branch (355:3): [True: 0, False: 82.0k]
  ------------------
  356|      0|    cinfo->out_color_components = 3;
  357|      0|    break;
  358|      0|  case JCS_CMYK:
  ------------------
  |  Branch (358:3): [True: 0, False: 82.0k]
  ------------------
  359|      0|  case JCS_YCCK:
  ------------------
  |  Branch (359:3): [True: 0, False: 82.0k]
  ------------------
  360|      0|    cinfo->out_color_components = 4;
  361|      0|    break;
  362|  66.5k|  default:                      /* else must be same colorspace as in file */
  ------------------
  |  Branch (362:3): [True: 66.5k, False: 15.4k]
  ------------------
  363|  66.5k|    cinfo->out_color_components = cinfo->num_components;
  364|  66.5k|    break;
  365|  82.0k|  }
  366|  82.0k|  cinfo->output_components = (cinfo->quantize_colors ? 1 :
  ------------------
  |  Branch (366:31): [True: 0, False: 82.0k]
  ------------------
  367|  82.0k|                              cinfo->out_color_components);
  368|       |
  369|       |  /* See if upsampler will want to emit more than one row at a time */
  370|  82.0k|  if (use_merged_upsample(cinfo))
  ------------------
  |  Branch (370:7): [True: 0, False: 82.0k]
  ------------------
  371|      0|    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
  372|  82.0k|  else
  373|  82.0k|    cinfo->rec_outbuf_height = 1;
  374|  82.0k|}
jinit_master_decompress:
  902|  82.0k|{
  903|  82.0k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  904|       |
  905|       |#ifdef WITH_PROFILE
  906|       |  master->pub.total_start = getTime();
  907|       |#endif
  908|       |
  909|  82.0k|  master->pub.prepare_for_output_pass = prepare_for_output_pass;
  910|  82.0k|  master->pub.finish_output_pass = finish_output_pass;
  911|       |
  912|  82.0k|  master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  207|  82.0k|#define FALSE   0               /* values of boolean */
  ------------------
  913|  82.0k|  master->pub.jinit_upsampler_no_alloc = FALSE;
  ------------------
  |  |  207|  82.0k|#define FALSE   0               /* values of boolean */
  ------------------
  914|       |
  915|  82.0k|  master_selection(cinfo);
  916|  82.0k|}
jdmaster.c:jpeg_core_output_dimensions:
  103|  82.0k|{
  104|  82.0k|#ifdef IDCT_SCALING_SUPPORTED
  105|  82.0k|  int ci;
  106|  82.0k|  jpeg_component_info *compptr;
  107|       |
  108|  82.0k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (108:7): [True: 78.6k, False: 3.40k]
  ------------------
  109|       |    /* Compute actual output image dimensions and DCT scaling choices. */
  110|  78.6k|    if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (110:9): [True: 0, False: 78.6k]
  ------------------
  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|  78.6k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (118:16): [True: 0, False: 78.6k]
  ------------------
  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|  78.6k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (126:16): [True: 0, False: 78.6k]
  ------------------
  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|  78.6k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (134:16): [True: 0, False: 78.6k]
  ------------------
  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|  78.6k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (142:16): [True: 0, False: 78.6k]
  ------------------
  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|  78.6k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (150:16): [True: 0, False: 78.6k]
  ------------------
  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|  78.6k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (158:16): [True: 0, False: 78.6k]
  ------------------
  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|  78.6k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (166:16): [True: 78.6k, False: 0]
  ------------------
  167|       |      /* Provide 8/block_size scaling */
  168|  78.6k|      cinfo->output_width = (JDIMENSION)
  169|  78.6k|        jdiv_round_up((long)cinfo->image_width * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  170|  78.6k|      cinfo->output_height = (JDIMENSION)
  171|  78.6k|        jdiv_round_up((long)cinfo->image_height * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  78.6k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  172|  78.6k|      cinfo->_min_DCT_h_scaled_size = 8;
  ------------------
  |  |   28|  78.6k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  173|  78.6k|      cinfo->_min_DCT_v_scaled_size = 8;
  ------------------
  |  |   29|  78.6k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  174|  78.6k|    } 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|   188k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (241:46): [True: 109k, False: 78.6k]
  ------------------
  242|   109k|         ci++, compptr++) {
  243|   109k|      compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   25|   109k|#define _DCT_h_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|   109k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  244|   109k|      compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   26|   109k|#define _DCT_v_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|   109k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  245|   109k|    }
  246|  78.6k|  } else
  247|  3.40k|#endif /* !IDCT_SCALING_SUPPORTED */
  248|  3.40k|  {
  249|       |    /* Hardwire it to "no scaling" */
  250|  3.40k|    cinfo->output_width = cinfo->image_width;
  251|  3.40k|    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.40k|  }
  256|  82.0k|}
jdmaster.c:use_merged_upsample:
   39|   164k|{
   40|   164k|#ifdef UPSAMPLE_MERGING_SUPPORTED
   41|       |  /* Colorspace conversion is not supported with lossless JPEG images */
   42|   164k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (42:7): [True: 6.81k, False: 157k]
  ------------------
   43|  6.81k|    return FALSE;
  ------------------
  |  |  207|  6.81k|#define FALSE   0               /* values of boolean */
  ------------------
   44|       |  /* Merging is the equivalent of plain box-filter upsampling */
   45|   157k|  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
  ------------------
  |  Branch (45:7): [True: 157k, False: 0]
  |  Branch (45:37): [True: 0, False: 0]
  ------------------
   46|   157k|    return FALSE;
  ------------------
  |  |  207|   157k|#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|  72.3k|{
  798|  72.3k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  799|       |
  800|  72.3k|  if (master->pub.is_dummy_pass) {
  ------------------
  |  Branch (800:7): [True: 0, False: 72.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|  72.3k|  } else {
  811|  72.3k|    if (cinfo->quantize_colors && cinfo->colormap == NULL) {
  ------------------
  |  Branch (811:9): [True: 0, False: 72.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|  72.3k|    (*cinfo->idct->start_pass) (cinfo);
  823|  72.3k|    (*cinfo->coef->start_output_pass) (cinfo);
  824|  72.3k|    if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (824:9): [True: 71.2k, False: 1.11k]
  ------------------
  825|  71.2k|      if (!master->using_merged_upsample)
  ------------------
  |  Branch (825:11): [True: 71.2k, False: 0]
  ------------------
  826|  71.2k|        (*cinfo->cconvert->start_pass) (cinfo);
  827|  71.2k|      (*cinfo->upsample->start_pass) (cinfo);
  828|  71.2k|      if (cinfo->quantize_colors)
  ------------------
  |  Branch (828:11): [True: 0, False: 71.2k]
  ------------------
  829|      0|        (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
  830|  71.2k|      (*cinfo->post->start_pass) (cinfo,
  831|  71.2k|            (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  ------------------
  |  Branch (831:14): [True: 0, False: 71.2k]
  ------------------
  832|  71.2k|      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  833|  71.2k|    }
  834|  72.3k|  }
  835|       |
  836|       |  /* Set up progress monitor's pass info if present */
  837|  72.3k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (837:7): [True: 31.4k, False: 40.9k]
  ------------------
  838|  31.4k|    cinfo->progress->completed_passes = master->pass_number;
  839|  31.4k|    cinfo->progress->total_passes = master->pass_number +
  840|  31.4k|                                    (master->pub.is_dummy_pass ? 2 : 1);
  ------------------
  |  Branch (840:38): [True: 0, False: 31.4k]
  ------------------
  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|  31.4k|    if (cinfo->buffered_image && !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (844:9): [True: 0, False: 31.4k]
  |  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|  31.4k|  }
  848|  72.3k|}
jdmaster.c:finish_output_pass:
  857|  30.9k|{
  858|  30.9k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  859|       |
  860|  30.9k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (860:7): [True: 0, False: 30.9k]
  ------------------
  861|      0|    (*cinfo->cquantize->finish_pass) (cinfo);
  862|  30.9k|  master->pass_number++;
  863|  30.9k|}
jdmaster.c:master_selection:
  515|  82.0k|{
  516|  82.0k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  517|  82.0k|  boolean use_c_buffer;
  518|  82.0k|  long samplesperrow;
  519|  82.0k|  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|  82.0k|  if (cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (527:7): [True: 82.0k, False: 0]
  ------------------
  528|  82.0k|      cinfo->data_precision != cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (528:7): [True: 0, False: 82.0k]
  ------------------
  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|  82.0k|#ifdef D_LOSSLESS_SUPPORTED
  539|  82.0k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (539:7): [True: 3.40k, False: 78.6k]
  ------------------
  540|  3.40k|    cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|  3.40k|#define FALSE   0               /* values of boolean */
  ------------------
  541|  3.40k|    cinfo->scale_num = cinfo->scale_denom = 1;
  542|  3.40k|  }
  543|  82.0k|#endif
  544|       |
  545|       |  /* Initialize dimensions and other stuff */
  546|  82.0k|  jpeg_calc_output_dimensions(cinfo);
  547|  82.0k|  prepare_range_limit_table(cinfo);
  548|       |
  549|       |  /* Width of an output scanline must be representable as JDIMENSION. */
  550|  82.0k|  samplesperrow = (long)cinfo->output_width *
  551|  82.0k|                  (long)cinfo->out_color_components;
  552|  82.0k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  553|  82.0k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (553:7): [True: 0, False: 82.0k]
  ------------------
  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|  82.0k|  master->pass_number = 0;
  558|  82.0k|  master->using_merged_upsample = use_merged_upsample(cinfo);
  559|       |
  560|       |  /* Color quantizer selection */
  561|  82.0k|  master->quantizer_1pass = NULL;
  562|  82.0k|  master->quantizer_2pass = NULL;
  563|       |  /* No mode changes if not using buffered-image mode. */
  564|  82.0k|  if (!cinfo->quantize_colors || !cinfo->buffered_image) {
  ------------------
  |  Branch (564:7): [True: 82.0k, False: 0]
  |  Branch (564:34): [True: 0, False: 0]
  ------------------
  565|  82.0k|    cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|  82.0k|#define FALSE   0               /* values of boolean */
  ------------------
  566|  82.0k|    cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|  82.0k|#define FALSE   0               /* values of boolean */
  ------------------
  567|  82.0k|    cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|  82.0k|#define FALSE   0               /* values of boolean */
  ------------------
  568|  82.0k|  }
  569|  82.0k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (569:7): [True: 0, False: 82.0k]
  ------------------
  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|  82.0k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (621:7): [True: 80.9k, False: 1.12k]
  ------------------
  622|  80.9k|    if (master->using_merged_upsample) {
  ------------------
  |  Branch (622:9): [True: 0, False: 80.9k]
  ------------------
  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|  80.9k|    } else {
  634|  80.9k|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (634:11): [True: 80.0k, False: 892]
  ------------------
  635|  80.0k|        jinit_color_deconverter(cinfo);
  636|  80.0k|        jinit_upsampler(cinfo);
  637|  80.0k|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (637:18): [True: 892, False: 0]
  ------------------
  638|    892|        j12init_color_deconverter(cinfo);
  639|    892|        j12init_upsampler(cinfo);
  640|    892|      } 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|  80.9k|    }
  649|  80.9k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (649:9): [True: 79.9k, False: 905]
  ------------------
  650|  79.9k|      jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  651|    905|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (651:14): [True: 892, False: 13]
  ------------------
  652|    892|      j12init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  653|     13|    else
  654|     13|#ifdef D_LOSSLESS_SUPPORTED
  655|     13|      j16init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  656|       |#else
  657|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  658|       |#endif
  659|  80.9k|  }
  660|       |
  661|  82.0k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (661:7): [True: 3.39k, False: 78.6k]
  ------------------
  662|  3.39k|#ifdef D_LOSSLESS_SUPPORTED
  663|       |    /* Prediction, sample undifferencing, point transform, and sample size
  664|       |     * scaling
  665|       |     */
  666|  3.39k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (666:9): [True: 3.08k, False: 309]
  ------------------
  667|  3.08k|      jinit_lossless_decompressor(cinfo);
  668|    309|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (668:14): [True: 309, False: 0]
  ------------------
  669|    309|      j12init_lossless_decompressor(cinfo);
  670|      0|    else
  671|      0|      j16init_lossless_decompressor(cinfo);
  672|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  673|  3.39k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (673:9): [True: 206, False: 3.18k]
  ------------------
  674|    206|      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  ------------------
  |  |  240|    206|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    206|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  675|  3.18k|    } else {
  676|  3.18k|      jinit_lhuff_decoder(cinfo);
  677|  3.18k|    }
  678|       |
  679|       |    /* Initialize principal buffer controllers. */
  680|  3.39k|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (680:20): [True: 281, False: 3.11k]
  ------------------
  681|  3.11k|                   cinfo->buffered_image;
  ------------------
  |  Branch (681:20): [True: 0, False: 3.11k]
  ------------------
  682|  3.39k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (682:9): [True: 2.87k, False: 514]
  ------------------
  683|  2.87k|      jinit_d_diff_controller(cinfo, use_c_buffer);
  684|    514|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (684:14): [True: 308, False: 206]
  ------------------
  685|    308|      j12init_d_diff_controller(cinfo, use_c_buffer);
  686|    206|    else
  687|    206|      j16init_d_diff_controller(cinfo, use_c_buffer);
  688|       |#else
  689|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  690|       |#endif
  691|  78.6k|  } else {
  692|  78.6k|#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) || \
  693|  78.6k|    defined(DCT_FLOAT_SUPPORTED)
  694|       |    /* Inverse DCT */
  695|  78.6k|    if (cinfo->data_precision == 8)
  ------------------
  |  Branch (695:9): [True: 78.0k, False: 596]
  ------------------
  696|  78.0k|      jinit_inverse_dct(cinfo);
  697|    596|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (697:14): [True: 583, False: 13]
  ------------------
  698|    583|      j12init_inverse_dct(cinfo);
  699|     13|    else
  700|     13|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     13|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     13|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  701|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  702|  78.6k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (702:9): [True: 19.0k, False: 59.6k]
  ------------------
  703|  19.0k|#ifdef D_ARITH_CODING_SUPPORTED
  704|  19.0k|      jinit_arith_decoder(cinfo);
  705|       |#else
  706|       |      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  707|       |#endif
  708|  59.6k|    } else {
  709|  59.6k|      if (cinfo->progressive_mode) {
  ------------------
  |  Branch (709:11): [True: 9.32k, False: 50.2k]
  ------------------
  710|  9.32k|#ifdef D_PROGRESSIVE_SUPPORTED
  711|  9.32k|        jinit_phuff_decoder(cinfo);
  712|       |#else
  713|       |        ERREXIT(cinfo, JERR_NOT_COMPILED);
  714|       |#endif
  715|  9.32k|      } else
  716|  50.2k|        jinit_huff_decoder(cinfo);
  717|  59.6k|    }
  718|       |
  719|       |    /* Initialize principal buffer controllers. */
  720|  78.6k|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (720:20): [True: 23.5k, False: 55.1k]
  ------------------
  721|  55.1k|                   cinfo->buffered_image;
  ------------------
  |  Branch (721:20): [True: 0, False: 55.1k]
  ------------------
  722|  78.6k|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (722:9): [True: 583, False: 78.0k]
  ------------------
  723|    583|      j12init_d_coef_controller(cinfo, use_c_buffer);
  724|  78.0k|    else
  725|  78.0k|      jinit_d_coef_controller(cinfo, use_c_buffer);
  726|       |#else
  727|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  728|       |#endif
  729|  78.6k|  }
  730|       |
  731|  82.0k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (731:7): [True: 80.6k, False: 1.34k]
  ------------------
  732|  80.6k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (732:9): [True: 79.7k, False: 891]
  ------------------
  733|  79.7k|      jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|  79.7k|#define FALSE   0               /* values of boolean */
  ------------------
  734|    891|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (734:14): [True: 891, False: 0]
  ------------------
  735|    891|      j12init_d_main_controller(cinfo,
  736|    891|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|    891|#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|  80.6k|  }
  745|       |
  746|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  747|  82.0k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  748|       |
  749|       |  /* Initialize input side of decompressor to consume first scan. */
  750|  82.0k|  (*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|  82.0k|  cinfo->master->first_iMCU_col = 0;
  756|  82.0k|  cinfo->master->last_iMCU_col = cinfo->MCUs_per_row - 1;
  757|  82.0k|  cinfo->master->last_good_iMCU_row = 0;
  758|       |
  759|  82.0k|#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|  82.0k|  if (cinfo->progress != NULL && !cinfo->buffered_image &&
  ------------------
  |  Branch (764:7): [True: 37.6k, False: 44.3k]
  |  Branch (764:34): [True: 37.6k, False: 0]
  ------------------
  765|  37.6k|      cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (765:7): [True: 22.9k, False: 14.7k]
  ------------------
  766|  22.9k|    int nscans;
  767|       |    /* Estimate number of scans to set pass_limit. */
  768|  22.9k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (768:9): [True: 20.5k, False: 2.36k]
  ------------------
  769|       |      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
  770|  20.5k|      nscans = 2 + 3 * cinfo->num_components;
  771|  20.5k|    } else {
  772|       |      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
  773|  2.36k|      nscans = cinfo->num_components;
  774|  2.36k|    }
  775|  22.9k|    cinfo->progress->pass_counter = 0L;
  776|  22.9k|    cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
  777|  22.9k|    cinfo->progress->completed_passes = 0;
  778|  22.9k|    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
  ------------------
  |  Branch (778:38): [True: 0, False: 22.9k]
  ------------------
  779|       |    /* Count the input pass as done */
  780|  22.9k|    master->pass_number++;
  781|  22.9k|  }
  782|  82.0k|#endif /* D_MULTISCAN_FILES_SUPPORTED */
  783|  82.0k|}
jdmaster.c:prepare_range_limit_table:
  420|  82.0k|{
  421|  82.0k|  JSAMPLE *table;
  422|  82.0k|  J12SAMPLE *table12;
  423|  82.0k|#ifdef D_LOSSLESS_SUPPORTED
  424|  82.0k|  J16SAMPLE *table16;
  425|  82.0k|#endif
  426|  82.0k|  int i;
  427|       |
  428|  82.0k|  if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (428:7): [True: 81.1k, False: 892]
  ------------------
  429|  81.1k|    table = (JSAMPLE *)
  430|  81.1k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  81.1k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  431|  81.1k|                  (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  81.1k|#define MAXJSAMPLE       255
  ------------------
                                (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|  81.1k|#define CENTERJSAMPLE    128
  ------------------
  432|  81.1k|    table += (MAXJSAMPLE + 1);  /* allow negative subscripts of simple table */
  ------------------
  |  |   52|  81.1k|#define MAXJSAMPLE       255
  ------------------
  433|  81.1k|    cinfo->sample_range_limit = table;
  434|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  435|  81.1k|    memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  81.1k|#define MAXJSAMPLE       255
  ------------------
                  memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  81.1k|#define MAXJSAMPLE       255
  ------------------
  436|       |    /* Main part of "simple" table: limit[x] = x */
  437|  20.8M|    for (i = 0; i <= MAXJSAMPLE; i++)
  ------------------
  |  |   52|  20.8M|#define MAXJSAMPLE       255
  ------------------
  |  Branch (437:17): [True: 20.7M, False: 81.1k]
  ------------------
  438|  20.7M|      table[i] = (JSAMPLE)i;
  439|  81.1k|    table += CENTERJSAMPLE;     /* Point to where post-IDCT table starts */
  ------------------
  |  |   53|  81.1k|#define CENTERJSAMPLE    128
  ------------------
  440|       |    /* End of simple table, rest of first half of post-IDCT table */
  441|  31.2M|    for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   53|  81.1k|#define CENTERJSAMPLE    128
  ------------------
                  for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   52|  31.2M|#define MAXJSAMPLE       255
  ------------------
  |  Branch (441:29): [True: 31.1M, False: 81.1k]
  ------------------
  442|  31.1M|      table[i] = MAXJSAMPLE;
  ------------------
  |  |   52|  31.1M|#define MAXJSAMPLE       255
  ------------------
  443|       |    /* Second half of post-IDCT table */
  444|  81.1k|    memset(table + (2 * (MAXJSAMPLE + 1)), 0,
  ------------------
  |  |   52|  81.1k|#define MAXJSAMPLE       255
  ------------------
  445|  81.1k|           (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  81.1k|#define MAXJSAMPLE       255
  ------------------
                         (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|  81.1k|#define CENTERJSAMPLE    128
  ------------------
  446|  81.1k|    memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   52|  81.1k|#define MAXJSAMPLE       255
  ------------------
                  memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   53|  81.1k|#define CENTERJSAMPLE    128
  ------------------
  447|  81.1k|           cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
  ------------------
  |  |   53|  81.1k|#define CENTERJSAMPLE    128
  ------------------
  448|  81.1k|  } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (448:14): [True: 892, False: 0]
  ------------------
  449|    892|    table12 = (J12SAMPLE *)
  450|    892|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    892|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  451|    892|                  (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   60|    892|#define MAXJ12SAMPLE     4095
  ------------------
                                (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   61|    892|#define CENTERJ12SAMPLE  2048
  ------------------
  452|    892|                  sizeof(J12SAMPLE));
  453|    892|    table12 += (MAXJ12SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   60|    892|#define MAXJ12SAMPLE     4095
  ------------------
  454|       |                                       table */
  455|    892|    cinfo->sample_range_limit = (JSAMPLE *)table12;
  456|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  457|    892|    memset(table12 - (MAXJ12SAMPLE + 1), 0,
  ------------------
  |  |   60|    892|#define MAXJ12SAMPLE     4095
  ------------------
  458|    892|           (MAXJ12SAMPLE + 1) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|    892|#define MAXJ12SAMPLE     4095
  ------------------
  459|       |    /* Main part of "simple" table: limit[x] = x */
  460|  3.65M|    for (i = 0; i <= MAXJ12SAMPLE; i++)
  ------------------
  |  |   60|  3.65M|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (460:17): [True: 3.65M, False: 892]
  ------------------
  461|  3.65M|      table12[i] = (J12SAMPLE)i;
  462|    892|    table12 += CENTERJ12SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   61|    892|#define CENTERJ12SAMPLE  2048
  ------------------
  463|       |    /* End of simple table, rest of first half of post-IDCT table */
  464|  5.48M|    for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   61|    892|#define CENTERJ12SAMPLE  2048
  ------------------
                  for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   60|  5.48M|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (464:31): [True: 5.48M, False: 892]
  ------------------
  465|  5.48M|      table12[i] = MAXJ12SAMPLE;
  ------------------
  |  |   60|  5.48M|#define MAXJ12SAMPLE     4095
  ------------------
  466|       |    /* Second half of post-IDCT table */
  467|    892|    memset(table12 + (2 * (MAXJ12SAMPLE + 1)), 0,
  ------------------
  |  |   60|    892|#define MAXJ12SAMPLE     4095
  ------------------
  468|    892|           (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|    892|#define MAXJ12SAMPLE     4095
  ------------------
                         (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   61|    892|#define CENTERJ12SAMPLE  2048
  ------------------
  469|    892|    memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   60|    892|#define MAXJ12SAMPLE     4095
  ------------------
                  memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   61|    892|#define CENTERJ12SAMPLE  2048
  ------------------
  470|    892|           cinfo->sample_range_limit, CENTERJ12SAMPLE * sizeof(J12SAMPLE));
  ------------------
  |  |   61|    892|#define CENTERJ12SAMPLE  2048
  ------------------
  471|    892|  } 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|  82.0k|}

jinit_phuff_decoder:
  654|  9.32k|{
  655|  9.32k|  phuff_entropy_ptr entropy;
  656|  9.32k|  int *coef_bit_ptr;
  657|  9.32k|  int ci, i;
  658|       |
  659|  9.32k|  entropy = (phuff_entropy_ptr)
  660|  9.32k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  9.32k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|  9.32k|                                sizeof(phuff_entropy_decoder));
  662|  9.32k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|  9.32k|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|  46.6k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  46.6k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 37.3k, False: 9.32k]
  ------------------
  667|  37.3k|    entropy->derived_tbls[i] = NULL;
  668|  37.3k|  }
  669|       |
  670|       |  /* Create progression status table */
  671|  9.32k|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|  9.32k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  9.32k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|  9.32k|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  9.32k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|  9.32k|                                sizeof(int));
  675|  9.32k|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|  27.5k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 18.2k, False: 9.32k]
  ------------------
  677|  1.18M|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  1.18M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 1.16M, False: 18.2k]
  ------------------
  678|  1.16M|      *coef_bit_ptr++ = -1;
  679|  9.32k|}
jdphuff.c:start_pass_phuff_decoder:
   83|  13.2k|{
   84|  13.2k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|  13.2k|  boolean is_DC_band, bad;
   86|  13.2k|  int ci, coefi, tbl;
   87|  13.2k|  d_derived_tbl **pdtbl;
   88|  13.2k|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|  13.2k|  jpeg_component_info *compptr;
   90|       |
   91|  13.2k|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|  13.2k|  bad = FALSE;
  ------------------
  |  |  207|  13.2k|#define FALSE   0               /* values of boolean */
  ------------------
   95|  13.2k|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 6.91k, False: 6.30k]
  ------------------
   96|  6.91k|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 306, False: 6.60k]
  ------------------
   97|    306|      bad = TRUE;
  ------------------
  |  |  210|    306|#define TRUE    1
  ------------------
   98|  6.91k|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|  6.30k|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|  5.87k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 425, False: 5.87k]
  |  Branch (100:34): [True: 194, False: 5.68k]
  ------------------
  101|    619|      bad = TRUE;
  ------------------
  |  |  210|    619|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|  6.30k|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 416, False: 5.88k]
  ------------------
  104|    416|      bad = TRUE;
  ------------------
  |  |  210|    416|#define TRUE    1
  ------------------
  105|  6.30k|  }
  106|  13.2k|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 7.46k, False: 5.75k]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|  7.46k|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 582, False: 6.88k]
  ------------------
  109|    582|      bad = TRUE;
  ------------------
  |  |  210|    582|#define TRUE    1
  ------------------
  110|  7.46k|  }
  111|  13.2k|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 446, False: 12.7k]
  ------------------
  112|    446|    bad = TRUE;
  ------------------
  |  |  210|    446|#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|  13.2k|  if (bad)
  ------------------
  |  Branch (119:7): [True: 1.16k, False: 12.0k]
  ------------------
  120|  1.16k|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.16k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.16k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.16k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.16k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.16k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.16k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|  13.2k|             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|  29.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 16.4k, False: 13.2k]
  ------------------
  127|  16.4k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|  16.4k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|  16.4k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|  16.4k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 5.45k, False: 10.9k]
  |  Branch (130:24): [True: 4.16k, False: 1.29k]
  ------------------
  131|  4.16k|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  4.16k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  4.16k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  4.16k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  4.16k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  132|   370k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  16.4k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 10.9k, False: 5.45k]
  |  |  ------------------
  ------------------
                  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: 249k, False: 121k]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 354k, False: 16.4k]
  ------------------
  133|   354k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 102k, False: 251k]
  ------------------
  134|   102k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|   251k|      else
  136|   251k|        prev_coef_bit_ptr[coefi] = 0;
  137|   354k|    }
  138|   188k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 172k, False: 16.4k]
  ------------------
  139|   172k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 139k, False: 33.0k]
  ------------------
  140|   172k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 70.1k, False: 102k]
  ------------------
  141|  70.1k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  70.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  70.1k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  70.1k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  70.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  142|   172k|      coef_bit_ptr[coefi] = cinfo->Al;
  143|   172k|    }
  144|  16.4k|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|  13.2k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 5.17k, False: 8.04k]
  ------------------
  148|  5.17k|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 2.10k, False: 3.06k]
  ------------------
  149|  2.10k|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|  3.06k|    else
  151|  3.06k|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|  8.04k|  } else {
  153|  8.04k|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 4.49k, False: 3.54k]
  ------------------
  154|  4.49k|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|  3.54k|    else
  156|  3.54k|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|  8.04k|  }
  158|       |
  159|  29.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 16.4k, False: 13.2k]
  ------------------
  160|  16.4k|    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|  16.4k|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 10.9k, False: 5.45k]
  ------------------
  165|  10.9k|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 5.90k, False: 5.06k]
  ------------------
  166|  5.90k|        tbl = compptr->dc_tbl_no;
  167|  5.90k|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|  5.90k|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  210|  5.90k|#define TRUE    1
  ------------------
  169|  5.90k|      }
  170|  10.9k|    } else {
  171|  5.45k|      tbl = compptr->ac_tbl_no;
  172|  5.45k|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|  5.45k|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  207|  5.45k|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|  5.45k|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|  5.45k|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|  16.4k|    entropy->saved.last_dc_val[ci] = 0;
  179|  16.4k|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|  13.2k|  entropy->bitstate.bits_left = 0;
  183|  13.2k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|  13.2k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  13.2k|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|  13.2k|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|  13.2k|  entropy->restarts_to_go = cinfo->restart_interval;
  191|  13.2k|}
jdphuff.c:decode_mcu_DC_first:
  291|  2.49M|{
  292|  2.49M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  2.49M|  int Al = cinfo->Al;
  294|  2.49M|  register int s, r;
  295|  2.49M|  int blkn, ci;
  296|  2.49M|  JBLOCKROW block;
  297|  2.49M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  2.49M|  register bit_buf_type get_buffer; \
  |  |  126|  2.49M|  register int bits_left; \
  |  |  127|  2.49M|  bitread_working_state br_state
  ------------------
  298|  2.49M|  savable_state state;
  299|  2.49M|  d_derived_tbl *tbl;
  300|  2.49M|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  2.49M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 14.9k, False: 2.48M]
  ------------------
  304|  14.9k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (304:9): [True: 6.04k, False: 8.88k]
  ------------------
  305|  6.04k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (305:11): [True: 0, False: 6.04k]
  ------------------
  306|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  307|  14.9k|  }
  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.49M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 11.5k, False: 2.48M]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  11.5k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  11.5k|  br_state.cinfo = cinfop; \
  |  |  131|  11.5k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  11.5k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  11.5k|  get_buffer = permstate.get_buffer; \
  |  |  134|  11.5k|  bits_left = permstate.bits_left;
  ------------------
  316|  11.5k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|  45.6k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 34.1k, False: 11.5k]
  ------------------
  321|  34.1k|      block = MCU_data[blkn];
  322|  34.1k|      ci = cinfo->MCU_membership[blkn];
  323|  34.1k|      compptr = cinfo->cur_comp_info[ci];
  324|  34.1k|      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|  34.1k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|  34.1k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  34.1k|  register int nb, look; \
  |  |  202|  34.1k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  34.1k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 4.54k, False: 29.5k]
  |  |  ------------------
  |  |  203|  4.54k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 4.54k]
  |  |  ------------------
  |  |  204|  4.54k|      { failaction; } \
  |  |  205|  4.54k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  4.54k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  4.54k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 703, False: 3.84k]
  |  |  ------------------
  |  |  207|    703|      nb = 1;  goto slowlabel; \
  |  |  208|    703|    } \
  |  |  209|  4.54k|  } \
  |  |  210|  34.1k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  33.4k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  33.4k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  33.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  33.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 29.8k, False: 3.52k]
  |  |  ------------------
  |  |  212|  29.8k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  29.8k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  29.8k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  29.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  29.8k|  } else { \
  |  |  215|  4.22k|slowlabel: \
  |  |  216|  4.22k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 4.22k]
  |  |  ------------------
  |  |  217|  4.22k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  4.22k|      { failaction; } \
  |  |  219|  4.22k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  4.22k|  } \
  |  |  221|  33.4k|}
  ------------------
  330|  34.1k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 9.66k, False: 24.4k]
  ------------------
  331|  9.66k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  9.66k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  9.66k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 895, False: 8.77k]
  |  |  ------------------
  |  |  162|    895|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 895]
  |  |  ------------------
  |  |  163|    895|      { action; } \
  |  |  164|    895|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    895|  } \
  |  |  166|  9.66k|}
  ------------------
  332|  9.66k|        r = GET_BITS(s);
  ------------------
  |  |  169|  9.66k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|  9.66k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  9.66k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  6.91k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 6.91k, False: 2.74k]
  |  |  ------------------
  ------------------
  334|  9.66k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|  34.1k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 21.8k, False: 12.2k]
  ------------------
  338|  21.8k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 21.8k]
  ------------------
  339|  34.1k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 12.2k, False: 21.8k]
  |  Branch (339:41): [True: 0, False: 12.2k]
  ------------------
  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|  34.1k|      s += state.last_dc_val[ci];
  342|  34.1k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|  34.1k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  34.1k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  34.1k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  11.5k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  11.5k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  11.5k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  11.5k|  permstate.get_buffer = get_buffer; \
  |  |  140|  11.5k|  permstate.bits_left = bits_left
  ------------------
  349|  11.5k|    entropy->saved = state;
  350|  11.5k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  2.49M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 14.9k, False: 2.48M]
  ------------------
  354|  14.9k|    entropy->restarts_to_go--;
  355|       |
  356|  2.49M|  return TRUE;
  ------------------
  |  |  210|  2.49M|#define TRUE    1
  ------------------
  357|  2.49M|}
jdphuff.c:process_restart:
  233|  24.6k|{
  234|  24.6k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  235|  24.6k|  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|  24.6k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  240|  24.6k|  entropy->bitstate.bits_left = 0;
  241|       |
  242|       |  /* Advance past the RSTn marker */
  243|  24.6k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (243:7): [True: 0, False: 24.6k]
  ------------------
  244|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  245|       |
  246|       |  /* Re-initialize DC predictions to 0 */
  247|  53.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (247:16): [True: 28.9k, False: 24.6k]
  ------------------
  248|  28.9k|    entropy->saved.last_dc_val[ci] = 0;
  249|       |  /* Re-init EOB run count, too */
  250|  24.6k|  entropy->saved.EOBRUN = 0;
  251|       |
  252|       |  /* Reset restart counter */
  253|  24.6k|  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|  24.6k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (260:7): [True: 757, False: 23.9k]
  ------------------
  261|    757|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    757|#define FALSE   0               /* values of boolean */
  ------------------
  262|       |
  263|  24.6k|  return TRUE;
  ------------------
  |  |  210|  24.6k|#define TRUE    1
  ------------------
  264|  24.6k|}
jdphuff.c:decode_mcu_AC_first:
  367|  1.08M|{
  368|  1.08M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  369|  1.08M|  int Se = cinfo->Se;
  370|  1.08M|  int Al = cinfo->Al;
  371|  1.08M|  register int s, k, r;
  372|  1.08M|  unsigned int EOBRUN;
  373|  1.08M|  JBLOCKROW block;
  374|  1.08M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  1.08M|  register bit_buf_type get_buffer; \
  |  |  126|  1.08M|  register int bits_left; \
  |  |  127|  1.08M|  bitread_working_state br_state
  ------------------
  375|  1.08M|  d_derived_tbl *tbl;
  376|       |
  377|       |  /* Process restart marker if needed; may have to suspend */
  378|  1.08M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 103k, False: 977k]
  ------------------
  379|   103k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (379:9): [True: 4.62k, False: 98.7k]
  ------------------
  380|  4.62k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (380:11): [True: 0, False: 4.62k]
  ------------------
  381|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  382|   103k|  }
  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|  1.08M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (387:7): [True: 117k, False: 964k]
  ------------------
  388|       |
  389|       |    /* Load up working state.
  390|       |     * We can avoid loading/saving bitread state if in an EOB run.
  391|       |     */
  392|   117k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  393|       |
  394|       |    /* There is always only one block per MCU */
  395|       |
  396|   117k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (396:9): [True: 106k, False: 10.8k]
  ------------------
  397|   106k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  398|  10.8k|    else {
  399|  10.8k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  10.8k|  br_state.cinfo = cinfop; \
  |  |  131|  10.8k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  10.8k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  10.8k|  get_buffer = permstate.get_buffer; \
  |  |  134|  10.8k|  bits_left = permstate.bits_left;
  ------------------
  400|  10.8k|      block = MCU_data[0];
  401|  10.8k|      tbl = entropy->ac_derived_tbl;
  402|       |
  403|  85.9k|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (403:27): [True: 82.2k, False: 3.77k]
  ------------------
  404|  82.2k|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  200|  82.2k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  82.2k|  register int nb, look; \
  |  |  202|  82.2k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  82.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 12.4k, False: 69.7k]
  |  |  ------------------
  |  |  203|  12.4k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 12.4k]
  |  |  ------------------
  |  |  204|  12.4k|      { failaction; } \
  |  |  205|  12.4k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  12.4k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  12.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 3.73k, False: 8.76k]
  |  |  ------------------
  |  |  207|  3.73k|      nb = 1;  goto slowlabel; \
  |  |  208|  3.73k|    } \
  |  |  209|  12.4k|  } \
  |  |  210|  82.2k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  78.4k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  78.4k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  78.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  78.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 73.7k, False: 4.69k]
  |  |  ------------------
  |  |  212|  73.7k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  73.7k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  73.7k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  73.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  73.7k|  } else { \
  |  |  215|  8.42k|slowlabel: \
  |  |  216|  8.42k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 8.42k]
  |  |  ------------------
  |  |  217|  8.42k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  8.42k|      { failaction; } \
  |  |  219|  8.42k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  8.42k|  } \
  |  |  221|  78.4k|}
  ------------------
  405|  82.2k|        r = s >> 4;
  406|  82.2k|        s &= 15;
  407|  82.2k|        if (s) {
  ------------------
  |  Branch (407:13): [True: 74.9k, False: 7.27k]
  ------------------
  408|  74.9k|          k += r;
  409|  74.9k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  74.9k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  74.9k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 10.4k, False: 64.5k]
  |  |  ------------------
  |  |  162|  10.4k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 10.4k]
  |  |  ------------------
  |  |  163|  10.4k|      { action; } \
  |  |  164|  10.4k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  10.4k|  } \
  |  |  166|  74.9k|}
  ------------------
  410|  74.9k|          r = GET_BITS(s);
  ------------------
  |  |  169|  74.9k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  411|  74.9k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  74.9k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  67.7k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 67.7k, False: 7.14k]
  |  |  ------------------
  ------------------
  412|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  413|  74.9k|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  74.9k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  414|  74.9k|        } else {
  415|  7.27k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (415:15): [True: 240, False: 7.03k]
  ------------------
  416|    240|            k += 15;            /* skip 15 zeroes in band */
  417|  7.03k|          } else {              /* EOBr, run length is 2^r + appended bits */
  418|  7.03k|            EOBRUN = 1 << r;
  419|  7.03k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (419:17): [True: 1.20k, False: 5.83k]
  ------------------
  420|  1.20k|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  160|  1.20k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.20k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 213, False: 991]
  |  |  ------------------
  |  |  162|    213|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 213]
  |  |  ------------------
  |  |  163|    213|      { action; } \
  |  |  164|    213|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    213|  } \
  |  |  166|  1.20k|}
  ------------------
  421|  1.20k|              r = GET_BITS(r);
  ------------------
  |  |  169|  1.20k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  422|  1.20k|              EOBRUN += r;
  423|  1.20k|            }
  424|  7.03k|            EOBRUN--;           /* this band is processed at this moment */
  425|  7.03k|            break;              /* force end-of-band */
  426|  7.03k|          }
  427|  7.27k|        }
  428|  82.2k|      }
  429|       |
  430|  10.8k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  10.8k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  10.8k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  10.8k|  permstate.get_buffer = get_buffer; \
  |  |  140|  10.8k|  permstate.bits_left = bits_left
  ------------------
  431|  10.8k|    }
  432|       |
  433|       |    /* Completed MCU, so update state */
  434|   117k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  435|   117k|  }
  436|       |
  437|       |  /* Account for restart interval (no-op if not using restarts) */
  438|  1.08M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (438:7): [True: 103k, False: 977k]
  ------------------
  439|   103k|    entropy->restarts_to_go--;
  440|       |
  441|  1.08M|  return TRUE;
  ------------------
  |  |  210|  1.08M|#define TRUE    1
  ------------------
  442|  1.08M|}
jdphuff.c:decode_mcu_DC_refine:
  453|   362k|{
  454|   362k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  455|   362k|  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
  456|   362k|  int blkn;
  457|   362k|  JBLOCKROW block;
  458|   362k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   362k|  register bit_buf_type get_buffer; \
  |  |  126|   362k|  register int bits_left; \
  |  |  127|   362k|  bitread_working_state br_state
  ------------------
  459|       |
  460|       |  /* Process restart marker if needed; may have to suspend */
  461|   362k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (461:7): [True: 181k, False: 181k]
  ------------------
  462|   181k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (462:9): [True: 5.60k, False: 175k]
  ------------------
  463|  5.60k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (463:11): [True: 0, False: 5.60k]
  ------------------
  464|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  465|   181k|  }
  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|   362k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   362k|  br_state.cinfo = cinfop; \
  |  |  131|   362k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   362k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   362k|  get_buffer = permstate.get_buffer; \
  |  |  134|   362k|  bits_left = permstate.bits_left;
  ------------------
  473|       |
  474|       |  /* Outer loop handles each block in the MCU */
  475|       |
  476|   728k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (476:18): [True: 365k, False: 362k]
  ------------------
  477|   365k|    block = MCU_data[blkn];
  478|       |
  479|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  480|   365k|    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
  ------------------
  |  |  160|   365k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   365k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 13.0k, False: 352k]
  |  |  ------------------
  |  |  162|  13.0k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 13.0k]
  |  |  ------------------
  |  |  163|  13.0k|      { action; } \
  |  |  164|  13.0k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  13.0k|  } \
  |  |  166|   365k|}
  ------------------
  481|   365k|    if (GET_BITS(1))
  ------------------
  |  |  169|   365k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 69.0k, False: 296k]
  |  |  ------------------
  ------------------
  482|  69.0k|      (*block)[0] |= p1;
  483|       |    /* Note: since we use |=, repeating the assignment later is safe */
  484|   365k|  }
  485|       |
  486|       |  /* Completed MCU, so update state */
  487|   362k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   362k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   362k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   362k|  permstate.get_buffer = get_buffer; \
  |  |  140|   362k|  permstate.bits_left = bits_left
  ------------------
  488|       |
  489|       |  /* Account for restart interval (no-op if not using restarts) */
  490|   362k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (490:7): [True: 181k, False: 181k]
  ------------------
  491|   181k|    entropy->restarts_to_go--;
  492|       |
  493|   362k|  return TRUE;
  ------------------
  |  |  210|   362k|#define TRUE    1
  ------------------
  494|   362k|}
jdphuff.c:decode_mcu_AC_refine:
  503|   463k|{
  504|   463k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  505|   463k|  int Se = cinfo->Se;
  506|   463k|  int p1 = 1 << cinfo->Al;        /* 1 in the bit position being coded */
  507|   463k|  int m1 = (NEG_1) << cinfo->Al;  /* -1 in the bit position being coded */
  ------------------
  |  |  202|   463k|#define NEG_1  ((unsigned)-1)
  ------------------
  508|   463k|  register int s, k, r;
  509|   463k|  unsigned int EOBRUN;
  510|   463k|  JBLOCKROW block;
  511|   463k|  JCOEFPTR thiscoef;
  512|   463k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   463k|  register bit_buf_type get_buffer; \
  |  |  126|   463k|  register int bits_left; \
  |  |  127|   463k|  bitread_working_state br_state
  ------------------
  513|   463k|  d_derived_tbl *tbl;
  514|   463k|  int num_newnz;
  515|   463k|  int newnz_pos[DCTSIZE2];
  516|       |
  517|       |  /* Process restart marker if needed; may have to suspend */
  518|   463k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (518:7): [True: 117k, False: 346k]
  ------------------
  519|   117k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (519:9): [True: 8.42k, False: 108k]
  ------------------
  520|  8.42k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (520:11): [True: 0, False: 8.42k]
  ------------------
  521|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  522|   117k|  }
  523|       |
  524|       |  /* If we've run out of data, don't modify the MCU.
  525|       |   */
  526|   463k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (526:7): [True: 43.3k, False: 420k]
  ------------------
  527|       |
  528|       |    /* Load up working state */
  529|  43.3k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  43.3k|  br_state.cinfo = cinfop; \
  |  |  131|  43.3k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  43.3k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  43.3k|  get_buffer = permstate.get_buffer; \
  |  |  134|  43.3k|  bits_left = permstate.bits_left;
  ------------------
  530|  43.3k|    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
  531|       |
  532|       |    /* There is always only one block per MCU */
  533|  43.3k|    block = MCU_data[0];
  534|  43.3k|    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|  43.3k|    num_newnz = 0;
  543|       |
  544|       |    /* initialize coefficient loop counter to start of band */
  545|  43.3k|    k = cinfo->Ss;
  546|       |
  547|  43.3k|    if (EOBRUN == 0) {
  ------------------
  |  Branch (547:9): [True: 14.4k, False: 28.9k]
  ------------------
  548|  85.9k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (548:14): [True: 81.5k, False: 4.36k]
  ------------------
  549|  81.5k|        HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
  ------------------
  |  |  200|  81.5k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  81.5k|  register int nb, look; \
  |  |  202|  81.5k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  81.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 10.5k, False: 71.0k]
  |  |  ------------------
  |  |  203|  10.5k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 10.5k]
  |  |  ------------------
  |  |  204|  10.5k|      { failaction; } \
  |  |  205|  10.5k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  10.5k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  10.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 4.92k, False: 5.59k]
  |  |  ------------------
  |  |  207|  4.92k|      nb = 1;  goto slowlabel; \
  |  |  208|  4.92k|    } \
  |  |  209|  10.5k|  } \
  |  |  210|  81.5k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  76.6k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  76.6k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  76.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  76.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 72.1k, False: 4.48k]
  |  |  ------------------
  |  |  212|  72.1k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  72.1k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  72.1k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  72.1k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  72.1k|  } else { \
  |  |  215|  9.40k|slowlabel: \
  |  |  216|  9.40k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 9.40k]
  |  |  ------------------
  |  |  217|  9.40k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  9.40k|      { failaction; } \
  |  |  219|  9.40k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  9.40k|  } \
  |  |  221|  76.6k|}
  ------------------
  550|  81.5k|        r = s >> 4;
  551|  81.5k|        s &= 15;
  552|  81.5k|        if (s) {
  ------------------
  |  Branch (552:13): [True: 71.2k, False: 10.2k]
  ------------------
  553|  71.2k|          if (s != 1)           /* size of new coef should always be 1 */
  ------------------
  |  Branch (553:15): [True: 67.1k, False: 4.11k]
  ------------------
  554|  67.1k|            WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|  67.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  67.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  555|  71.2k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  71.2k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  71.2k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 443, False: 70.8k]
  |  |  ------------------
  |  |  162|    443|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 443]
  |  |  ------------------
  |  |  163|    443|      { action; } \
  |  |  164|    443|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    443|  } \
  |  |  166|  71.2k|}
  ------------------
  556|  71.2k|          if (GET_BITS(1))
  ------------------
  |  |  169|  71.2k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 12.0k, False: 59.2k]
  |  |  ------------------
  ------------------
  557|  12.0k|            s = p1;             /* newly nonzero coef is positive */
  558|  59.2k|          else
  559|  59.2k|            s = m1;             /* newly nonzero coef is negative */
  560|  71.2k|        } else {
  561|  10.2k|          if (r != 15) {
  ------------------
  |  Branch (561:15): [True: 10.0k, False: 255]
  ------------------
  562|  10.0k|            EOBRUN = 1 << r;    /* EOBr, run length is 2^r + appended bits */
  563|  10.0k|            if (r) {
  ------------------
  |  Branch (563:17): [True: 1.96k, False: 8.07k]
  ------------------
  564|  1.96k|              CHECK_BIT_BUFFER(br_state, r, goto undoit);
  ------------------
  |  |  160|  1.96k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.96k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 252, False: 1.71k]
  |  |  ------------------
  |  |  162|    252|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 252]
  |  |  ------------------
  |  |  163|    252|      { action; } \
  |  |  164|    252|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    252|  } \
  |  |  166|  1.96k|}
  ------------------
  565|  1.96k|              r = GET_BITS(r);
  ------------------
  |  |  169|  1.96k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  566|  1.96k|              EOBRUN += r;
  567|  1.96k|            }
  568|  10.0k|            break;              /* rest of block is handled by EOB logic */
  569|  10.0k|          }
  570|       |          /* note s = 0 for processing ZRL */
  571|  10.2k|        }
  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|   156k|        do {
  577|   156k|          thiscoef = *block + jpeg_natural_order[k];
  578|   156k|          if (*thiscoef != 0) {
  ------------------
  |  Branch (578:15): [True: 9.68k, False: 146k]
  ------------------
  579|  9.68k|            CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  9.68k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  9.68k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 232, False: 9.45k]
  |  |  ------------------
  |  |  162|    232|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 232]
  |  |  ------------------
  |  |  163|    232|      { action; } \
  |  |  164|    232|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    232|  } \
  |  |  166|  9.68k|}
  ------------------
  580|  9.68k|            if (GET_BITS(1)) {
  ------------------
  |  |  169|  9.68k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 2.62k, False: 7.06k]
  |  |  ------------------
  ------------------
  581|  2.62k|              if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
  ------------------
  |  Branch (581:19): [True: 823, False: 1.80k]
  ------------------
  582|    823|                if (*thiscoef >= 0)
  ------------------
  |  Branch (582:21): [True: 461, False: 362]
  ------------------
  583|    461|                  *thiscoef += (JCOEF)p1;
  584|    362|                else
  585|    362|                  *thiscoef += (JCOEF)m1;
  586|    823|              }
  587|  2.62k|            }
  588|   146k|          } else {
  589|   146k|            if (--r < 0)
  ------------------
  |  Branch (589:17): [True: 69.3k, False: 77.2k]
  ------------------
  590|  69.3k|              break;            /* reached target zero coefficient */
  591|   146k|          }
  592|  86.9k|          k++;
  593|  86.9k|        } while (k <= Se);
  ------------------
  |  Branch (593:18): [True: 84.7k, False: 2.20k]
  ------------------
  594|  71.5k|        if (s) {
  ------------------
  |  Branch (594:13): [True: 71.2k, False: 255]
  ------------------
  595|  71.2k|          int pos = jpeg_natural_order[k];
  596|       |          /* Output newly nonzero coefficient */
  597|  71.2k|          (*block)[pos] = (JCOEF)s;
  598|       |          /* Remember its position in case we have to suspend */
  599|  71.2k|          newnz_pos[num_newnz++] = pos;
  600|  71.2k|        }
  601|  71.5k|      }
  602|  14.4k|    }
  603|       |
  604|  43.3k|    if (EOBRUN > 0) {
  ------------------
  |  Branch (604:9): [True: 38.9k, False: 4.36k]
  ------------------
  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|   951k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (610:14): [True: 912k, False: 38.9k]
  ------------------
  611|   912k|        thiscoef = *block + jpeg_natural_order[k];
  612|   912k|        if (*thiscoef != 0) {
  ------------------
  |  Branch (612:13): [True: 13.7k, False: 898k]
  ------------------
  613|  13.7k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  13.7k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  13.7k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 298, False: 13.4k]
  |  |  ------------------
  |  |  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|  13.7k|}
  ------------------
  614|  13.7k|          if (GET_BITS(1)) {
  ------------------
  |  |  169|  13.7k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 2.79k, False: 10.9k]
  |  |  ------------------
  ------------------
  615|  2.79k|            if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
  ------------------
  |  Branch (615:17): [True: 1.94k, False: 843]
  ------------------
  616|  1.94k|              if (*thiscoef >= 0)
  ------------------
  |  Branch (616:19): [True: 1.03k, False: 915]
  ------------------
  617|  1.03k|                *thiscoef += (JCOEF)p1;
  618|    915|              else
  619|    915|                *thiscoef += (JCOEF)m1;
  620|  1.94k|            }
  621|  2.79k|          }
  622|  13.7k|        }
  623|   912k|      }
  624|       |      /* Count one block completed in EOB run */
  625|  38.9k|      EOBRUN--;
  626|  38.9k|    }
  627|       |
  628|       |    /* Completed MCU, so update state */
  629|  43.3k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  43.3k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  43.3k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  43.3k|  permstate.get_buffer = get_buffer; \
  |  |  140|  43.3k|  permstate.bits_left = bits_left
  ------------------
  630|  43.3k|    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
  631|  43.3k|  }
  632|       |
  633|       |  /* Account for restart interval (no-op if not using restarts) */
  634|   463k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (634:7): [True: 117k, False: 346k]
  ------------------
  635|   117k|    entropy->restarts_to_go--;
  636|       |
  637|   463k|  return TRUE;
  ------------------
  |  |  210|   463k|#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|   463k|}

jinit_d_post_controller:
  267|  79.9k|{
  268|  79.9k|  my_post_ptr post;
  269|       |
  270|  79.9k|#ifdef D_LOSSLESS_SUPPORTED
  271|  79.9k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 3.08k, False: 76.9k]
  ------------------
  272|  3.08k|#if BITS_IN_JSAMPLE == 8
  273|  3.08k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.16k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (273:9): [True: 0, False: 3.08k]
  |  Branch (273:52): [True: 0, False: 3.08k]
  ------------------
  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.08k|  } else
  280|  76.9k|#endif
  281|  76.9k|  {
  282|  76.9k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  76.9k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (282:9): [True: 0, False: 76.9k]
  ------------------
  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|  76.9k|  }
  285|       |
  286|  79.9k|  post = (my_post_ptr)
  287|  79.9k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  79.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|  79.9k|                                sizeof(my_post_controller));
  289|  79.9k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|  79.9k|  post->pub.start_pass = start_pass_dpost;
  291|  79.9k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|  79.9k|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|  79.9k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 79.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|  79.9k|}
jdpostct-8.c:start_pass_dpost:
   85|  70.3k|{
   86|  70.3k|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|  70.3k|  switch (pass_mode) {
   89|  70.3k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 70.3k, False: 0]
  ------------------
   90|  70.3k|#if BITS_IN_JSAMPLE != 16
   91|  70.3k|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 70.3k]
  ------------------
   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|  70.3k|#endif
  105|  70.3k|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|  70.3k|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  260|  70.3k|#define _post_process_data  post_process_data
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  265|  70.3k|#define _upsample  upsample
  ------------------
  110|  70.3k|    }
  111|  70.3k|    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: 70.3k]
  ------------------
  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: 70.3k]
  ------------------
  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: 70.3k]
  ------------------
  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|  70.3k|  }
  130|  70.3k|  post->starting_row = post->next_row = 0;
  131|  70.3k|}
j12init_d_post_controller:
  267|    892|{
  268|    892|  my_post_ptr post;
  269|       |
  270|    892|#ifdef D_LOSSLESS_SUPPORTED
  271|    892|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 309, False: 583]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|    309|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    618|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (275:9): [True: 0, False: 309]
  ------------------
  276|    309|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    309|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (276:9): [True: 0, False: 309]
  ------------------
  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|    309|  } else
  280|    583|#endif
  281|    583|  {
  282|    583|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    583|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (282:9): [True: 0, False: 583]
  ------------------
  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|    583|  }
  285|       |
  286|    892|  post = (my_post_ptr)
  287|    892|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    892|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|    892|                                sizeof(my_post_controller));
  289|    892|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|    892|  post->pub.start_pass = start_pass_dpost;
  291|    892|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|    892|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|    892|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 892]
  ------------------
  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|    892|}
jdpostct-12.c:start_pass_dpost:
   85|    873|{
   86|    873|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|    873|  switch (pass_mode) {
   89|    873|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 873, False: 0]
  ------------------
   90|    873|#if BITS_IN_JSAMPLE != 16
   91|    873|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 873]
  ------------------
   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|    873|#endif
  105|    873|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|    873|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  144|    873|#define _post_process_data  post_process_data_12
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  149|    873|#define _upsample  upsample_12
  ------------------
  110|    873|    }
  111|    873|    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: 873]
  ------------------
  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: 873]
  ------------------
  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: 873]
  ------------------
  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|    873|  }
  130|    873|  post->starting_row = post->next_row = 0;
  131|    873|}

jinit_upsampler:
  438|  80.0k|{
  439|  80.0k|  my_upsample_ptr upsample;
  440|  80.0k|  int ci;
  441|  80.0k|  jpeg_component_info *compptr;
  442|  80.0k|  boolean need_buffer, do_fancy;
  443|  80.0k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|  80.0k|#ifdef D_LOSSLESS_SUPPORTED
  446|  80.0k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 3.08k, False: 76.9k]
  ------------------
  447|  3.08k|#if BITS_IN_JSAMPLE == 8
  448|  3.08k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.17k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (448:9): [True: 0, False: 3.08k]
  |  Branch (448:52): [True: 0, False: 3.08k]
  ------------------
  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.08k|  } else
  455|  76.9k|#endif
  456|  76.9k|  {
  457|  76.9k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  76.9k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (457:9): [True: 0, False: 76.9k]
  ------------------
  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|  76.9k|  }
  460|       |
  461|  80.0k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 80.0k, False: 0]
  ------------------
  462|  80.0k|    upsample = (my_upsample_ptr)
  463|  80.0k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  80.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  80.0k|                                  sizeof(my_upsampler));
  465|  80.0k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|  80.0k|    upsample->pub.start_pass = start_pass_upsample;
  467|  80.0k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  265|  80.0k|#define _upsample  upsample
  ------------------
  468|  80.0k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  80.0k|#define FALSE   0               /* values of boolean */
  ------------------
  469|  80.0k|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|  80.0k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 80.0k]
  ------------------
  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|  80.0k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  80.0k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 80.0k, False: 0]
  |  Branch (478:44): [True: 76.9k, False: 3.08k]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|   189k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 109k, False: 80.0k]
  ------------------
  484|   109k|       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|   109k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|   109k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|   109k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   109k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|   109k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|   109k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|   109k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   109k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|   109k|    h_out_group = cinfo->max_h_samp_factor;
  493|   109k|    v_out_group = cinfo->max_v_samp_factor;
  494|   109k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|   109k|    need_buffer = TRUE;
  ------------------
  |  |  210|   109k|#define TRUE    1
  ------------------
  496|   109k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 109k]
  ------------------
  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|   109k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 82.4k, False: 26.8k]
  |  Branch (500:45): [True: 80.5k, False: 1.90k]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|  80.5k|      upsample->methods[ci] = fullsize_upsample;
  503|  80.5k|      need_buffer = FALSE;
  ------------------
  |  |  207|  80.5k|#define FALSE   0               /* values of boolean */
  ------------------
  504|  80.5k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 23.8k, False: 4.88k]
  |  Branch (504:49): [True: 10.0k, False: 13.7k]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|  10.0k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 10.0k, False: 10]
  |  Branch (506:23): [True: 9.33k, False: 738]
  ------------------
  507|  9.33k|#ifdef WITH_SIMD
  508|  9.33k|        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  ------------------
  |  Branch (508:13): [True: 9.33k, False: 0]
  ------------------
  509|  9.33k|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|      0|        else
  511|      0|#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|  9.33k|      } else {
  514|    748|#ifdef WITH_SIMD
  515|    748|        if (jsimd_set_h2v1_upsample(cinfo))
  ------------------
  |  Branch (515:13): [True: 748, False: 0]
  ------------------
  516|    748|          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|      0|        else
  518|      0|#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|    748|      }
  521|  18.6k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 1.90k, False: 16.7k]
  ------------------
  522|  1.90k|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 1.58k, False: 319]
  |  Branch (522:49): [True: 1.57k, False: 8]
  ------------------
  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.57k|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|  1.57k|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  1.57k|#define TRUE    1
  ------------------
  531|  17.0k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 13.7k, False: 3.31k]
  ------------------
  532|  13.7k|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 13.1k, False: 600]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|  13.1k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 13.1k, False: 5]
  |  Branch (534:23): [True: 11.7k, False: 1.41k]
  ------------------
  535|  11.7k|#ifdef WITH_SIMD
  536|  11.7k|        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 11.7k, False: 0]
  ------------------
  537|  11.7k|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|      0|        else
  539|      0|#endif
  540|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|  11.7k|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  11.7k|#define TRUE    1
  ------------------
  542|  11.7k|      } else {
  543|  1.42k|#ifdef WITH_SIMD
  544|  1.42k|        if (jsimd_set_h2v2_upsample(cinfo))
  ------------------
  |  Branch (544:13): [True: 1.42k, False: 0]
  ------------------
  545|  1.42k|          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|      0|        else
  547|      0|#endif
  548|      0|          upsample->methods[ci] = h2v2_upsample;
  549|  1.42k|      }
  550|  13.1k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 3.91k, False: 2]
  ------------------
  551|  3.91k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 3.91k, False: 2]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|  3.91k|      upsample->methods[ci] = int_upsample;
  554|  3.91k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|  3.91k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|  3.91k|    } 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|   109k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 28.7k, False: 80.5k]
  |  Branch (558:24): [True: 28.7k, False: 0]
  ------------------
  559|  28.7k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|  28.7k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  28.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|  28.7k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|  28.7k|                               (long)cinfo->max_h_samp_factor),
  563|  28.7k|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|  28.7k|    }
  565|   109k|  }
  566|  80.0k|}
jdsample-8.c:start_pass_upsample:
   47|  70.3k|{
   48|  70.3k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|  70.3k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|  70.3k|  upsample->rows_to_go = cinfo->output_height;
   54|  70.3k|}
jdsample-8.c:sep_upsample:
   70|  17.1M|{
   71|  17.1M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|  17.1M|  int ci;
   73|  17.1M|  jpeg_component_info *compptr;
   74|  17.1M|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|  17.1M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 16.8M, False: 302k]
  ------------------
   78|  34.7M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 17.8M, False: 16.8M]
  ------------------
   79|  17.8M|         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|  17.8M|      (*upsample->methods[ci]) (cinfo, compptr,
   87|  17.8M|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|  17.8M|        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|  17.8M|    }
   95|  16.8M|    upsample->next_row_out = 0;
   96|  16.8M|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|  17.1M|  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|  17.1M|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 4.30k, False: 17.1M]
  ------------------
  106|  4.30k|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|  17.1M|  out_rows_avail -= *out_row_ctr;
  109|  17.1M|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 302k, False: 16.8M]
  ------------------
  110|   302k|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|  17.1M|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  267|  17.1M|#define _color_convert  color_convert
  ------------------
  116|  17.1M|                                      (JDIMENSION)upsample->next_row_out,
  117|  17.1M|                                      output_buf + *out_row_ctr,
  118|  17.1M|                                      (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|  17.1M|  *out_row_ctr += num_rows;
  127|  17.1M|  upsample->rows_to_go -= num_rows;
  128|  17.1M|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|  17.1M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 16.8M, False: 306k]
  ------------------
  131|  16.8M|    (*in_row_group_ctr)++;
  132|  17.1M|}
jdsample-8.c:fullsize_upsample:
  151|  17.1M|{
  152|  17.1M|  *output_data_ptr = input_data;
  153|  17.1M|}
jdsample-8.c:h1v2_fancy_upsample:
  338|  57.6k|{
  339|  57.6k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  57.6k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  340|  57.6k|  _JSAMPROW inptr0, inptr1, outptr;
  ------------------
  |  |  229|  57.6k|#define _JSAMPROW  JSAMPROW
  ------------------
  341|  57.6k|#if BITS_IN_JSAMPLE == 8
  342|  57.6k|  int thiscolsum, bias;
  343|       |#else
  344|       |  JLONG thiscolsum, bias;
  345|       |#endif
  346|  57.6k|  JDIMENSION colctr;
  347|  57.6k|  int inrow, outrow, v;
  348|       |
  349|  57.6k|  inrow = outrow = 0;
  350|   115k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (350:10): [True: 57.6k, False: 57.6k]
  ------------------
  351|   172k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (351:17): [True: 115k, False: 57.6k]
  ------------------
  352|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  353|   115k|      inptr0 = input_data[inrow];
  354|   115k|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (354:11): [True: 57.6k, False: 57.6k]
  ------------------
  355|  57.6k|        inptr1 = input_data[inrow - 1];
  356|  57.6k|        bias = 1;
  357|  57.6k|      } else {                  /* next nearest is row below */
  358|  57.6k|        inptr1 = input_data[inrow + 1];
  359|  57.6k|        bias = 2;
  360|  57.6k|      }
  361|   115k|      outptr = output_data[outrow++];
  362|       |
  363|  1.00M|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (363:24): [True: 888k, False: 115k]
  ------------------
  364|   888k|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  365|   888k|        *outptr++ = (_JSAMPLE)((thiscolsum + bias) >> 2);
  366|   888k|      }
  367|   115k|    }
  368|  57.6k|    inrow++;
  369|  57.6k|  }
  370|  57.6k|}
jdsample-8.c:int_upsample:
  183|  33.9k|{
  184|  33.9k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  185|  33.9k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  33.9k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  186|  33.9k|  register _JSAMPROW inptr, outptr;
  187|  33.9k|  register _JSAMPLE invalue;
  188|  33.9k|  register int h;
  189|  33.9k|  _JSAMPROW outend;
  ------------------
  |  |  229|  33.9k|#define _JSAMPROW  JSAMPROW
  ------------------
  190|  33.9k|  int h_expand, v_expand;
  191|  33.9k|  int inrow, outrow;
  192|       |
  193|  33.9k|  h_expand = upsample->h_expand[compptr->component_index];
  194|  33.9k|  v_expand = upsample->v_expand[compptr->component_index];
  195|       |
  196|  33.9k|  inrow = outrow = 0;
  197|  67.9k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (197:10): [True: 33.9k, False: 33.9k]
  ------------------
  198|       |    /* Generate one output row with proper horizontal expansion */
  199|  33.9k|    inptr = input_data[inrow];
  200|  33.9k|    outptr = output_data[outrow];
  201|  33.9k|    outend = outptr + cinfo->output_width;
  202|   227k|    while (outptr < outend) {
  ------------------
  |  Branch (202:12): [True: 193k, False: 33.9k]
  ------------------
  203|   193k|      invalue = *inptr++;
  204|   656k|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (204:26): [True: 462k, False: 193k]
  ------------------
  205|   462k|        *outptr++ = invalue;
  206|   462k|      }
  207|   193k|    }
  208|       |    /* Generate any additional output rows by duplicating the first one */
  209|  33.9k|    if (v_expand > 1) {
  ------------------
  |  Branch (209:9): [True: 28.7k, False: 5.19k]
  ------------------
  210|  28.7k|      _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  ------------------
  |  |  297|  28.7k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  211|  28.7k|                         v_expand - 1, cinfo->output_width);
  212|  28.7k|    }
  213|  33.9k|    inrow++;
  214|  33.9k|    outrow += v_expand;
  215|  33.9k|  }
  216|  33.9k|}
j12init_upsampler:
  438|    892|{
  439|    892|  my_upsample_ptr upsample;
  440|    892|  int ci;
  441|    892|  jpeg_component_info *compptr;
  442|    892|  boolean need_buffer, do_fancy;
  443|    892|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|    892|#ifdef D_LOSSLESS_SUPPORTED
  446|    892|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 309, False: 583]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|    309|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    618|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (450:9): [True: 0, False: 309]
  ------------------
  451|    309|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    309|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (451:9): [True: 0, False: 309]
  ------------------
  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|    309|  } else
  455|    583|#endif
  456|    583|  {
  457|    583|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    583|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (457:9): [True: 0, False: 583]
  ------------------
  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|    583|  }
  460|       |
  461|    892|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 892, False: 0]
  ------------------
  462|    892|    upsample = (my_upsample_ptr)
  463|    892|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    892|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|    892|                                  sizeof(my_upsampler));
  465|    892|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|    892|    upsample->pub.start_pass = start_pass_upsample;
  467|    892|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  149|    892|#define _upsample  upsample_12
  ------------------
  468|    892|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|    892|#define FALSE   0               /* values of boolean */
  ------------------
  469|    892|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|    892|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 892]
  ------------------
  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|    892|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    892|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 892, False: 0]
  |  Branch (478:44): [True: 583, False: 309]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  1.78k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 892, False: 892]
  ------------------
  484|    892|       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|    892|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    892|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|    892|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    892|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|    892|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    892|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|    892|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    892|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|    892|    h_out_group = cinfo->max_h_samp_factor;
  493|    892|    v_out_group = cinfo->max_v_samp_factor;
  494|    892|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|    892|    need_buffer = TRUE;
  ------------------
  |  |  210|    892|#define TRUE    1
  ------------------
  496|    892|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 892]
  ------------------
  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|    892|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 892, False: 0]
  |  Branch (500:45): [True: 892, False: 0]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|    892|      upsample->methods[ci] = fullsize_upsample;
  503|    892|      need_buffer = FALSE;
  ------------------
  |  |  207|    892|#define FALSE   0               /* values of boolean */
  ------------------
  504|    892|    } 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|    892|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 0, False: 892]
  |  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|    892|  }
  566|    892|}
jdsample-12.c:start_pass_upsample:
   47|    873|{
   48|    873|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|    873|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|    873|  upsample->rows_to_go = cinfo->output_height;
   54|    873|}
jdsample-12.c:sep_upsample:
   70|  1.90M|{
   71|  1.90M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|  1.90M|  int ci;
   73|  1.90M|  jpeg_component_info *compptr;
   74|  1.90M|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|  1.90M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 1.90M, False: 0]
  ------------------
   78|  3.81M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 1.90M, False: 1.90M]
  ------------------
   79|  1.90M|         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.90M|      (*upsample->methods[ci]) (cinfo, compptr,
   87|  1.90M|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|  1.90M|        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.90M|    }
   95|  1.90M|    upsample->next_row_out = 0;
   96|  1.90M|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|  1.90M|  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.90M|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 0, False: 1.90M]
  ------------------
  106|      0|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|  1.90M|  out_rows_avail -= *out_row_ctr;
  109|  1.90M|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 0, False: 1.90M]
  ------------------
  110|      0|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|  1.90M|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  151|  1.90M|#define _color_convert  color_convert_12
  ------------------
  116|  1.90M|                                      (JDIMENSION)upsample->next_row_out,
  117|  1.90M|                                      output_buf + *out_row_ctr,
  118|  1.90M|                                      (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.90M|  *out_row_ctr += num_rows;
  127|  1.90M|  upsample->rows_to_go -= num_rows;
  128|  1.90M|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|  1.90M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 1.90M, False: 0]
  ------------------
  131|  1.90M|    (*in_row_group_ctr)++;
  132|  1.90M|}
jdsample-12.c:fullsize_upsample:
  151|  1.90M|{
  152|  1.90M|  *output_data_ptr = input_data;
  153|  1.90M|}

jpeg_std_error:
  229|  43.1k|{
  230|  43.1k|  memset(err, 0, sizeof(struct jpeg_error_mgr));
  231|       |
  232|  43.1k|  err->error_exit = error_exit;
  233|  43.1k|  err->emit_message = emit_message;
  234|  43.1k|  err->output_message = output_message;
  235|  43.1k|  err->format_message = format_message;
  236|  43.1k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|       |  /* Initialize message table pointers */
  239|  43.1k|  err->jpeg_message_table = jpeg_std_message_table;
  240|  43.1k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  241|       |
  242|  43.1k|  return err;
  243|  43.1k|}
jerror.c:emit_message:
  126|   178M|{
  127|   178M|  struct jpeg_error_mgr *err = cinfo->err;
  128|       |
  129|   178M|  if (msg_level < 0) {
  ------------------
  |  Branch (129:7): [True: 177M, False: 1.46M]
  ------------------
  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|   177M|    if (err->num_warnings == 0 || err->trace_level >= 3)
  ------------------
  |  Branch (134:9): [True: 108k, False: 176M]
  |  Branch (134:35): [True: 0, False: 176M]
  ------------------
  135|   108k|      (*err->output_message) (cinfo);
  136|       |    /* Always count warnings in num_warnings. */
  137|   177M|    err->num_warnings++;
  138|   177M|  } else {
  139|       |    /* It's a trace message.  Show it if trace_level >= msg_level. */
  140|  1.46M|    if (err->trace_level >= msg_level)
  ------------------
  |  Branch (140:9): [True: 0, False: 1.46M]
  ------------------
  141|      0|      (*err->output_message) (cinfo);
  142|  1.46M|  }
  143|   178M|}
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.35M|  while ((ch = *msgptr++) != '\0') {
  ------------------
  |  Branch (181:10): [True: 6.29M, False: 69.0k]
  ------------------
  182|  6.29M|    if (ch == '%') {
  ------------------
  |  Branch (182:9): [True: 145k, False: 6.14M]
  ------------------
  183|   145k|      if (*msgptr == 's') isstring = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (183:11): [True: 0, False: 145k]
  ------------------
  184|   145k|      break;
  185|   145k|    }
  186|  6.29M|  }
  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.70M|{
  199|  3.70M|  JLONG tmp0, tmp1, tmp2, tmp3;
  200|  3.70M|  JLONG tmp10, tmp11, tmp12, tmp13;
  201|  3.70M|  JLONG z1, z2, z3, z4, z5;
  202|  3.70M|  JCOEFPTR inptr;
  203|  3.70M|  ISLOW_MULT_TYPE *quantptr;
  204|  3.70M|  int *wsptr;
  205|  3.70M|  _JSAMPROW outptr;
  ------------------
  |  |  113|  3.70M|#define _JSAMPROW  J12SAMPROW
  ------------------
  206|  3.70M|  _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |  108|  3.70M|#define _JSAMPLE  J12SAMPLE
  ------------------
                _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |   95|  3.70M|  ((_JSAMPLE *)((cinfo)->sample_range_limit) + _CENTERJSAMPLE)
  |  |  ------------------
  |  |  |  |  111|  3.70M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  3.70M|#define CENTERJ12SAMPLE  2048
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|  3.70M|  int ctr;
  208|  3.70M|  int workspace[DCTSIZE2];      /* buffers data between passes */
  209|  3.70M|  SHIFT_TEMPS
  210|  3.70M|  SCALING_FACTOR
  ------------------
  |  |  170|  3.70M|  JLONG scaling_factor = (cinfo->master->jpeg_data_precision == 8 && \
  |  |  ------------------
  |  |  |  Branch (170:27): [True: 0, False: 3.70M]
  |  |  ------------------
  |  |  171|  3.70M|                          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.70M|  inptr = coef_block;
  217|  3.70M|  quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
  218|  3.70M|  wsptr = workspace;
  219|  33.3M|  for (ctr = DCTSIZE; ctr > 0; ctr--) {
  ------------------
  |  |   66|  3.70M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (219:23): [True: 29.6M, False: 3.70M]
  ------------------
  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|  29.6M|    if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  29.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  28.0M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (229:9): [True: 28.0M, False: 1.58M]
  |  Branch (229:36): [True: 27.9M, False: 109k]
  ------------------
  230|  27.9M|        inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  27.9M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  27.8M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (230:9): [True: 27.8M, False: 66.8k]
  |  Branch (230:36): [True: 27.8M, False: 14.8k]
  ------------------
  231|  27.8M|        inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  27.8M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  27.8M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (231:9): [True: 27.8M, False: 44.7k]
  |  Branch (231:36): [True: 27.7M, False: 31.5k]
  ------------------
  232|  27.7M|        inptr[DCTSIZE * 7] == 0) {
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (232:9): [True: 27.7M, False: 643]
  ------------------
  233|       |      /* AC terms all zero */
  234|  27.7M|      int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
  ------------------
  |  |   85|  27.7M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  235|  27.7M|                             quantptr[DCTSIZE * 0]), PASS1_BITS);
  236|       |
  237|  27.7M|      wsptr[DCTSIZE * 0] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  238|  27.7M|      wsptr[DCTSIZE * 1] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  239|  27.7M|      wsptr[DCTSIZE * 2] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  240|  27.7M|      wsptr[DCTSIZE * 3] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  241|  27.7M|      wsptr[DCTSIZE * 4] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  242|  27.7M|      wsptr[DCTSIZE * 5] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  243|  27.7M|      wsptr[DCTSIZE * 6] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  244|  27.7M|      wsptr[DCTSIZE * 7] = dcval;
  ------------------
  |  |   66|  27.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  245|       |
  246|  27.7M|      inptr++;                  /* advance pointers to next column */
  247|  27.7M|      quantptr++;
  248|  27.7M|      wsptr++;
  249|  27.7M|      continue;
  250|  27.7M|    }
  251|       |
  252|       |    /* Even part: reverse the even part of the forward DCT. */
  253|       |    /* The rotator is sqrt(2)*c(-6). */
  254|       |
  255|  1.85M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  256|  1.85M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  257|       |
  258|  1.85M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  259|  1.85M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  260|  1.85M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  261|       |
  262|  1.85M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  263|  1.85M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  264|       |
  265|  1.85M|    tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
  ------------------
  |  |   85|  1.85M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  266|  1.85M|    tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
  ------------------
  |  |   85|  1.85M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  267|       |
  268|  1.85M|    tmp10 = tmp0 + tmp3;
  269|  1.85M|    tmp13 = tmp0 - tmp3;
  270|  1.85M|    tmp11 = tmp1 + tmp2;
  271|  1.85M|    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.85M|    tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  278|  1.85M|    tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  279|  1.85M|    tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  280|  1.85M|    tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
  ------------------
  |  |  186|  1.85M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  281|       |
  282|  1.85M|    z1 = tmp0 + tmp3;
  283|  1.85M|    z2 = tmp1 + tmp2;
  284|  1.85M|    z3 = tmp0 + tmp2;
  285|  1.85M|    z4 = tmp1 + tmp3;
  286|  1.85M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  287|       |
  288|  1.85M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  289|  1.85M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  290|  1.85M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  291|  1.85M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  292|  1.85M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  293|  1.85M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  294|  1.85M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  295|  1.85M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  156|  1.85M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  296|       |
  297|  1.85M|    z3 += z5;
  298|  1.85M|    z4 += z5;
  299|       |
  300|  1.85M|    tmp0 += z1 + z3;
  301|  1.85M|    tmp1 += z2 + z4;
  302|  1.85M|    tmp2 += z2 + z3;
  303|  1.85M|    tmp3 += z1 + z4;
  304|       |
  305|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  306|       |
  307|  1.85M|    wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  308|  1.85M|    wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  309|  1.85M|    wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  310|  1.85M|    wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  311|  1.85M|    wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  312|  1.85M|    wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  313|  1.85M|    wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  314|  1.85M|    wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.85M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.85M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.85M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  315|       |
  316|  1.85M|    inptr++;                    /* advance pointers to next column */
  317|  1.85M|    quantptr++;
  318|  1.85M|    wsptr++;
  319|  1.85M|  }
  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.70M|  wsptr = workspace;
  326|  33.3M|  for (ctr = 0; ctr < DCTSIZE; ctr++) {
  ------------------
  |  |   66|  33.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (326:17): [True: 29.6M, False: 3.70M]
  ------------------
  327|  29.6M|    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|  29.6M|#ifndef NO_ZERO_ROW_TEST
  337|  29.6M|    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
  ------------------
  |  Branch (337:9): [True: 22.8M, False: 6.78M]
  |  Branch (337:26): [True: 22.4M, False: 431k]
  |  Branch (337:43): [True: 22.1M, False: 257k]
  |  Branch (337:60): [True: 22.1M, False: 12.3k]
  ------------------
  338|  22.1M|        wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
  ------------------
  |  Branch (338:9): [True: 22.0M, False: 119k]
  |  Branch (338:26): [True: 21.8M, False: 223k]
  |  Branch (338:43): [True: 21.7M, False: 16.4k]
  ------------------
  339|       |      /* AC terms all zero */
  340|  21.7M|      _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  108|  21.7M|#define _JSAMPLE  J12SAMPLE
  ------------------
                    _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  216|  21.7M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  21.7M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  341|  21.7M|                                                PASS1_BITS + 3) & RANGE_MASK];
  ------------------
  |  |   97|  21.7M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  21.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  21.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  342|       |
  343|  21.7M|      outptr[0] = dcval;
  344|  21.7M|      outptr[1] = dcval;
  345|  21.7M|      outptr[2] = dcval;
  346|  21.7M|      outptr[3] = dcval;
  347|  21.7M|      outptr[4] = dcval;
  348|  21.7M|      outptr[5] = dcval;
  349|  21.7M|      outptr[6] = dcval;
  350|  21.7M|      outptr[7] = dcval;
  351|       |
  352|  21.7M|      wsptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|  21.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  353|  21.7M|      continue;
  354|  21.7M|    }
  355|  7.84M|#endif
  356|       |
  357|       |    /* Even part: reverse the even part of the forward DCT. */
  358|       |    /* The rotator is sqrt(2)*c(-6). */
  359|       |
  360|  7.84M|    z2 = (JLONG)wsptr[2];
  361|  7.84M|    z3 = (JLONG)wsptr[6];
  362|       |
  363|  7.84M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  364|  7.84M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  365|  7.84M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  366|       |
  367|  7.84M|    tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  7.84M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  368|  7.84M|    tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  7.84M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  369|       |
  370|  7.84M|    tmp10 = tmp0 + tmp3;
  371|  7.84M|    tmp13 = tmp0 - tmp3;
  372|  7.84M|    tmp11 = tmp1 + tmp2;
  373|  7.84M|    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|  7.84M|    tmp0 = (JLONG)wsptr[7];
  380|  7.84M|    tmp1 = (JLONG)wsptr[5];
  381|  7.84M|    tmp2 = (JLONG)wsptr[3];
  382|  7.84M|    tmp3 = (JLONG)wsptr[1];
  383|       |
  384|  7.84M|    z1 = tmp0 + tmp3;
  385|  7.84M|    z2 = tmp1 + tmp2;
  386|  7.84M|    z3 = tmp0 + tmp2;
  387|  7.84M|    z4 = tmp1 + tmp3;
  388|  7.84M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  389|       |
  390|  7.84M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  391|  7.84M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  392|  7.84M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  393|  7.84M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  394|  7.84M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  395|  7.84M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  396|  7.84M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  397|  7.84M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  156|  7.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  398|       |
  399|  7.84M|    z3 += z5;
  400|  7.84M|    z4 += z5;
  401|       |
  402|  7.84M|    tmp0 += z1 + z3;
  403|  7.84M|    tmp1 += z2 + z4;
  404|  7.84M|    tmp2 += z2 + z3;
  405|  7.84M|    tmp3 += z1 + z4;
  406|       |
  407|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  408|       |
  409|  7.84M|    outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  410|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  411|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|  7.84M|    outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  413|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  414|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  415|  7.84M|    outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  416|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  417|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  418|  7.84M|    outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  419|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  420|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  421|  7.84M|    outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  422|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  423|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  424|  7.84M|    outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  425|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  426|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|  7.84M|    outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  428|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  429|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  430|  7.84M|    outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
  ------------------
  |  |  216|  7.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  7.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  431|  7.84M|                                         CONST_BITS + PASS1_BITS + 3) &
  432|  7.84M|                            RANGE_MASK];
  ------------------
  |  |   97|  7.84M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  7.84M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  7.84M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|       |
  434|  7.84M|    wsptr += DCTSIZE;           /* advance pointer to next row */
  ------------------
  |  |   66|  7.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  435|  7.84M|  }
  436|  3.70M|}

jmemmgr.c:GETENV_S:
   80|  43.1k|{
   81|  43.1k|  char *env;
   82|       |
   83|  43.1k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 43.1k]
  ------------------
   84|      0|    if (buffer_size == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      return 0;
   86|      0|    else
   87|      0|      return (errno = EINVAL);
   88|      0|  }
   89|  43.1k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 43.1k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  43.1k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 43.1k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  43.1k|  env = getenv(name);
   97|  43.1k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 43.1k, False: 0]
  ------------------
   98|  43.1k|  {
   99|  43.1k|    *buffer = 0;
  100|  43.1k|    return 0;
  101|  43.1k|  }
  102|       |
  103|      0|  if (strlen(env) + 1 > buffer_size) {
  ------------------
  |  Branch (103:7): [True: 0, False: 0]
  ------------------
  104|      0|    *buffer = 0;
  105|      0|    return ERANGE;
  106|      0|  }
  107|       |
  108|      0|  strncpy(buffer, env, buffer_size);
  109|       |
  110|      0|  return 0;
  111|      0|}
jsimd.c:GETENV_S:
   80|   125k|{
   81|   125k|  char *env;
   82|       |
   83|   125k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 125k]
  ------------------
   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|   125k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 125k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|   125k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 125k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|   125k|  env = getenv(name);
   97|   125k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 125k, False: 0]
  ------------------
   98|   125k|  {
   99|   125k|    *buffer = 0;
  100|   125k|    return 0;
  101|   125k|  }
  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|  43.1k|{
 1197|  43.1k|  my_mem_ptr mem;
 1198|  43.1k|  long max_to_use;
 1199|  43.1k|  int pool;
 1200|  43.1k|  size_t test_mac;
 1201|       |
 1202|  43.1k|  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|  43.1k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  43.1k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  43.1k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 43.1k]
  ------------------
 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|  43.1k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  43.1k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  43.1k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  86.2k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 43.1k]
  ------------------
 1220|  43.1k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  43.1k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  43.1k|#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|  43.1k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  43.1k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  43.1k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 43.1k]
  ------------------
 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|  43.1k|  mem->pub.alloc_small = alloc_small;
 1235|  43.1k|  mem->pub.alloc_large = alloc_large;
 1236|  43.1k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  43.1k|  mem->pub.alloc_barray = alloc_barray;
 1238|  43.1k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  43.1k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  43.1k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  43.1k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  43.1k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  43.1k|  mem->pub.free_pool = free_pool;
 1244|  43.1k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  43.1k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  43.1k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  43.1k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|   129k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  43.1k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   129k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 86.2k, False: 43.1k]
  ------------------
 1253|  86.2k|    mem->small_list[pool] = NULL;
 1254|  86.2k|    mem->large_list[pool] = NULL;
 1255|  86.2k|  }
 1256|  43.1k|  mem->virt_sarray_list = NULL;
 1257|  43.1k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  43.1k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  43.1k|  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|  43.1k|#ifndef NO_GETENV
 1271|  43.1k|  {
 1272|  43.1k|    char memenv[30] = { 0 };
 1273|       |
 1274|  43.1k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 43.1k, False: 0]
  |  Branch (1274:45): [True: 0, False: 43.1k]
  ------------------
 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|  43.1k|  }
 1288|  43.1k|#endif
 1289|       |
 1290|  43.1k|}
jmemmgr.c:alloc_small:
  269|  1.83M|{
  270|  1.83M|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|  1.83M|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|  1.83M|  char *data_ptr;
  273|  1.83M|  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.83M|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  1.83M|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 1.83M]
  ------------------
  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.83M|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  1.83M|#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.83M|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  1.83M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 1.83M]
  ------------------
  290|  1.83M|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  1.83M|#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.83M|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  1.83M|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 1.83M]
  |  Branch (294:22): [True: 0, False: 1.83M]
  ------------------
  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.83M|  prev_hdr_ptr = NULL;
  297|  1.83M|  hdr_ptr = mem->small_list[pool_id];
  298|  2.02M|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 1.86M, False: 168k]
  ------------------
  299|  1.86M|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 1.66M, False: 190k]
  ------------------
  300|  1.66M|      break;                    /* found pool with enough space */
  301|   190k|    prev_hdr_ptr = hdr_ptr;
  302|   190k|    hdr_ptr = hdr_ptr->next;
  303|   190k|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|  1.83M|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 168k, False: 1.66M]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|   168k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   168k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|   168k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 133k, False: 34.8k]
  ------------------
  310|   133k|      slop = first_pool_slop[pool_id];
  311|  34.8k|    else
  312|  34.8k|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|   168k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|   168k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 168k]
  ------------------
  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|   168k|    for (;;) {
  318|   168k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|   168k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 168k, False: 0]
  ------------------
  320|   168k|        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|   168k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|   168k|    hdr_ptr->next = NULL;
  328|   168k|    hdr_ptr->bytes_used = 0;
  329|   168k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|   168k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 133k, False: 34.8k]
  ------------------
  331|   133k|      mem->small_list[pool_id] = hdr_ptr;
  332|  34.8k|    else
  333|  34.8k|      prev_hdr_ptr->next = hdr_ptr;
  334|   168k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|  1.83M|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|  1.83M|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|  1.83M|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  1.83M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 1.83M, False: 0]
  ------------------
  340|  1.83M|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  1.83M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  1.83M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|  1.83M|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|  1.83M|  hdr_ptr->bytes_used += sizeofobject;
  343|  1.83M|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|  1.83M|  return (void *)data_ptr;
  346|  1.83M|}
jmemmgr.c:round_up_pow2:
   45|  2.23M|{
   46|  2.23M|  return ((a + b - 1) & (~(b - 1)));
   47|  2.23M|}
jmemmgr.c:alloc_large:
  366|   252k|{
  367|   252k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|   252k|  large_pool_ptr hdr_ptr;
  369|   252k|  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|   252k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   252k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 252k]
  ------------------
  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|   252k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   252k|#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|   252k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   252k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 252k]
  ------------------
  385|   252k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   252k|#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|   252k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   252k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 252k]
  |  Branch (389:22): [True: 0, False: 252k]
  ------------------
  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|   252k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|   252k|                                           sizeof(large_pool_hdr) +
  394|   252k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|   252k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|   252k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 252k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|   252k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|   252k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|   252k|#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|   252k|  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|   252k|  hdr_ptr->bytes_used = sizeofobject;
  406|   252k|  hdr_ptr->bytes_left = 0;
  407|   252k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|   252k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|   252k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|   252k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   252k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 252k, False: 0]
  ------------------
  412|   252k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   252k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   252k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|   252k|  return (void *)data_ptr;
  415|   252k|}
jmemmgr.c:alloc_sarray:
  438|   145k|{
  439|   145k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|   145k|  JSAMPARRAY result;
  441|   145k|  JSAMPROW workspace;
  442|   145k|  JDIMENSION rowsperchunk, currow, i;
  443|   145k|  long ltemp;
  444|   145k|  J12SAMPARRAY result12;
  445|   145k|  J12SAMPROW workspace12;
  446|   145k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|   145k|  J16SAMPARRAY result16;
  448|   145k|  J16SAMPROW workspace16;
  449|   145k|#endif
  450|   145k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 145k, False: 0]
  ------------------
  451|   145k|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|   145k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|   145k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 0, False: 145k]
  ------------------
  454|   145k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 1.50k, False: 144k]
  ------------------
  455|  1.50k|                                            sizeof(J12SAMPLE) :
  456|   145k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|   145k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|   145k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 145k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|   145k|  if (samplesperrow == 0 || samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   145k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 145k]
  |  Branch (462:29): [True: 0, False: 145k]
  ------------------
  463|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  464|       |       is close to SIZE_MAX. */
  465|      0|    out_of_memory(cinfo, 9);
  466|      0|  }
  467|   145k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|   145k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|   145k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|   145k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|   145k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|   145k|          ((long)samplesperrow * (long)sample_size);
  473|   145k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 145k]
  ------------------
  474|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  475|   145k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 145k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|   145k|  else
  478|   145k|    rowsperchunk = numrows;
  479|   145k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|   145k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 144k, False: 1.50k]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|   144k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|   144k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|   144k|    currow = 0;
  488|   288k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 144k, False: 144k]
  ------------------
  489|   144k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|   144k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 144k]
  |  |  ------------------
  ------------------
  490|   144k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|   144k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  1.64M|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 1.49M, False: 144k]
  ------------------
  493|  1.49M|        result[currow++] = workspace;
  494|  1.49M|        workspace += samplesperrow;
  495|  1.49M|      }
  496|   144k|    }
  497|       |
  498|   144k|    return result;
  499|   144k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 1.50k, False: 0]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|  1.50k|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|  1.50k|                                         (size_t)(numrows *
  503|  1.50k|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|  1.50k|    currow = 0;
  507|  3.01k|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 1.50k, False: 1.50k]
  ------------------
  508|  1.50k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  1.50k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 1.50k]
  |  |  ------------------
  ------------------
  509|  1.50k|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|  1.50k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|  7.09k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 5.58k, False: 1.50k]
  ------------------
  512|  5.58k|        result12[currow++] = workspace12;
  513|  5.58k|        workspace12 += samplesperrow;
  514|  5.58k|      }
  515|  1.50k|    }
  516|       |
  517|  1.50k|    return (JSAMPARRAY)result12;
  518|  1.50k|  } else {
  519|      0|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  520|       |    /* Get space for row pointers (small object) */
  521|      0|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  522|      0|                                         (size_t)(numrows *
  523|      0|                                                  sizeof(J16SAMPROW)));
  524|       |
  525|       |    /* Get the rows themselves (large objects) */
  526|      0|    currow = 0;
  527|      0|    while (currow < numrows) {
  ------------------
  |  Branch (527:12): [True: 0, False: 0]
  ------------------
  528|      0|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  529|      0|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  530|      0|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  531|      0|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (531:30): [True: 0, False: 0]
  ------------------
  532|      0|        result16[currow++] = workspace16;
  533|      0|        workspace16 += samplesperrow;
  534|      0|      }
  535|      0|    }
  536|       |
  537|      0|    return (JSAMPARRAY)result16;
  538|       |#else
  539|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  540|       |    return NULL;
  541|       |#endif
  542|      0|  }
  543|   145k|}
jmemmgr.c:alloc_barray:
  555|  51.4k|{
  556|  51.4k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|  51.4k|  JBLOCKARRAY result;
  558|  51.4k|  JBLOCKROW workspace;
  559|  51.4k|  JDIMENSION rowsperchunk, currow, i;
  560|  51.4k|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|  51.4k|  if (blocksperrow == 0 || (sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  51.4k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [True: 0, False: 51.4k]
  |  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|  51.4k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  51.4k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|  51.4k|          ((long)blocksperrow * sizeof(JBLOCK));
  569|  51.4k|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 51.4k]
  ------------------
  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|  51.4k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 10, False: 51.4k]
  ------------------
  572|     10|    rowsperchunk = (JDIMENSION)ltemp;
  573|  51.4k|  else
  574|  51.4k|    rowsperchunk = numrows;
  575|  51.4k|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|  51.4k|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|  51.4k|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|  51.4k|  currow = 0;
  583|   103k|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 51.5k, False: 51.4k]
  ------------------
  584|  51.5k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  51.5k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 34, False: 51.4k]
  |  |  ------------------
  ------------------
  585|  51.5k|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|  51.5k|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|  51.5k|                  sizeof(JBLOCK)));
  588|  1.09M|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 1.04M, False: 51.5k]
  ------------------
  589|  1.04M|      result[currow++] = workspace;
  590|  1.04M|      workspace += blocksperrow;
  591|  1.04M|    }
  592|  51.5k|  }
  593|       |
  594|  51.4k|  return result;
  595|  51.4k|}
jmemmgr.c:request_virt_sarray:
  640|    225|{
  641|    225|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  642|    225|  jvirt_sarray_ptr result;
  643|       |
  644|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  645|    225|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|    225|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (645:7): [True: 0, False: 225]
  ------------------
  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|    225|  result = (jvirt_sarray_ptr)alloc_small(cinfo, pool_id,
  650|    225|                                         sizeof(struct jvirt_sarray_control));
  651|       |
  652|    225|  result->mem_buffer = NULL;    /* marks array not yet realized */
  653|    225|  result->rows_in_array = numrows;
  654|    225|  result->samplesperrow = samplesperrow;
  655|    225|  result->maxaccess = maxaccess;
  656|    225|  result->pre_zero = pre_zero;
  657|    225|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|    225|#define FALSE   0               /* values of boolean */
  ------------------
  658|    225|  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
  659|    225|  mem->virt_sarray_list = result;
  660|       |
  661|    225|  return result;
  662|    225|}
jmemmgr.c:request_virt_barray:
  670|  51.4k|{
  671|  51.4k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|  51.4k|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|  51.4k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|  51.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 51.4k]
  ------------------
  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|  51.4k|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|  51.4k|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|  51.4k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|  51.4k|  result->rows_in_array = numrows;
  684|  51.4k|  result->blocksperrow = blocksperrow;
  685|  51.4k|  result->maxaccess = maxaccess;
  686|  51.4k|  result->pre_zero = pre_zero;
  687|  51.4k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|  51.4k|#define FALSE   0               /* values of boolean */
  ------------------
  688|  51.4k|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|  51.4k|  mem->virt_barray_list = result;
  690|       |
  691|  51.4k|  return result;
  692|  51.4k|}
jmemmgr.c:realize_virt_arrays:
  698|  81.8k|{
  699|  81.8k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  81.8k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  81.8k|  size_t minheights, max_minheights;
  702|  81.8k|  jvirt_sarray_ptr sptr;
  703|  81.8k|  jvirt_barray_ptr bptr;
  704|  81.8k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 81.8k, False: 0]
  ------------------
  705|  81.8k|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  81.8k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  81.8k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 0, False: 81.8k]
  ------------------
  708|  81.8k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 891, False: 80.9k]
  ------------------
  709|    891|                                            sizeof(J12SAMPLE) :
  710|  81.8k|                                            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|  81.8k|  space_per_minheight = 0;
  717|  81.8k|  maximum_space = 0;
  718|  82.0k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 225, False: 81.8k]
  ------------------
  719|    225|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 225, False: 0]
  ------------------
  720|    225|      size_t new_space = (size_t)sptr->rows_in_array *
  721|    225|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|    225|      space_per_minheight += (size_t)sptr->maxaccess *
  724|    225|                             (size_t)sptr->samplesperrow * sample_size;
  725|    225|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 225]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|    225|      maximum_space += new_space;
  728|    225|    }
  729|    225|  }
  730|   133k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 51.4k, False: 81.8k]
  ------------------
  731|  51.4k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 51.4k, False: 0]
  ------------------
  732|  51.4k|      size_t new_space = (size_t)bptr->rows_in_array *
  733|  51.4k|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|  51.4k|      space_per_minheight += (size_t)bptr->maxaccess *
  736|  51.4k|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|  51.4k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 51.4k]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|  51.4k|      maximum_space += new_space;
  740|  51.4k|    }
  741|  51.4k|  }
  742|       |
  743|  81.8k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 58.2k, False: 23.5k]
  ------------------
  744|  58.2k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|  23.5k|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|  23.5k|                                 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|  23.5k|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 23.5k, False: 0]
  ------------------
  755|  23.5k|    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|  23.8k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 225, False: 23.5k]
  ------------------
  768|    225|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 225, False: 0]
  ------------------
  769|    225|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|    225|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 225, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|    225|        sptr->rows_in_mem = sptr->rows_in_array;
  773|    225|      } 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|    225|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    225|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|    225|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|    225|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|    225|      sptr->cur_start_row = 0;
  786|    225|      sptr->first_undef_row = 0;
  787|    225|      sptr->dirty = FALSE;
  ------------------
  |  |  207|    225|#define FALSE   0               /* values of boolean */
  ------------------
  788|    225|    }
  789|    225|  }
  790|       |
  791|  75.0k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 51.4k, False: 23.5k]
  ------------------
  792|  51.4k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 51.4k, False: 0]
  ------------------
  793|  51.4k|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|  51.4k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 51.4k, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|  51.4k|        bptr->rows_in_mem = bptr->rows_in_array;
  797|  51.4k|      } 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|  51.4k|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  51.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|  51.4k|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|  51.4k|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|  51.4k|      bptr->cur_start_row = 0;
  810|  51.4k|      bptr->first_undef_row = 0;
  811|  51.4k|      bptr->dirty = FALSE;
  ------------------
  |  |  207|  51.4k|#define FALSE   0               /* values of boolean */
  ------------------
  812|  51.4k|    }
  813|  51.4k|  }
  814|  23.5k|}
jmemmgr.c:access_virt_sarray:
  924|   571k|{
  925|   571k|  JDIMENSION end_row = start_row + num_rows;
  926|   571k|  JDIMENSION undef_row;
  927|   571k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (927:24): [True: 571k, False: 0]
  ------------------
  928|   571k|                        ((j_decompress_ptr)cinfo)->data_precision :
  929|   571k|                        ((j_compress_ptr)cinfo)->data_precision;
  930|   571k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (930:24): [True: 0, False: 571k]
  ------------------
  931|   571k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (931:45): [True: 0, False: 571k]
  ------------------
  932|      0|                                            sizeof(J12SAMPLE) :
  933|   571k|                                            sizeof(JSAMPLE));
  934|       |
  935|       |  /* debugging check */
  936|   571k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (936:7): [True: 0, False: 571k]
  |  Branch (936:39): [True: 0, False: 571k]
  ------------------
  937|   571k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (937:7): [True: 0, False: 571k]
  ------------------
  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|   571k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (941:7): [True: 0, False: 571k]
  ------------------
  942|   571k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (942:7): [True: 0, False: 571k]
  ------------------
  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|   571k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (978:7): [True: 288k, False: 283k]
  ------------------
  979|   288k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (979:9): [True: 0, False: 288k]
  ------------------
  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|   288k|    } else {
  984|   288k|      undef_row = ptr->first_undef_row;
  985|   288k|    }
  986|   288k|    if (writable)
  ------------------
  |  Branch (986:9): [True: 288k, False: 21]
  ------------------
  987|   288k|      ptr->first_undef_row = end_row;
  988|   288k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (988:9): [True: 0, False: 288k]
  ------------------
  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|   288k|    } else {
  997|   288k|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (997:11): [True: 21, False: 288k]
  ------------------
  998|     21|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|     21|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     21|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  999|   288k|    }
 1000|   288k|  }
 1001|       |  /* Flag the buffer dirty if caller will write in it */
 1002|   571k|  if (writable)
  ------------------
  |  Branch (1002:7): [True: 369k, False: 202k]
  ------------------
 1003|   369k|    ptr->dirty = TRUE;
  ------------------
  |  |  210|   369k|#define TRUE    1
  ------------------
 1004|       |  /* Return address of proper part of the buffer */
 1005|   571k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1006|   571k|}
jmemmgr.c:access_virt_barray:
 1015|  1.71M|{
 1016|  1.71M|  JDIMENSION end_row = start_row + num_rows;
 1017|  1.71M|  JDIMENSION undef_row;
 1018|       |
 1019|       |  /* debugging check */
 1020|  1.71M|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1020:7): [True: 0, False: 1.71M]
  |  Branch (1020:39): [True: 0, False: 1.71M]
  ------------------
 1021|  1.71M|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1021:7): [True: 0, False: 1.71M]
  ------------------
 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.71M|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1025:7): [True: 0, False: 1.71M]
  ------------------
 1026|  1.71M|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 1.71M]
  ------------------
 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.71M|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1062:7): [True: 954k, False: 762k]
  ------------------
 1063|   954k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1063:9): [True: 73.0k, False: 881k]
  ------------------
 1064|  73.0k|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1064:11): [True: 0, False: 73.0k]
  ------------------
 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|  73.0k|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1067|   881k|    } else {
 1068|   881k|      undef_row = ptr->first_undef_row;
 1069|   881k|    }
 1070|   954k|    if (writable)
  ------------------
  |  Branch (1070:9): [True: 865k, False: 89.5k]
  ------------------
 1071|   865k|      ptr->first_undef_row = end_row;
 1072|   954k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1072:9): [True: 954k, False: 0]
  ------------------
 1073|   954k|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1074|   954k|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1075|   954k|      end_row -= ptr->cur_start_row;
 1076|  1.95M|      while (undef_row < end_row) {
  ------------------
  |  Branch (1076:14): [True: 999k, False: 954k]
  ------------------
 1077|   999k|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1078|   999k|        undef_row++;
 1079|   999k|      }
 1080|   954k|    } 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|   954k|  }
 1085|       |  /* Flag the buffer dirty if caller will write in it */
 1086|  1.71M|  if (writable)
  ------------------
  |  Branch (1086:7): [True: 1.23M, False: 483k]
  ------------------
 1087|  1.23M|    ptr->dirty = TRUE;
  ------------------
  |  |  210|  1.23M|#define TRUE    1
  ------------------
 1088|       |  /* Return address of proper part of the buffer */
 1089|  1.71M|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1090|  1.71M|}
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: 308k, False: 43.1k]
  ------------------
 1115|   308k|    jvirt_sarray_ptr sptr;
 1116|   308k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|   308k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 225, False: 308k]
  ------------------
 1119|    225|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 225]
  ------------------
 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|    225|    }
 1124|   308k|    mem->virt_sarray_list = NULL;
 1125|   360k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 51.4k, False: 308k]
  ------------------
 1126|  51.4k|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 51.4k]
  ------------------
 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|  51.4k|    }
 1131|   308k|    mem->virt_barray_list = NULL;
 1132|   308k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|   351k|  lhdr_ptr = mem->large_list[pool_id];
 1136|   351k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|   604k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 252k, False: 351k]
  ------------------
 1139|   252k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|   252k|    space_freed = lhdr_ptr->bytes_used +
 1141|   252k|                  lhdr_ptr->bytes_left +
 1142|   252k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   252k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|   252k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|   252k|    mem->total_space_allocated -= space_freed;
 1145|   252k|    lhdr_ptr = next_lhdr_ptr;
 1146|   252k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|   351k|  shdr_ptr = mem->small_list[pool_id];
 1150|   351k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|   520k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 168k, False: 351k]
  ------------------
 1153|   168k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|   168k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|   168k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   168k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|   168k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|   168k|    mem->total_space_allocated -= space_freed;
 1158|   168k|    shdr_ptr = next_shdr_ptr;
 1159|   168k|  }
 1160|   351k|}
jmemmgr.c:self_destruct:
 1170|  43.1k|{
 1171|  43.1k|  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|   129k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  43.1k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   129k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 86.2k, False: 43.1k]
  ------------------
 1178|  86.2k|    free_pool(cinfo, pool);
 1179|  86.2k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  43.1k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  43.1k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  43.1k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  43.1k|}

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

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

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

handle_error:
   43|  3.39M|{
   44|  3.39M|    return;
   45|  3.39M|}
LLVMFuzzerTestOneInput:
   48|  6.25k|{
   49|  6.25k|#ifndef STANDALONE
   50|  6.25k|    TIFFSetErrorHandler(handle_error);
   51|  6.25k|    TIFFSetWarningHandler(handle_error);
   52|  6.25k|#endif
   53|  6.25k|#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|  6.25k|#endif
   61|  6.25k|    std::istringstream s(std::string(Data, Data + Size));
   62|  6.25k|    TIFF *tif = TIFFStreamOpen("MemTIFF", &s);
   63|  6.25k|    if (!tif)
  ------------------
  |  Branch (63:9): [True: 1.55k, False: 4.70k]
  ------------------
   64|  1.55k|    {
   65|  1.55k|        return 0;
   66|  1.55k|    }
   67|  4.70k|    uint32_t w, h;
   68|  4.70k|    uint32_t *raster;
   69|       |
   70|  4.70k|    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
  ------------------
  |  |  178|  4.70k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
   71|  4.70k|    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
  ------------------
  |  |  179|  4.70k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
   72|       |    /* don't continue if file size is ludicrous */
   73|  4.70k|    if (TIFFTileSize64(tif) > MAX_SIZE)
  ------------------
  |  Branch (73:9): [True: 22, False: 4.67k]
  ------------------
   74|     22|    {
   75|     22|        TIFFClose(tif);
   76|     22|        return 0;
   77|     22|    }
   78|  4.67k|    uint64_t bufsize = TIFFTileSize64(tif);
   79|       |    /* don't continue if the buffer size greater than the max allowed by the
   80|       |     * fuzzer */
   81|  4.67k|    if (bufsize > MAX_SIZE || bufsize == 0)
  ------------------
  |  Branch (81:9): [True: 0, False: 4.67k]
  |  Branch (81:31): [True: 28, False: 4.65k]
  ------------------
   82|     28|    {
   83|     28|        TIFFClose(tif);
   84|     28|        return 0;
   85|     28|    }
   86|       |
   87|  4.65k|    if (TIFFIsTiled(tif))
  ------------------
  |  Branch (87:9): [True: 2.61k, False: 2.03k]
  ------------------
   88|  2.61k|    {
   89|       |        /* another hack to work around an OOM in tif_fax3.c */
   90|  2.61k|        uint32_t tilewidth = 0;
   91|  2.61k|        uint32_t imagewidth = 0;
   92|  2.61k|        TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tilewidth);
  ------------------
  |  |  311|  2.61k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
   93|  2.61k|        TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imagewidth);
  ------------------
  |  |  178|  2.61k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
   94|  2.61k|        tilewidth = __TIFFSafeMultiply(uint32_t, tilewidth, 2);
  ------------------
  |  |   35|  2.61k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 2.61k, Folded]
  |  |  |  Branch (35:27): [True: 2.61k, False: 0]
  |  |  ------------------
  |  |   36|  2.61k|         ? (t)((v) * (m))                                                      \
  |  |   37|  2.61k|         : (t)0)
  ------------------
   95|  2.61k|        imagewidth = __TIFFSafeMultiply(uint32_t, imagewidth, 2);
  ------------------
  |  |   35|  2.61k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 2.61k, Folded]
  |  |  |  Branch (35:27): [True: 2.61k, False: 4]
  |  |  ------------------
  |  |   36|  2.61k|         ? (t)((v) * (m))                                                      \
  |  |   37|  2.61k|         : (t)0)
  ------------------
   96|  2.61k|        if (tilewidth * 2 > MAX_SIZE || imagewidth * 2 > MAX_SIZE ||
  ------------------
  |  Branch (96:13): [True: 0, False: 2.61k]
  |  Branch (96:41): [True: 2, False: 2.61k]
  ------------------
   97|  2.61k|            tilewidth == 0 || imagewidth == 0)
  ------------------
  |  Branch (97:13): [True: 0, False: 2.61k]
  |  Branch (97:31): [True: 4, False: 2.61k]
  ------------------
   98|      6|        {
   99|      6|            TIFFClose(tif);
  100|      6|            return 0;
  101|      6|        }
  102|  2.61k|    }
  103|  2.03k|    else
  104|  2.03k|    {
  105|       |        // check the size of the non-tiled image
  106|  2.03k|        uint32_t rowsize = 0;
  107|  2.03k|        TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsize);
  ------------------
  |  |  258|  2.03k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  108|  2.03k|        uint32_t stripsize = TIFFStripSize(tif);
  109|  2.03k|        rowsize = __TIFFSafeMultiply(uint32_t, rowsize, 2);
  ------------------
  |  |   35|  2.03k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 2.03k, Folded]
  |  |  |  Branch (35:27): [True: 2.03k, False: 0]
  |  |  ------------------
  |  |   36|  2.03k|         ? (t)((v) * (m))                                                      \
  |  |   37|  2.03k|         : (t)0)
  ------------------
  110|  2.03k|        stripsize = __TIFFSafeMultiply(uint32_t, stripsize, 2);
  ------------------
  |  |   35|  2.03k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 2.03k, Folded]
  |  |  |  Branch (35:27): [True: 2.03k, False: 0]
  |  |  ------------------
  |  |   36|  2.03k|         ? (t)((v) * (m))                                                      \
  |  |   37|  2.03k|         : (t)0)
  ------------------
  111|  2.03k|        if (rowsize * 2 > MAX_SIZE || stripsize * 2 > MAX_SIZE ||
  ------------------
  |  Branch (111:13): [True: 0, False: 2.03k]
  |  Branch (111:39): [True: 0, False: 2.03k]
  ------------------
  112|  2.03k|            rowsize == 0 || stripsize == 0)
  ------------------
  |  Branch (112:13): [True: 0, False: 2.03k]
  |  Branch (112:29): [True: 0, False: 2.03k]
  ------------------
  113|      0|        {
  114|      0|            TIFFClose(tif);
  115|      0|            return 0;
  116|      0|        }
  117|  2.03k|    }
  118|       |
  119|  4.64k|    uint32_t size = __TIFFSafeMultiply(uint32_t, w, h);
  ------------------
  |  |   35|  4.64k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 4.64k, False: 0]
  |  |  |  Branch (35:27): [True: 4.64k, False: 0]
  |  |  ------------------
  |  |   36|  4.64k|         ? (t)((v) * (m))                                                      \
  |  |   37|  4.64k|         : (t)0)
  ------------------
  120|       |
  121|  4.64k|    if (size > MAX_SIZE || size == 0)
  ------------------
  |  Branch (121:9): [True: 3, False: 4.64k]
  |  Branch (121:28): [True: 0, False: 4.64k]
  ------------------
  122|      3|    {
  123|      3|        TIFFClose(tif);
  124|      3|        return 0;
  125|      3|    }
  126|       |
  127|  4.64k|    raster = (uint32_t *)_TIFFmalloc(size * sizeof(uint32_t));
  128|  4.64k|    int ret = 0;
  129|  4.64k|    if (raster != NULL)
  ------------------
  |  Branch (129:9): [True: 4.64k, False: 0]
  ------------------
  130|  4.64k|    {
  131|  4.64k|        TIFFReadRGBAImage(tif, w, h, raster, 0);
  132|       |
  133|  4.64k|        if (!TIFFIsTiled(tif))
  ------------------
  |  Branch (133:13): [True: 2.03k, False: 2.61k]
  ------------------
  134|  2.03k|        {
  135|       |            // Allocate a buffer to hold one scanline
  136|  2.03k|            tsize_t scanlineSize = TIFFScanlineSize(tif);
  137|  2.03k|            void *buffer = _TIFFmalloc(scanlineSize);
  138|  2.03k|            if (!buffer)
  ------------------
  |  Branch (138:17): [True: 0, False: 2.03k]
  ------------------
  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|  2.05M|            for (uint32_t row = 0; row < h; row++)
  ------------------
  |  Branch (146:36): [True: 2.05M, False: 750]
  ------------------
  147|  2.05M|            {
  148|  2.05M|                if (TIFFReadScanline(tif, buffer, row, 0) < 0)
  ------------------
  |  Branch (148:21): [True: 1.28k, False: 2.05M]
  ------------------
  149|  1.28k|                {
  150|  1.28k|                    _TIFFfree(buffer);
  151|  1.28k|                    ret = 1;
  152|  1.28k|                    goto cleanup;
  153|  1.28k|                }
  154|  2.05M|            }
  155|    750|            _TIFFfree(buffer);
  156|    750|        }
  157|  4.64k|    cleanup:
  158|  4.64k|        _TIFFfree(raster);
  159|  4.64k|    }
  160|  4.64k|    TIFFClose(tif);
  161|       |
  162|  4.64k|    return ret;
  163|  4.64k|}

_TIFFMultiply32:
   37|  4.38M|{
   38|  4.38M|    if (second && first > UINT32_MAX / second)
  ------------------
  |  Branch (38:9): [True: 4.38M, False: 8]
  |  Branch (38:19): [True: 638, False: 4.38M]
  ------------------
   39|    638|    {
   40|    638|        TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   41|    638|        return 0;
   42|    638|    }
   43|       |
   44|  4.38M|    return first * second;
   45|  4.38M|}
_TIFFMultiply64:
   49|  7.99M|{
   50|  7.99M|    if (second && first > UINT64_MAX / second)
  ------------------
  |  Branch (50:9): [True: 4.87M, False: 3.11M]
  |  Branch (50:19): [True: 0, False: 4.87M]
  ------------------
   51|      0|    {
   52|      0|        TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   53|      0|        return 0;
   54|      0|    }
   55|       |
   56|  7.99M|    return first * second;
   57|  7.99M|}
_TIFFAdd64:
   61|  5.16M|{
   62|  5.16M|    if (first > UINT64_MAX - second)
  ------------------
  |  Branch (62:9): [True: 0, False: 5.16M]
  ------------------
   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|  5.16M|    return first + second;
   72|  5.16M|}
_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.43M|{
  125|  1.43M|    if (val > (uint64_t)TIFF_TMSIZE_T_MAX)
  ------------------
  |  |   68|  1.43M|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (125:9): [True: 5, False: 1.43M]
  ------------------
  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.43M|    return (tmsize_t)val;
  134|  1.43M|}
_TIFFCastUInt64ToUInt32:
  137|  2.03M|{
  138|  2.03M|    if (val > UINT32_MAX)
  ------------------
  |  Branch (138:9): [True: 0, False: 2.03M]
  ------------------
  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|  2.03M|    return (uint32_t)val;
  147|  2.03M|}
_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|  50.4k|{
  213|       |    return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);
  214|  50.4k|}
TIFFVGetFieldDefaulted:
  309|  74.4k|{
  310|  74.4k|    TIFFDirectory *td = &tif->tif_dir;
  311|       |
  312|  74.4k|    if (TIFFVGetField(tif, tag, ap))
  ------------------
  |  Branch (312:9): [True: 57.3k, False: 17.0k]
  ------------------
  313|  57.3k|        return (1);
  314|  17.0k|    switch (tag)
  315|  17.0k|    {
  316|      0|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (316:9): [True: 0, False: 17.0k]
  ------------------
  317|      0|            *va_arg(ap, uint32_t *) = td->td_subfiletype;
  318|      0|            return (1);
  319|    516|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|    516|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (319:9): [True: 516, False: 16.5k]
  ------------------
  320|    516|            *va_arg(ap, uint16_t *) = td->td_bitspersample;
  321|    516|            return (1);
  322|      0|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      0|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (322:9): [True: 0, False: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  326|      0|            *va_arg(ap, uint16_t *) = td->td_fillorder;
  327|      0|            return (1);
  328|  3.11k|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|  3.11k|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (328:9): [True: 3.11k, False: 13.9k]
  ------------------
  329|  3.11k|            *va_arg(ap, uint16_t *) = td->td_orientation;
  330|  3.11k|            return (1);
  331|  1.37k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  1.37k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (331:9): [True: 1.37k, False: 15.6k]
  ------------------
  332|  1.37k|            *va_arg(ap, uint16_t *) = td->td_samplesperpixel;
  333|  1.37k|            return (1);
  334|      0|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|      0|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (334:9): [True: 0, False: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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|     94|        case TIFFTAG_INKSET:
  ------------------
  |  |  322|     94|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  |  Branch (395:9): [True: 94, False: 16.9k]
  ------------------
  396|     94|            *va_arg(ap, uint16_t *) = INKSET_CMYK;
  ------------------
  |  |  323|     94|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  397|     94|            return 1;
  398|      0|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|      0|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (398:9): [True: 0, False: 17.0k]
  ------------------
  399|      0|            *va_arg(ap, uint16_t *) = 4;
  400|      0|            return (1);
  401|  3.23k|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|  3.23k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (401:9): [True: 3.23k, False: 13.8k]
  ------------------
  402|  3.23k|            *va_arg(ap, uint16_t *) = td->td_extrasamples;
  403|  3.23k|            *va_arg(ap, const uint16_t **) = td->td_sampleinfo;
  404|  3.23k|            return (1);
  405|      0|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|      0|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (405:9): [True: 0, False: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  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: 17.0k]
  ------------------
  420|      0|            *va_arg(ap, uint32_t *) = td->td_imagedepth;
  421|      0|            return (1);
  422|  1.13k|        case TIFFTAG_YCBCRCOEFFICIENTS:
  ------------------
  |  |  387|  1.13k|#define TIFFTAG_YCBCRCOEFFICIENTS 529      /* !RGB -> YCbCr transform */
  ------------------
  |  Branch (422:9): [True: 1.13k, False: 15.9k]
  ------------------
  423|  1.13k|        {
  424|       |            /* defaults are from CCIR Recommendation 601-1 */
  425|  1.13k|            static const float ycbcrcoeffs[] = {0.299f, 0.587f, 0.114f};
  426|  1.13k|            *va_arg(ap, const float **) = ycbcrcoeffs;
  427|  1.13k|            return 1;
  428|      0|        }
  429|  6.42k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  6.42k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (429:9): [True: 6.42k, False: 10.6k]
  ------------------
  430|  6.42k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
  431|  6.42k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
  432|  6.42k|            return (1);
  433|      0|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      0|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (433:9): [True: 0, False: 17.0k]
  ------------------
  434|      0|            *va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
  435|      0|            return (1);
  436|     13|        case TIFFTAG_WHITEPOINT:
  ------------------
  |  |  307|     13|#define TIFFTAG_WHITEPOINT 318             /* image white point */
  ------------------
  |  Branch (436:9): [True: 13, False: 17.0k]
  ------------------
  437|     13|        {
  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|     13|            static const float whitepoint[] = {
  442|     13|                D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|     13|#define D50_X0 (96.4250f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|     13|#define D50_X0 (96.4250f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  133|     13|#define D50_Y0 (100.0f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  134|     13|#define D50_Z0 (82.4680f)
  ------------------
  443|     13|                D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  133|     13|#define D50_Y0 (100.0f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  132|     13|#define D50_X0 (96.4250f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  133|     13|#define D50_Y0 (100.0f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  134|     13|#define D50_Z0 (82.4680f)
  ------------------
  444|     13|            *va_arg(ap, const float **) = whitepoint;
  445|     13|            return 1;
  446|      0|        }
  447|      0|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      0|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (447:9): [True: 0, False: 17.0k]
  ------------------
  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.13k|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|  1.13k|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (462:9): [True: 1.13k, False: 15.9k]
  ------------------
  463|  1.13k|            if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(tif, td))
  ------------------
  |  Branch (463:17): [True: 1.13k, False: 0]
  |  Branch (463:42): [True: 0, False: 1.13k]
  ------------------
  464|      0|                return (0);
  465|  1.13k|            *va_arg(ap, const float **) = td->td_refblackwhite;
  466|  1.13k|            return (1);
  467|      0|        default:
  ------------------
  |  Branch (467:9): [True: 0, False: 17.0k]
  ------------------
  468|      0|            break;
  469|  17.0k|    }
  470|      0|    return 0;
  471|  17.0k|}
TIFFGetFieldDefaulted:
  478|  74.4k|{
  479|  74.4k|    int ok;
  480|  74.4k|    va_list ap;
  481|       |
  482|  74.4k|    va_start(ap, tag);
  483|  74.4k|    ok = TIFFVGetFieldDefaulted(tif, tag, ap);
  484|       |    va_end(ap);
  485|  74.4k|    return (ok);
  486|  74.4k|}
_TIFFClampDoubleToFloat:
  489|    718|{
  490|    718|    if (val > (double)FLT_MAX)
  ------------------
  |  Branch (490:9): [True: 0, False: 718]
  ------------------
  491|      0|        return FLT_MAX;
  492|    718|    if (val < -(double)FLT_MAX)
  ------------------
  |  Branch (492:9): [True: 0, False: 718]
  ------------------
  493|      0|        return -FLT_MAX;
  494|    718|    return (float)val;
  495|    718|}
_TIFFSeekOK:
  507|   536k|{
  508|       |    /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
  509|       |    /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
  510|   536k|    return off <= (~(uint64_t)0) / 2 && TIFFSeekFile(tif, off, SEEK_SET) == off;
  ------------------
  |  |  287|   536k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
  |  Branch (510:12): [True: 536k, False: 214]
  |  Branch (510:41): [True: 349k, False: 187k]
  ------------------
  511|   536k|}
tif_aux.c:TIFFDefaultRefBlackWhite:
  265|  1.13k|{
  266|  1.13k|    int i;
  267|       |
  268|  1.13k|    td->td_refblackwhite = (float *)_TIFFmallocExt(tif, 6 * sizeof(float));
  269|  1.13k|    if (td->td_refblackwhite == NULL)
  ------------------
  |  Branch (269:9): [True: 0, False: 1.13k]
  ------------------
  270|      0|        return 0;
  271|  1.13k|    if (td->td_photometric == PHOTOMETRIC_YCBCR)
  ------------------
  |  |  227|  1.13k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (271:9): [True: 1.13k, False: 0]
  ------------------
  272|  1.13k|    {
  273|       |        /*
  274|       |         * YCbCr (Class Y) images must have the ReferenceBlackWhite
  275|       |         * tag set. Fix the broken images, which lacks that tag.
  276|       |         */
  277|  1.13k|        td->td_refblackwhite[0] = 0.0f;
  278|  1.13k|        td->td_refblackwhite[1] = td->td_refblackwhite[3] =
  279|  1.13k|            td->td_refblackwhite[5] = 255.0f;
  280|  1.13k|        td->td_refblackwhite[2] = td->td_refblackwhite[4] = 128.0f;
  281|  1.13k|    }
  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.13k|    return 1;
  298|  1.13k|}

TIFFCleanup:
   45|  6.25k|{
   46|       |    /*
   47|       |     * Flush buffered data and directory (if dirty).
   48|       |     */
   49|  6.25k|    if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (49:9): [True: 0, False: 6.25k]
  ------------------
   50|      0|        TIFFFlush(tif);
   51|  6.25k|    TIFFFreeDirectory(tif);
   52|       |
   53|  6.25k|    _TIFFCleanupIFDOffsetAndNumberMaps(tif);
   54|       |
   55|       |    /*
   56|       |     * Clean up client info links.
   57|       |     */
   58|  6.25k|    while (tif->tif_clientinfo)
  ------------------
  |  Branch (58:12): [True: 0, False: 6.25k]
  ------------------
   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|  6.25k|    if (tif->tif_rawdata && (tif->tif_flags & TIFF_MYBUFFER))
  ------------------
  |  |  128|  3.55k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (67:9): [True: 3.55k, False: 2.69k]
  |  Branch (67:29): [True: 3.55k, False: 0]
  ------------------
   68|  3.55k|        _TIFFfreeExt(tif, tif->tif_rawdata);
   69|  6.25k|    if (isMapped(tif))
  ------------------
  |  |  279|  6.25k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  6.25k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 6.25k]
  |  |  ------------------
  ------------------
   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|  6.25k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (75:9): [True: 6.24k, False: 6]
  |  Branch (75:28): [True: 6.24k, False: 0]
  ------------------
   76|  6.24k|    {
   77|  6.24k|        uint32_t i;
   78|       |
   79|  1.10M|        for (i = 0; i < tif->tif_nfields; i++)
  ------------------
  |  Branch (79:21): [True: 1.09M, False: 6.24k]
  ------------------
   80|  1.09M|        {
   81|  1.09M|            TIFFField *fld = tif->tif_fields[i];
   82|  1.09M|            if (fld->field_name != NULL)
  ------------------
  |  Branch (82:17): [True: 1.09M, False: 0]
  ------------------
   83|  1.09M|            {
   84|  1.09M|                if (fld->field_bit == FIELD_CUSTOM &&
  ------------------
  |  |  346|  2.18M|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (84:21): [True: 758k, False: 336k]
  ------------------
   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|   758k|                    TIFFFieldIsAnonymous(fld))
  ------------------
  |  Branch (89:21): [True: 115k, False: 643k]
  ------------------
   90|   115k|                {
   91|   115k|                    _TIFFfreeExt(tif, (void *)fld->field_name);
   92|   115k|                    _TIFFfreeExt(tif, fld);
   93|   115k|                }
   94|  1.09M|            }
   95|  1.09M|        }
   96|       |
   97|  6.24k|        _TIFFfreeExt(tif, tif->tif_fields);
   98|  6.24k|    }
   99|       |
  100|  6.25k|    if (tif->tif_nfieldscompat > 0)
  ------------------
  |  Branch (100:9): [True: 0, False: 6.25k]
  ------------------
  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|  6.25k|    if (tif->tif_cur_cumulated_mem_alloc != 0)
  ------------------
  |  Branch (112:9): [True: 0, False: 6.25k]
  ------------------
  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|  6.25k|}
_TIFFCleanupIFDOffsetAndNumberMaps:
  128|  6.25k|{
  129|  6.25k|    if (tif->tif_map_dir_offset_to_number)
  ------------------
  |  Branch (129:9): [True: 6.24k, False: 4]
  ------------------
  130|  6.24k|    {
  131|  6.24k|        TIFFHashSetDestroy(tif->tif_map_dir_offset_to_number);
  132|  6.24k|        tif->tif_map_dir_offset_to_number = NULL;
  133|  6.24k|    }
  134|  6.25k|    if (tif->tif_map_dir_number_to_offset)
  ------------------
  |  Branch (134:9): [True: 6.24k, False: 4]
  ------------------
  135|  6.24k|    {
  136|  6.24k|        TIFFHashSetDestroy(tif->tif_map_dir_number_to_offset);
  137|       |        tif->tif_map_dir_number_to_offset = NULL;
  138|  6.24k|    }
  139|  6.25k|}
TIFFClose:
  156|  4.70k|{
  157|  4.70k|    if (tif != NULL)
  ------------------
  |  Branch (157:9): [True: 4.70k, False: 0]
  ------------------
  158|  4.70k|    {
  159|  4.70k|        TIFFCloseProc closeproc = tif->tif_closeproc;
  160|  4.70k|        thandle_t fd = tif->tif_clientdata;
  161|       |
  162|  4.70k|        TIFFCleanup(tif);
  163|  4.70k|        (void)(*closeproc)(fd);
  164|  4.70k|    }
  165|  4.70k|}

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

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: 27.2k]
  ------------------
   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|  27.2k|    else
   74|  27.2k|    {
   75|  27.2k|        cby = (L + 16.0f) / 116.0f;
   76|  27.2k|        *Y = cielab->Y0 * cby * cby * cby;
   77|  27.2k|    }
   78|       |
   79|   467M|    tmp = (float)a / 256.0f / 500.0f + cby;
   80|   467M|    if (tmp < 0.2069f)
  ------------------
  |  Branch (80:9): [True: 467M, False: 29.3k]
  ------------------
   81|   467M|        *X = cielab->X0 * (tmp - 0.13793f) / 7.787f;
   82|  29.3k|    else
   83|  29.3k|        *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: 22.0k]
  ------------------
   87|   467M|        *Z = cielab->Z0 * (tmp - 0.13793f) / 7.787f;
   88|  22.0k|    else
   89|  22.0k|        *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: 23.5k, 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: 20.8k, 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: 20.9k, 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: 3.48k]
  |  |  ------------------
  ------------------
  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: 664]
  |  |  ------------------
  ------------------
  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: 9.33k]
  |  |  ------------------
  ------------------
  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: 22.9k, 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: 20.8k, 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: 20.8k, 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: 3.61k]
  |  |  ------------------
  ------------------
  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: 664]
  |  |  ------------------
  ------------------
  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: 9.33k]
  |  |  ------------------
  ------------------
  135|   467M|}
TIFFCIELabToRGBInit:
  144|     13|{
  145|     13|    size_t i;
  146|     13|    double dfGamma;
  147|       |
  148|     13|    cielab->range = CIELABTORGB_TABLE_RANGE;
  ------------------
  |  |  182|     13|#define CIELABTORGB_TABLE_RANGE 1500
  ------------------
  149|       |
  150|     13|    _TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
  151|       |
  152|       |    /* Red */
  153|     13|    dfGamma = 1.0 / (double)cielab->display.d_gammaR;
  154|     13|    cielab->rstep =
  155|     13|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  156|  19.5k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (156:17): [True: 19.5k, False: 13]
  ------------------
  157|  19.5k|    {
  158|  19.5k|        cielab->Yr2r[i] = (float)cielab->display.d_Vrwr *
  159|  19.5k|                          ((float)pow((double)i / cielab->range, dfGamma));
  160|  19.5k|    }
  161|       |
  162|       |    /* Green */
  163|     13|    dfGamma = 1.0 / (double)cielab->display.d_gammaG;
  164|     13|    cielab->gstep =
  165|     13|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  166|  19.5k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (166:17): [True: 19.5k, False: 13]
  ------------------
  167|  19.5k|    {
  168|  19.5k|        cielab->Yg2g[i] = (float)cielab->display.d_Vrwg *
  169|  19.5k|                          ((float)pow((double)i / cielab->range, dfGamma));
  170|  19.5k|    }
  171|       |
  172|       |    /* Blue */
  173|     13|    dfGamma = 1.0 / (double)cielab->display.d_gammaB;
  174|     13|    cielab->bstep =
  175|     13|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  176|  19.5k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (176:17): [True: 19.5k, False: 13]
  ------------------
  177|  19.5k|    {
  178|  19.5k|        cielab->Yb2b[i] = (float)cielab->display.d_Vrwb *
  179|  19.5k|                          ((float)pow((double)i / cielab->range, dfGamma));
  180|  19.5k|    }
  181|       |
  182|       |    /* Init reference white point */
  183|     13|    cielab->X0 = refWhite[0];
  184|     13|    cielab->Y0 = refWhite[1];
  185|     13|    cielab->Z0 = refWhite[2];
  186|       |
  187|     13|    return 0;
  188|     13|}
TIFFYCbCrtoRGB:
  208|   238M|{
  209|   238M|    int32_t i;
  210|       |
  211|       |    /* XXX: Only 8-bit YCbCr input supported for now */
  212|   238M|    Y = HICLAMP(Y, 255);
  ------------------
  |  |  204|   238M|#define HICLAMP(f, max) ((f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (204:26): [True: 0, False: 238M]
  |  |  ------------------
  ------------------
  213|   238M|    Cb = CLAMP(Cb, 0, 255);
  ------------------
  |  |  203|   238M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 0, False: 238M]
  |  |  |  Branch (203:34): [True: 0, False: 238M]
  |  |  ------------------
  ------------------
  214|   238M|    Cr = CLAMP(Cr, 0, 255);
  ------------------
  |  |  203|   238M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 0, False: 238M]
  |  |  |  Branch (203:34): [True: 0, False: 238M]
  |  |  ------------------
  ------------------
  215|       |
  216|   238M|    i = ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr];
  217|   238M|    *r = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   238M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 232M, False: 5.19M]
  |  |  |  Branch (203:34): [True: 557k, False: 4.63M]
  |  |  ------------------
  ------------------
  218|   238M|    i = ycbcr->Y_tab[Y] +
  219|   238M|        ((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT);
  ------------------
  |  |  195|   238M|#define SHIFT 16
  ------------------
  220|   238M|    *g = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   238M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 354k, False: 237M]
  |  |  |  Branch (203:34): [True: 95.6M, False: 142M]
  |  |  ------------------
  ------------------
  221|   238M|    i = ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb];
  222|   238M|    *b = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   238M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 224M, False: 13.7M]
  |  |  |  Branch (203:34): [True: 724k, False: 13.0M]
  |  |  ------------------
  ------------------
  223|   238M|}
TIFFYCbCrToRGBInit:
  259|  1.13k|{
  260|  1.13k|    TIFFRGBValue *clamptab;
  261|  1.13k|    int i;
  262|       |
  263|  1.13k|#define LumaRed luma[0]
  264|  1.13k|#define LumaGreen luma[1]
  265|  1.13k|#define LumaBlue luma[2]
  266|       |
  267|  1.13k|    clamptab =
  268|  1.13k|        (uint8_t *)ycbcr + TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long));
  ------------------
  |  |  322|  1.13k|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  312|  1.13k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (312:6): [True: 1.13k, Folded]
  |  |  |  |  ------------------
  |  |  |  |  313|  1.13k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  314|  1.13k|         : 0U)
  |  |  ------------------
  ------------------
  269|  1.13k|    _TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
  270|  1.13k|    ycbcr->clamptab = (clamptab += 256);
  271|   291k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (271:17): [True: 290k, False: 1.13k]
  ------------------
  272|   290k|        clamptab[i] = (TIFFRGBValue)i;
  273|  1.13k|    _TIFFmemset(clamptab + 256, 255, 2 * 256); /* v > 255 => 255 */
  274|  1.13k|    ycbcr->Cr_r_tab = (int *)(clamptab + 3 * 256);
  275|  1.13k|    ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
  276|  1.13k|    ycbcr->Cr_g_tab = (int32_t *)(ycbcr->Cb_b_tab + 256);
  277|  1.13k|    ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
  278|  1.13k|    ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
  279|       |
  280|  1.13k|    {
  281|  1.13k|        float f1 = 2 - 2 * LumaRed;
  ------------------
  |  |  263|  1.13k|#define LumaRed luma[0]
  ------------------
  282|  1.13k|        int32_t D1 = FIX(CLAMP(f1, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.53k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.13k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.13k]
  |  |  |  Branch (196:36): [True: 2, False: 1.13k]
  |  |  ------------------
  ------------------
  283|  1.13k|        float f2 = LumaRed * f1 / LumaGreen;
  ------------------
  |  |  263|  1.13k|#define LumaRed luma[0]
  ------------------
                      float f2 = LumaRed * f1 / LumaGreen;
  ------------------
  |  |  264|  1.13k|#define LumaGreen luma[1]
  ------------------
  284|  1.13k|        int32_t D2 = -FIX(CLAMP(f2, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.53k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.13k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.13k]
  |  |  |  Branch (196:36): [True: 2, False: 1.13k]
  |  |  ------------------
  ------------------
  285|  1.13k|        float f3 = 2 - 2 * LumaBlue;
  ------------------
  |  |  265|  1.13k|#define LumaBlue luma[2]
  ------------------
  286|  1.13k|        int32_t D3 = FIX(CLAMP(f3, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.53k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.13k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.13k]
  |  |  |  Branch (196:36): [True: 1, False: 1.13k]
  |  |  ------------------
  ------------------
  287|  1.13k|        float f4 = LumaBlue * f3 / LumaGreen;
  ------------------
  |  |  265|  1.13k|#define LumaBlue luma[2]
  ------------------
                      float f4 = LumaBlue * f3 / LumaGreen;
  ------------------
  |  |  264|  1.13k|#define LumaGreen luma[1]
  ------------------
  288|  1.13k|        int32_t D4 = -FIX(CLAMP(f4, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.53k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.13k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.13k]
  |  |  |  Branch (196:36): [True: 1, False: 1.13k]
  |  |  ------------------
  ------------------
  289|  1.13k|        int x;
  290|       |
  291|  1.13k|#undef LumaBlue
  292|  1.13k|#undef LumaGreen
  293|  1.13k|#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|   291k|        for (i = 0, x = -128; i < 256; i++, x++)
  ------------------
  |  Branch (302:31): [True: 290k, False: 1.13k]
  ------------------
  303|   290k|        {
  304|   290k|            int32_t Cr = (int32_t)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0f,
  ------------------
  |  |  199|   290k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   290k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  342|   290k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 290k, False: 0]
  |  |  ------------------
  ------------------
  305|   290k|                                                refBlackWhite[5] - 128.0f, 127),
  306|   290k|                                         -128.0f * 32, 128.0f * 32);
  307|   290k|            int32_t Cb = (int32_t)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0f,
  ------------------
  |  |  199|   290k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   290k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  342|   290k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 290k, False: 0]
  |  |  ------------------
  ------------------
  308|   290k|                                                refBlackWhite[3] - 128.0f, 127),
  309|   290k|                                         -128.0f * 32, 128.0f * 32);
  310|       |
  311|   290k|            ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  197|   290k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   290k|#define SHIFT 16
  |  |  ------------------
  ------------------
                          ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  195|   290k|#define SHIFT 16
  ------------------
  312|   290k|            ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  197|   290k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   290k|#define SHIFT 16
  |  |  ------------------
  ------------------
                          ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  195|   290k|#define SHIFT 16
  ------------------
  313|   290k|            ycbcr->Cr_g_tab[i] = D2 * Cr;
  314|   290k|            ycbcr->Cb_g_tab[i] = D4 * Cb + ONE_HALF;
  ------------------
  |  |  197|   290k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   290k|#define SHIFT 16
  |  |  ------------------
  ------------------
  315|   290k|            ycbcr->Y_tab[i] = (int32_t)CLAMPw(
  316|   290k|                Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
  ------------------
  |  |  199|   290k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   290k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  342|   290k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 290k, False: 0]
  |  |  ------------------
  ------------------
  317|   290k|                -128.0f * 32, 128.0f * 32);
  318|   290k|        }
  319|  1.13k|    }
  320|       |
  321|  1.13k|    return 0;
  322|  1.13k|}
tif_color.c:CLAMPw:
  228|   870k|{
  229|   870k|    if (v < vmin)
  ------------------
  |  Branch (229:9): [True: 1.39k, False: 869k]
  ------------------
  230|  1.39k|    {
  231|       |        /* printf("%f clamped to %f\n", v, vmin); */
  232|  1.39k|        return vmin;
  233|  1.39k|    }
  234|   869k|    if (v > vmax)
  ------------------
  |  Branch (234:9): [True: 989, False: 868k]
  ------------------
  235|    989|    {
  236|       |        /* printf("%f clamped to %f\n", v, vmax); */
  237|    989|        return vmax;
  238|    989|    }
  239|   868k|    return v;
  240|   869k|}

_TIFFNoRowDecode:
   97|      5|{
   98|      5|    (void)pp;
   99|      5|    (void)cc;
  100|      5|    (void)s;
  101|      5|    return (TIFFNoDecode(tif, "scanline"));
  102|      5|}
_TIFFNoStripDecode:
  105|    186|{
  106|    186|    (void)pp;
  107|    186|    (void)cc;
  108|    186|    (void)s;
  109|    186|    return (TIFFNoDecode(tif, "strip"));
  110|    186|}
_TIFFNoTileDecode:
  113|    837|{
  114|    837|    (void)pp;
  115|    837|    (void)cc;
  116|    837|    (void)s;
  117|    837|    return (TIFFNoDecode(tif, "tile"));
  118|    837|}
_TIFFNoPreCode:
  129|  3.43k|{
  130|  3.43k|    (void)tif;
  131|  3.43k|    (void)s;
  132|  3.43k|    return (1);
  133|  3.43k|}
_TIFFSetDefaultCompressionState:
  155|  23.7k|{
  156|  23.7k|    tif->tif_fixuptags = _TIFFNoFixupTags;
  157|  23.7k|    tif->tif_decodestatus = TRUE;
  ------------------
  |  |   71|  23.7k|#define TRUE 1
  ------------------
  158|  23.7k|    tif->tif_setupdecode = _TIFFtrue;
  159|  23.7k|    tif->tif_predecode = _TIFFNoPreCode;
  160|  23.7k|    tif->tif_decoderow = _TIFFNoRowDecode;
  161|  23.7k|    tif->tif_decodestrip = _TIFFNoStripDecode;
  162|  23.7k|    tif->tif_decodetile = _TIFFNoTileDecode;
  163|  23.7k|    tif->tif_encodestatus = TRUE;
  ------------------
  |  |   71|  23.7k|#define TRUE 1
  ------------------
  164|  23.7k|    tif->tif_setupencode = _TIFFtrue;
  165|  23.7k|    tif->tif_preencode = _TIFFNoPreCode;
  166|  23.7k|    tif->tif_postencode = _TIFFtrue;
  167|  23.7k|    tif->tif_encoderow = _TIFFNoRowEncode;
  168|  23.7k|    tif->tif_encodestrip = _TIFFNoStripEncode;
  169|  23.7k|    tif->tif_encodetile = _TIFFNoTileEncode;
  170|  23.7k|    tif->tif_close = _TIFFvoid;
  171|  23.7k|    tif->tif_seek = _TIFFNoSeek;
  172|  23.7k|    tif->tif_cleanup = _TIFFvoid;
  173|  23.7k|    tif->tif_defstripsize = _TIFFDefaultStripSize;
  174|  23.7k|    tif->tif_deftilesize = _TIFFDefaultTileSize;
  175|  23.7k|    tif->tif_getmaxcompressionratio = _TIFFDefaultGetMaxCompressionRatio;
  176|  23.7k|    tif->tif_flags &= ~(TIFF_NOBITREV | TIFF_NOREADRAW);
  ------------------
  |  |  127|  23.7k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
                  tif->tif_flags &= ~(TIFF_NOBITREV | TIFF_NOREADRAW);
  ------------------
  |  |  138|  23.7k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  177|  23.7k|}
TIFFSetCompressionScheme:
  180|  11.9k|{
  181|  11.9k|    const TIFFCodec *c = TIFFFindCODEC((uint16_t)scheme);
  182|       |
  183|  11.9k|    _TIFFSetDefaultCompressionState(tif);
  184|  11.9k|    if (scheme == COMPRESSION_NONE)
  ------------------
  |  |  182|  11.9k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (184:9): [True: 6.24k, False: 5.73k]
  ------------------
  185|  6.24k|        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.9k|    return (c ? (*c->init)(tif, scheme) : 1);
  ------------------
  |  Branch (192:13): [True: 11.8k, False: 107]
  ------------------
  193|  11.9k|}
TIFFGetMaxCompressionRatio:
  196|    765|{
  197|    765|    if (tif->tif_getmaxcompressionratio)
  ------------------
  |  Branch (197:9): [True: 765, False: 0]
  ------------------
  198|    765|        return tif->tif_getmaxcompressionratio(tif);
  199|      0|    return 0;
  200|    765|}
TIFFFindCODEC:
  215|  20.6k|{
  216|  20.6k|    const TIFFCodec *c;
  217|  20.6k|    codec_t *cd;
  218|       |
  219|  20.6k|    for (cd = registeredCODECS; cd; cd = cd->next)
  ------------------
  |  Branch (219:33): [True: 0, False: 20.6k]
  ------------------
  220|      0|        if (cd->info->scheme == scheme)
  ------------------
  |  Branch (220:13): [True: 0, False: 0]
  ------------------
  221|      0|            return ((const TIFFCodec *)cd->info);
  222|   118k|    for (c = _TIFFBuiltinCODECS; c->name; c++)
  ------------------
  |  Branch (222:34): [True: 117k, False: 805]
  ------------------
  223|   117k|        if (c->scheme == scheme)
  ------------------
  |  Branch (223:13): [True: 19.8k, False: 97.9k]
  ------------------
  224|  19.8k|            return (c);
  225|    805|    return NULL;
  226|  20.6k|}
tif_compress.c:TIFFNoDecode:
   76|  1.02k|{
   77|  1.02k|    const TIFFCodec *c = TIFFFindCODEC(tif->tif_dir.td_compression);
   78|       |
   79|  1.02k|    if (c)
  ------------------
  |  Branch (79:9): [True: 399, False: 629]
  ------------------
   80|    399|        TIFFErrorExtR(tif, tif->tif_name, "%s %s decoding is not implemented",
   81|    399|                      c->name, method);
   82|    629|    else
   83|    629|        TIFFErrorExtR(tif, tif->tif_name,
   84|    629|                      "Compression scheme %" PRIu16
   85|    629|                      " %s decoding is not implemented",
   86|    629|                      tif->tif_dir.td_compression, method);
   87|  1.02k|    return (0);
   88|  1.02k|}
tif_compress.c:_TIFFNoFixupTags:
   91|    152|{
   92|    152|    (void)tif;
   93|    152|    return (1);
   94|    152|}
tif_compress.c:_TIFFtrue:
  136|    367|{
  137|    367|    (void)tif;
  138|    367|    return (1);
  139|    367|}
tif_compress.c:_TIFFvoid:
  140|  12.7k|static void _TIFFvoid(TIFF *tif) { (void)tif; }
tif_compress.c:_TIFFDefaultGetMaxCompressionRatio:
  143|    502|{
  144|    502|    (void)tif;
  145|    502|    return 0; /* unknown */
  146|    502|}
tif_compress.c:_TIFFGetMaxCompressionRatioOne:
  149|      2|{
  150|      2|    (void)tif;
  151|      2|    return 1; /* no compression */
  152|      2|}

_TIFFsetByteArrayExt:
   67|    882|{
   68|    882|    setByteArray(tif, vpp, vp, n, 1);
   69|    882|}
_TIFFsetShortArrayExt:
   82|    896|{
   83|    896|    setByteArray(tif, (void **)wpp, wp, n, sizeof(uint16_t));
   84|    896|}
_TIFFsetFloatArrayExt:
  107|      7|{
  108|      7|    setByteArray(tif, (void **)fpp, fp, n, sizeof(float));
  109|      7|}
_TIFFsetDoubleArrayExt:
  117|    211|{
  118|    211|    setByteArray(tif, (void **)dpp, dp, n, sizeof(double));
  119|    211|}
TIFFSetField:
 1168|  72.7k|{
 1169|  72.7k|    va_list ap;
 1170|  72.7k|    int status;
 1171|       |
 1172|  72.7k|    va_start(ap, tag);
 1173|  72.7k|    status = TIFFVSetField(tif, tag, ap);
 1174|       |    va_end(ap);
 1175|  72.7k|    return (status);
 1176|  72.7k|}
TIFFVSetField:
 1227|  72.7k|{
 1228|  72.7k|    return OkToChangeTag(tif, tag)
  ------------------
  |  Branch (1228:12): [True: 72.7k, False: 0]
  ------------------
 1229|  72.7k|               ? (*tif->tif_tagmethods.vsetfield)(tif, tag, ap)
 1230|  72.7k|               : 0;
 1231|  72.7k|}
TIFFGetField:
 1608|  40.6k|{
 1609|  40.6k|    int status;
 1610|  40.6k|    va_list ap;
 1611|       |
 1612|  40.6k|    va_start(ap, tag);
 1613|  40.6k|    status = TIFFVGetField(tif, tag, ap);
 1614|       |    va_end(ap);
 1615|  40.6k|    return (status);
 1616|  40.6k|}
TIFFVGetField:
 1625|   115k|{
 1626|   115k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|   115k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1627|   115k|    return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit))
  ------------------
  |  |  276|   230k|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (276:24): [True: 0, False: 115k]
  |  |  ------------------
  ------------------
                  return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit))
  ------------------
  |  |  248|   115k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|   115k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|   115k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 93.4k, False: 21.6k]
  |  |  ------------------
  ------------------
  |  Branch (1627:13): [True: 115k, False: 0]
  ------------------
 1628|   115k|                ? (*tif->tif_tagmethods.vgetfield)(tif, tag, ap)
 1629|   115k|                : 0);
 1630|   115k|}
_TIFFResetTifDirAndInitStrileCounters:
 1646|  12.4k|{
 1647|  12.4k|    _TIFFmemset(td, 0, sizeof(*td));
 1648|  12.4k|    td->td_curstrip = NOSTRIP;      /* invalid strip = NOSTRIP */
  ------------------
  |  |  111|  12.4k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
 1649|  12.4k|    td->td_row = (uint32_t)-1;      /* read/write pre-increment */
 1650|  12.4k|    td->td_col = (uint32_t)-1;      /* read/write pre-increment */
 1651|  12.4k|    td->td_scanlinesize = 0;        /* initialize to zero */
 1652|  12.4k|    td->td_curtile = NOTILE;        /* invalid tile = NOTILE */
  ------------------
  |  |  116|  12.4k|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1653|  12.4k|    td->td_tilesize = (tmsize_t)-1; /* invalidate tilezize */
 1654|  12.4k|}
TIFFFreeDirectory:
 1660|  12.4k|{
 1661|  12.4k|    TIFFDirectory *td = &tif->tif_dir;
 1662|  12.4k|    int i;
 1663|       |
 1664|  12.4k|    (*tif->tif_cleanup)(tif);
 1665|  12.4k|    _TIFFmemset(td->td_fieldsset, 0, sizeof(td->td_fieldsset));
 1666|  12.4k|    CleanupField(td_sminsamplevalue);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 197, False: 12.2k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|    197|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|    197|            td->member = 0;                                                    \
  |  | 1638|    197|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1667|  12.4k|    CleanupField(td_smaxsamplevalue);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 10, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|     10|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     10|            td->member = 0;                                                    \
  |  | 1638|     10|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1668|  12.4k|    CleanupField(td_colormap[0]);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 37, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|     37|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     37|            td->member = 0;                                                    \
  |  | 1638|     37|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1669|  12.4k|    CleanupField(td_colormap[1]);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 37, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|     37|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     37|            td->member = 0;                                                    \
  |  | 1638|     37|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1670|  12.4k|    CleanupField(td_colormap[2]);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 37, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|     37|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     37|            td->member = 0;                                                    \
  |  | 1638|     37|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1671|  12.4k|    CleanupField(td_sampleinfo);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 702, False: 11.7k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|    702|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|    702|            td->member = 0;                                                    \
  |  | 1638|    702|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1672|  12.4k|    CleanupField(td_subifd);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 4, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|      4|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      4|            td->member = 0;                                                    \
  |  | 1638|      4|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1673|  12.4k|    CleanupField(td_inknames);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 12, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|     12|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     12|            td->member = 0;                                                    \
  |  | 1638|     12|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1674|  12.4k|    CleanupField(td_refblackwhite);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 1.13k, False: 11.3k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|  1.13k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  1.13k|            td->member = 0;                                                    \
  |  | 1638|  1.13k|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1675|  12.4k|    CleanupField(td_transferfunction[0]);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 2, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|      2|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      2|            td->member = 0;                                                    \
  |  | 1638|      2|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1676|  12.4k|    CleanupField(td_transferfunction[1]);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 0, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|      0|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      0|            td->member = 0;                                                    \
  |  | 1638|      0|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1677|  12.4k|    CleanupField(td_transferfunction[2]);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 0, False: 12.4k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|      0|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      0|            td->member = 0;                                                    \
  |  | 1638|      0|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1678|  12.4k|    CleanupField(td_stripoffset_p);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 5.81k, False: 6.67k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|  5.81k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  5.81k|            td->member = 0;                                                    \
  |  | 1638|  5.81k|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1679|  12.4k|    CleanupField(td_stripbytecount_p);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 5.45k, False: 7.04k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|  5.45k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  5.45k|            td->member = 0;                                                    \
  |  | 1638|  5.45k|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1680|  12.4k|    td->td_stripoffsetbyteallocsize = 0;
 1681|  12.4k|    TIFFClrFieldBit(tif, FIELD_YCBCRSUBSAMPLING);
  ------------------
  |  |  250|  12.4k|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|  12.4k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|  12.4k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1682|  12.4k|    TIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING);
  ------------------
  |  |  250|  12.4k|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|  12.4k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|  12.4k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1683|       |
 1684|       |    /* Cleanup custom tag values */
 1685|  24.2k|    for (i = 0; i < td->td_customValueCount; i++)
  ------------------
  |  Branch (1685:17): [True: 11.7k, False: 12.4k]
  ------------------
 1686|  11.7k|    {
 1687|  11.7k|        if (td->td_customValues[i].value)
  ------------------
  |  Branch (1687:13): [True: 9.70k, False: 2.05k]
  ------------------
 1688|  9.70k|            _TIFFfreeExt(tif, td->td_customValues[i].value);
 1689|  11.7k|    }
 1690|       |
 1691|  12.4k|    td->td_customValueCount = 0;
 1692|  12.4k|    CleanupField(td_customValues);
  ------------------
  |  | 1633|  12.4k|    {                                                                          \
  |  | 1634|  12.4k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 3.67k, False: 8.82k]
  |  |  ------------------
  |  | 1635|  12.4k|        {                                                                      \
  |  | 1636|  3.67k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  3.67k|            td->member = 0;                                                    \
  |  | 1638|  3.67k|        }                                                                      \
  |  | 1639|  12.4k|    }
  ------------------
 1693|       |
 1694|  12.4k|    _TIFFmemset(&(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
 1695|  12.4k|    _TIFFmemset(&(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
 1696|       |
 1697|       |    /* Reset some internal parameters for IFD data size checking. */
 1698|  12.4k|    tif->tif_dir.td_dirdatasize_read = 0;
 1699|  12.4k|    tif->tif_dir.td_dirdatasize_write = 0;
 1700|  12.4k|    if (tif->tif_dir.td_dirdatasize_offsets != NULL)
  ------------------
  |  Branch (1700:9): [True: 6.24k, False: 6.25k]
  ------------------
 1701|  6.24k|    {
 1702|  6.24k|        _TIFFfreeExt(tif, tif->tif_dir.td_dirdatasize_offsets);
 1703|  6.24k|        tif->tif_dir.td_dirdatasize_offsets = NULL;
 1704|  6.24k|        tif->tif_dir.td_dirdatasize_Noffsets = 0;
 1705|  6.24k|    }
 1706|  12.4k|    tif->tif_dir.td_iswrittentofile = FALSE;
  ------------------
  |  |   72|  12.4k|#define FALSE 0
  ------------------
 1707|       |    /* Note: tif->tif_dir structure is set to zero in TIFFDefaultDirectory() */
 1708|  12.4k|}
TIFFDefaultDirectory:
 1788|  6.24k|{
 1789|  6.24k|    TIFFDirectory *td = &tif->tif_dir;
 1790|  6.24k|    const TIFFFieldArray *tiffFieldArray;
 1791|       |
 1792|  6.24k|    tiffFieldArray = _TIFFGetFields();
 1793|  6.24k|    _TIFFSetupFields(tif, tiffFieldArray);
 1794|       |    /* Reset tif->tif_dir structure to zero and
 1795|       |     * initialize some IFD strile counter and index parameters. */
 1796|  6.24k|    _TIFFResetTifDirAndInitStrileCounters(td);
 1797|  6.24k|    td->td_fillorder = FILLORDER_MSB2LSB;
  ------------------
  |  |  241|  6.24k|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
 1798|  6.24k|    td->td_bitspersample = 1;
 1799|  6.24k|    td->td_threshholding = THRESHHOLD_BILEVEL;
  ------------------
  |  |  235|  6.24k|#define THRESHHOLD_BILEVEL 1               /* b&w art scan */
  ------------------
 1800|  6.24k|    td->td_orientation = ORIENTATION_TOPLEFT;
  ------------------
  |  |  249|  6.24k|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
 1801|  6.24k|    td->td_samplesperpixel = 1;
 1802|  6.24k|    td->td_rowsperstrip = (uint32_t)-1;
 1803|  6.24k|    td->td_tilewidth = 0;
 1804|  6.24k|    td->td_tilelength = 0;
 1805|  6.24k|    td->td_tiledepth = 1;
 1806|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 1807|       |    td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */
 1808|       |#endif
 1809|  6.24k|    td->td_resolutionunit = RESUNIT_INCH;
  ------------------
  |  |  289|  6.24k|#define RESUNIT_INCH 2                     /* english */
  ------------------
 1810|  6.24k|    td->td_sampleformat = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|  6.24k|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1811|  6.24k|    td->td_imagedepth = 1;
 1812|  6.24k|    td->td_ycbcrsubsampling[0] = 2;
 1813|  6.24k|    td->td_ycbcrsubsampling[1] = 2;
 1814|  6.24k|    td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
  ------------------
  |  |  390|  6.24k|#define YCBCRPOSITION_CENTERED 1           /* !as in PostScript Level 2 */
  ------------------
 1815|  6.24k|    tif->tif_postdecode = _TIFFNoPostDecode;
 1816|  6.24k|    tif->tif_foundfield = NULL;
 1817|  6.24k|    tif->tif_tagmethods.vsetfield = _TIFFVSetField;
 1818|  6.24k|    tif->tif_tagmethods.vgetfield = _TIFFVGetField;
 1819|  6.24k|    tif->tif_tagmethods.printdir = NULL;
 1820|       |    /* additional default values */
 1821|  6.24k|    td->td_planarconfig = PLANARCONFIG_CONTIG;
  ------------------
  |  |  265|  6.24k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 1822|  6.24k|    td->td_compression = COMPRESSION_NONE;
  ------------------
  |  |  182|  6.24k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
 1823|  6.24k|    td->td_subfiletype = 0;
 1824|  6.24k|    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|  6.24k|    td->td_maxsamplevalue = 1; /* Default for td_bitspersample=1 */
 1829|  6.24k|    td->td_extrasamples = 0;
 1830|  6.24k|    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|  6.24k|    if (tif->tif_nfieldscompat > 0)
  ------------------
  |  Branch (1838:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    if (_TIFFextender)
  ------------------
  |  Branch (1851:9): [True: 0, False: 6.24k]
  ------------------
 1852|      0|        (*_TIFFextender)(tif);
 1853|  6.24k|    (void)TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  181|  6.24k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
                  (void)TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  182|  6.24k|#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|  6.24k|    tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  6.24k|#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|  6.24k|    tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  129|  6.24k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 1870|       |
 1871|  6.24k|    return (1);
 1872|  6.24k|}
tif_dir.c:setByteArray:
   46|  5.49k|{
   47|  5.49k|    if (*vpp)
  ------------------
  |  Branch (47:9): [True: 81, False: 5.41k]
  ------------------
   48|     81|    {
   49|     81|        _TIFFfreeExt(tif, *vpp);
   50|     81|        *vpp = 0;
   51|     81|    }
   52|  5.49k|    if (vp)
  ------------------
  |  Branch (52:9): [True: 5.45k, False: 40]
  ------------------
   53|  5.45k|    {
   54|  5.45k|        tmsize_t bytes = _TIFFMultiplySSize(NULL, (tmsize_t)nmemb,
   55|  5.45k|                                            (tmsize_t)elem_size, NULL);
   56|  5.45k|        if (bytes)
  ------------------
  |  Branch (56:13): [True: 5.45k, False: 0]
  ------------------
   57|  5.45k|            *vpp = (void *)_TIFFmallocExt(tif, bytes);
   58|  5.45k|        if (*vpp)
  ------------------
  |  Branch (58:13): [True: 5.45k, False: 0]
  ------------------
   59|  5.45k|            _TIFFmemcpy(*vpp, vp, bytes);
   60|  5.45k|    }
   61|  5.49k|}
tif_dir.c:OkToChangeTag:
 1135|  72.7k|{
 1136|  72.7k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|  72.7k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1137|  72.7k|    if (!fip)
  ------------------
  |  Branch (1137:9): [True: 0, False: 72.7k]
  ------------------
 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|  72.7k|    if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |  179|   145k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
                  if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |  125|  67.7k|#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
  |  Branch (1143:9): [True: 67.7k, False: 4.96k]
  |  Branch (1143:39): [True: 0, False: 67.7k]
  ------------------
 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|  72.7k|    return (1);
 1158|  72.7k|}
tif_dir.c:_TIFFVSetField:
  224|  66.6k|{
  225|  66.6k|    static const char module[] = "_TIFFVSetField";
  226|       |
  227|  66.6k|    TIFFDirectory *td = &tif->tif_dir;
  228|  66.6k|    int status = 1;
  229|  66.6k|    uint32_t v32, v;
  230|  66.6k|    double dblval;
  231|  66.6k|    char *s;
  232|  66.6k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|  66.6k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  233|  66.6k|    uint32_t standard_tag = tag;
  234|  66.6k|    if (fip == NULL) /* cannot happen since OkToChangeTag() already checks it */
  ------------------
  |  Branch (234:9): [True: 0, False: 66.6k]
  ------------------
  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|  66.6k|    if (fip->field_bit == FIELD_CUSTOM)
  ------------------
  |  |  346|  66.6k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (242:9): [True: 11.8k, False: 54.7k]
  ------------------
  243|  11.8k|    {
  244|  11.8k|        standard_tag = 0;
  245|  11.8k|    }
  246|       |
  247|  66.6k|    switch (standard_tag)
  248|  66.6k|    {
  249|     40|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|     40|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (249:9): [True: 40, False: 66.5k]
  ------------------
  250|     40|            td->td_subfiletype = (uint32_t)va_arg(ap, uint32_t);
  251|     40|            break;
  252|  6.14k|        case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  6.14k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (252:9): [True: 6.14k, False: 60.4k]
  ------------------
  253|  6.14k|            td->td_imagewidth = (uint32_t)va_arg(ap, uint32_t);
  254|  6.14k|            break;
  255|  4.96k|        case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  4.96k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (255:9): [True: 4.96k, False: 61.6k]
  ------------------
  256|  4.96k|            td->td_imagelength = (uint32_t)va_arg(ap, uint32_t);
  257|  4.96k|            break;
  258|  4.35k|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  4.35k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (258:9): [True: 4.35k, False: 62.2k]
  ------------------
  259|  4.35k|            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.35k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  4.35k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (267:17): [True: 177, False: 4.17k]
  ------------------
  268|    177|            {
  269|    177|                if (td->td_bitspersample == 8)
  ------------------
  |  Branch (269:21): [True: 9, False: 168]
  ------------------
  270|      9|                    tif->tif_postdecode = _TIFFNoPostDecode;
  271|    168|                else if (td->td_bitspersample == 16)
  ------------------
  |  Branch (271:26): [True: 36, False: 132]
  ------------------
  272|     36|                    tif->tif_postdecode = _TIFFSwab16BitData;
  273|    132|                else if (td->td_bitspersample == 24)
  ------------------
  |  Branch (273:26): [True: 13, False: 119]
  ------------------
  274|     13|                    tif->tif_postdecode = _TIFFSwab24BitData;
  275|    119|                else if (td->td_bitspersample == 32)
  ------------------
  |  Branch (275:26): [True: 61, False: 58]
  ------------------
  276|     61|                    tif->tif_postdecode = _TIFFSwab32BitData;
  277|     58|                else if (td->td_bitspersample == 64)
  ------------------
  |  Branch (277:26): [True: 48, False: 10]
  ------------------
  278|     48|                    tif->tif_postdecode = _TIFFSwab64BitData;
  279|     10|                else if (td->td_bitspersample == 128) /* two 64's */
  ------------------
  |  Branch (279:26): [True: 4, False: 6]
  ------------------
  280|      4|                    tif->tif_postdecode = _TIFFSwab64BitData;
  281|    177|            }
  282|  4.35k|            break;
  283|  12.4k|        case TIFFTAG_COMPRESSION:
  ------------------
  |  |  181|  12.4k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (283:9): [True: 12.4k, False: 54.1k]
  ------------------
  284|  12.4k|            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|  12.4k|            if (TIFFFieldSet(tif, FIELD_COMPRESSION))
  ------------------
  |  |  248|  12.4k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  12.4k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  12.4k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 6.23k, False: 6.24k]
  |  |  ------------------
  ------------------
  291|  6.23k|            {
  292|  6.23k|                if ((uint32_t)td->td_compression == v)
  ------------------
  |  Branch (292:21): [True: 499, False: 5.73k]
  ------------------
  293|    499|                    break;
  294|  5.73k|                (*tif->tif_cleanup)(tif);
  295|  5.73k|                tif->tif_flags &= ~TIFF_CODERSETUP;
  ------------------
  |  |  124|  5.73k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  296|  5.73k|            }
  297|       |            /*
  298|       |             * Setup new compression routine state.
  299|       |             */
  300|  11.9k|            if ((status = TIFFSetCompressionScheme(tif, (int)v)) != 0)
  ------------------
  |  Branch (300:17): [True: 11.9k, False: 0]
  ------------------
  301|  11.9k|                td->td_compression = (uint16_t)v;
  302|      0|            else
  303|      0|                status = 0;
  304|  11.9k|            break;
  305|  3.26k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  3.26k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (305:9): [True: 3.26k, False: 63.3k]
  ------------------
  306|  3.26k|            td->td_photometric = (uint16_t)va_arg(ap, uint16_vap);
  307|  3.26k|            break;
  308|      0|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      0|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (308:9): [True: 0, False: 66.6k]
  ------------------
  309|      0|            td->td_threshholding = (uint16_t)va_arg(ap, uint16_vap);
  310|      0|            break;
  311|    270|        case TIFFTAG_FILLORDER:
  ------------------
  |  |  240|    270|#define TIFFTAG_FILLORDER 266              /* data order within a byte */
  ------------------
  |  Branch (311:9): [True: 270, False: 66.3k]
  ------------------
  312|    270|            v = (uint16_t)va_arg(ap, uint16_vap);
  313|    270|            if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  242|    540|#define FILLORDER_LSB2MSB 2                /* least significant -> most */
  ------------------
                          if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  241|    264|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
  |  Branch (313:17): [True: 264, False: 6]
  |  Branch (313:43): [True: 38, False: 226]
  ------------------
  314|     38|                goto badvalue;
  315|    232|            td->td_fillorder = (uint16_t)v;
  316|    232|            break;
  317|    483|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|    483|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (317:9): [True: 483, False: 66.1k]
  ------------------
  318|    483|            v = (uint16_t)va_arg(ap, uint16_vap);
  319|    483|            if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  249|    966|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
                          if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  256|    483|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (319:17): [True: 0, False: 483]
  |  Branch (319:44): [True: 22, False: 461]
  ------------------
  320|     22|                goto badvalue;
  321|    461|            else
  322|    461|                td->td_orientation = (uint16_t)v;
  323|    461|            break;
  324|  3.52k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  3.52k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (324:9): [True: 3.52k, False: 63.0k]
  ------------------
  325|  3.52k|            v = (uint16_t)va_arg(ap, uint16_vap);
  326|  3.52k|            if (v == 0)
  ------------------
  |  Branch (326:17): [True: 0, False: 3.52k]
  ------------------
  327|      0|                goto badvalue;
  328|  3.52k|            if (v != td->td_samplesperpixel)
  ------------------
  |  Branch (328:17): [True: 3.39k, False: 129]
  ------------------
  329|  3.39k|            {
  330|       |                /* See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */
  331|  3.39k|                if (td->td_sminsamplevalue != NULL)
  ------------------
  |  Branch (331:21): [True: 3, False: 3.39k]
  ------------------
  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.39k|                if (td->td_smaxsamplevalue != NULL)
  ------------------
  |  Branch (341:21): [True: 1, False: 3.39k]
  ------------------
  342|      1|                {
  343|      1|                    TIFFWarningExtR(tif, module,
  344|      1|                                    "SamplesPerPixel tag value is changing, "
  345|      1|                                    "but SMaxSampleValue tag was read with a "
  346|      1|                                    "different value. Canceling it");
  347|      1|                    TIFFClrFieldBit(tif, FIELD_SMAXSAMPLEVALUE);
  ------------------
  |  |  250|      1|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|      1|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|      1|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  348|      1|                    _TIFFfreeExt(tif, td->td_smaxsamplevalue);
  349|      1|                    td->td_smaxsamplevalue = NULL;
  350|      1|                }
  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.39k|                if (td->td_transferfunction[0] != NULL &&
  ------------------
  |  Branch (354:21): [True: 0, False: 3.39k]
  ------------------
  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.39k|            }
  367|  3.52k|            td->td_samplesperpixel = (uint16_t)v;
  368|  3.52k|            break;
  369|  3.47k|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  3.47k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (369:9): [True: 3.47k, False: 63.1k]
  ------------------
  370|  3.47k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  371|  3.47k|            if (v32 == 0)
  ------------------
  |  Branch (371:17): [True: 0, False: 3.47k]
  ------------------
  372|      0|                goto badvalue32;
  373|  3.47k|            td->td_rowsperstrip = v32;
  374|  3.47k|            if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS))
  ------------------
  |  |  248|  3.47k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  3.47k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  3.47k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (374:17): [True: 3.40k, False: 64]
  ------------------
  375|  3.40k|            {
  376|  3.40k|                td->td_tilelength = v32;
  377|  3.40k|                td->td_tilewidth = td->td_imagewidth;
  378|  3.40k|            }
  379|  3.47k|            break;
  380|      7|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|      7|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (380:9): [True: 7, False: 66.6k]
  ------------------
  381|      7|            td->td_minsamplevalue = (uint16_t)va_arg(ap, uint16_vap);
  382|      7|            break;
  383|      5|        case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|      5|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (383:9): [True: 5, False: 66.6k]
  ------------------
  384|      5|            td->td_maxsamplevalue = (uint16_t)va_arg(ap, uint16_vap);
  385|      5|            break;
  386|    200|        case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|    200|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (386:9): [True: 200, False: 66.4k]
  ------------------
  387|    200|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  143|    200|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (387:17): [True: 200, False: 0]
  ------------------
  388|    200|                _TIFFsetDoubleArrayExt(tif, &td->td_sminsamplevalue,
  389|    200|                                       va_arg(ap, double *),
  390|    200|                                       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|    200|            break;
  396|     11|        case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|     11|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (396:9): [True: 11, False: 66.5k]
  ------------------
  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|    377|        case TIFFTAG_XRESOLUTION:
  ------------------
  |  |  262|    377|#define TIFFTAG_XRESOLUTION 282            /* pixels/resolution in x */
  ------------------
  |  Branch (406:9): [True: 377, False: 66.2k]
  ------------------
  407|    377|            dblval = va_arg(ap, double);
  408|    377|            if (isnan(dblval) || dblval < 0)
  ------------------
  |  Branch (408:17): [True: 0, False: 377]
  |  Branch (408:34): [True: 5, False: 372]
  ------------------
  409|      5|                goto badvaluedouble;
  410|    372|            td->td_xresolution = _TIFFClampDoubleToFloat(dblval);
  411|    372|            break;
  412|    267|        case TIFFTAG_YRESOLUTION:
  ------------------
  |  |  263|    267|#define TIFFTAG_YRESOLUTION 283            /* pixels/resolution in y */
  ------------------
  |  Branch (412:9): [True: 267, False: 66.3k]
  ------------------
  413|    267|            dblval = va_arg(ap, double);
  414|    267|            if (isnan(dblval) || dblval < 0)
  ------------------
  |  Branch (414:17): [True: 0, False: 267]
  |  Branch (414:34): [True: 2, False: 265]
  ------------------
  415|      2|                goto badvaluedouble;
  416|    265|            td->td_yresolution = _TIFFClampDoubleToFloat(dblval);
  417|    265|            break;
  418|  7.95k|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  7.95k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (418:9): [True: 7.95k, False: 58.6k]
  ------------------
  419|  7.95k|            v = (uint16_t)va_arg(ap, uint16_vap);
  420|  7.95k|            if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  265|  15.9k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
                          if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.25k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (420:17): [True: 1.25k, False: 6.70k]
  |  Branch (420:45): [True: 0, False: 1.25k]
  ------------------
  421|      0|                goto badvalue;
  422|  7.95k|            td->td_planarconfig = (uint16_t)v;
  423|  7.95k|            break;
  424|      6|        case TIFFTAG_XPOSITION:
  ------------------
  |  |  268|      6|#define TIFFTAG_XPOSITION 286              /* x page offset of image lhs */
  ------------------
  |  Branch (424:9): [True: 6, False: 66.6k]
  ------------------
  425|      6|            td->td_xposition = _TIFFClampDoubleToFloat(va_arg(ap, double));
  426|      6|            break;
  427|     75|        case TIFFTAG_YPOSITION:
  ------------------
  |  |  269|     75|#define TIFFTAG_YPOSITION 287              /* y page offset of image lhs */
  ------------------
  |  Branch (427:9): [True: 75, False: 66.5k]
  ------------------
  428|     75|            td->td_yposition = _TIFFClampDoubleToFloat(va_arg(ap, double));
  429|     75|            break;
  430|    202|        case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  287|    202|#define TIFFTAG_RESOLUTIONUNIT 296         /* units of resolutions */
  ------------------
  |  Branch (430:9): [True: 202, False: 66.4k]
  ------------------
  431|    202|            v = (uint16_t)va_arg(ap, uint16_vap);
  432|    202|            if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  288|    404|#define RESUNIT_NONE 1                     /* no meaningful units */
  ------------------
                          if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  290|    194|#define RESUNIT_CENTIMETER 3               /* metric */
  ------------------
  |  Branch (432:17): [True: 8, False: 194]
  |  Branch (432:37): [True: 22, False: 172]
  ------------------
  433|     30|                goto badvalue;
  434|    172|            td->td_resolutionunit = (uint16_t)v;
  435|    172|            break;
  436|    194|        case TIFFTAG_PAGENUMBER:
  ------------------
  |  |  291|    194|#define TIFFTAG_PAGENUMBER 297             /* page numbers of multi-page */
  ------------------
  |  Branch (436:9): [True: 194, False: 66.4k]
  ------------------
  437|    194|            td->td_pagenumber[0] = (uint16_t)va_arg(ap, uint16_vap);
  438|    194|            td->td_pagenumber[1] = (uint16_t)va_arg(ap, uint16_vap);
  439|    194|            break;
  440|      0|        case TIFFTAG_HALFTONEHINTS:
  ------------------
  |  |  310|      0|#define TIFFTAG_HALFTONEHINTS 321          /* !highlight+shadow info */
  ------------------
  |  Branch (440:9): [True: 0, False: 66.6k]
  ------------------
  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|     37|        case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|     37|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (444:9): [True: 37, False: 66.5k]
  ------------------
  445|     37|            if (td->td_bitspersample >= 32)
  ------------------
  |  Branch (445:17): [True: 0, False: 37]
  ------------------
  446|      0|            {
  447|      0|                v = td->td_bitspersample;
  448|      0|                goto badvalue;
  449|      0|            }
  450|     37|            v32 = 1U << td->td_bitspersample;
  451|     37|            _TIFFsetShortArrayExt(tif, &td->td_colormap[0],
  452|     37|                                  va_arg(ap, uint16_t *), v32);
  453|     37|            _TIFFsetShortArrayExt(tif, &td->td_colormap[1],
  454|     37|                                  va_arg(ap, uint16_t *), v32);
  455|     37|            _TIFFsetShortArrayExt(tif, &td->td_colormap[2],
  456|     37|                                  va_arg(ap, uint16_t *), v32);
  457|     37|            break;
  458|    200|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|    200|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (458:9): [True: 200, False: 66.4k]
  ------------------
  459|    200|            if (!setExtraSamples(tif, ap, &v))
  ------------------
  |  Branch (459:17): [True: 1, False: 199]
  ------------------
  460|      1|                goto badvalue;
  461|    199|            break;
  462|    199|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|     13|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (462:9): [True: 13, False: 66.5k]
  ------------------
  463|     13|            td->td_extrasamples = (((uint16_t)va_arg(ap, uint16_vap)) != 0);
  464|     13|            if (td->td_extrasamples)
  ------------------
  |  Branch (464:17): [True: 13, False: 0]
  ------------------
  465|     13|            {
  466|     13|                uint16_t sv = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|     13|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  467|     13|                _TIFFsetShortArrayExt(tif, &td->td_sampleinfo, &sv, 1);
  468|     13|            }
  469|     13|            break;
  470|  2.61k|        case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  2.61k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (470:9): [True: 2.61k, False: 63.9k]
  ------------------
  471|  2.61k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  472|  2.61k|            if (v32 % 16)
  ------------------
  |  Branch (472:17): [True: 2.14k, False: 464]
  ------------------
  473|  2.14k|            {
  474|  2.14k|                if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (474:21): [True: 0, False: 2.14k]
  ------------------
  475|      0|                    goto badvalue32;
  476|  2.14k|                TIFFWarningExtR(
  477|  2.14k|                    tif, tif->tif_name,
  478|  2.14k|                    "Nonstandard tile width %" PRIu32 ", convert file", v32);
  479|  2.14k|            }
  480|  2.61k|            td->td_tilewidth = v32;
  481|  2.61k|            tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  129|  2.61k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  482|  2.61k|            break;
  483|  1.61k|        case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  1.61k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (483:9): [True: 1.61k, False: 64.9k]
  ------------------
  484|  1.61k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  485|  1.61k|            if (v32 % 16)
  ------------------
  |  Branch (485:17): [True: 1.23k, False: 385]
  ------------------
  486|  1.23k|            {
  487|  1.23k|                if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (487:21): [True: 0, False: 1.23k]
  ------------------
  488|      0|                    goto badvalue32;
  489|  1.23k|                TIFFWarningExtR(
  490|  1.23k|                    tif, tif->tif_name,
  491|  1.23k|                    "Nonstandard tile length %" PRIu32 ", convert file", v32);
  492|  1.23k|            }
  493|  1.61k|            td->td_tilelength = v32;
  494|  1.61k|            tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  129|  1.61k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  495|  1.61k|            break;
  496|      9|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|      9|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (496:9): [True: 9, False: 66.5k]
  ------------------
  497|      9|            v32 = (uint32_t)va_arg(ap, uint32_t);
  498|      9|            if (v32 == 0)
  ------------------
  |  Branch (498:17): [True: 0, False: 9]
  ------------------
  499|      0|                goto badvalue32;
  500|      9|            td->td_tiledepth = v32;
  501|      9|            break;
  502|     20|        case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|     20|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (502:9): [True: 20, False: 66.5k]
  ------------------
  503|     20|            v = (uint16_t)va_arg(ap, uint16_vap);
  504|     20|            switch (v)
  505|     20|            {
  506|      2|                case DATATYPE_VOID:
  ------------------
  |  |   39|      2|#define DATATYPE_VOID 0   /* !untyped data */
  ------------------
  |  Branch (506:17): [True: 2, False: 18]
  ------------------
  507|      2|                    v = SAMPLEFORMAT_VOID;
  ------------------
  |  |  337|      2|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
  508|      2|                    break;
  509|      0|                case DATATYPE_INT:
  ------------------
  |  |   40|      0|#define DATATYPE_INT 1    /* !signed integer data */
  ------------------
  |  Branch (509:17): [True: 0, False: 20]
  ------------------
  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: 20]
  ------------------
  513|      0|                    v = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  514|      0|                    break;
  515|     18|                case DATATYPE_IEEEFP:
  ------------------
  |  |   42|     18|#define DATATYPE_IEEEFP 3 /* !IEEE floating point data */
  ------------------
  |  Branch (515:17): [True: 18, False: 2]
  ------------------
  516|     18|                    v = SAMPLEFORMAT_IEEEFP;
  ------------------
  |  |  336|     18|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  517|     18|                    break;
  518|      0|                default:
  ------------------
  |  Branch (518:17): [True: 0, False: 20]
  ------------------
  519|      0|                    goto badvalue;
  520|     20|            }
  521|     20|            td->td_sampleformat = (uint16_t)v;
  522|     20|            break;
  523|    612|        case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|    612|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (523:9): [True: 612, False: 65.9k]
  ------------------
  524|    612|            v = (uint16_t)va_arg(ap, uint16_vap);
  525|    612|            if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  334|  1.22k|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
                          if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  339|    612|#define SAMPLEFORMAT_COMPLEXIEEEFP 6       /* !complex ieee floating */
  ------------------
  |  Branch (525:17): [True: 0, False: 612]
  |  Branch (525:42): [True: 0, False: 612]
  ------------------
  526|      0|                goto badvalue;
  527|    612|            td->td_sampleformat = (uint16_t)v;
  528|       |
  529|       |            /*  Try to fix up the SWAB function for complex data. */
  530|    612|            if (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT &&
  ------------------
  |  |  338|  1.22k|#define SAMPLEFORMAT_COMPLEXINT 5          /* !complex signed int */
  ------------------
  |  Branch (530:17): [True: 4, False: 608]
  ------------------
  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|    612|            else if ((td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT ||
  ------------------
  |  |  338|  1.22k|#define SAMPLEFORMAT_COMPLEXINT 5          /* !complex signed int */
  ------------------
  |  Branch (534:23): [True: 4, False: 608]
  ------------------
  535|    608|                      td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP) &&
  ------------------
  |  |  339|    608|#define SAMPLEFORMAT_COMPLEXIEEEFP 6       /* !complex ieee floating */
  ------------------
  |  Branch (535:23): [True: 0, False: 608]
  ------------------
  536|      4|                     td->td_bitspersample == 64 &&
  ------------------
  |  Branch (536:22): [True: 1, False: 3]
  ------------------
  537|      1|                     tif->tif_postdecode == _TIFFSwab64BitData)
  ------------------
  |  Branch (537:22): [True: 1, False: 0]
  ------------------
  538|      1|                tif->tif_postdecode = _TIFFSwab32BitData;
  539|    612|            break;
  540|      8|        case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|      8|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (540:9): [True: 8, False: 66.5k]
  ------------------
  541|      8|            td->td_imagedepth = (uint32_t)va_arg(ap, uint32_t);
  542|      8|            break;
  543|      4|        case TIFFTAG_SUBIFD:
  ------------------
  |  |  321|      4|#define TIFFTAG_SUBIFD 330                 /* subimage descriptors */
  ------------------
  |  Branch (543:9): [True: 4, False: 66.6k]
  ------------------
  544|      4|            if ((tif->tif_flags & TIFF_INSUBIFD) == 0)
  ------------------
  |  |  132|      4|#define TIFF_INSUBIFD 0x02000U    /* currently writing a subifd */
  ------------------
  |  Branch (544:17): [True: 4, False: 0]
  ------------------
  545|      4|            {
  546|      4|                td->td_nsubifd = (uint16_t)va_arg(ap, uint16_vap);
  547|      4|                _TIFFsetLong8Array(tif, &td->td_subifd,
  548|      4|                                   (uint64_t *)va_arg(ap, uint64_t *),
  549|      4|                                   (uint32_t)td->td_nsubifd);
  550|      4|            }
  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|      4|            break;
  558|      4|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      4|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (558:9): [True: 4, False: 66.6k]
  ------------------
  559|      4|            td->td_ycbcrpositioning = (uint16_t)va_arg(ap, uint16_vap);
  560|      4|            break;
  561|  1.27k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  1.27k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (561:9): [True: 1.27k, False: 65.3k]
  ------------------
  562|  1.27k|            td->td_ycbcrsubsampling[0] = (uint16_t)va_arg(ap, uint16_vap);
  563|  1.27k|            td->td_ycbcrsubsampling[1] = (uint16_t)va_arg(ap, uint16_vap);
  564|  1.27k|            break;
  565|      2|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      2|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (565:9): [True: 2, False: 66.6k]
  ------------------
  566|      2|        {
  567|      2|            uint32_t i;
  568|      2|            uint32_t count;
  569|      2|            if (td->td_bitspersample >= 32)
  ------------------
  |  Branch (569:17): [True: 0, False: 2]
  ------------------
  570|      0|            {
  571|      0|                v = td->td_bitspersample;
  572|      0|                goto badvalue;
  573|      0|            }
  574|      2|            count = 1U << td->td_bitspersample;
  575|      2|            v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
  ------------------
  |  Branch (575:17): [True: 0, False: 2]
  ------------------
  576|      4|            for (i = 0; i < v; i++)
  ------------------
  |  Branch (576:25): [True: 2, False: 2]
  ------------------
  577|      2|                _TIFFsetShortArrayExt(tif, &td->td_transferfunction[i],
  578|      2|                                      va_arg(ap, uint16_t *), count);
  579|      2|            break;
  580|      2|        }
  581|      7|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|      7|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (581:9): [True: 7, False: 66.6k]
  ------------------
  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|     12|        case TIFFTAG_INKNAMES:
  ------------------
  |  |  325|     12|#define TIFFTAG_INKNAMES 333               /* !ascii names of inks */
  ------------------
  |  Branch (586:9): [True: 12, False: 66.5k]
  ------------------
  587|     12|        {
  588|     12|            v = (uint16_t)va_arg(ap, uint16_vap);
  589|     12|            s = va_arg(ap, char *);
  590|     12|            uint16_t ninksinstring;
  591|     12|            ninksinstring = countInkNamesString(tif, v, s);
  592|     12|            status = ninksinstring > 0;
  593|     12|            if (ninksinstring > 0)
  ------------------
  |  Branch (593:17): [True: 12, False: 0]
  ------------------
  594|     12|            {
  595|     12|                _TIFFsetNString(tif, &td->td_inknames, s, v);
  596|     12|                td->td_inknameslen = (int)v;
  597|       |                /* Set NumberOfInks to the value ninksinstring */
  598|     12|                if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS))
  ------------------
  |  |  248|     12|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|     12|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|     12|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 6, False: 6]
  |  |  ------------------
  ------------------
  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|      6|                else
  614|      6|                {
  615|      6|                    td->td_numberofinks = ninksinstring;
  616|      6|                    TIFFSetFieldBit(tif, FIELD_NUMBEROFINKS);
  ------------------
  |  |  249|      6|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|      6|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|      6|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  617|      6|                }
  618|     12|                if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  248|     12|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|     12|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|     12|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 7, False: 5]
  |  |  ------------------
  ------------------
  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|     12|            }
  632|     12|        }
  633|     12|        break;
  634|      8|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|      8|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (634:9): [True: 8, False: 66.5k]
  ------------------
  635|      8|            v = (uint16_t)va_arg(ap, uint16_vap);
  636|       |            /* If InkNames already set also NumberOfInks is set accordingly and
  637|       |             * should be equal */
  638|      8|            if (TIFFFieldSet(tif, FIELD_INKNAMES))
  ------------------
  |  |  248|      8|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|      8|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|      8|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 0, False: 8]
  |  |  ------------------
  ------------------
  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|      8|            else
  655|      8|            {
  656|      8|                td->td_numberofinks = (uint16_t)v;
  657|      8|                if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  248|      8|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|      8|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|      8|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 1, False: 7]
  |  |  ------------------
  ------------------
  658|      1|                {
  659|      1|                    if (td->td_numberofinks != td->td_samplesperpixel)
  ------------------
  |  Branch (659:25): [True: 1, False: 0]
  ------------------
  660|      1|                    {
  661|      1|                        TIFFErrorExtR(tif, module,
  662|      1|                                      "Warning %s; Tag %s:\n  Value %" PRIu32
  663|      1|                                      " of NumberOfInks is different from the "
  664|      1|                                      "SamplesPerPixel value %" PRIu16 "",
  665|      1|                                      tif->tif_name, fip->field_name, v,
  666|      1|                                      td->td_samplesperpixel);
  667|      1|                    }
  668|      1|                }
  669|      8|            }
  670|      8|            break;
  671|      0|        case TIFFTAG_PERSAMPLE:
  ------------------
  |  |  752|      0|#define TIFFTAG_PERSAMPLE 65563        /* interface for per sample tags */
  ------------------
  |  Branch (671:9): [True: 0, False: 66.6k]
  ------------------
  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|  11.8k|        default:
  ------------------
  |  Branch (678:9): [True: 11.8k, False: 54.7k]
  ------------------
  679|  11.8k|        {
  680|  11.8k|            TIFFTagValue *tv;
  681|  11.8k|            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|  11.8k|            if (fip->field_bit == FIELD_IGNORE)
  ------------------
  |  |  190|  11.8k|#define FIELD_IGNORE 0
  ------------------
  |  Branch (694:17): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|            if (fip->field_bit != FIELD_CUSTOM)
  ------------------
  |  |  346|  11.8k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (704:17): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|            tv = NULL;
  719|   214k|            for (iCustom = 0; iCustom < td->td_customValueCount; iCustom++)
  ------------------
  |  Branch (719:31): [True: 202k, False: 11.8k]
  ------------------
  720|   202k|            {
  721|   202k|                if (td->td_customValues[iCustom].info->field_tag == tag)
  ------------------
  |  Branch (721:21): [True: 0, False: 202k]
  ------------------
  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|   202k|            }
  732|       |
  733|       |            /*
  734|       |             * Grow the custom list if the entry was not found.
  735|       |             */
  736|  11.8k|            if (tv == NULL)
  ------------------
  |  Branch (736:17): [True: 11.8k, False: 0]
  ------------------
  737|  11.8k|            {
  738|  11.8k|                TIFFTagValue *new_customValues;
  739|       |
  740|  11.8k|                new_customValues = (TIFFTagValue *)_TIFFreallocExt(
  741|  11.8k|                    tif, td->td_customValues,
  742|  11.8k|                    (tmsize_t)(sizeof(TIFFTagValue) *
  743|  11.8k|                               (size_t)(td->td_customValueCount + 1)));
  744|  11.8k|                if (!new_customValues)
  ------------------
  |  Branch (744:21): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|                td->td_customValueCount++;
  755|  11.8k|                td->td_customValues = new_customValues;
  756|       |
  757|  11.8k|                tv = td->td_customValues + (td->td_customValueCount - 1);
  758|  11.8k|                tv->info = fip;
  759|  11.8k|                tv->value = NULL;
  760|  11.8k|                tv->count = 0;
  761|  11.8k|            }
  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|  11.8k|            tv_size = TIFFFieldSetGetSize(fip);
  769|  11.8k|            if (tv_size == 0)
  ------------------
  |  Branch (769:17): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|            if (fip->field_type == TIFF_ASCII)
  ------------------
  |  Branch (777:17): [True: 3.48k, False: 8.39k]
  ------------------
  778|  3.48k|            {
  779|  3.48k|                uint32_t ma;
  780|  3.48k|                const char *mb;
  781|  3.48k|                if (fip->field_passcount)
  ------------------
  |  Branch (781:21): [True: 2.60k, False: 882]
  ------------------
  782|  2.60k|                {
  783|  2.60k|                    assert(fip->field_writecount == TIFF_VARIABLE2);
  ------------------
  |  Branch (783:21): [True: 0, False: 2.60k]
  |  Branch (783:21): [True: 2.60k, False: 0]
  ------------------
  784|  2.60k|                    ma = (uint32_t)va_arg(ap, uint32_t);
  785|  2.60k|                    mb = (const char *)va_arg(ap, const char *);
  786|  2.60k|                }
  787|    882|                else
  788|    882|                {
  789|    882|                    mb = (const char *)va_arg(ap, const char *);
  790|    882|                    size_t len = strlen(mb) + 1;
  791|    882|                    if (len >= 0x80000000U)
  ------------------
  |  Branch (791:25): [True: 0, False: 882]
  ------------------
  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|    882|                    ma = (uint32_t)len;
  801|    882|                }
  802|  3.48k|                tv->count = (int)ma;
  803|  3.48k|                setByteArray(tif, &tv->value, mb, ma, 1);
  804|  3.48k|            }
  805|  8.39k|            else
  806|  8.39k|            {
  807|  8.39k|                if (fip->field_passcount)
  ------------------
  |  Branch (807:21): [True: 8.11k, False: 280]
  ------------------
  808|  8.11k|                {
  809|  8.11k|                    if (fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  344|  8.11k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (809:25): [True: 7.96k, False: 152]
  ------------------
  810|  7.96k|                        tv->count = (int)va_arg(ap, uint32_t);
  811|    152|                    else
  812|    152|                        tv->count = va_arg(ap, int);
  813|  8.11k|                }
  814|    280|                else if (fip->field_writecount == TIFF_VARIABLE ||
  ------------------
  |  |  342|    560|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (814:26): [True: 0, False: 280]
  ------------------
  815|    280|                         fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  344|    280|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (815:26): [True: 0, False: 280]
  ------------------
  816|      0|                    tv->count = 1;
  817|    280|                else if (fip->field_writecount == TIFF_SPP)
  ------------------
  |  |  343|    280|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (817:26): [True: 0, False: 280]
  ------------------
  818|      0|                    tv->count = td->td_samplesperpixel;
  819|    280|                else
  820|    280|                    tv->count = fip->field_writecount;
  821|       |
  822|  8.39k|                if (tv->count == 0)
  ------------------
  |  Branch (822:21): [True: 2.01k, False: 6.37k]
  ------------------
  823|  2.01k|                {
  824|  2.01k|                    TIFFWarningExtR(tif, module,
  825|  2.01k|                                    "%s: Null count for \"%s\" (type "
  826|  2.01k|                                    "%u, writecount %d, passcount %d)",
  827|  2.01k|                                    tif->tif_name, fip->field_name,
  828|  2.01k|                                    fip->field_type, fip->field_writecount,
  829|  2.01k|                                    fip->field_passcount);
  830|  2.01k|                    break;
  831|  2.01k|                }
  832|       |
  833|  6.37k|                tv->value = _TIFFCheckMalloc(tif, tv->count, tv_size,
  834|  6.37k|                                             "custom tag binary object");
  835|  6.37k|                if (!tv->value)
  ------------------
  |  Branch (835:21): [True: 0, False: 6.37k]
  ------------------
  836|      0|                {
  837|      0|                    status = 0;
  838|      0|                    goto end;
  839|      0|                }
  840|       |
  841|  6.37k|                if (fip->field_tag == TIFFTAG_DOTRANGE &&
  ------------------
  |  |  327|  12.7k|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (841:21): [True: 0, False: 6.37k]
  ------------------
  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.37k|                else if (fip->field_passcount ||
  ------------------
  |  Branch (854:26): [True: 6.09k, False: 280]
  ------------------
  855|    280|                         fip->field_writecount == TIFF_VARIABLE ||
  ------------------
  |  |  342|  6.65k|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (855:26): [True: 0, False: 280]
  ------------------
  856|    280|                         fip->field_writecount == TIFF_VARIABLE2 ||
  ------------------
  |  |  344|  6.65k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (856:26): [True: 0, False: 280]
  ------------------
  857|    280|                         fip->field_writecount == TIFF_SPP || tv->count > 1)
  ------------------
  |  |  343|  6.65k|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (857:26): [True: 0, False: 280]
  |  Branch (857:63): [True: 64, False: 216]
  ------------------
  858|  6.16k|                {
  859|       |                    /*--: Rational2Double: For Rationals tv_size is set above to
  860|       |                     * 4 or 8 according to fip->set_get_field_type! */
  861|  6.16k|                    _TIFFmemcpy(tv->value, va_arg(ap, void *),
  862|  6.16k|                                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|  6.16k|                    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  6.16k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (865:25): [True: 6.15k, False: 8]
  ------------------
  866|  6.15k|                    {
  867|  6.15k|                        if (tv->info->field_type == TIFF_LONG8 ||
  ------------------
  |  Branch (867:29): [True: 16, False: 6.13k]
  ------------------
  868|  6.13k|                            tv->info->field_type == TIFF_IFD8)
  ------------------
  |  Branch (868:29): [True: 10, False: 6.12k]
  ------------------
  869|     26|                        {
  870|     26|                            uint64_t *pui64 = (uint64_t *)tv->value;
  871|    200|                            for (int i = 0; i < tv->count; i++)
  ------------------
  |  Branch (871:45): [True: 199, False: 1]
  ------------------
  872|    199|                            {
  873|    199|                                if (pui64[i] > 0xffffffffu)
  ------------------
  |  Branch (873:37): [True: 25, False: 174]
  ------------------
  874|     25|                                {
  875|     25|                                    TIFFErrorExtR(
  876|     25|                                        tif, module,
  877|     25|                                        "%s: Bad %s value %" PRIu64
  878|     25|                                        " at %d. array position for \"%s\" tag "
  879|     25|                                        "%u in ClassicTIFF. Tag won't be "
  880|     25|                                        "written to file",
  881|     25|                                        tif->tif_name,
  882|     25|                                        (tv->info->field_type == TIFF_LONG8
  ------------------
  |  Branch (882:42): [True: 15, False: 10]
  ------------------
  883|     25|                                             ? "LONG8"
  884|     25|                                             : "IFD8"),
  885|     25|                                        pui64[i], i, fip->field_name, tag);
  886|     25|                                    goto badvalueifd8long8;
  887|     25|                                }
  888|    199|                            }
  889|     26|                        }
  890|  6.12k|                        else if (tv->info->field_type == TIFF_SLONG8)
  ------------------
  |  Branch (890:34): [True: 101, False: 6.02k]
  ------------------
  891|    101|                        {
  892|    101|                            int64_t *pi64 = (int64_t *)tv->value;
  893|    319|                            for (int i = 0; i < tv->count; i++)
  ------------------
  |  Branch (893:45): [True: 308, False: 11]
  ------------------
  894|    308|                            {
  895|    308|                                if (pi64[i] > 2147483647 ||
  ------------------
  |  Branch (895:37): [True: 43, False: 265]
  ------------------
  896|    265|                                    pi64[i] < (-2147483647 - 1))
  ------------------
  |  Branch (896:37): [True: 47, False: 218]
  ------------------
  897|     90|                                {
  898|     90|                                    TIFFErrorExtR(
  899|     90|                                        tif, module,
  900|     90|                                        "%s: Bad SLONG8 value %" PRIi64
  901|     90|                                        " at %d. array position for \"%s\" tag "
  902|     90|                                        "%u in ClassicTIFF. Tag won't be "
  903|     90|                                        "written to file",
  904|     90|                                        tif->tif_name, pi64[i], i,
  905|     90|                                        fip->field_name, tag);
  906|     90|                                    goto badvalueifd8long8;
  907|     90|                                }
  908|    308|                            }
  909|    101|                        }
  910|  6.15k|                    }
  911|  6.16k|                }
  912|    216|                else
  913|    216|                {
  914|    216|                    char *val = (char *)tv->value;
  915|    216|                    assert(tv->count == 1);
  ------------------
  |  Branch (915:21): [True: 0, False: 216]
  |  Branch (915:21): [True: 216, False: 0]
  ------------------
  916|       |
  917|    216|                    switch (fip->field_type)
  918|    216|                    {
  919|      9|                        case TIFF_BYTE:
  ------------------
  |  Branch (919:25): [True: 9, False: 207]
  ------------------
  920|      9|                        case TIFF_UNDEFINED:
  ------------------
  |  Branch (920:25): [True: 0, False: 216]
  ------------------
  921|      9|                        {
  922|      9|                            uint8_t v2 = (uint8_t)va_arg(ap, int);
  923|      9|                            _TIFFmemcpy(val, &v2, tv_size);
  924|      9|                        }
  925|      9|                        break;
  926|      0|                        case TIFF_SBYTE:
  ------------------
  |  Branch (926:25): [True: 0, False: 216]
  ------------------
  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|    108|                        case TIFF_SHORT:
  ------------------
  |  Branch (932:25): [True: 108, False: 108]
  ------------------
  933|    108|                        {
  934|    108|                            uint16_t v2 = (uint16_t)va_arg(ap, int);
  935|    108|                            _TIFFmemcpy(val, &v2, tv_size);
  936|    108|                        }
  937|    108|                        break;
  938|      0|                        case TIFF_SSHORT:
  ------------------
  |  Branch (938:25): [True: 0, False: 216]
  ------------------
  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|      7|                        case TIFF_LONG:
  ------------------
  |  Branch (944:25): [True: 7, False: 209]
  ------------------
  945|      7|                        case TIFF_IFD:
  ------------------
  |  Branch (945:25): [True: 0, False: 216]
  ------------------
  946|      7|                        {
  947|      7|                            uint32_t v2 = va_arg(ap, uint32_t);
  948|      7|                            _TIFFmemcpy(val, &v2, tv_size);
  949|      7|                        }
  950|      7|                        break;
  951|      0|                        case TIFF_SLONG:
  ------------------
  |  Branch (951:25): [True: 0, False: 216]
  ------------------
  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|     44|                        case TIFF_LONG8:
  ------------------
  |  Branch (957:25): [True: 44, False: 172]
  ------------------
  958|     57|                        case TIFF_IFD8:
  ------------------
  |  Branch (958:25): [True: 13, False: 203]
  ------------------
  959|     57|                        {
  960|     57|                            uint64_t v2 = va_arg(ap, uint64_t);
  961|     57|                            _TIFFmemcpy(val, &v2, tv_size);
  962|       |                            /* Test here for too big values for ClassicTIFF and
  963|       |                             * delete custom field from custom list */
  964|     57|                            if (!(tif->tif_flags & TIFF_BIGTIFF) &&
  ------------------
  |  |  140|     57|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (964:33): [True: 57, False: 0]
  ------------------
  965|     57|                                (v2 > 0xffffffffu))
  ------------------
  |  Branch (965:33): [True: 0, False: 57]
  ------------------
  966|      0|                            {
  967|      0|                                TIFFErrorExtR(
  968|      0|                                    tif, module,
  969|      0|                                    "%s: Bad LONG8 or IFD8 value %" PRIu64
  970|      0|                                    " for \"%s\" tag %u in ClassicTIFF. Tag "
  971|      0|                                    "won't be written to file",
  972|      0|                                    tif->tif_name, v2, fip->field_name, tag);
  973|      0|                                goto badvalueifd8long8;
  974|      0|                            }
  975|     57|                        }
  976|     57|                        break;
  977|     57|                        case TIFF_SLONG8:
  ------------------
  |  Branch (977:25): [True: 0, False: 216]
  ------------------
  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|     22|                        case TIFF_RATIONAL:
  ------------------
  |  Branch (996:25): [True: 22, False: 194]
  ------------------
  997|     35|                        case TIFF_SRATIONAL:
  ------------------
  |  Branch (997:25): [True: 13, False: 203]
  ------------------
  998|       |                            /*-- Rational2Double: For Rationals tv_size is set
  999|       |                             * above to 4 or 8 according to
 1000|       |                             * fip->set_get_field_type!
 1001|       |                             */
 1002|     35|                            {
 1003|     35|                                if (tv_size == 8)
  ------------------
  |  Branch (1003:37): [True: 0, False: 35]
  ------------------
 1004|      0|                                {
 1005|      0|                                    double v2 = va_arg(ap, double);
 1006|      0|                                    _TIFFmemcpy(val, &v2, tv_size);
 1007|      0|                                }
 1008|     35|                                else
 1009|     35|                                {
 1010|       |                                    /*-- default should be tv_size == 4 */
 1011|     35|                                    float v3 = (float)va_arg(ap, double);
 1012|     35|                                    _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|     35|                                    if (tv_size != 4)
  ------------------
  |  Branch (1016:41): [True: 0, False: 35]
  ------------------
 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|     35|                                }
 1025|     35|                            }
 1026|     35|                            break;
 1027|      0|                        case TIFF_FLOAT:
  ------------------
  |  Branch (1027:25): [True: 0, False: 216]
  ------------------
 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: 216]
  ------------------
 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: 216]
  ------------------
 1041|      0|                        case TIFF_ASCII:
  ------------------
  |  Branch (1041:25): [True: 0, False: 216]
  ------------------
 1042|      0|                        default:
  ------------------
  |  Branch (1042:25): [True: 0, False: 216]
  ------------------
 1043|      0|                            _TIFFmemset(val, 0, tv_size);
 1044|      0|                            status = 0;
 1045|      0|                            break;
 1046|    216|                    }
 1047|    216|                }
 1048|  6.37k|            }
 1049|  11.8k|        }
 1050|  66.6k|    }
 1051|  66.3k|    if (status)
  ------------------
  |  Branch (1051:9): [True: 66.3k, False: 0]
  ------------------
 1052|  66.3k|    {
 1053|  66.3k|        const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1054|  66.3k|        if (fip2)
  ------------------
  |  Branch (1054:13): [True: 66.3k, False: 0]
  ------------------
 1055|  66.3k|            TIFFSetFieldBit(tif, fip2->field_bit);
  ------------------
  |  |  249|  66.3k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|  66.3k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|  66.3k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1056|  66.3k|        tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  66.3k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1057|  66.3k|    }
 1058|       |
 1059|  66.3k|end:
 1060|  66.3k|    va_end(ap);
 1061|  66.3k|    return (status);
 1062|     91|badvalue:
 1063|     91|{
 1064|     91|    const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1065|     91|    TIFFErrorExtR(tif, module, "%s: Bad value %" PRIu32 " for \"%s\" tag",
 1066|     91|                  tif->tif_name, v, fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (1066:37): [True: 91, False: 0]
  ------------------
 1067|     91|    va_end(ap);
 1068|     91|}
 1069|     91|    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|    115|badvalueifd8long8:
 1087|    115|{
 1088|       |    /* Error message issued already above. */
 1089|    115|    TIFFTagValue *tv2 = NULL;
 1090|    115|    int iCustom2, iC2;
 1091|       |    /* Find the existing entry for this custom value. */
 1092|    572|    for (iCustom2 = 0; iCustom2 < td->td_customValueCount; iCustom2++)
  ------------------
  |  Branch (1092:24): [True: 572, False: 0]
  ------------------
 1093|    572|    {
 1094|    572|        if (td->td_customValues[iCustom2].info->field_tag == tag)
  ------------------
  |  Branch (1094:13): [True: 115, False: 457]
  ------------------
 1095|    115|        {
 1096|    115|            tv2 = td->td_customValues + (iCustom2);
 1097|    115|            break;
 1098|    115|        }
 1099|    572|    }
 1100|    115|    if (tv2 != NULL)
  ------------------
  |  Branch (1100:9): [True: 115, False: 0]
  ------------------
 1101|    115|    {
 1102|       |        /* Remove custom field from custom list */
 1103|    115|        if (tv2->value != NULL)
  ------------------
  |  Branch (1103:13): [True: 115, False: 0]
  ------------------
 1104|    115|        {
 1105|    115|            _TIFFfreeExt(tif, tv2->value);
 1106|    115|            tv2->value = NULL;
 1107|    115|        }
 1108|       |        /* Shorten list and close gap in customValues list.
 1109|       |         * Re-allocation of td_customValues not necessary here. */
 1110|    115|        td->td_customValueCount--;
 1111|    115|        for (iC2 = iCustom2; iC2 < td->td_customValueCount; iC2++)
  ------------------
  |  Branch (1111:30): [True: 0, False: 115]
  ------------------
 1112|      0|        {
 1113|      0|            td->td_customValues[iC2] = td->td_customValues[iC2 + 1];
 1114|      0|        }
 1115|    115|    }
 1116|      0|    else
 1117|      0|    {
 1118|      0|        assert(0);
  ------------------
  |  Branch (1118:9): [Folded, False: 0]
  |  Branch (1118:9): [Folded, False: 0]
  ------------------
 1119|      0|    }
 1120|    115|    va_end(ap);
 1121|    115|}
 1122|    115|    return (0);
 1123|    115|} /*-- _TIFFVSetField() --*/
tif_dir.c:setExtraSamples:
  139|    200|{
  140|       |/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
  141|    200|#define EXTRASAMPLE_COREL_UNASSALPHA 999
  142|       |
  143|    200|    uint16_t *va;
  144|    200|    uint32_t i;
  145|    200|    TIFFDirectory *td = &tif->tif_dir;
  146|    200|    static const char module[] = "setExtraSamples";
  147|       |
  148|    200|    *v = (uint16_t)va_arg(ap, uint16_vap);
  149|    200|    if ((uint16_t)*v > td->td_samplesperpixel)
  ------------------
  |  Branch (149:9): [True: 0, False: 200]
  ------------------
  150|      0|        return 0;
  151|    200|    va = va_arg(ap, uint16_t *);
  152|    200|    if (*v > 0 && va == NULL) /* typically missing param */
  ------------------
  |  Branch (152:9): [True: 200, False: 0]
  |  Branch (152:19): [True: 0, False: 200]
  ------------------
  153|      0|        return 0;
  154|    437|    for (i = 0; i < *v; i++)
  ------------------
  |  Branch (154:17): [True: 238, False: 199]
  ------------------
  155|    238|    {
  156|    238|        if (va[i] > EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|    238|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (156:13): [True: 1, False: 237]
  ------------------
  157|      1|        {
  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|      1|            if (va[i] == EXTRASAMPLE_COREL_UNASSALPHA)
  ------------------
  |  |  141|      1|#define EXTRASAMPLE_COREL_UNASSALPHA 999
  ------------------
  |  Branch (164:17): [True: 0, False: 1]
  ------------------
  165|      0|                va[i] = EXTRASAMPLE_UNASSALPHA;
  ------------------
  |  |  332|      0|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  166|      1|            else
  167|      1|                return 0;
  168|      1|        }
  169|    238|    }
  170|       |
  171|    199|    if (td->td_transferfunction[0] != NULL &&
  ------------------
  |  Branch (171:9): [True: 0, False: 199]
  ------------------
  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|    199|    td->td_extrasamples = (uint16_t)*v;
  185|    199|    _TIFFsetShortArrayExt(tif, &td->td_sampleinfo, va, td->td_extrasamples);
  186|    199|    return 1;
  187|       |
  188|    200|#undef EXTRASAMPLE_COREL_UNASSALPHA
  189|    200|}
tif_dir.c:_TIFFsetLong8Array:
   98|      4|{
   99|      4|    setByteArray(tif, (void **)lpp, lp, n, sizeof(uint64_t));
  100|      4|}
tif_dir.c:countInkNamesString:
  196|     12|{
  197|     12|    uint16_t i = 0;
  198|       |
  199|     12|    if (slen > 0)
  ------------------
  |  Branch (199:9): [True: 12, False: 0]
  ------------------
  200|     12|    {
  201|     12|        const char *ep = s + slen;
  202|     12|        const char *cp = s;
  203|     12|        do
  204|  3.37k|        {
  205|  9.50k|            for (; cp < ep && *cp != '\0'; cp++)
  ------------------
  |  Branch (205:20): [True: 9.50k, False: 0]
  |  Branch (205:31): [True: 6.13k, False: 3.37k]
  ------------------
  206|  6.13k|            {
  207|  6.13k|            }
  208|  3.37k|            if (cp >= ep)
  ------------------
  |  Branch (208:17): [True: 0, False: 3.37k]
  ------------------
  209|      0|                goto bad;
  210|  3.37k|            cp++; /* skip \0 */
  211|  3.37k|            i++;
  212|  3.37k|        } while (cp < ep);
  ------------------
  |  Branch (212:18): [True: 3.35k, False: 12]
  ------------------
  213|     12|        return (i);
  214|     12|    }
  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|     12|}
tif_dir.c:_TIFFsetNString:
   72|     12|{
   73|     12|    setByteArray(tif, (void **)cpp, cp, n, 1);
   74|     12|}
tif_dir.c:_TIFFVGetField:
 1234|  90.5k|{
 1235|  90.5k|    TIFFDirectory *td = &tif->tif_dir;
 1236|  90.5k|    int ret_val = 1;
 1237|  90.5k|    uint32_t standard_tag = tag;
 1238|  90.5k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|  90.5k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1239|  90.5k|    if (fip == NULL) /* cannot happen since TIFFGetField() already checks it */
  ------------------
  |  Branch (1239:9): [True: 0, False: 90.5k]
  ------------------
 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|  90.5k|    if (fip->field_bit == FIELD_CUSTOM)
  ------------------
  |  |  346|  90.5k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (1248:9): [True: 549, False: 90.0k]
  ------------------
 1249|    549|    {
 1250|    549|        standard_tag = 0;
 1251|    549|    }
 1252|       |
 1253|  90.5k|    switch (standard_tag)
 1254|  90.5k|    {
 1255|      0|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (1255:9): [True: 0, False: 90.5k]
  ------------------
 1256|      0|            *va_arg(ap, uint32_t *) = td->td_subfiletype;
 1257|      0|            break;
 1258|  10.7k|        case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  10.7k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (1258:9): [True: 10.7k, False: 79.8k]
  ------------------
 1259|  10.7k|            *va_arg(ap, uint32_t *) = td->td_imagewidth;
 1260|  10.7k|            break;
 1261|  8.10k|        case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  8.10k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (1261:9): [True: 8.10k, False: 82.4k]
  ------------------
 1262|  8.10k|            *va_arg(ap, uint32_t *) = td->td_imagelength;
 1263|  8.10k|            break;
 1264|  2.89k|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  2.89k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (1264:9): [True: 2.89k, False: 87.6k]
  ------------------
 1265|  2.89k|            *va_arg(ap, uint16_t *) = td->td_bitspersample;
 1266|  2.89k|            break;
 1267|  5.12k|        case TIFFTAG_COMPRESSION:
  ------------------
  |  |  181|  5.12k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (1267:9): [True: 5.12k, False: 85.4k]
  ------------------
 1268|  5.12k|            *va_arg(ap, uint16_t *) = td->td_compression;
 1269|  5.12k|            break;
 1270|  5.15k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  5.15k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (1270:9): [True: 5.15k, False: 85.4k]
  ------------------
 1271|  5.15k|            *va_arg(ap, uint16_t *) = td->td_photometric;
 1272|  5.15k|            break;
 1273|      0|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      0|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (1273:9): [True: 0, False: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 1277|      0|            *va_arg(ap, uint16_t *) = td->td_fillorder;
 1278|      0|            break;
 1279|    293|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|    293|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (1279:9): [True: 293, False: 90.2k]
  ------------------
 1280|    293|            *va_arg(ap, uint16_t *) = td->td_orientation;
 1281|    293|            break;
 1282|  2.03k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  2.03k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (1282:9): [True: 2.03k, False: 88.5k]
  ------------------
 1283|  2.03k|            *va_arg(ap, uint16_t *) = td->td_samplesperpixel;
 1284|  2.03k|            break;
 1285|  2.79k|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  2.79k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (1285:9): [True: 2.79k, False: 87.7k]
  ------------------
 1286|  2.79k|            *va_arg(ap, uint32_t *) = td->td_rowsperstrip;
 1287|  2.79k|            break;
 1288|      0|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|      0|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (1288:9): [True: 0, False: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 1326|      0|            *va_arg(ap, float *) = td->td_yresolution;
 1327|      0|            break;
 1328|  3.40k|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  3.40k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (1328:9): [True: 3.40k, False: 87.1k]
  ------------------
 1329|  3.40k|            *va_arg(ap, uint16_t *) = td->td_planarconfig;
 1330|  3.40k|            break;
 1331|      0|        case TIFFTAG_XPOSITION:
  ------------------
  |  |  268|      0|#define TIFFTAG_XPOSITION 286              /* x page offset of image lhs */
  ------------------
  |  Branch (1331:9): [True: 0, False: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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|     29|        case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|     29|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (1348:9): [True: 29, False: 90.5k]
  ------------------
 1349|     29|            *va_arg(ap, const uint16_t **) = td->td_colormap[0];
 1350|     29|            *va_arg(ap, const uint16_t **) = td->td_colormap[1];
 1351|     29|            *va_arg(ap, const uint16_t **) = td->td_colormap[2];
 1352|     29|            break;
 1353|      0|        case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|      0|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (1353:9): [True: 0, False: 90.5k]
  ------------------
 1354|      0|        case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|      0|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (1354:9): [True: 0, False: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 1361|      0|        case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|      0|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (1361:9): [True: 0, False: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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|    176|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|    176|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (1372:9): [True: 176, False: 90.3k]
  ------------------
 1373|    176|            *va_arg(ap, uint16_t *) = td->td_extrasamples;
 1374|    176|            *va_arg(ap, const uint16_t **) = td->td_sampleinfo;
 1375|    176|            break;
 1376|  5.19k|        case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  5.19k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (1376:9): [True: 5.19k, False: 85.3k]
  ------------------
 1377|  5.19k|            *va_arg(ap, uint32_t *) = td->td_tilewidth;
 1378|  5.19k|            break;
 1379|  2.58k|        case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  2.58k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (1379:9): [True: 2.58k, False: 87.9k]
  ------------------
 1380|  2.58k|            *va_arg(ap, uint32_t *) = td->td_tilelength;
 1381|  2.58k|            break;
 1382|      0|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|      0|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (1382:9): [True: 0, False: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 1415|      0|            *va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
 1416|      0|            break;
 1417|  41.5k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  41.5k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (1417:9): [True: 41.5k, False: 49.0k]
  ------------------
 1418|  41.5k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
 1419|  41.5k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
 1420|  41.5k|            break;
 1421|      0|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      0|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (1421:9): [True: 0, False: 90.5k]
  ------------------
 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|      4|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|      4|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (1434:9): [True: 4, False: 90.5k]
  ------------------
 1435|      4|            *va_arg(ap, const float **) = td->td_refblackwhite;
 1436|      4|            break;
 1437|      0|        case TIFFTAG_INKNAMES:
  ------------------
  |  |  325|      0|#define TIFFTAG_INKNAMES 333               /* !ascii names of inks */
  ------------------
  |  Branch (1437:9): [True: 0, False: 90.5k]
  ------------------
 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: 90.5k]
  ------------------
 1441|      0|            *va_arg(ap, uint16_t *) = td->td_numberofinks;
 1442|      0|            break;
 1443|    549|        default:
  ------------------
  |  Branch (1443:9): [True: 549, False: 90.0k]
  ------------------
 1444|    549|        {
 1445|    549|            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|    549|            if (fip->field_bit != FIELD_CUSTOM)
  ------------------
  |  |  346|    549|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (1456:17): [True: 0, False: 549]
  ------------------
 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|    549|            ret_val = 0;
 1471|  1.46k|            for (i = 0; i < td->td_customValueCount; i++)
  ------------------
  |  Branch (1471:25): [True: 927, False: 542]
  ------------------
 1472|    927|            {
 1473|    927|                TIFFTagValue *tv = td->td_customValues + i;
 1474|       |
 1475|    927|                if (tv->info->field_tag != tag)
  ------------------
  |  Branch (1475:21): [True: 920, False: 7]
  ------------------
 1476|    920|                    continue;
 1477|       |
 1478|      7|                if (fip->field_passcount)
  ------------------
  |  Branch (1478:21): [True: 0, False: 7]
  ------------------
 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|      7|                else if (fip->field_tag == TIFFTAG_DOTRANGE &&
  ------------------
  |  |  327|     14|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (1487:26): [True: 0, False: 7]
  ------------------
 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|      7|                else
 1499|      7|                {
 1500|      7|                    if (fip->field_type == TIFF_ASCII ||
  ------------------
  |  Branch (1500:25): [True: 0, False: 7]
  ------------------
 1501|      7|                        fip->field_readcount == TIFF_VARIABLE ||
  ------------------
  |  |  342|     14|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (1501:25): [True: 0, False: 7]
  ------------------
 1502|      7|                        fip->field_readcount == TIFF_VARIABLE2 ||
  ------------------
  |  |  344|     14|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1502:25): [True: 0, False: 7]
  ------------------
 1503|      7|                        fip->field_readcount == TIFF_SPP || tv->count > 1)
  ------------------
  |  |  343|     14|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (1503:25): [True: 0, False: 7]
  |  Branch (1503:61): [True: 6, False: 1]
  ------------------
 1504|      6|                    {
 1505|      6|                        *va_arg(ap, void **) = tv->value;
 1506|      6|                        ret_val = 1;
 1507|      6|                    }
 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|      7|                }
 1596|      7|                break;
 1597|      7|            }
 1598|    549|        }
 1599|  90.5k|    }
 1600|  90.5k|    return (ret_val);
 1601|  90.5k|}

_TIFFGetFields:
  561|  6.24k|const TIFFFieldArray *_TIFFGetFields(void) { return (&tiffFieldArray); }
_TIFFSetupFields:
  568|  6.24k|{
  569|  6.24k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (569:9): [True: 0, False: 6.24k]
  |  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|  6.24k|    if (!_TIFFMergeFields(tif, fieldarray->fields, fieldarray->count))
  ------------------
  |  Branch (594:9): [True: 0, False: 6.24k]
  ------------------
  595|      0|    {
  596|      0|        TIFFErrorExtR(tif, "_TIFFSetupFields", "Setting up field info failed");
  597|      0|    }
  598|  6.24k|}
_TIFFMergeFields:
  628|   127k|{
  629|   127k|    static const char module[] = "_TIFFMergeFields";
  630|   127k|    static const char reason[] = "for fields array";
  631|       |    /* TIFFField** tp; */
  632|   127k|    uint32_t i;
  633|       |
  634|   127k|    tif->tif_foundfield = NULL;
  635|       |
  636|   127k|    TIFFField **tif_newfields = NULL;
  637|       |
  638|   127k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (638:9): [True: 121k, False: 6.24k]
  |  Branch (638:28): [True: 121k, False: 0]
  ------------------
  639|   121k|    {
  640|   121k|        tif_newfields = (TIFFField **)_TIFFCheckRealloc(
  641|   121k|            tif, tif->tif_fields, (tmsize_t)tif->tif_nfields + n,
  642|   121k|            (tmsize_t)sizeof(TIFFField *), reason);
  643|   121k|    }
  644|  6.24k|    else
  645|  6.24k|    {
  646|  6.24k|        tif_newfields =
  647|  6.24k|            (TIFFField **)_TIFFCheckMalloc(tif, n, sizeof(TIFFField *), reason);
  648|  6.24k|    }
  649|   127k|    if (!tif_newfields)
  ------------------
  |  Branch (649:9): [True: 0, False: 127k]
  ------------------
  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|   127k|    tif->tif_fields = tif_newfields;
  656|       |
  657|       |    /* tp = tif->tif_fields + tif->tif_nfields; */
  658|  1.22M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (658:17): [True: 1.09M, False: 127k]
  ------------------
  659|  1.09M|    {
  660|  1.09M|        const TIFFField *fip = TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
  ------------------
  |  |  341|  1.09M|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  661|       |
  662|       |        /* only add definitions that aren't already present */
  663|  1.09M|        if (!fip)
  ------------------
  |  Branch (663:13): [True: 1.09M, False: 0]
  ------------------
  664|  1.09M|        {
  665|  1.09M|            tif->tif_fields[tif->tif_nfields] = (TIFFField *)(info + i);
  666|  1.09M|            tif->tif_nfields++;
  667|  1.09M|        }
  668|  1.09M|    }
  669|       |
  670|       |    /* Sort the field info by tag number */
  671|   127k|    qsort(tif->tif_fields, tif->tif_nfields, sizeof(TIFFField *), tagCompare);
  672|       |
  673|   127k|    return (int)n;
  674|   127k|}
TIFFDataWidth:
  696|  77.1k|{
  697|  77.1k|    switch (type)
  698|  77.1k|    {
  699|    884|        case 0: /* nothing */
  ------------------
  |  Branch (699:9): [True: 884, False: 76.2k]
  ------------------
  700|  16.8k|        case TIFF_BYTE:
  ------------------
  |  Branch (700:9): [True: 15.9k, False: 61.2k]
  ------------------
  701|  27.0k|        case TIFF_ASCII:
  ------------------
  |  Branch (701:9): [True: 10.2k, False: 66.9k]
  ------------------
  702|  28.1k|        case TIFF_SBYTE:
  ------------------
  |  Branch (702:9): [True: 1.07k, False: 76.0k]
  ------------------
  703|  30.4k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (703:9): [True: 2.37k, False: 74.7k]
  ------------------
  704|  30.4k|            return 1;
  705|  20.5k|        case TIFF_SHORT:
  ------------------
  |  Branch (705:9): [True: 20.5k, False: 56.5k]
  ------------------
  706|  22.1k|        case TIFF_SSHORT:
  ------------------
  |  Branch (706:9): [True: 1.58k, False: 75.5k]
  ------------------
  707|  22.1k|            return 2;
  708|  11.8k|        case TIFF_LONG:
  ------------------
  |  Branch (708:9): [True: 11.8k, False: 65.2k]
  ------------------
  709|  12.2k|        case TIFF_SLONG:
  ------------------
  |  Branch (709:9): [True: 339, False: 76.8k]
  ------------------
  710|  12.4k|        case TIFF_FLOAT:
  ------------------
  |  Branch (710:9): [True: 171, False: 76.9k]
  ------------------
  711|  12.6k|        case TIFF_IFD:
  ------------------
  |  Branch (711:9): [True: 212, False: 76.9k]
  ------------------
  712|  12.6k|            return 4;
  713|  1.73k|        case TIFF_RATIONAL:
  ------------------
  |  Branch (713:9): [True: 1.73k, False: 75.4k]
  ------------------
  714|  2.06k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (714:9): [True: 332, False: 76.8k]
  ------------------
  715|  8.11k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (715:9): [True: 6.04k, False: 71.1k]
  ------------------
  716|  11.0k|        case TIFF_LONG8:
  ------------------
  |  Branch (716:9): [True: 2.93k, False: 74.2k]
  ------------------
  717|  11.6k|        case TIFF_SLONG8:
  ------------------
  |  Branch (717:9): [True: 559, False: 76.6k]
  ------------------
  718|  11.7k|        case TIFF_IFD8:
  ------------------
  |  Branch (718:9): [True: 141, False: 77.0k]
  ------------------
  719|  11.7k|            return 8;
  720|    129|        default:
  ------------------
  |  Branch (720:9): [True: 129, False: 77.0k]
  ------------------
  721|    129|            return 0; /* will return 0 for unknown types */
  722|  77.1k|    }
  723|  77.1k|}
TIFFFieldSetGetSize:
  732|  11.8k|{
  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|  11.8k|    if (fip == NULL)
  ------------------
  |  Branch (744:9): [True: 0, False: 11.8k]
  ------------------
  745|      0|        return 0;
  746|       |
  747|  11.8k|    switch (fip->set_get_field_type)
  748|  11.8k|    {
  749|      0|        case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (749:9): [True: 0, False: 11.8k]
  ------------------
  750|    882|        case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (750:9): [True: 882, False: 10.9k]
  ------------------
  751|    882|        case TIFF_SETGET_C0_ASCII:
  ------------------
  |  Branch (751:9): [True: 0, False: 11.8k]
  ------------------
  752|    882|        case TIFF_SETGET_C16_ASCII:
  ------------------
  |  Branch (752:9): [True: 0, False: 11.8k]
  ------------------
  753|  3.48k|        case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (753:9): [True: 2.60k, False: 9.27k]
  ------------------
  754|  3.48k|        case TIFF_SETGET_OTHER:
  ------------------
  |  Branch (754:9): [True: 0, False: 11.8k]
  ------------------
  755|  3.48k|            return 1;
  756|      9|        case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (756:9): [True: 9, False: 11.8k]
  ------------------
  757|      9|        case TIFF_SETGET_SINT8:
  ------------------
  |  Branch (757:9): [True: 0, False: 11.8k]
  ------------------
  758|     33|        case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (758:9): [True: 24, False: 11.8k]
  ------------------
  759|     33|        case TIFF_SETGET_C0_SINT8:
  ------------------
  |  Branch (759:9): [True: 0, False: 11.8k]
  ------------------
  760|     43|        case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (760:9): [True: 10, False: 11.8k]
  ------------------
  761|     43|        case TIFF_SETGET_C16_SINT8:
  ------------------
  |  Branch (761:9): [True: 0, False: 11.8k]
  ------------------
  762|  2.16k|        case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (762:9): [True: 2.12k, False: 9.75k]
  ------------------
  763|  2.22k|        case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (763:9): [True: 58, False: 11.8k]
  ------------------
  764|  2.22k|            return 1;
  765|    108|        case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (765:9): [True: 108, False: 11.7k]
  ------------------
  766|    108|        case TIFF_SETGET_SINT16:
  ------------------
  |  Branch (766:9): [True: 0, False: 11.8k]
  ------------------
  767|    108|        case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (767:9): [True: 0, False: 11.8k]
  ------------------
  768|    108|        case TIFF_SETGET_C0_SINT16:
  ------------------
  |  Branch (768:9): [True: 0, False: 11.8k]
  ------------------
  769|    109|        case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (769:9): [True: 1, False: 11.8k]
  ------------------
  770|    109|        case TIFF_SETGET_C16_SINT16:
  ------------------
  |  Branch (770:9): [True: 0, False: 11.8k]
  ------------------
  771|  2.27k|        case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (771:9): [True: 2.16k, False: 9.71k]
  ------------------
  772|  2.35k|        case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (772:9): [True: 80, False: 11.8k]
  ------------------
  773|  2.35k|            return 2;
  774|      0|        case TIFF_SETGET_INT:
  ------------------
  |  Branch (774:9): [True: 0, False: 11.8k]
  ------------------
  775|      7|        case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (775:9): [True: 7, False: 11.8k]
  ------------------
  776|      7|        case TIFF_SETGET_SINT32:
  ------------------
  |  Branch (776:9): [True: 0, False: 11.8k]
  ------------------
  777|     42|        case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (777:9): [True: 35, False: 11.8k]
  ------------------
  778|     42|        case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (778:9): [True: 0, False: 11.8k]
  ------------------
  779|     59|        case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (779:9): [True: 17, False: 11.8k]
  ------------------
  780|     59|        case TIFF_SETGET_C0_SINT32:
  ------------------
  |  Branch (780:9): [True: 0, False: 11.8k]
  ------------------
  781|     82|        case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (781:9): [True: 23, False: 11.8k]
  ------------------
  782|    110|        case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (782:9): [True: 28, False: 11.8k]
  ------------------
  783|    110|        case TIFF_SETGET_C16_SINT32:
  ------------------
  |  Branch (783:9): [True: 0, False: 11.8k]
  ------------------
  784|    223|        case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (784:9): [True: 113, False: 11.7k]
  ------------------
  785|    539|        case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (785:9): [True: 316, False: 11.5k]
  ------------------
  786|    589|        case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (786:9): [True: 50, False: 11.8k]
  ------------------
  787|    777|        case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (787:9): [True: 188, False: 11.6k]
  ------------------
  788|    777|            return 4;
  789|     44|        case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (789:9): [True: 44, False: 11.8k]
  ------------------
  790|     44|        case TIFF_SETGET_SINT64:
  ------------------
  |  Branch (790:9): [True: 0, False: 11.8k]
  ------------------
  791|     44|        case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (791:9): [True: 0, False: 11.8k]
  ------------------
  792|     57|        case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (792:9): [True: 13, False: 11.8k]
  ------------------
  793|     57|        case TIFF_SETGET_C0_UINT64:
  ------------------
  |  Branch (793:9): [True: 0, False: 11.8k]
  ------------------
  794|     57|        case TIFF_SETGET_C0_SINT64:
  ------------------
  |  Branch (794:9): [True: 0, False: 11.8k]
  ------------------
  795|     57|        case TIFF_SETGET_C0_DOUBLE:
  ------------------
  |  Branch (795:9): [True: 0, False: 11.8k]
  ------------------
  796|     57|        case TIFF_SETGET_C0_IFD8:
  ------------------
  |  Branch (796:9): [True: 0, False: 11.8k]
  ------------------
  797|     57|        case TIFF_SETGET_C16_UINT64:
  ------------------
  |  Branch (797:9): [True: 0, False: 11.8k]
  ------------------
  798|     57|        case TIFF_SETGET_C16_SINT64:
  ------------------
  |  Branch (798:9): [True: 0, False: 11.8k]
  ------------------
  799|     57|        case TIFF_SETGET_C16_DOUBLE:
  ------------------
  |  Branch (799:9): [True: 0, False: 11.8k]
  ------------------
  800|     57|        case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (800:9): [True: 0, False: 11.8k]
  ------------------
  801|     78|        case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (801:9): [True: 21, False: 11.8k]
  ------------------
  802|    217|        case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (802:9): [True: 139, False: 11.7k]
  ------------------
  803|  2.98k|        case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (803:9): [True: 2.76k, False: 9.11k]
  ------------------
  804|  3.03k|        case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (804:9): [True: 53, False: 11.8k]
  ------------------
  805|  3.03k|            return 8;
  806|      0|        default:
  ------------------
  |  Branch (806:9): [True: 0, False: 11.8k]
  ------------------
  807|      0|            return 0;
  808|  11.8k|    }
  809|  11.8k|} /*-- TIFFFieldSetGetSize() --- */
TIFFFindField:
  882|  1.51M|{
  883|  1.51M|    TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0,   TIFF_SETGET_UNDEFINED,
  884|  1.51M|                     0, 0, 0, NULL,        NULL};
  885|  1.51M|    TIFFField *pkey = &key;
  886|  1.51M|    const TIFFField **ret;
  887|  1.51M|    if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
  ------------------
  |  Branch (887:9): [True: 399k, False: 1.11M]
  |  Branch (887:32): [True: 271k, False: 128k]
  ------------------
  888|   271k|        (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
  ------------------
  |  |  341|   542k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  |  Branch (888:10): [True: 271k, False: 0]
  |  Branch (888:28): [True: 0, False: 0]
  ------------------
  889|   271k|        return tif->tif_foundfield;
  890|       |
  891|       |    /* If we are invoked with no field information, then just return. */
  892|  1.24M|    if (!tif->tif_fields)
  ------------------
  |  Branch (892:9): [True: 0, False: 1.24M]
  ------------------
  893|      0|        return NULL;
  894|       |
  895|       |    /* NB: use sorted search (e.g. binary search) */
  896|       |
  897|  1.24M|    key.field_tag = tag;
  898|  1.24M|    key.field_type = dt;
  899|       |
  900|  1.24M|    ret = (const TIFFField **)bsearch(&pkey, tif->tif_fields, tif->tif_nfields,
  901|  1.24M|                                      sizeof(TIFFField *), tagCompare);
  902|  1.24M|    return tif->tif_foundfield = (ret ? *ret : NULL);
  ------------------
  |  Branch (902:35): [True: 153k, False: 1.09M]
  ------------------
  903|  1.24M|}
TIFFFieldWithTag:
  934|  79.2k|{
  935|  79.2k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|  79.2k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  936|  79.2k|    if (!fip)
  ------------------
  |  Branch (936:9): [True: 0, False: 79.2k]
  ------------------
  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|  79.2k|    return (fip);
  945|  79.2k|}
TIFFFieldIsAnonymous:
  974|   758k|{
  975|   758k|    return (int)fip->field_anonymous;
  976|   758k|}
_TIFFCreateAnonField:
  997|   115k|{
  998|   115k|    TIFFField *fld;
  999|   115k|    (void)tif;
 1000|       |
 1001|   115k|    fld = (TIFFField *)_TIFFmallocExt(tif, sizeof(TIFFField));
 1002|   115k|    if (fld == NULL)
  ------------------
  |  Branch (1002:9): [True: 0, False: 115k]
  ------------------
 1003|      0|        return NULL;
 1004|   115k|    _TIFFmemset(fld, 0, sizeof(TIFFField));
 1005|       |
 1006|   115k|    fld->field_tag = tag;
 1007|   115k|    fld->field_readcount = TIFF_VARIABLE2;
  ------------------
  |  |  344|   115k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
 1008|   115k|    fld->field_writecount = TIFF_VARIABLE2;
  ------------------
  |  |  344|   115k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
 1009|   115k|    fld->field_type = field_type;
 1010|   115k|    fld->field_anonymous =
 1011|   115k|        1; /* indicate that this is an anonymous / unknown tag */
 1012|   115k|    switch (field_type)
 1013|   115k|    {
 1014|  3.44k|        case TIFF_BYTE:
  ------------------
  |  Branch (1014:9): [True: 3.44k, False: 111k]
  ------------------
 1015|  3.88k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1015:9): [True: 442, False: 114k]
  ------------------
 1016|  3.88k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT8;
 1017|  3.88k|            break;
 1018|  5.74k|        case TIFF_ASCII:
  ------------------
  |  Branch (1018:9): [True: 5.74k, False: 109k]
  ------------------
 1019|  5.74k|            fld->set_get_field_type = TIFF_SETGET_C32_ASCII;
 1020|  5.74k|            break;
 1021|  3.67k|        case TIFF_SHORT:
  ------------------
  |  Branch (1021:9): [True: 3.67k, False: 111k]
  ------------------
 1022|  3.67k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT16;
 1023|  3.67k|            break;
 1024|  1.13k|        case TIFF_LONG:
  ------------------
  |  Branch (1024:9): [True: 1.13k, False: 113k]
  ------------------
 1025|  1.13k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT32;
 1026|  1.13k|            break;
 1027|    770|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1027:9): [True: 770, False: 114k]
  ------------------
 1028|    939|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1028:9): [True: 169, False: 114k]
  ------------------
 1029|  1.07k|        case TIFF_FLOAT:
  ------------------
  |  Branch (1029:9): [True: 138, False: 114k]
  ------------------
 1030|  1.07k|            fld->set_get_field_type = TIFF_SETGET_C32_FLOAT;
 1031|  1.07k|            break;
 1032|    364|        case TIFF_SBYTE:
  ------------------
  |  Branch (1032:9): [True: 364, False: 114k]
  ------------------
 1033|    364|            fld->set_get_field_type = TIFF_SETGET_C32_SINT8;
 1034|    364|            break;
 1035|    439|        case TIFF_SSHORT:
  ------------------
  |  Branch (1035:9): [True: 439, False: 114k]
  ------------------
 1036|    439|            fld->set_get_field_type = TIFF_SETGET_C32_SINT16;
 1037|    439|            break;
 1038|    203|        case TIFF_SLONG:
  ------------------
  |  Branch (1038:9): [True: 203, False: 114k]
  ------------------
 1039|    203|            fld->set_get_field_type = TIFF_SETGET_C32_SINT32;
 1040|    203|            break;
 1041|  3.08k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1041:9): [True: 3.08k, False: 112k]
  ------------------
 1042|  3.08k|            fld->set_get_field_type = TIFF_SETGET_C32_DOUBLE;
 1043|  3.08k|            break;
 1044|    129|        case TIFF_IFD:
  ------------------
  |  Branch (1044:9): [True: 129, False: 114k]
  ------------------
 1045|    192|        case TIFF_IFD8:
  ------------------
  |  Branch (1045:9): [True: 63, False: 115k]
  ------------------
 1046|    192|            fld->set_get_field_type = TIFF_SETGET_C32_IFD8;
 1047|    192|            break;
 1048|    172|        case TIFF_LONG8:
  ------------------
  |  Branch (1048:9): [True: 172, False: 114k]
  ------------------
 1049|    172|            fld->set_get_field_type = TIFF_SETGET_C32_UINT64;
 1050|    172|            break;
 1051|    277|        case TIFF_SLONG8:
  ------------------
  |  Branch (1051:9): [True: 277, False: 114k]
  ------------------
 1052|    277|            fld->set_get_field_type = TIFF_SETGET_C32_SINT64;
 1053|    277|            break;
 1054|  9.75k|        case TIFF_NOTYPE:
  ------------------
  |  Branch (1054:9): [True: 9.75k, False: 105k]
  ------------------
 1055|  94.8k|        default:
  ------------------
  |  Branch (1055:9): [True: 85.0k, False: 30.0k]
  ------------------
 1056|  94.8k|            fld->set_get_field_type = TIFF_SETGET_UNDEFINED;
 1057|  94.8k|            break;
 1058|   115k|    }
 1059|   115k|    fld->field_bit = FIELD_CUSTOM;
  ------------------
  |  |  346|   115k|#define FIELD_CUSTOM 65
  ------------------
 1060|   115k|    fld->field_oktochange = TRUE;
  ------------------
  |  |   71|   115k|#define TRUE 1
  ------------------
 1061|   115k|    fld->field_passcount = TRUE;
  ------------------
  |  |   71|   115k|#define TRUE 1
  ------------------
 1062|   115k|    char *field_name_buf = (char *)_TIFFmallocExt(tif, 32);
 1063|   115k|    if (field_name_buf == NULL)
  ------------------
  |  Branch (1063:9): [True: 0, False: 115k]
  ------------------
 1064|      0|    {
 1065|      0|        _TIFFfreeExt(tif, fld);
 1066|      0|        return NULL;
 1067|      0|    }
 1068|   115k|    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|   115k|    (void)snprintf(field_name_buf, 32, "Tag %d", (int)tag);
 1077|   115k|    fld->field_name = field_name_buf;
 1078|       |
 1079|   115k|    return fld;
 1080|   115k|}
_TIFFCheckFieldIsValidForCodec:
 1354|   136k|{
 1355|       |    /* Filter out non-codec specific tags */
 1356|   136k|    switch (tag)
 1357|   136k|    {
 1358|       |        /* Shared tags */
 1359|    626|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|    626|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1359:9): [True: 626, False: 136k]
  ------------------
 1360|       |        /* JPEG tags */
 1361|  1.75k|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|  1.75k|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (1361:9): [True: 1.12k, False: 135k]
  ------------------
 1362|       |        /* OJPEG tags */
 1363|  2.52k|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|  2.52k|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (1363:9): [True: 766, False: 136k]
  ------------------
 1364|  2.71k|        case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|  2.71k|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (1364:9): [True: 193, False: 136k]
  ------------------
 1365|  3.66k|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|  3.66k|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (1365:9): [True: 955, False: 135k]
  ------------------
 1366|  4.58k|        case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|  4.58k|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (1366:9): [True: 916, False: 135k]
  ------------------
 1367|  5.46k|        case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|  5.46k|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (1367:9): [True: 885, False: 135k]
  ------------------
 1368|  6.67k|        case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|  6.67k|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (1368:9): [True: 1.20k, False: 135k]
  ------------------
 1369|  6.71k|        case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|  6.71k|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (1369:9): [True: 40, False: 136k]
  ------------------
 1370|       |        /* CCITT* */
 1371|  6.73k|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|  6.73k|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1371:9): [True: 18, False: 136k]
  ------------------
 1372|  6.77k|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|  6.77k|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1372:9): [True: 38, False: 136k]
  ------------------
 1373|  7.20k|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|  7.20k|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1373:9): [True: 431, False: 136k]
  ------------------
 1374|  7.49k|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|  7.49k|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1374:9): [True: 292, False: 136k]
  ------------------
 1375|  7.59k|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|  7.59k|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1375:9): [True: 101, False: 136k]
  ------------------
 1376|       |        /* LERC */
 1377|  7.60k|        case TIFFTAG_LERC_PARAMETERS:
  ------------------
  |  |  502|  7.60k|#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
  ------------------
  |  Branch (1377:9): [True: 3, False: 136k]
  ------------------
 1378|  7.60k|            break;
 1379|   129k|        default:
  ------------------
  |  Branch (1379:9): [True: 129k, False: 7.60k]
  ------------------
 1380|   129k|            return 1;
 1381|   136k|    }
 1382|  7.60k|    if (!TIFFIsCODECConfigured(tif->tif_dir.td_compression))
  ------------------
  |  Branch (1382:9): [True: 86, False: 7.51k]
  ------------------
 1383|     86|    {
 1384|     86|        return 0;
 1385|     86|    }
 1386|       |    /* Check if codec specific tags are allowed for the current
 1387|       |     * compression scheme (codec) */
 1388|  7.51k|    switch (tif->tif_dir.td_compression)
 1389|  7.51k|    {
 1390|    333|        case COMPRESSION_LZW:
  ------------------
  |  |  188|    333|#define COMPRESSION_LZW 5             /* Lempel-Ziv  & Welch */
  ------------------
  |  Branch (1390:9): [True: 333, False: 7.18k]
  ------------------
 1391|    333|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    333|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1391:17): [True: 300, False: 33]
  ------------------
 1392|    300|                return 1;
 1393|     33|            break;
 1394|     33|        case COMPRESSION_PACKBITS:
  ------------------
  |  |  195|     14|#define COMPRESSION_PACKBITS 32773    /* Macintosh RLE */
  ------------------
  |  Branch (1394:9): [True: 14, False: 7.50k]
  ------------------
 1395|       |            /* No codec-specific tags */
 1396|     14|            break;
 1397|      9|        case COMPRESSION_THUNDERSCAN:
  ------------------
  |  |  196|      9|#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
  ------------------
  |  Branch (1397:9): [True: 9, False: 7.50k]
  ------------------
 1398|       |            /* No codec-specific tags */
 1399|      9|            break;
 1400|      6|        case COMPRESSION_NEXT:
  ------------------
  |  |  193|      6|#define COMPRESSION_NEXT 32766        /* NeXT 2-bit RLE */
  ------------------
  |  Branch (1400:9): [True: 6, False: 7.50k]
  ------------------
 1401|       |            /* No codec-specific tags */
 1402|      6|            break;
 1403|  2.57k|        case COMPRESSION_JPEG:
  ------------------
  |  |  190|  2.57k|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
  |  Branch (1403:9): [True: 2.57k, False: 4.94k]
  ------------------
 1404|  2.57k|            if (tag == TIFFTAG_JPEGTABLES)
  ------------------
  |  |  346|  2.57k|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (1404:17): [True: 1.00k, False: 1.56k]
  ------------------
 1405|  1.00k|                return 1;
 1406|  1.56k|            break;
 1407|  3.74k|        case COMPRESSION_OJPEG:
  ------------------
  |  |  189|  3.74k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (1407:9): [True: 3.74k, False: 3.77k]
  ------------------
 1408|  3.74k|            switch (tag)
 1409|  3.74k|            {
 1410|    661|                case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|    661|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (1410:17): [True: 661, False: 3.07k]
  ------------------
 1411|    828|                case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|    828|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (1411:17): [True: 167, False: 3.57k]
  ------------------
 1412|  1.74k|                case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|  1.74k|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (1412:17): [True: 915, False: 2.82k]
  ------------------
 1413|  2.61k|                case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|  2.61k|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (1413:17): [True: 868, False: 2.87k]
  ------------------
 1414|  3.46k|                case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|  3.46k|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (1414:17): [True: 852, False: 2.88k]
  ------------------
 1415|  3.52k|                case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|  3.52k|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (1415:17): [True: 62, False: 3.67k]
  ------------------
 1416|  3.55k|                case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|  3.55k|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (1416:17): [True: 29, False: 3.71k]
  ------------------
 1417|  3.55k|                    return 1;
 1418|    186|                default:
  ------------------
  |  Branch (1418:17): [True: 186, False: 3.55k]
  ------------------
 1419|    186|                    break;
 1420|  3.74k|            }
 1421|    186|            break;
 1422|    186|        case COMPRESSION_CCITTRLE:
  ------------------
  |  |  183|     32|#define COMPRESSION_CCITTRLE 2        /* CCITT modified Huffman RLE */
  ------------------
  |  Branch (1422:9): [True: 32, False: 7.48k]
  ------------------
 1423|     40|        case COMPRESSION_CCITTRLEW:
  ------------------
  |  |  194|     40|#define COMPRESSION_CCITTRLEW 32771   /* #1 w/ word alignment */
  ------------------
  |  Branch (1423:9): [True: 8, False: 7.50k]
  ------------------
 1424|    292|        case COMPRESSION_CCITTFAX3:
  ------------------
  |  |  184|    292|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1424:9): [True: 252, False: 7.26k]
  ------------------
 1425|    359|        case COMPRESSION_CCITTFAX4:
  ------------------
  |  |  186|    359|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1425:9): [True: 67, False: 7.44k]
  ------------------
 1426|    359|            switch (tag)
 1427|    359|            {
 1428|      8|                case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      8|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1428:17): [True: 8, False: 351]
  ------------------
 1429|     21|                case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|     21|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1429:17): [True: 13, False: 346]
  ------------------
 1430|     32|                case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|     32|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1430:17): [True: 11, False: 348]
  ------------------
 1431|     32|                    return 1;
 1432|    169|                case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|    169|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1432:17): [True: 169, False: 190]
  ------------------
 1433|    169|                    if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  184|    169|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1433:25): [True: 160, False: 9]
  ------------------
 1434|    160|                        return 1;
 1435|      9|                    break;
 1436|     28|                case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|     28|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1436:17): [True: 28, False: 331]
  ------------------
 1437|     28|                    if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
  ------------------
  |  |  186|     28|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1437:25): [True: 18, False: 10]
  ------------------
 1438|     18|                        return 1;
 1439|     10|                    break;
 1440|    130|                default:
  ------------------
  |  Branch (1440:17): [True: 130, False: 229]
  ------------------
 1441|    130|                    break;
 1442|    359|            }
 1443|    149|            break;
 1444|    149|        case COMPRESSION_JBIG:
  ------------------
  |  |  209|      1|#define COMPRESSION_JBIG 34661     /* ISO JBIG */
  ------------------
  |  Branch (1444:9): [True: 1, False: 7.51k]
  ------------------
 1445|       |            /* No codec-specific tags */
 1446|      1|            break;
 1447|     13|        case COMPRESSION_DEFLATE:
  ------------------
  |  |  205|     13|#define COMPRESSION_DEFLATE 32946   /* Deflate compression, legacy tag */
  ------------------
  |  Branch (1447:9): [True: 13, False: 7.50k]
  ------------------
 1448|    110|        case COMPRESSION_ADOBE_DEFLATE:
  ------------------
  |  |  206|    110|#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as recognized by Adobe */
  ------------------
  |  Branch (1448:9): [True: 97, False: 7.41k]
  ------------------
 1449|    110|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    110|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1449:17): [True: 70, False: 40]
  ------------------
 1450|     70|                return 1;
 1451|     40|            break;
 1452|    158|        case COMPRESSION_PIXARLOG:
  ------------------
  |  |  204|    158|#define COMPRESSION_PIXARLOG 32909  /* Pixar companded 11bit ZIP */
  ------------------
  |  Branch (1452:9): [True: 158, False: 7.35k]
  ------------------
 1453|    158|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    158|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1453:17): [True: 100, False: 58]
  ------------------
 1454|    100|                return 1;
 1455|     58|            break;
 1456|     58|        case COMPRESSION_SGILOG:
  ------------------
  |  |  210|     11|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (1456:9): [True: 11, False: 7.50k]
  ------------------
 1457|     38|        case COMPRESSION_SGILOG24:
  ------------------
  |  |  211|     38|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (1457:9): [True: 27, False: 7.48k]
  ------------------
 1458|       |            /* No codec-specific tags */
 1459|     38|            break;
 1460|     33|        case COMPRESSION_LZMA:
  ------------------
  |  |  215|     33|#define COMPRESSION_LZMA 34925             /* LZMA2 */
  ------------------
  |  Branch (1460:9): [True: 33, False: 7.48k]
  ------------------
 1461|     33|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|     33|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1461:17): [True: 7, False: 26]
  ------------------
 1462|      7|                return 1;
 1463|     26|            break;
 1464|     26|        case COMPRESSION_ZSTD:
  ------------------
  |  |  216|      0|#define COMPRESSION_ZSTD 50000             /* ZSTD: WARNING not registered in Adobe-maintained registry */
  ------------------
  |  Branch (1464:9): [True: 0, False: 7.51k]
  ------------------
 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.51k]
  ------------------
 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|    140|        default:
  ------------------
  |  Branch (1472:9): [True: 140, False: 7.37k]
  ------------------
 1473|    140|            break;
 1474|  7.51k|    }
 1475|  2.26k|    return 0;
 1476|  7.51k|}
tif_dirinfo.c:tagCompare:
  601|   274M|{
  602|   274M|    const TIFFField *ta = *(const TIFFField **)a;
  603|   274M|    const TIFFField *tb = *(const TIFFField **)b;
  604|       |    /* NB: be careful of return values for 16-bit platforms */
  605|   274M|    if (ta->field_tag != tb->field_tag)
  ------------------
  |  Branch (605:9): [True: 274M, False: 153k]
  ------------------
  606|   274M|        return (int)ta->field_tag - (int)tb->field_tag;
  607|   153k|    else
  608|   153k|        return (ta->field_type == TIFF_ANY)
  ------------------
  |  |  341|   153k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  |  Branch (608:16): [True: 153k, False: 0]
  ------------------
  609|   153k|                   ? 0
  610|   153k|                   : ((int)tb->field_type - (int)ta->field_type);
  611|   274M|}

TIFFReadDirectory:
 4336|  6.24k|{
 4337|  6.24k|    static const char module[] = "TIFFReadDirectory";
 4338|  6.24k|    TIFFDirEntry *dir;
 4339|  6.24k|    uint16_t dircount;
 4340|  6.24k|    TIFFDirEntry *dp;
 4341|  6.24k|    uint16_t di;
 4342|  6.24k|    const TIFFField *fip;
 4343|  6.24k|    uint32_t fii = FAILED_FII;
  ------------------
  |  |   44|  6.24k|#define FAILED_FII ((uint32_t)-1)
  ------------------
 4344|  6.24k|    toff_t nextdiroff;
 4345|  6.24k|    int bitspersample_read = FALSE;
  ------------------
  |  |   72|  6.24k|#define FALSE 0
  ------------------
 4346|  6.24k|    int color_channels;
 4347|       |
 4348|  6.24k|    if (tif->tif_nextdiroff == 0)
  ------------------
  |  Branch (4348:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    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|  6.24k|    if (!_TIFFCheckDirNumberAndOffset(tif,
  ------------------
  |  Branch (4361:9): [True: 0, False: 6.24k]
  ------------------
 4362|  6.24k|                                      tif->tif_curdir ==
  ------------------
  |  Branch (4362:39): [True: 6.24k, False: 0]
  ------------------
 4363|  6.24k|                                              TIFF_NON_EXISTENT_DIR_NUMBER
  ------------------
  |  |   65|  6.24k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
 4364|  6.24k|                                          ? 0
 4365|  6.24k|                                          : tif->tif_curdir + 1,
 4366|  6.24k|                                      nextdiroff))
 4367|      0|    {
 4368|      0|        return 0; /* bad offset (IFD looping or more than TIFF_MAX_DIR_COUNT
 4369|       |                     IFDs) */
 4370|      0|    }
 4371|  6.24k|    dircount = TIFFFetchDirectory(tif, nextdiroff, &dir, &tif->tif_nextdiroff);
 4372|  6.24k|    if (!dircount)
  ------------------
  |  Branch (4372:9): [True: 2, False: 6.24k]
  ------------------
 4373|      2|    {
 4374|      2|        TIFFErrorExtR(tif, module,
 4375|      2|                      "Failed to read directory at offset %" PRIu64,
 4376|      2|                      nextdiroff);
 4377|      2|        return 0;
 4378|      2|    }
 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|  6.24k|    if (tif->tif_curdir == TIFF_NON_EXISTENT_DIR_NUMBER)
  ------------------
  |  |   65|  6.24k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
  |  Branch (4382:9): [True: 6.24k, False: 0]
  ------------------
 4383|  6.24k|        tif->tif_curdir = 0;
 4384|      0|    else
 4385|      0|        tif->tif_curdir++;
 4386|       |
 4387|  6.24k|    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|  6.24k|    {
 4394|  6.24k|        TIFFDirEntry *ma;
 4395|  6.24k|        uint16_t mb;
 4396|   355k|        for (ma = dir, mb = 0; mb < dircount; ma++, mb++)
  ------------------
  |  Branch (4396:32): [True: 348k, False: 6.24k]
  ------------------
 4397|   348k|        {
 4398|   348k|            TIFFDirEntry *na;
 4399|   348k|            uint16_t nb;
 4400|   340M|            for (na = ma + 1, nb = (uint16_t)(mb + 1); nb < dircount;
  ------------------
  |  Branch (4400:56): [True: 339M, False: 348k]
  ------------------
 4401|   339M|                 na++, nb++)
 4402|   339M|            {
 4403|   339M|                if (ma->tdir_tag == na->tdir_tag)
  ------------------
  |  Branch (4403:21): [True: 33.3M, False: 306M]
  ------------------
 4404|  33.3M|                {
 4405|  33.3M|                    na->tdir_ignore = TRUE;
  ------------------
  |  |   71|  33.3M|#define TRUE 1
  ------------------
 4406|  33.3M|                }
 4407|   339M|            }
 4408|   348k|        }
 4409|  6.24k|    }
 4410|       |
 4411|  6.24k|    tif->tif_flags &= ~TIFF_BEENWRITING; /* reset before new dir */
  ------------------
  |  |  125|  6.24k|#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
 4412|  6.24k|    tif->tif_flags &= ~TIFF_BUF4WRITE;   /* reset before new dir */
  ------------------
  |  |  141|  6.24k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 4413|  6.24k|    tif->tif_flags &= ~TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  153|  6.24k|    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|  6.24k|    tif->tif_flags &= ~TIFF_LAZYSTRILELOAD_DONE;
  ------------------
  |  |  149|  6.24k|    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|  6.24k|    TIFFFreeDirectory(tif);
 4425|  6.24k|    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|  6.24k|    tif->tif_dir.td_iswrittentofile = TRUE;
  ------------------
  |  |   71|  6.24k|#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|  6.24k|    tif->tif_dir.td_dirdatasize_offsets =
 4435|  6.24k|        (TIFFEntryOffsetAndLength *)_TIFFmallocExt(
 4436|  6.24k|            tif,
 4437|  6.24k|            (tmsize_t)((size_t)dircount * sizeof(TIFFEntryOffsetAndLength)));
 4438|  6.24k|    if (tif->tif_dir.td_dirdatasize_offsets == NULL)
  ------------------
  |  Branch (4438:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  ------------------
  |  |  264|  6.24k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
                  TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  ------------------
  |  |  265|  6.24k|#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|  6.24k|    dp =
 4472|  6.24k|        TIFFReadDirectoryFindEntry(tif, dir, dircount, TIFFTAG_SAMPLESPERPIXEL);
  ------------------
  |  |  257|  6.24k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
 4473|  6.24k|    if (dp)
  ------------------
  |  Branch (4473:9): [True: 2.54k, False: 3.69k]
  ------------------
 4474|  2.54k|    {
 4475|  2.54k|        if (!TIFFFetchNormalTag(tif, dp, 0))
  ------------------
  |  Branch (4475:13): [True: 2, False: 2.54k]
  ------------------
 4476|      2|            goto bad;
 4477|  2.54k|        dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  2.54k|#define TRUE 1
  ------------------
 4478|  2.54k|    }
 4479|  6.24k|    dp = TIFFReadDirectoryFindEntry(tif, dir, dircount, TIFFTAG_COMPRESSION);
  ------------------
  |  |  181|  6.24k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
 4480|  6.24k|    if (dp)
  ------------------
  |  Branch (4480:9): [True: 5.74k, False: 493]
  ------------------
 4481|  5.74k|    {
 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.74k|        uint16_t value;
 4489|  5.74k|        enum TIFFReadDirEntryErr err;
 4490|  5.74k|        err = TIFFReadDirEntryShort(tif, dp, &value);
 4491|  5.74k|        if (err == TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (4491:13): [True: 315, False: 5.43k]
  ------------------
 4492|    315|            err = TIFFReadDirEntryPersampleShort(tif, dp, &value);
 4493|  5.74k|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4493:13): [True: 11, False: 5.73k]
  ------------------
 4494|     11|        {
 4495|     11|            TIFFReadDirEntryOutputErr(tif, err, module, "Compression", 0);
 4496|     11|            goto bad;
 4497|     11|        }
 4498|  5.73k|        if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, value))
  ------------------
  |  |  181|  5.73k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (4498:13): [True: 0, False: 5.73k]
  ------------------
 4499|      0|            goto bad;
 4500|  5.73k|        dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  5.73k|#define TRUE 1
  ------------------
 4501|  5.73k|    }
 4502|    493|    else
 4503|    493|    {
 4504|    493|        if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE))
  ------------------
  |  |  181|    493|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
                      if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE))
  ------------------
  |  |  182|    493|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (4504:13): [True: 0, False: 493]
  ------------------
 4505|      0|            goto bad;
 4506|    493|    }
 4507|       |    /*
 4508|       |     * First real pass over the directory.
 4509|       |     */
 4510|   346k|    for (di = 0, dp = dir; di < dircount; di++, dp++)
  ------------------
  |  Branch (4510:28): [True: 339k, False: 6.22k]
  ------------------
 4511|   339k|    {
 4512|   339k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4512:13): [True: 169k, False: 170k]
  ------------------
 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: 115k, False: 54.3k]
  ------------------
 4516|   115k|            {
 4517|   115k|                if (tif->tif_warn_about_unknown_tags)
  ------------------
  |  Branch (4517:21): [True: 0, False: 115k]
  ------------------
 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|   115k|                const TIFFField *fld = _TIFFCreateAnonField(
 4527|   115k|                    tif, dp->tdir_tag, (TIFFDataType)dp->tdir_type);
 4528|   115k|                if (fld == NULL || !_TIFFMergeFields(tif, fld, 1))
  ------------------
  |  Branch (4528:21): [True: 0, False: 115k]
  |  Branch (4528:36): [True: 0, False: 115k]
  ------------------
 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|   115k|                else
 4538|   115k|                {
 4539|   115k|                    TIFFReadDirectoryFindFieldInfo(tif, dp->tdir_tag, &fii);
 4540|   115k|                    assert(fii != FAILED_FII);
  ------------------
  |  Branch (4540:21): [True: 0, False: 115k]
  |  Branch (4540:21): [True: 115k, False: 0]
  ------------------
 4541|   115k|                }
 4542|   115k|            }
 4543|   169k|        }
 4544|   339k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4544:13): [True: 169k, False: 170k]
  ------------------
 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: 473, False: 169k]
  ------------------
 4548|    473|                dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|    473|#define TRUE 1
  ------------------
 4549|   169k|            else
 4550|   169k|            {
 4551|   169k|                switch (dp->tdir_tag)
 4552|   169k|                {
 4553|  3.48k|                    case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|  3.48k|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (4553:21): [True: 3.48k, False: 165k]
  ------------------
 4554|  7.28k|                    case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|  7.28k|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (4554:21): [True: 3.79k, False: 165k]
  ------------------
 4555|  9.90k|                    case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|  9.90k|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (4555:21): [True: 2.62k, False: 166k]
  ------------------
 4556|  11.4k|                    case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|  11.4k|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (4556:21): [True: 1.58k, False: 167k]
  ------------------
 4557|  11.4k|                        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|  11.4k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|  11.4k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|  11.4k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 4558|  11.4k|                        break;
 4559|  6.14k|                    case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  6.14k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (4559:21): [True: 6.14k, False: 162k]
  ------------------
 4560|  11.1k|                    case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  11.1k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (4560:21): [True: 4.97k, False: 164k]
  ------------------
 4561|  11.1k|                    case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|  11.1k|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (4561:21): [True: 8, False: 168k]
  ------------------
 4562|  12.7k|                    case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  12.7k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (4562:21): [True: 1.61k, False: 167k]
  ------------------
 4563|  15.3k|                    case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  15.3k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (4563:21): [True: 2.61k, False: 166k]
  ------------------
 4564|  15.3k|                    case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|  15.3k|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (4564:21): [True: 9, False: 168k]
  ------------------
 4565|  17.0k|                    case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  17.0k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (4565:21): [True: 1.70k, False: 167k]
  ------------------
 4566|  20.5k|                    case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  20.5k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (4566:21): [True: 3.46k, False: 165k]
  ------------------
 4567|  20.7k|                    case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|  20.7k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (4567:21): [True: 200, False: 168k]
  ------------------
 4568|  20.7k|                        if (!TIFFFetchNormalTag(tif, dp, 0))
  ------------------
  |  Branch (4568:29): [True: 11, False: 20.7k]
  ------------------
 4569|     11|                            goto bad;
 4570|  20.7k|                        dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  20.7k|#define TRUE 1
  ------------------
 4571|  20.7k|                        break;
 4572|   136k|                    default:
  ------------------
  |  Branch (4572:21): [True: 136k, False: 32.2k]
  ------------------
 4573|   136k|                        if (!_TIFFCheckFieldIsValidForCodec(tif, dp->tdir_tag))
  ------------------
  |  Branch (4573:29): [True: 2.35k, False: 134k]
  ------------------
 4574|  2.35k|                            dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  2.35k|#define TRUE 1
  ------------------
 4575|   136k|                        break;
 4576|   169k|                }
 4577|   169k|            }
 4578|   169k|        }
 4579|   339k|    }
 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|  6.22k|    if ((tif->tif_dir.td_compression == COMPRESSION_OJPEG) &&
  ------------------
  |  |  189|  6.22k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (4588:9): [True: 1.10k, False: 5.11k]
  ------------------
 4589|  1.10k|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE))
  ------------------
  |  |  266|  1.10k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (4589:9): [True: 721, False: 387]
  ------------------
 4590|    721|    {
 4591|    721|        if (!_TIFFFillStriles(tif))
  ------------------
  |  Branch (4591:13): [True: 0, False: 721]
  ------------------
 4592|      0|            goto bad;
 4593|    721|        dp = TIFFReadDirectoryFindEntry(tif, dir, dircount,
 4594|    721|                                        TIFFTAG_STRIPOFFSETS);
  ------------------
  |  |  247|    721|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
 4595|    721|        if ((dp != 0) && (dp->tdir_count == 1))
  ------------------
  |  Branch (4595:13): [True: 718, False: 3]
  |  Branch (4595:26): [True: 28, False: 690]
  ------------------
 4596|     28|        {
 4597|     28|            dp = TIFFReadDirectoryFindEntry(tif, dir, dircount,
 4598|     28|                                            TIFFTAG_STRIPBYTECOUNTS);
  ------------------
  |  |  259|     28|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
 4599|     28|            if ((dp != 0) && (dp->tdir_count == 1))
  ------------------
  |  Branch (4599:17): [True: 8, False: 20]
  |  Branch (4599:30): [True: 0, False: 8]
  ------------------
 4600|      0|            {
 4601|      0|                tif->tif_dir.td_planarconfig = PLANARCONFIG_CONTIG;
  ------------------
  |  |  265|      0|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 4602|      0|                TIFFWarningExtR(tif, module,
 4603|      0|                                "Planarconfig tag value assumed incorrect, "
 4604|      0|                                "assuming data is contig instead of chunky");
 4605|      0|            }
 4606|     28|        }
 4607|    721|    }
 4608|       |    /*
 4609|       |     * Allocate directory structure and setup defaults.
 4610|       |     */
 4611|  6.22k|    if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS))
  ------------------
  |  |  248|  6.22k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  6.22k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  6.22k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4611:9): [True: 13, False: 6.20k]
  ------------------
 4612|     13|    {
 4613|     13|        MissingRequired(tif, "ImageLength");
 4614|     13|        goto bad;
 4615|     13|    }
 4616|       |
 4617|       |    /*
 4618|       |     * Second pass: extract other information.
 4619|       |     */
 4620|   332k|    for (di = 0, dp = dir; di < dircount; di++, dp++)
  ------------------
  |  Branch (4620:28): [True: 326k, False: 6.18k]
  ------------------
 4621|   326k|    {
 4622|   326k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4622:13): [True: 138k, False: 188k]
  ------------------
 4623|   138k|        {
 4624|   138k|            switch (dp->tdir_tag)
 4625|   138k|            {
 4626|     13|                case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|     13|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (4626:17): [True: 13, False: 138k]
  ------------------
 4627|     22|                case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|     22|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (4627:17): [True: 9, False: 138k]
  ------------------
 4628|  3.34k|                case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  3.34k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4628:17): [True: 3.32k, False: 134k]
  ------------------
 4629|  3.36k|                case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|  3.36k|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (4629:17): [True: 26, False: 138k]
  ------------------
 4630|  3.96k|                case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|  3.96k|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (4630:17): [True: 595, False: 137k]
  ------------------
 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.96k|                    {
 4642|  3.96k|                        uint16_t value;
 4643|  3.96k|                        enum TIFFReadDirEntryErr err;
 4644|  3.96k|                        err = TIFFReadDirEntryShort(tif, dp, &value);
 4645|  3.96k|                        if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4645:29): [True: 0, False: 3.96k]
  ------------------
 4646|      0|                            goto bad;
 4647|  3.96k|                        if (err == TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (4647:29): [True: 1.76k, False: 2.20k]
  ------------------
 4648|  1.76k|                            err =
 4649|  1.76k|                                TIFFReadDirEntryPersampleShort(tif, dp, &value);
 4650|  3.96k|                        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4650:29): [True: 26, False: 3.93k]
  ------------------
 4651|     26|                        {
 4652|     26|                            fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4653|     26|                            TIFFReadDirEntryOutputErr(
 4654|     26|                                tif, err, module,
 4655|     26|                                fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (4655:33): [True: 26, False: 0]
  ------------------
 4656|     26|                            goto bad;
 4657|     26|                        }
 4658|  3.93k|                        if (!TIFFSetField(tif, dp->tdir_tag, value))
  ------------------
  |  Branch (4658:29): [True: 0, False: 3.93k]
  ------------------
 4659|      0|                            goto bad;
 4660|  3.93k|                        if (dp->tdir_tag == TIFFTAG_BITSPERSAMPLE)
  ------------------
  |  |  180|  3.93k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4660:29): [True: 3.31k, False: 626]
  ------------------
 4661|  3.31k|                            bitspersample_read = TRUE;
  ------------------
  |  |   71|  3.31k|#define TRUE 1
  ------------------
 4662|  3.93k|                    }
 4663|      0|                    break;
 4664|    201|                case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|    201|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (4664:17): [True: 201, False: 137k]
  ------------------
 4665|    212|                case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|    212|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (4665:17): [True: 11, False: 138k]
  ------------------
 4666|    212|                {
 4667|       |
 4668|    212|                    double *data = NULL;
 4669|    212|                    enum TIFFReadDirEntryErr err;
 4670|    212|                    uint32_t saved_flags;
 4671|    212|                    int m;
 4672|    212|                    if (dp->tdir_count !=
  ------------------
  |  Branch (4672:25): [True: 1, False: 211]
  ------------------
 4673|    212|                        (uint64_t)tif->tif_dir.td_samplesperpixel)
 4674|      1|                        err = TIFFReadDirEntryErrCount;
 4675|    211|                    else
 4676|    211|                        err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 4677|    212|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4677:25): [True: 0, False: 212]
  ------------------
 4678|      0|                        goto bad;
 4679|    212|                    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4679:25): [True: 1, False: 211]
  ------------------
 4680|      1|                    {
 4681|      1|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4682|      1|                        TIFFReadDirEntryOutputErr(
 4683|      1|                            tif, err, module,
 4684|      1|                            fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (4684:29): [True: 1, False: 0]
  ------------------
 4685|      1|                        goto bad;
 4686|      1|                    }
 4687|    211|                    saved_flags = tif->tif_flags;
 4688|    211|                    tif->tif_flags |= TIFF_PERSAMPLE;
  ------------------
  |  |  143|    211|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
 4689|    211|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 4690|    211|                    tif->tif_flags = saved_flags;
 4691|    211|                    _TIFFfreeExt(tif, data);
 4692|    211|                    if (!m)
  ------------------
  |  Branch (4692:25): [True: 0, False: 211]
  ------------------
 4693|      0|                        goto bad;
 4694|    211|                }
 4695|    211|                break;
 4696|  3.47k|                case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|  3.47k|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (4696:17): [True: 3.47k, False: 134k]
  ------------------
 4697|  6.09k|                case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|  6.09k|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (4697:17): [True: 2.61k, False: 135k]
  ------------------
 4698|  6.09k|                {
 4699|  6.09k|                    switch (dp->tdir_type)
 4700|  6.09k|                    {
 4701|     33|                        case TIFF_SHORT:
  ------------------
  |  Branch (4701:25): [True: 33, False: 6.06k]
  ------------------
 4702|  3.90k|                        case TIFF_LONG:
  ------------------
  |  Branch (4702:25): [True: 3.87k, False: 2.22k]
  ------------------
 4703|  4.07k|                        case TIFF_LONG8:
  ------------------
  |  Branch (4703:25): [True: 165, False: 5.93k]
  ------------------
 4704|  4.07k|                            break;
 4705|  2.02k|                        default:
  ------------------
  |  Branch (4705:25): [True: 2.02k, False: 4.07k]
  ------------------
 4706|       |                            /* Warn except if directory typically created with
 4707|       |                             * TIFFDeferStrileArrayWriting() */
 4708|  2.02k|                            if (!(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4708:35): [True: 0, False: 2.02k]
  ------------------
 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|  2.02k|                            {
 4712|  2.02k|                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4713|  2.02k|                                TIFFWarningExtR(
 4714|  2.02k|                                    tif, module, "Invalid data type for tag %s",
 4715|  2.02k|                                    fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4715:37): [True: 2.02k, False: 0]
  ------------------
 4716|  2.02k|                            }
 4717|  2.02k|                            break;
 4718|  6.09k|                    }
 4719|  6.09k|                    _TIFFmemcpy(&(tif->tif_dir.td_stripoffset_entry), dp,
 4720|  6.09k|                                sizeof(TIFFDirEntry));
 4721|  6.09k|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4721:25): [True: 0, False: 6.09k]
  ------------------
 4722|      0|                        goto bad;
 4723|  6.09k|                }
 4724|  6.09k|                break;
 4725|  6.09k|                case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|  3.78k|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (4725:17): [True: 3.78k, False: 134k]
  ------------------
 4726|  5.37k|                case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|  5.37k|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (4726:17): [True: 1.58k, False: 136k]
  ------------------
 4727|  5.37k|                {
 4728|  5.37k|                    switch (dp->tdir_type)
 4729|  5.37k|                    {
 4730|  1.37k|                        case TIFF_SHORT:
  ------------------
  |  Branch (4730:25): [True: 1.37k, False: 4.00k]
  ------------------
 4731|  2.42k|                        case TIFF_LONG:
  ------------------
  |  Branch (4731:25): [True: 1.04k, False: 4.33k]
  ------------------
 4732|  3.56k|                        case TIFF_LONG8:
  ------------------
  |  Branch (4732:25): [True: 1.14k, False: 4.22k]
  ------------------
 4733|  3.56k|                            break;
 4734|  1.80k|                        default:
  ------------------
  |  Branch (4734:25): [True: 1.80k, False: 3.56k]
  ------------------
 4735|       |                            /* Warn except if directory typically created with
 4736|       |                             * TIFFDeferStrileArrayWriting() */
 4737|  1.80k|                            if (!(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4737:35): [True: 0, False: 1.80k]
  ------------------
 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.80k|                            {
 4741|  1.80k|                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4742|  1.80k|                                TIFFWarningExtR(
 4743|  1.80k|                                    tif, module, "Invalid data type for tag %s",
 4744|  1.80k|                                    fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4744:37): [True: 1.80k, False: 0]
  ------------------
 4745|  1.80k|                            }
 4746|  1.80k|                            break;
 4747|  5.37k|                    }
 4748|  5.37k|                    _TIFFmemcpy(&(tif->tif_dir.td_stripbytecount_entry), dp,
 4749|  5.37k|                                sizeof(TIFFDirEntry));
 4750|  5.37k|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4750:25): [True: 0, False: 5.37k]
  ------------------
 4751|      0|                        goto bad;
 4752|  5.37k|                }
 4753|  5.37k|                break;
 4754|  5.37k|                case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|    304|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (4754:17): [True: 304, False: 137k]
  ------------------
 4755|    408|                case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|    408|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (4755:17): [True: 104, False: 138k]
  ------------------
 4756|    408|                {
 4757|    408|                    enum TIFFReadDirEntryErr err;
 4758|    408|                    uint32_t countpersample;
 4759|    408|                    uint32_t countrequired;
 4760|    408|                    uint32_t incrementpersample;
 4761|    408|                    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|    408|                    if (!bitspersample_read)
  ------------------
  |  Branch (4769:25): [True: 99, False: 309]
  ------------------
 4770|     99|                    {
 4771|     99|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4772|     99|                        TIFFWarningExtR(
 4773|     99|                            tif, module,
 4774|     99|                            "Ignoring %s since BitsPerSample tag not found",
 4775|     99|                            fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4775:29): [True: 99, False: 0]
  ------------------
 4776|     99|                        continue;
 4777|     99|                    }
 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|    309|                    if (tif->tif_dir.td_bitspersample > 24)
  ------------------
  |  Branch (4781:25): [True: 25, False: 284]
  ------------------
 4782|     25|                    {
 4783|     25|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4784|     25|                        TIFFWarningExtR(
 4785|     25|                            tif, module,
 4786|     25|                            "Ignoring %s because BitsPerSample=%" PRIu16 ">24",
 4787|     25|                            fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (4787:29): [True: 25, False: 0]
  ------------------
 4788|     25|                            tif->tif_dir.td_bitspersample);
 4789|     25|                        continue;
 4790|     25|                    }
 4791|    284|                    countpersample = (1U << tif->tif_dir.td_bitspersample);
 4792|    284|                    if ((dp->tdir_tag == TIFFTAG_TRANSFERFUNCTION) &&
  ------------------
  |  |  298|    284|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (4792:25): [True: 41, False: 243]
  ------------------
 4793|     41|                        (dp->tdir_count == (uint64_t)countpersample))
  ------------------
  |  Branch (4793:25): [True: 0, False: 41]
  ------------------
 4794|      0|                    {
 4795|      0|                        countrequired = countpersample;
 4796|      0|                        incrementpersample = 0;
 4797|      0|                    }
 4798|    284|                    else
 4799|    284|                    {
 4800|    284|                        countrequired = 3 * countpersample;
 4801|    284|                        incrementpersample = countpersample;
 4802|    284|                    }
 4803|    284|                    if (dp->tdir_count != (uint64_t)countrequired)
  ------------------
  |  Branch (4803:25): [True: 238, False: 46]
  ------------------
 4804|    238|                        err = TIFFReadDirEntryErrCount;
 4805|     46|                    else
 4806|     46|                        err = TIFFReadDirEntryShortArray(tif, dp, &value);
 4807|    284|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4807:25): [True: 0, False: 284]
  ------------------
 4808|      0|                        goto bad;
 4809|    284|                    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4809:25): [True: 245, False: 39]
  ------------------
 4810|    245|                    {
 4811|    245|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4812|    245|                        TIFFReadDirEntryOutputErr(
 4813|    245|                            tif, err, module,
 4814|    245|                            fip ? fip->field_name : "unknown tagname", 1);
  ------------------
  |  Branch (4814:29): [True: 245, False: 0]
  ------------------
 4815|    245|                    }
 4816|     39|                    else
 4817|     39|                    {
 4818|     39|                        TIFFSetField(tif, dp->tdir_tag, value,
 4819|     39|                                     value + incrementpersample,
 4820|     39|                                     value + 2 * incrementpersample);
 4821|     39|                        _TIFFfreeExt(tif, value);
 4822|     39|                    }
 4823|    284|                }
 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|   122k|                default:
  ------------------
  |  Branch (4896:17): [True: 122k, False: 16.0k]
  ------------------
 4897|   122k|                    (void)TIFFFetchNormalTag(tif, dp, TRUE);
  ------------------
  |  |   71|   122k|#define TRUE 1
  ------------------
 4898|   122k|                    break;
 4899|   138k|            } /* -- switch (dp->tdir_tag) -- */
 4900|   138k|        } /* -- if (!dp->tdir_ignore) */
 4901|   326k|    } /* -- for-loop -- */
 4902|       |
 4903|       |    /* Evaluate final IFD data size. */
 4904|  6.18k|    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|  6.18k|    if (tif->tif_dir.td_compression == COMPRESSION_OJPEG)
  ------------------
  |  |  189|  6.18k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (4922:9): [True: 1.10k, False: 5.07k]
  ------------------
 4923|  1.10k|    {
 4924|  1.10k|        if (!TIFFFieldSet(tif, FIELD_PHOTOMETRIC))
  ------------------
  |  |  248|  1.10k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.10k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.10k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4924:13): [True: 1.02k, False: 79]
  ------------------
 4925|  1.02k|        {
 4926|  1.02k|            TIFFWarningExtR(
 4927|  1.02k|                tif, module,
 4928|  1.02k|                "Photometric tag is missing, assuming data is YCbCr");
 4929|  1.02k|            if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR))
  ------------------
  |  |  220|  1.02k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
                          if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR))
  ------------------
  |  |  227|  1.02k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4929:17): [True: 0, False: 1.02k]
  ------------------
 4930|      0|                goto bad;
 4931|  1.02k|        }
 4932|     79|        else if (tif->tif_dir.td_photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|     79|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4932:18): [True: 24, False: 55]
  ------------------
 4933|     24|        {
 4934|     24|            tif->tif_dir.td_photometric = PHOTOMETRIC_YCBCR;
  ------------------
  |  |  227|     24|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
 4935|     24|            TIFFWarningExtR(tif, module,
 4936|     24|                            "Photometric tag value assumed incorrect, "
 4937|     24|                            "assuming data is YCbCr instead of RGB");
 4938|     24|        }
 4939|  1.10k|        if (!TIFFFieldSet(tif, FIELD_BITSPERSAMPLE))
  ------------------
  |  |  248|  1.10k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.10k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.10k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4939:13): [True: 1.02k, False: 79]
  ------------------
 4940|  1.02k|        {
 4941|  1.02k|            TIFFWarningExtR(
 4942|  1.02k|                tif, module,
 4943|  1.02k|                "BitsPerSample tag is missing, assuming 8 bits per sample");
 4944|  1.02k|            if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8))
  ------------------
  |  |  180|  1.02k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4944:17): [True: 0, False: 1.02k]
  ------------------
 4945|      0|                goto bad;
 4946|  1.02k|        }
 4947|  1.10k|        if (!TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  248|  1.10k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.10k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.10k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4947:13): [True: 990, False: 111]
  ------------------
 4948|    990|        {
 4949|    990|            if (tif->tif_dir.td_photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|    990|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4949:17): [True: 0, False: 990]
  ------------------
 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|    990|            if (tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR)
  ------------------
  |  |  227|    990|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4957:17): [True: 976, False: 14]
  ------------------
 4958|    976|            {
 4959|    976|                TIFFWarningExtR(tif, module,
 4960|    976|                                "SamplesPerPixel tag is missing, "
 4961|    976|                                "applying correct SamplesPerPixel value of 3");
 4962|    976|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3))
  ------------------
  |  |  257|    976|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4962:21): [True: 0, False: 976]
  ------------------
 4963|      0|                    goto bad;
 4964|    976|            }
 4965|     14|            else if ((tif->tif_dir.td_photometric == PHOTOMETRIC_MINISWHITE) ||
  ------------------
  |  |  221|     14|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (4965:22): [True: 3, False: 11]
  ------------------
 4966|     11|                     (tif->tif_dir.td_photometric == PHOTOMETRIC_MINISBLACK))
  ------------------
  |  |  222|     11|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (4966:22): [True: 0, False: 11]
  ------------------
 4967|      3|            {
 4968|       |                /*
 4969|       |                 * SamplesPerPixel tag is missing, but is not required
 4970|       |                 * by spec.  Assume correct SamplesPerPixel value of 1.
 4971|       |                 */
 4972|      3|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1))
  ------------------
  |  |  257|      3|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4972:21): [True: 0, False: 3]
  ------------------
 4973|      0|                    goto bad;
 4974|      3|            }
 4975|    990|        }
 4976|  1.10k|    }
 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|  6.18k|    if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS))
  ------------------
  |  |  248|  6.18k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  6.18k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  6.18k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4983:9): [True: 3.45k, False: 2.72k]
  ------------------
 4984|  3.45k|    {
 4985|  3.45k|        tif->tif_dir.td_nstrips = TIFFNumberOfStrips(tif);
 4986|  3.45k|        tif->tif_dir.td_tilewidth = tif->tif_dir.td_imagewidth;
 4987|  3.45k|        tif->tif_dir.td_tilelength = tif->tif_dir.td_rowsperstrip;
 4988|  3.45k|        tif->tif_dir.td_tiledepth = tif->tif_dir.td_imagedepth;
 4989|  3.45k|        tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  129|  3.45k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 4990|  3.45k|    }
 4991|  2.72k|    else
 4992|  2.72k|    {
 4993|  2.72k|        tif->tif_dir.td_nstrips = TIFFNumberOfTiles(tif);
 4994|  2.72k|        tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  129|  2.72k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 4995|  2.72k|    }
 4996|  6.18k|    if (!tif->tif_dir.td_nstrips)
  ------------------
  |  Branch (4996:9): [True: 48, False: 6.13k]
  ------------------
 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: 37, False: 11]
  |  |  ------------------
  ------------------
 5000|     48|        goto bad;
 5001|     48|    }
 5002|  6.13k|    tif->tif_dir.td_stripsperimage = tif->tif_dir.td_nstrips;
 5003|  6.13k|    if (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  6.13k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5003:9): [True: 1.24k, False: 4.88k]
  ------------------
 5004|  1.24k|        tif->tif_dir.td_stripsperimage /= tif->tif_dir.td_samplesperpixel;
 5005|  6.13k|    if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS))
  ------------------
  |  |  248|  6.13k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  6.13k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  6.13k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5005:9): [True: 197, False: 5.93k]
  ------------------
 5006|    197|    {
 5007|    197|#ifdef OJPEG_SUPPORT
 5008|    197|        if ((tif->tif_dir.td_compression == COMPRESSION_OJPEG) &&
  ------------------
  |  |  189|    197|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (5008:13): [True: 31, False: 166]
  ------------------
 5009|     31|            (isTiled(tif) == 0) && (tif->tif_dir.td_nstrips == 1))
  ------------------
  |  |  278|     31|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     31|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (5009:13): [True: 31, False: 0]
  |  Branch (5009:36): [True: 30, False: 1]
  ------------------
 5010|     30|        {
 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|     30|            TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
  ------------------
  |  |  249|     30|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|     30|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|     30|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 5020|     30|        }
 5021|    167|        else
 5022|    167|#endif
 5023|    167|        {
 5024|    167|            MissingRequired(tif, isTiled(tif) ? "TileOffsets" : "StripOffsets");
  ------------------
  |  |  278|    167|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    167|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 0, False: 167]
  |  |  ------------------
  ------------------
 5025|    167|            goto bad;
 5026|    167|        }
 5027|    197|    }
 5028|       |
 5029|  5.96k|    if (tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (5029:9): [True: 0, False: 5.96k]
  ------------------
 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.96k|    else if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD))
  ------------------
  |  |  147|  5.96k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (5042:14): [True: 5.96k, False: 0]
  ------------------
 5043|  5.96k|    {
 5044|  5.96k|        if (tif->tif_dir.td_stripoffset_entry.tdir_tag != 0)
  ------------------
  |  Branch (5044:13): [True: 5.93k, False: 30]
  ------------------
 5045|  5.93k|        {
 5046|  5.93k|            if (!TIFFFetchStripThing(tif, &(tif->tif_dir.td_stripoffset_entry),
  ------------------
  |  Branch (5046:17): [True: 120, False: 5.81k]
  ------------------
 5047|  5.93k|                                     tif->tif_dir.td_nstrips,
 5048|  5.93k|                                     &tif->tif_dir.td_stripoffset_p))
 5049|    120|            {
 5050|    120|                goto bad;
 5051|    120|            }
 5052|  5.93k|        }
 5053|  5.84k|        if (tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0)
  ------------------
  |  Branch (5053:13): [True: 5.16k, False: 678]
  ------------------
 5054|  5.16k|        {
 5055|  5.16k|            if (!TIFFFetchStripThing(
  ------------------
  |  Branch (5055:17): [True: 20, False: 5.14k]
  ------------------
 5056|  5.16k|                    tif, &(tif->tif_dir.td_stripbytecount_entry),
 5057|  5.16k|                    tif->tif_dir.td_nstrips, &tif->tif_dir.td_stripbytecount_p))
 5058|     20|            {
 5059|     20|                goto bad;
 5060|     20|            }
 5061|  5.16k|        }
 5062|  5.84k|    }
 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.82k|    color_channels = _TIFFGetMaxColorChannels(tif->tif_dir.td_photometric);
 5069|  5.82k|    if (color_channels &&
  ------------------
  |  Branch (5069:9): [True: 5.72k, False: 103]
  ------------------
 5070|  5.72k|        tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples >
  ------------------
  |  Branch (5070:9): [True: 571, False: 5.15k]
  ------------------
 5071|  5.72k|            color_channels)
 5072|    571|    {
 5073|    571|        uint16_t old_extrasamples;
 5074|    571|        uint16_t *new_sampleinfo;
 5075|       |
 5076|    571|        TIFFWarningExtR(
 5077|    571|            tif, module,
 5078|    571|            "Sum of Photometric type-related "
 5079|    571|            "color channels and ExtraSamples doesn't match SamplesPerPixel. "
 5080|    571|            "Defining non-color channels as ExtraSamples.");
 5081|       |
 5082|    571|        old_extrasamples = tif->tif_dir.td_extrasamples;
 5083|    571|        tif->tif_dir.td_extrasamples =
 5084|    571|            (uint16_t)(tif->tif_dir.td_samplesperpixel - color_channels);
 5085|       |
 5086|       |        // sampleinfo should contain information relative to these new extra
 5087|       |        // samples
 5088|    571|        new_sampleinfo = (uint16_t *)_TIFFcallocExt(
 5089|    571|            tif, tif->tif_dir.td_extrasamples, sizeof(uint16_t));
 5090|    571|        if (!new_sampleinfo)
  ------------------
  |  Branch (5090:13): [True: 0, False: 571]
  ------------------
 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|    571|        if (old_extrasamples > 0)
  ------------------
  |  Branch (5100:13): [True: 80, False: 491]
  ------------------
 5101|     80|            memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo,
 5102|     80|                   old_extrasamples * sizeof(uint16_t));
 5103|    571|        _TIFFsetShortArrayExt(tif, &tif->tif_dir.td_sampleinfo, new_sampleinfo,
 5104|    571|                              tif->tif_dir.td_extrasamples);
 5105|    571|        _TIFFfreeExt(tif, new_sampleinfo);
 5106|    571|    }
 5107|       |
 5108|       |    /*
 5109|       |     * Verify Palette image has a Colormap.
 5110|       |     */
 5111|  5.82k|    if (tif->tif_dir.td_photometric == PHOTOMETRIC_PALETTE &&
  ------------------
  |  |  224|  11.6k|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (5111:9): [True: 149, False: 5.67k]
  ------------------
 5112|    149|        !TIFFFieldSet(tif, FIELD_COLORMAP))
  ------------------
  |  |  248|    149|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|    149|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|    149|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5112:9): [True: 120, False: 29]
  ------------------
 5113|    120|    {
 5114|    120|        if (tif->tif_dir.td_bitspersample >= 8 &&
  ------------------
  |  Branch (5114:13): [True: 110, False: 10]
  ------------------
 5115|    110|            tif->tif_dir.td_samplesperpixel == 3)
  ------------------
  |  Branch (5115:13): [True: 25, False: 85]
  ------------------
 5116|     25|            tif->tif_dir.td_photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|     25|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
 5117|     95|        else if (tif->tif_dir.td_bitspersample >= 8)
  ------------------
  |  Branch (5117:18): [True: 85, False: 10]
  ------------------
 5118|     85|            tif->tif_dir.td_photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|     85|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
 5119|     10|        else
 5120|     10|        {
 5121|     10|            MissingRequired(tif, "Colormap");
 5122|     10|            goto bad;
 5123|     10|        }
 5124|    120|    }
 5125|       |    /*
 5126|       |     * OJPEG hack:
 5127|       |     * We do no further messing with strip/tile offsets/bytecounts in OJPEG
 5128|       |     * TIFFs
 5129|       |     */
 5130|  5.81k|    if (tif->tif_dir.td_compression != COMPRESSION_OJPEG)
  ------------------
  |  |  189|  5.81k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (5130:9): [True: 4.75k, False: 1.06k]
  ------------------
 5131|  4.75k|    {
 5132|       |        /*
 5133|       |         * Attempt to deal with a missing StripByteCounts tag.
 5134|       |         */
 5135|  4.75k|        if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS))
  ------------------
  |  |  248|  4.75k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  4.75k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  4.75k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5135:13): [True: 309, False: 4.44k]
  ------------------
 5136|    309|        {
 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|    309|            if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|    618|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5142:18): [True: 305, False: 4]
  ------------------
 5143|    305|                 tif->tif_dir.td_nstrips > 1) ||
  ------------------
  |  Branch (5143:18): [True: 4, False: 301]
  ------------------
 5144|    305|                (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  266|    610|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5144:18): [True: 4, False: 301]
  ------------------
 5145|      4|                 tif->tif_dir.td_nstrips !=
  ------------------
  |  Branch (5145:18): [True: 0, False: 4]
  ------------------
 5146|      4|                     (uint32_t)tif->tif_dir.td_samplesperpixel))
 5147|      4|            {
 5148|      4|                MissingRequired(tif, "StripByteCounts");
 5149|      4|                goto bad;
 5150|      4|            }
 5151|    305|            TIFFWarningExtR(
 5152|    305|                tif, module,
 5153|    305|                "TIFF directory is missing required "
 5154|    305|                "\"StripByteCounts\" field, calculating from imagelength");
 5155|    305|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5155:17): [True: 10, False: 295]
  ------------------
 5156|     10|                goto bad;
 5157|    305|        }
 5158|  4.44k|        else if (tif->tif_dir.td_nstrips == 1 &&
  ------------------
  |  Branch (5158:18): [True: 2.20k, False: 2.23k]
  ------------------
 5159|  2.20k|                 !(tif->tif_flags & TIFF_ISTILED) && ByteCountLooksBad(tif))
  ------------------
  |  |  129|  2.20k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  |  Branch (5159:18): [True: 2.18k, False: 18]
  |  Branch (5159:54): [True: 118, False: 2.06k]
  ------------------
 5160|    118|        {
 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|    118|            TIFFWarningExtR(tif, module,
 5168|    118|                            "Bogus \"StripByteCounts\" field, ignoring and "
 5169|    118|                            "calculating from imagelength");
 5170|    118|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5170:17): [True: 1, False: 117]
  ------------------
 5171|      1|                goto bad;
 5172|    118|        }
 5173|  4.32k|        else if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) &&
  ------------------
  |  |  147|  4.32k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (5173:18): [True: 4.32k, False: 0]
  ------------------
 5174|  4.32k|                 tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  8.64k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5174:18): [True: 3.80k, False: 522]
  ------------------
 5175|  3.80k|                 tif->tif_dir.td_nstrips > 2 &&
  ------------------
  |  Branch (5175:18): [True: 1.81k, False: 1.98k]
  ------------------
 5176|  1.81k|                 tif->tif_dir.td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  182|  6.14k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5176:18): [True: 101, False: 1.71k]
  ------------------
 5177|    101|                 TIFFGetStrileByteCount(tif, 0) !=
  ------------------
  |  Branch (5177:18): [True: 98, False: 3]
  ------------------
 5178|    101|                     TIFFGetStrileByteCount(tif, 1) &&
 5179|     98|                 TIFFGetStrileByteCount(tif, 0) != 0 &&
  ------------------
  |  Branch (5179:18): [True: 97, False: 1]
  ------------------
 5180|     97|                 TIFFGetStrileByteCount(tif, 1) != 0)
  ------------------
  |  Branch (5180:18): [True: 3, False: 94]
  ------------------
 5181|      3|        {
 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|      3|            TIFFWarningExtR(tif, module,
 5193|      3|                            "Wrong \"StripByteCounts\" field, ignoring and "
 5194|      3|                            "calculating from imagelength");
 5195|      3|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5195:17): [True: 0, False: 3]
  ------------------
 5196|      0|                goto bad;
 5197|      3|        }
 5198|  4.75k|    }
 5199|  5.80k|    if (dir)
  ------------------
  |  Branch (5199:9): [True: 5.80k, False: 0]
  ------------------
 5200|  5.80k|    {
 5201|  5.80k|        _TIFFfreeExt(tif, dir);
 5202|  5.80k|        dir = NULL;
 5203|  5.80k|    }
 5204|  5.80k|    if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))
  ------------------
  |  |  248|  5.80k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  5.80k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  5.80k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5204:9): [True: 5.79k, False: 4]
  ------------------
 5205|  5.79k|    {
 5206|  5.79k|        if (tif->tif_dir.td_bitspersample >= 16)
  ------------------
  |  Branch (5206:13): [True: 497, False: 5.29k]
  ------------------
 5207|    497|            tif->tif_dir.td_maxsamplevalue = 0xFFFF;
 5208|  5.29k|        else
 5209|  5.29k|            tif->tif_dir.td_maxsamplevalue =
 5210|  5.29k|                (uint16_t)((1 << tif->tif_dir.td_bitspersample) - 1);
 5211|  5.79k|    }
 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.80k|    (*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.80k|    if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|  5.80k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5250:9): [True: 4.56k, False: 1.23k]
  ------------------
 5251|  4.56k|        (tif->tif_dir.td_nstrips == 1) &&
  ------------------
  |  Branch (5251:9): [True: 2.40k, False: 2.16k]
  ------------------
 5252|  2.40k|        (tif->tif_dir.td_compression == COMPRESSION_NONE) &&
  ------------------
  |  |  182|  2.40k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5252:9): [True: 77, False: 2.32k]
  ------------------
 5253|     77|        ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  134|     77|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
                      ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  129|     77|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
                      ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  134|     77|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  |  Branch (5253:9): [True: 74, False: 3]
  ------------------
 5254|     74|    {
 5255|     74|        ChopUpSingleUncompressedStrip(tif);
 5256|     74|    }
 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.80k|    if (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  11.6k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5261:9): [True: 4.56k, False: 1.23k]
  ------------------
 5262|  4.56k|        tif->tif_dir.td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  182|  10.3k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5262:9): [True: 202, False: 4.36k]
  ------------------
 5263|    202|        (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  134|    202|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
                      (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  129|    202|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
                      (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  134|  6.00k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  |  Branch (5263:9): [True: 187, False: 15]
  ------------------
 5264|    187|        TIFFStripSize64(tif) > 0x7FFFFFFFUL)
  ------------------
  |  Branch (5264:9): [True: 19, False: 168]
  ------------------
 5265|     19|    {
 5266|     19|        TryChopUpUncompressedBigTiff(tif);
 5267|     19|    }
 5268|       |
 5269|       |    /*
 5270|       |     * Clear the dirty directory flag.
 5271|       |     */
 5272|  5.80k|    tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  5.80k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 5273|  5.80k|    tif->tif_flags &= ~TIFF_DIRTYSTRIP;
  ------------------
  |  |  142|  5.80k|#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.80k|    tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 5279|  5.80k|    if (!tif->tif_dir.td_scanlinesize)
  ------------------
  |  Branch (5279:9): [True: 25, False: 5.77k]
  ------------------
 5280|     25|    {
 5281|     25|        TIFFErrorExtR(tif, module, "Cannot handle zero scanline size");
 5282|     25|        return (0);
 5283|     25|    }
 5284|       |
 5285|  5.77k|    if (isTiled(tif))
  ------------------
  |  |  278|  5.77k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  5.77k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 2.62k, False: 3.15k]
  |  |  ------------------
  ------------------
 5286|  2.62k|    {
 5287|  2.62k|        tif->tif_dir.td_tilesize = TIFFTileSize(tif);
 5288|  2.62k|        if (!tif->tif_dir.td_tilesize)
  ------------------
  |  Branch (5288:13): [True: 1, False: 2.62k]
  ------------------
 5289|      1|        {
 5290|      1|            TIFFErrorExtR(tif, module, "Cannot handle zero tile size");
 5291|      1|            return (0);
 5292|      1|        }
 5293|  2.62k|    }
 5294|  3.15k|    else
 5295|  3.15k|    {
 5296|  3.15k|        if (!TIFFStripSize(tif))
  ------------------
  |  Branch (5296:13): [True: 1.07k, False: 2.07k]
  ------------------
 5297|  1.07k|        {
 5298|  1.07k|            TIFFErrorExtR(tif, module, "Cannot handle zero strip size");
 5299|  1.07k|            return (0);
 5300|  1.07k|        }
 5301|  3.15k|    }
 5302|  4.70k|    return (1);
 5303|    444|bad:
 5304|    444|    if (dir)
  ------------------
  |  Branch (5304:9): [True: 444, False: 0]
  ------------------
 5305|    444|        _TIFFfreeExt(tif, dir);
 5306|    444|    return (0);
 5307|  5.77k|} /*-- TIFFReadDirectory() --*/
_TIFFCheckDirNumberAndOffset:
 5773|  6.24k|{
 5774|  6.24k|    if (diroff == 0) /* no more directories */
  ------------------
  |  Branch (5774:9): [True: 0, False: 6.24k]
  ------------------
 5775|      0|        return 0;
 5776|       |
 5777|  6.24k|    if (tif->tif_map_dir_offset_to_number == NULL)
  ------------------
  |  Branch (5777:9): [True: 6.24k, False: 0]
  ------------------
 5778|  6.24k|    {
 5779|  6.24k|        tif->tif_map_dir_offset_to_number = TIFFHashSetNew(
 5780|  6.24k|            hashFuncOffsetToNumber, equalFuncOffsetToNumber, free);
 5781|  6.24k|        if (tif->tif_map_dir_offset_to_number == NULL)
  ------------------
  |  Branch (5781:13): [True: 0, False: 6.24k]
  ------------------
 5782|      0|        {
 5783|      0|            TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5784|      0|                          "Not enough memory");
 5785|      0|            return 1;
 5786|      0|        }
 5787|  6.24k|    }
 5788|       |
 5789|  6.24k|    if (tif->tif_map_dir_number_to_offset == NULL)
  ------------------
  |  Branch (5789:9): [True: 6.24k, False: 0]
  ------------------
 5790|  6.24k|    {
 5791|       |        /* No free callback for this map, as it shares the same items as
 5792|       |         * tif->tif_map_dir_offset_to_number. */
 5793|  6.24k|        tif->tif_map_dir_number_to_offset = TIFFHashSetNew(
 5794|  6.24k|            hashFuncNumberToOffset, equalFuncNumberToOffset, NULL);
 5795|  6.24k|        if (tif->tif_map_dir_number_to_offset == NULL)
  ------------------
  |  Branch (5795:13): [True: 0, False: 6.24k]
  ------------------
 5796|      0|        {
 5797|      0|            TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5798|      0|                          "Not enough memory");
 5799|      0|            return 1;
 5800|      0|        }
 5801|  6.24k|    }
 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|  6.24k|    TIFFOffsetAndDirNumber entry;
 5809|  6.24k|    entry.offset = diroff;
 5810|  6.24k|    entry.dirNumber = dirn;
 5811|       |
 5812|  6.24k|    TIFFOffsetAndDirNumber *foundEntry =
 5813|  6.24k|        (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5814|  6.24k|            tif->tif_map_dir_offset_to_number, &entry);
 5815|  6.24k|    if (foundEntry)
  ------------------
  |  Branch (5815:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    foundEntry = (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5835|  6.24k|        tif->tif_map_dir_number_to_offset, &entry);
 5836|  6.24k|    if (foundEntry)
  ------------------
  |  Branch (5836:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    if (TIFFHashSetSize(tif->tif_map_dir_offset_to_number) >=
  ------------------
  |  Branch (5891:9): [True: 0, False: 6.24k]
  ------------------
 5892|  6.24k|        TIFF_MAX_DIR_COUNT)
  ------------------
  |  |  122|  6.24k|#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|  6.24k|    TIFFOffsetAndDirNumber *entryPtr =
 5901|  6.24k|        (TIFFOffsetAndDirNumber *)malloc(sizeof(TIFFOffsetAndDirNumber));
 5902|  6.24k|    if (entryPtr == NULL)
  ------------------
  |  Branch (5902:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    *entryPtr = entry;
 5911|       |
 5912|  6.24k|    if (!TIFFHashSetInsert(tif->tif_map_dir_offset_to_number, entryPtr))
  ------------------
  |  Branch (5912:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    if (!TIFFHashSetInsert(tif->tif_map_dir_number_to_offset, entryPtr))
  ------------------
  |  Branch (5918:9): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|    return 1;
 5926|  6.24k|} /* --- _TIFFCheckDirNumberAndOffset() ---*/
TIFFGetStrileOffset:
 8522|   506k|{
 8523|       |    return TIFFGetStrileOffsetWithErr(tif, strile, NULL);
 8524|   506k|}
TIFFGetStrileOffsetWithErr:
 8529|  15.5M|{
 8530|  15.5M|    TIFFDirectory *td = &tif->tif_dir;
 8531|  15.5M|    return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
 8532|  15.5M|                                                &(td->td_stripoffset_entry),
 8533|  15.5M|                                                &(td->td_stripoffset_p), pbErr);
 8534|  15.5M|}
TIFFGetStrileByteCount:
 8539|  1.18M|{
 8540|       |    return TIFFGetStrileByteCountWithErr(tif, strile, NULL);
 8541|  1.18M|}
TIFFGetStrileByteCountWithErr:
 8546|  1.59M|{
 8547|  1.59M|    TIFFDirectory *td = &tif->tif_dir;
 8548|  1.59M|    return _TIFFGetStrileOffsetOrByteCountValue(
 8549|  1.59M|        tif, strile, &(td->td_stripbytecount_entry), &(td->td_stripbytecount_p),
 8550|  1.59M|        pbErr);
 8551|  1.59M|}
_TIFFFillStriles:
 8553|    721|int _TIFFFillStriles(TIFF *tif) { return _TIFFFillStrilesInternal(tif, 1); }
tif_dirread.c:TIFFReadDirEntryShort:
  486|  20.0k|{
  487|  20.0k|    enum TIFFReadDirEntryErr err;
  488|  20.0k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (488:9): [True: 4.13k, False: 15.9k]
  ------------------
  489|  4.13k|        return (TIFFReadDirEntryErrCount);
  490|  15.9k|    switch (direntry->tdir_type)
  491|  15.9k|    {
  492|    841|        case TIFF_BYTE:
  ------------------
  |  Branch (492:9): [True: 841, False: 15.0k]
  ------------------
  493|    841|        {
  494|    841|            uint8_t m;
  495|    841|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  496|    841|            *value = (uint16_t)m;
  497|    841|            return (TIFFReadDirEntryErrOk);
  498|      0|        }
  499|    532|        case TIFF_SBYTE:
  ------------------
  |  Branch (499:9): [True: 532, False: 15.3k]
  ------------------
  500|    532|        {
  501|    532|            int8_t m;
  502|    532|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  503|    532|            err = TIFFReadDirEntryCheckRangeShortSbyte(m);
  504|    532|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (504:17): [True: 23, False: 509]
  ------------------
  505|     23|                return (err);
  506|    509|            *value = (uint16_t)m;
  507|    509|            return (TIFFReadDirEntryErrOk);
  508|    532|        }
  509|  14.1k|        case TIFF_SHORT:
  ------------------
  |  Branch (509:9): [True: 14.1k, False: 1.76k]
  ------------------
  510|  14.1k|            TIFFReadDirEntryCheckedShort(tif, direntry, value);
  511|  14.1k|            return (TIFFReadDirEntryErrOk);
  512|     48|        case TIFF_SSHORT:
  ------------------
  |  Branch (512:9): [True: 48, False: 15.8k]
  ------------------
  513|     48|        {
  514|     48|            int16_t m;
  515|     48|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  516|     48|            err = TIFFReadDirEntryCheckRangeShortSshort(m);
  517|     48|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (517:17): [True: 0, False: 48]
  ------------------
  518|      0|                return (err);
  519|     48|            *value = (uint16_t)m;
  520|     48|            return (TIFFReadDirEntryErrOk);
  521|     48|        }
  522|     87|        case TIFF_LONG:
  ------------------
  |  Branch (522:9): [True: 87, False: 15.8k]
  ------------------
  523|     87|        {
  524|     87|            uint32_t m;
  525|     87|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  526|     87|            err = TIFFReadDirEntryCheckRangeShortLong(m);
  527|     87|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (527:17): [True: 0, False: 87]
  ------------------
  528|      0|                return (err);
  529|     87|            *value = (uint16_t)m;
  530|     87|            return (TIFFReadDirEntryErrOk);
  531|     87|        }
  532|      8|        case TIFF_SLONG:
  ------------------
  |  Branch (532:9): [True: 8, False: 15.9k]
  ------------------
  533|      8|        {
  534|      8|            int32_t m;
  535|      8|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  536|      8|            err = TIFFReadDirEntryCheckRangeShortSlong(m);
  537|      8|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (537:17): [True: 0, False: 8]
  ------------------
  538|      0|                return (err);
  539|      8|            *value = (uint16_t)m;
  540|      8|            return (TIFFReadDirEntryErrOk);
  541|      8|        }
  542|     22|        case TIFF_LONG8:
  ------------------
  |  Branch (542:9): [True: 22, False: 15.8k]
  ------------------
  543|     22|        {
  544|     22|            uint64_t m;
  545|     22|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  546|     22|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (546:17): [True: 7, False: 15]
  ------------------
  547|      7|                return (err);
  548|     15|            err = TIFFReadDirEntryCheckRangeShortLong8(m);
  549|     15|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (549:17): [True: 10, False: 5]
  ------------------
  550|     10|                return (err);
  551|      5|            *value = (uint16_t)m;
  552|      5|            return (TIFFReadDirEntryErrOk);
  553|     15|        }
  554|      2|        case TIFF_SLONG8:
  ------------------
  |  Branch (554:9): [True: 2, False: 15.9k]
  ------------------
  555|      2|        {
  556|      2|            int64_t m;
  557|      2|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  558|      2|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (558:17): [True: 2, False: 0]
  ------------------
  559|      2|                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|    229|        default:
  ------------------
  |  Branch (566:9): [True: 229, False: 15.6k]
  ------------------
  567|    229|            return (TIFFReadDirEntryErrType);
  568|  15.9k|    }
  569|  15.9k|} /*-- TIFFReadDirEntryShort() --*/
tif_dirread.c:TIFFReadDirEntryCheckedByte:
 3406|  4.30k|{
 3407|  4.30k|    (void)tif;
 3408|  4.30k|    *value = *(uint8_t *)(&direntry->tdir_offset);
 3409|  4.30k|}
tif_dirread.c:TIFFReadDirEntryCheckedSbyte:
 3413|  1.01k|{
 3414|  1.01k|    (void)tif;
 3415|  1.01k|    *value = *(int8_t *)(&direntry->tdir_offset);
 3416|  1.01k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSbyte:
 3772|    845|{
 3773|    845|    if (value < 0)
  ------------------
  |  Branch (3773:9): [True: 23, False: 822]
  ------------------
 3774|     23|        return (TIFFReadDirEntryErrRange);
 3775|    822|    else
 3776|    822|        return (TIFFReadDirEntryErrOk);
 3777|    845|}
tif_dirread.c:TIFFReadDirEntryCheckedShort:
 3420|  28.6k|{
 3421|  28.6k|    *value = direntry->tdir_offset.toff_short;
 3422|       |    /* *value=*(uint16_t*)(&direntry->tdir_offset); */
 3423|  28.6k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  28.6k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3423:9): [True: 1.34k, False: 27.3k]
  ------------------
 3424|  1.34k|        TIFFSwabShort(value);
 3425|  28.6k|}
tif_dirread.c:TIFFReadDirEntryCheckedSshort:
 3429|    312|{
 3430|    312|    *value = *(int16_t *)(&direntry->tdir_offset);
 3431|    312|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    312|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3431:9): [True: 7, False: 305]
  ------------------
 3432|      7|        TIFFSwabShort((uint16_t *)value);
 3433|    312|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSshort:
 3781|  1.90k|{
 3782|  1.90k|    if (value < 0)
  ------------------
  |  Branch (3782:9): [True: 11, False: 1.89k]
  ------------------
 3783|     11|        return (TIFFReadDirEntryErrRange);
 3784|  1.89k|    else
 3785|  1.89k|        return (TIFFReadDirEntryErrOk);
 3786|  1.90k|}
tif_dirread.c:TIFFReadDirEntryCheckedLong:
 3437|    771|{
 3438|    771|    *value = *(uint32_t *)(&direntry->tdir_offset);
 3439|    771|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    771|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3439:9): [True: 49, False: 722]
  ------------------
 3440|     49|        TIFFSwabLong(value);
 3441|    771|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong:
 3790|    440|{
 3791|    440|    if (value > 0xFFFF)
  ------------------
  |  Branch (3791:9): [True: 1, False: 439]
  ------------------
 3792|      1|        return (TIFFReadDirEntryErrRange);
 3793|    439|    else
 3794|    439|        return (TIFFReadDirEntryErrOk);
 3795|    440|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong:
 3445|    141|{
 3446|    141|    *value = *(int32_t *)(&direntry->tdir_offset);
 3447|    141|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    141|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3447:9): [True: 6, False: 135]
  ------------------
 3448|      6|        TIFFSwabLong((uint32_t *)value);
 3449|    141|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong:
 3799|    281|{
 3800|    281|    if ((value < 0) || (value > 0xFFFF))
  ------------------
  |  Branch (3800:9): [True: 0, False: 281]
  |  Branch (3800:24): [True: 1, False: 280]
  ------------------
 3801|      1|        return (TIFFReadDirEntryErrRange);
 3802|    280|    else
 3803|    280|        return (TIFFReadDirEntryErrOk);
 3804|    281|}
tif_dirread.c:TIFFReadDirEntryCheckedLong8:
 3453|     30|{
 3454|     30|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|     30|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3454:9): [True: 23, False: 7]
  ------------------
 3455|     23|    {
 3456|     23|        enum TIFFReadDirEntryErr err;
 3457|     23|        uint32_t offset = direntry->tdir_offset.toff_long;
 3458|     23|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     23|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3458:13): [True: 2, False: 21]
  ------------------
 3459|      2|            TIFFSwabLong(&offset);
 3460|     23|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3461|     23|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3461:13): [True: 8, False: 15]
  ------------------
 3462|      8|            return (err);
 3463|     23|    }
 3464|      7|    else
 3465|      7|        *value = direntry->tdir_offset.toff_long8;
 3466|     22|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     22|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3466:9): [True: 2, False: 20]
  ------------------
 3467|      2|        TIFFSwabLong8(value);
 3468|     22|    return (TIFFReadDirEntryErrOk);
 3469|     30|}
tif_dirread.c:TIFFReadDirEntryData:
 3990|    744|{
 3991|    744|    assert(size > 0);
  ------------------
  |  Branch (3991:5): [True: 0, False: 744]
  |  Branch (3991:5): [True: 744, False: 0]
  ------------------
 3992|    744|    if (!isMapped(tif))
  ------------------
  |  |  279|    744|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|    744|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (3992:9): [True: 744, False: 0]
  ------------------
 3993|    744|    {
 3994|    744|        if (!SeekOK(tif, offset))
  ------------------
  |  |  303|    744|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (3994:13): [True: 104, False: 640]
  ------------------
 3995|    104|            return (TIFFReadDirEntryErrIo);
 3996|    640|        if (!ReadOK(tif, dest, size))
  ------------------
  |  |  300|    640|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|    640|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (3996:13): [True: 7, False: 633]
  ------------------
 3997|      7|            return (TIFFReadDirEntryErrIo);
 3998|    640|    }
 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|    633|    return (TIFFReadDirEntryErrOk);
 4013|    744|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong8:
 3808|    484|{
 3809|    484|    if (value > 0xFFFF)
  ------------------
  |  Branch (3809:9): [True: 13, False: 471]
  ------------------
 3810|     13|        return (TIFFReadDirEntryErrRange);
 3811|    471|    else
 3812|    471|        return (TIFFReadDirEntryErrOk);
 3813|    484|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong8:
 3473|      5|{
 3474|      5|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|      5|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3474:9): [True: 5, False: 0]
  ------------------
 3475|      5|    {
 3476|      5|        enum TIFFReadDirEntryErr err;
 3477|      5|        uint32_t offset = direntry->tdir_offset.toff_long;
 3478|      5|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      5|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3478:13): [True: 1, False: 4]
  ------------------
 3479|      1|            TIFFSwabLong(&offset);
 3480|      5|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3481|      5|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3481:13): [True: 4, False: 1]
  ------------------
 3482|      4|            return (err);
 3483|      5|    }
 3484|      0|    else
 3485|      0|        *value = *(int64_t *)(&direntry->tdir_offset);
 3486|      1|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      1|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3486:9): [True: 0, False: 1]
  ------------------
 3487|      0|        TIFFSwabLong8((uint64_t *)value);
 3488|      1|    return (TIFFReadDirEntryErrOk);
 3489|      5|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong8:
 3817|    502|{
 3818|    502|    if ((value < 0) || (value > 0xFFFF))
  ------------------
  |  Branch (3818:9): [True: 2, False: 500]
  |  Branch (3818:24): [True: 4, False: 496]
  ------------------
 3819|      6|        return (TIFFReadDirEntryErrRange);
 3820|    496|    else
 3821|    496|        return (TIFFReadDirEntryErrOk);
 3822|    502|}
tif_dirread.c:TIFFReadDirEntryPersampleShort:
 3348|  2.07k|{
 3349|  2.07k|    enum TIFFReadDirEntryErr err;
 3350|  2.07k|    uint16_t *m;
 3351|  2.07k|    uint16_t *na;
 3352|  2.07k|    uint16_t nb;
 3353|  2.07k|    if (direntry->tdir_count != (uint64_t)tif->tif_dir.td_samplesperpixel)
  ------------------
  |  Branch (3353:9): [True: 1.85k, False: 226]
  ------------------
 3354|  1.85k|    {
 3355|  1.85k|        const TIFFField *fip = TIFFFieldWithTag(tif, direntry->tdir_tag);
 3356|  1.85k|        if (direntry->tdir_count == 0)
  ------------------
  |  Branch (3356:13): [True: 0, False: 1.85k]
  ------------------
 3357|      0|        {
 3358|      0|            return TIFFReadDirEntryErrCount;
 3359|      0|        }
 3360|  1.85k|        else if (direntry->tdir_count <
  ------------------
  |  Branch (3360:18): [True: 0, False: 1.85k]
  ------------------
 3361|  1.85k|                 (uint64_t)tif->tif_dir.td_samplesperpixel)
 3362|      0|        {
 3363|      0|            TIFFWarningExtR(
 3364|      0|                tif, "TIFFReadDirEntryPersampleShort",
 3365|      0|                "Tag %s entry count is %" PRIu64
 3366|      0|                " , whereas it should be SamplesPerPixel=%d. Assuming that "
 3367|      0|                "missing entries are all at the value of the first one",
 3368|      0|                fip ? fip->field_name : "unknown tagname", direntry->tdir_count,
  ------------------
  |  Branch (3368:17): [True: 0, False: 0]
  ------------------
 3369|      0|                tif->tif_dir.td_samplesperpixel);
 3370|      0|        }
 3371|  1.85k|        else
 3372|  1.85k|        {
 3373|  1.85k|            TIFFWarningExtR(tif, "TIFFReadDirEntryPersampleShort",
 3374|  1.85k|                            "Tag %s entry count is %" PRIu64
 3375|  1.85k|                            " , whereas it should be SamplesPerPixel=%d. "
 3376|  1.85k|                            "Ignoring extra entries",
 3377|  1.85k|                            fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (3377:29): [True: 1.85k, False: 0]
  ------------------
 3378|  1.85k|                            direntry->tdir_count,
 3379|  1.85k|                            tif->tif_dir.td_samplesperpixel);
 3380|  1.85k|        }
 3381|  1.85k|    }
 3382|  2.07k|    err = TIFFReadDirEntryShortArray(tif, direntry, &m);
 3383|  2.07k|    if (err != TIFFReadDirEntryErrOk || m == NULL)
  ------------------
  |  Branch (3383:9): [True: 35, False: 2.04k]
  |  Branch (3383:41): [True: 0, False: 2.04k]
  ------------------
 3384|     35|        return (err);
 3385|  2.04k|    na = m;
 3386|  2.04k|    nb = tif->tif_dir.td_samplesperpixel;
 3387|  2.04k|    if (direntry->tdir_count < nb)
  ------------------
  |  Branch (3387:9): [True: 0, False: 2.04k]
  ------------------
 3388|      0|        nb = (uint16_t)direntry->tdir_count;
 3389|  2.04k|    *value = *na++;
 3390|  2.04k|    nb--;
 3391|  2.66k|    while (nb > 0)
  ------------------
  |  Branch (3391:12): [True: 627, False: 2.04k]
  ------------------
 3392|    627|    {
 3393|    627|        if (*na++ != *value)
  ------------------
  |  Branch (3393:13): [True: 1, False: 626]
  ------------------
 3394|      1|        {
 3395|      1|            err = TIFFReadDirEntryErrPsdif;
 3396|      1|            break;
 3397|      1|        }
 3398|    626|        nb--;
 3399|    626|    }
 3400|  2.04k|    _TIFFfreeExt(tif, m);
 3401|  2.04k|    return (err);
 3402|  2.07k|}
tif_dirread.c:TIFFReadDirEntryOutputErr:
 4018|  17.0k|{
 4019|  17.0k|    if (!recover)
  ------------------
  |  Branch (4019:9): [True: 190, False: 16.8k]
  ------------------
 4020|    190|    {
 4021|    190|        switch (err)
 4022|    190|        {
 4023|     12|            case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (4023:13): [True: 12, False: 178]
  ------------------
 4024|     12|                TIFFErrorExtR(tif, module, "Incorrect count for \"%s\"",
 4025|     12|                              tagname);
 4026|     12|                break;
 4027|     33|            case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (4027:13): [True: 33, False: 157]
  ------------------
 4028|     33|                TIFFErrorExtR(tif, module, "Incompatible type for \"%s\"",
 4029|     33|                              tagname);
 4030|     33|                break;
 4031|    119|            case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (4031:13): [True: 119, False: 71]
  ------------------
 4032|    119|                TIFFErrorExtR(tif, module, "IO error during reading of \"%s\"",
 4033|    119|                              tagname);
 4034|    119|                break;
 4035|     21|            case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (4035:13): [True: 21, False: 169]
  ------------------
 4036|     21|                TIFFErrorExtR(tif, module, "Incorrect value for \"%s\"",
 4037|     21|                              tagname);
 4038|     21|                break;
 4039|      1|            case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (4039:13): [True: 1, False: 189]
  ------------------
 4040|      1|                TIFFErrorExtR(
 4041|      1|                    tif, module,
 4042|      1|                    "Cannot handle different values per sample for \"%s\"",
 4043|      1|                    tagname);
 4044|      1|                break;
 4045|      4|            case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (4045:13): [True: 4, False: 186]
  ------------------
 4046|      4|                TIFFErrorExtR(tif, module,
 4047|      4|                              "Sanity check on size of \"%s\" value failed",
 4048|      4|                              tagname);
 4049|      4|                break;
 4050|      0|            case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (4050:13): [True: 0, False: 190]
  ------------------
 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: 190]
  ------------------
 4055|      0|            default:
  ------------------
  |  Branch (4055:13): [True: 0, False: 190]
  ------------------
 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|    190|        }
 4059|    190|    }
 4060|  16.8k|    else
 4061|  16.8k|    {
 4062|  16.8k|        switch (err)
 4063|  16.8k|        {
 4064|  6.04k|            case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (4064:13): [True: 6.04k, False: 10.8k]
  ------------------
 4065|  6.04k|                TIFFWarningExtR(tif, module,
 4066|  6.04k|                                "Incorrect count for \"%s\"; tag ignored",
 4067|  6.04k|                                tagname);
 4068|  6.04k|                break;
 4069|  1.00k|            case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (4069:13): [True: 1.00k, False: 15.8k]
  ------------------
 4070|  1.00k|                TIFFWarningExtR(tif, module,
 4071|  1.00k|                                "Incompatible type for \"%s\"; tag ignored",
 4072|  1.00k|                                tagname);
 4073|  1.00k|                break;
 4074|  5.93k|            case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (4074:13): [True: 5.93k, False: 10.9k]
  ------------------
 4075|  5.93k|                TIFFWarningExtR(
 4076|  5.93k|                    tif, module,
 4077|  5.93k|                    "IO error during reading of \"%s\"; tag ignored", tagname);
 4078|  5.93k|                break;
 4079|    179|            case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (4079:13): [True: 179, False: 16.6k]
  ------------------
 4080|    179|                TIFFWarningExtR(tif, module,
 4081|    179|                                "Incorrect value for \"%s\"; tag ignored",
 4082|    179|                                tagname);
 4083|    179|                break;
 4084|      0|            case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (4084:13): [True: 0, False: 16.8k]
  ------------------
 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|  2.44k|            case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (4090:13): [True: 2.44k, False: 14.4k]
  ------------------
 4091|  2.44k|                TIFFWarningExtR(
 4092|  2.44k|                    tif, module,
 4093|  2.44k|                    "Sanity check on size of \"%s\" value failed; tag ignored",
 4094|  2.44k|                    tagname);
 4095|  2.44k|                break;
 4096|  1.25k|            case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (4096:13): [True: 1.25k, False: 15.6k]
  ------------------
 4097|  1.25k|                TIFFWarningExtR(tif, module,
 4098|  1.25k|                                "Out of memory reading of \"%s\"; tag ignored",
 4099|  1.25k|                                tagname);
 4100|  1.25k|                break;
 4101|      0|            case TIFFReadDirEntryErrOk:
  ------------------
  |  Branch (4101:13): [True: 0, False: 16.8k]
  ------------------
 4102|      0|            default:
  ------------------
  |  Branch (4102:13): [True: 0, False: 16.8k]
  ------------------
 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|  16.8k|        }
 4106|  16.8k|    }
 4107|  17.0k|}
tif_dirread.c:EvaluateIFDdatasizeReading:
 4186|  32.5k|{
 4187|  32.5k|    const uint64_t data_width =
 4188|  32.5k|        (uint64_t)TIFFDataWidth((TIFFDataType)dp->tdir_type);
 4189|  32.5k|    if (data_width != 0 && dp->tdir_count > UINT64_MAX / data_width)
  ------------------
  |  Branch (4189:9): [True: 32.4k, False: 118]
  |  Branch (4189:28): [True: 0, False: 32.4k]
  ------------------
 4190|      0|    {
 4191|      0|        TIFFErrorExtR(tif, "EvaluateIFDdatasizeReading",
 4192|      0|                      "Too large IFD data size");
 4193|      0|        return false;
 4194|      0|    }
 4195|  32.5k|    const uint64_t datalength = dp->tdir_count * data_width;
 4196|  32.5k|    if (datalength > ((tif->tif_flags & TIFF_BIGTIFF) ? 0x8U : 0x4U))
  ------------------
  |  |  140|  32.5k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4196:9): [True: 21.5k, False: 10.9k]
  |  Branch (4196:23): [True: 136, False: 32.4k]
  ------------------
 4197|  21.5k|    {
 4198|  21.5k|        if (tif->tif_dir.td_dirdatasize_read > UINT64_MAX - datalength)
  ------------------
  |  Branch (4198:13): [True: 76, False: 21.5k]
  ------------------
 4199|     76|        {
 4200|     76|            TIFFErrorExtR(tif, "EvaluateIFDdatasizeReading",
 4201|     76|                          "Too large IFD data size");
 4202|     76|            return false;
 4203|     76|        }
 4204|  21.5k|        tif->tif_dir.td_dirdatasize_read += datalength;
 4205|  21.5k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  21.5k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4205:13): [True: 21.4k, False: 36]
  ------------------
 4206|  21.4k|        {
 4207|       |            /* The offset of TIFFDirEntry are not swapped when read in. That has
 4208|       |             * to be done when used. */
 4209|  21.4k|            uint32_t offset = dp->tdir_offset.toff_long;
 4210|  21.4k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  21.4k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (4210:17): [True: 461, False: 21.0k]
  ------------------
 4211|    461|                TIFFSwabLong(&offset);
 4212|  21.4k|            tif->tif_dir
 4213|  21.4k|                .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4214|  21.4k|                .offset = (uint64_t)offset;
 4215|  21.4k|        }
 4216|     36|        else
 4217|     36|        {
 4218|     36|            tif->tif_dir
 4219|     36|                .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4220|     36|                .offset = dp->tdir_offset.toff_long8;
 4221|     36|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     36|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (4221:17): [True: 0, False: 36]
  ------------------
 4222|      0|                TIFFSwabLong8(
 4223|      0|                    &tif->tif_dir
 4224|      0|                         .td_dirdatasize_offsets[tif->tif_dir
 4225|      0|                                                     .td_dirdatasize_Noffsets]
 4226|      0|                         .offset);
 4227|     36|        }
 4228|  21.5k|        tif->tif_dir
 4229|  21.5k|            .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4230|  21.5k|            .length = datalength;
 4231|  21.5k|        tif->tif_dir.td_dirdatasize_Noffsets++;
 4232|  21.5k|    }
 4233|  32.4k|    return true;
 4234|  32.5k|}
tif_dirread.c:TIFFReadDirEntryDoubleArray:
 3046|  3.29k|{
 3047|  3.29k|    enum TIFFReadDirEntryErr err;
 3048|  3.29k|    uint32_t count;
 3049|  3.29k|    void *origdata;
 3050|  3.29k|    double *data;
 3051|  3.29k|    switch (direntry->tdir_type)
 3052|  3.29k|    {
 3053|      4|        case TIFF_BYTE:
  ------------------
  |  Branch (3053:9): [True: 4, False: 3.28k]
  ------------------
 3054|      5|        case TIFF_SBYTE:
  ------------------
  |  Branch (3054:9): [True: 1, False: 3.29k]
  ------------------
 3055|    161|        case TIFF_SHORT:
  ------------------
  |  Branch (3055:9): [True: 156, False: 3.13k]
  ------------------
 3056|    164|        case TIFF_SSHORT:
  ------------------
  |  Branch (3056:9): [True: 3, False: 3.28k]
  ------------------
 3057|    168|        case TIFF_LONG:
  ------------------
  |  Branch (3057:9): [True: 4, False: 3.28k]
  ------------------
 3058|    171|        case TIFF_SLONG:
  ------------------
  |  Branch (3058:9): [True: 3, False: 3.28k]
  ------------------
 3059|    175|        case TIFF_LONG8:
  ------------------
  |  Branch (3059:9): [True: 4, False: 3.28k]
  ------------------
 3060|    179|        case TIFF_SLONG8:
  ------------------
  |  Branch (3060:9): [True: 4, False: 3.28k]
  ------------------
 3061|    187|        case TIFF_RATIONAL:
  ------------------
  |  Branch (3061:9): [True: 8, False: 3.28k]
  ------------------
 3062|    208|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (3062:9): [True: 21, False: 3.27k]
  ------------------
 3063|    211|        case TIFF_FLOAT:
  ------------------
  |  Branch (3063:9): [True: 3, False: 3.28k]
  ------------------
 3064|  3.29k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3064:9): [True: 3.08k, False: 211]
  ------------------
 3065|  3.29k|            break;
 3066|      0|        default:
  ------------------
  |  Branch (3066:9): [True: 0, False: 3.29k]
  ------------------
 3067|      0|            return (TIFFReadDirEntryErrType);
 3068|  3.29k|    }
 3069|  3.29k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 3070|  3.29k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (3070:9): [True: 311, False: 2.98k]
  |  Branch (3070:43): [True: 124, False: 2.85k]
  ------------------
 3071|    435|    {
 3072|    435|        *value = 0;
 3073|    435|        return (err);
 3074|    435|    }
 3075|  2.85k|    switch (direntry->tdir_type)
 3076|  2.85k|    {
 3077|  2.64k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3077:9): [True: 2.64k, False: 211]
  ------------------
 3078|  2.64k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  2.64k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3078:17): [True: 195, False: 2.45k]
  ------------------
 3079|    195|                TIFFSwabArrayOfLong8((uint64_t *)origdata, count);
 3080|  2.64k|            TIFFCvtIEEEDoubleToNative(tif, count, (double *)origdata);
 3081|  2.64k|            *value = (double *)origdata;
 3082|  2.64k|            return (TIFFReadDirEntryErrOk);
 3083|    211|        default:
  ------------------
  |  Branch (3083:9): [True: 211, False: 2.64k]
  ------------------
 3084|    211|            break;
 3085|  2.85k|    }
 3086|    211|    data = (double *)_TIFFmallocExt(tif,
 3087|    211|                                    (tmsize_t)((size_t)count * sizeof(double)));
 3088|    211|    if (data == 0)
  ------------------
  |  Branch (3088:9): [True: 0, False: 211]
  ------------------
 3089|      0|    {
 3090|      0|        _TIFFfreeExt(tif, origdata);
 3091|      0|        return (TIFFReadDirEntryErrAlloc);
 3092|      0|    }
 3093|    211|    switch (direntry->tdir_type)
 3094|    211|    {
 3095|      4|        case TIFF_BYTE:
  ------------------
  |  Branch (3095:9): [True: 4, False: 207]
  ------------------
 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: 210]
  ------------------
 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|    156|        case TIFF_SHORT:
  ------------------
  |  Branch (3117:9): [True: 156, False: 55]
  ------------------
 3118|    156|        {
 3119|    156|            uint16_t *ma;
 3120|    156|            double *mb;
 3121|    156|            uint32_t n;
 3122|    156|            ma = (uint16_t *)origdata;
 3123|    156|            mb = data;
 3124|  1.16k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3124:25): [True: 1.01k, False: 156]
  ------------------
 3125|  1.01k|            {
 3126|  1.01k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.01k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3126:21): [True: 224, False: 786]
  ------------------
 3127|    224|                    TIFFSwabShort(ma);
 3128|  1.01k|                *mb++ = (double)(*ma++);
 3129|  1.01k|            }
 3130|    156|        }
 3131|    156|        break;
 3132|      3|        case TIFF_SSHORT:
  ------------------
  |  Branch (3132:9): [True: 3, False: 208]
  ------------------
 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: 207]
  ------------------
 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: 208]
  ------------------
 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: 207]
  ------------------
 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: 207]
  ------------------
 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|      8|        case TIFF_RATIONAL:
  ------------------
  |  Branch (3207:9): [True: 8, False: 203]
  ------------------
 3208|      8|        {
 3209|      8|            uint32_t *ma;
 3210|      8|            uint32_t maa;
 3211|      8|            uint32_t mab;
 3212|      8|            double *mb;
 3213|      8|            uint32_t n;
 3214|      8|            ma = (uint32_t *)origdata;
 3215|      8|            mb = data;
 3216|    850|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3216:25): [True: 842, False: 8]
  ------------------
 3217|    842|            {
 3218|    842|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    842|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3218:21): [True: 448, False: 394]
  ------------------
 3219|    448|                    TIFFSwabLong(ma);
 3220|    842|                maa = *ma++;
 3221|    842|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    842|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3221:21): [True: 448, False: 394]
  ------------------
 3222|    448|                    TIFFSwabLong(ma);
 3223|    842|                mab = *ma++;
 3224|    842|                if (mab == 0)
  ------------------
  |  Branch (3224:21): [True: 322, False: 520]
  ------------------
 3225|    322|                    *mb++ = 0.0;
 3226|    520|                else
 3227|    520|                    *mb++ = (double)maa / (double)mab;
 3228|    842|            }
 3229|      8|        }
 3230|      8|        break;
 3231|     21|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (3231:9): [True: 21, False: 190]
  ------------------
 3232|     21|        {
 3233|     21|            uint32_t *ma;
 3234|     21|            int32_t maa;
 3235|     21|            uint32_t mab;
 3236|     21|            double *mb;
 3237|     21|            uint32_t n;
 3238|     21|            ma = (uint32_t *)origdata;
 3239|     21|            mb = data;
 3240|    624|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3240:25): [True: 603, False: 21]
  ------------------
 3241|    603|            {
 3242|    603|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    603|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3242:21): [True: 224, False: 379]
  ------------------
 3243|    224|                    TIFFSwabLong(ma);
 3244|    603|                maa = *(int32_t *)ma;
 3245|    603|                ma++;
 3246|    603|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    603|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3246:21): [True: 224, False: 379]
  ------------------
 3247|    224|                    TIFFSwabLong(ma);
 3248|    603|                mab = *ma++;
 3249|    603|                if (mab == 0)
  ------------------
  |  Branch (3249:21): [True: 211, False: 392]
  ------------------
 3250|    211|                    *mb++ = 0.0;
 3251|    392|                else
 3252|    392|                    *mb++ = (double)maa / (double)mab;
 3253|    603|            }
 3254|     21|        }
 3255|     21|        break;
 3256|      3|        case TIFF_FLOAT:
  ------------------
  |  Branch (3256:9): [True: 3, False: 208]
  ------------------
 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: 211]
  ------------------
 3271|      0|            break;
 3272|    211|    }
 3273|    211|    _TIFFfreeExt(tif, origdata);
 3274|    211|    *value = data;
 3275|    211|    return (TIFFReadDirEntryErrOk);
 3276|    211|}
tif_dirread.c:TIFFReadDirEntryArray:
 1390|  25.7k|{
 1391|  25.7k|    return TIFFReadDirEntryArrayWithLimit(tif, direntry, count, desttypesize,
 1392|  25.7k|                                          value, ~((uint64_t)0));
 1393|  25.7k|}
tif_dirread.c:TIFFReadDirEntryArrayWithLimit:
 1263|  39.6k|{
 1264|  39.6k|    int typesize;
 1265|  39.6k|    uint32_t datasize;
 1266|  39.6k|    void *data;
 1267|  39.6k|    uint64_t target_count64;
 1268|  39.6k|    int original_datasize_clamped;
 1269|  39.6k|    typesize = TIFFDataWidth((TIFFDataType)direntry->tdir_type);
 1270|       |
 1271|  39.6k|    target_count64 =
 1272|  39.6k|        (direntry->tdir_count > maxcount) ? maxcount : direntry->tdir_count;
  ------------------
  |  Branch (1272:9): [True: 8.17k, False: 31.4k]
  ------------------
 1273|       |
 1274|  39.6k|    if ((target_count64 == 0) || (typesize == 0))
  ------------------
  |  Branch (1274:9): [True: 2.27k, False: 37.3k]
  |  Branch (1274:34): [True: 0, False: 37.3k]
  ------------------
 1275|  2.27k|    {
 1276|  2.27k|        *value = 0;
 1277|  2.27k|        return (TIFFReadDirEntryErrOk);
 1278|  2.27k|    }
 1279|  37.3k|    (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.3k|    original_datasize_clamped =
 1285|  37.3k|        ((direntry->tdir_count > 10) ? 10 : (int)direntry->tdir_count) *
  ------------------
  |  Branch (1285:10): [True: 20.8k, False: 16.5k]
  ------------------
 1286|  37.3k|        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.3k|    if ((uint64_t)(MAX_SIZE_TAG_DATA / (unsigned int)typesize) < target_count64)
  ------------------
  |  | 1257|  37.3k|#define MAX_SIZE_TAG_DATA 2147483647U
  ------------------
  |  Branch (1293:9): [True: 2.41k, False: 34.9k]
  ------------------
 1294|  2.41k|        return (TIFFReadDirEntryErrSizesan);
 1295|  34.9k|    if ((uint64_t)(MAX_SIZE_TAG_DATA / desttypesize) < target_count64)
  ------------------
  |  | 1257|  34.9k|#define MAX_SIZE_TAG_DATA 2147483647U
  ------------------
  |  Branch (1295:9): [True: 34, False: 34.9k]
  ------------------
 1296|     34|        return (TIFFReadDirEntryErrSizesan);
 1297|       |
 1298|  34.9k|    *count = (uint32_t)target_count64;
 1299|  34.9k|    datasize = (uint32_t)(*count) * (unsigned int)typesize;
 1300|  34.9k|    assert((tmsize_t)datasize > 0);
  ------------------
  |  Branch (1300:5): [True: 0, False: 34.9k]
  |  Branch (1300:5): [True: 34.9k, False: 0]
  ------------------
 1301|       |
 1302|  34.9k|    if (datasize > 100 * 1024 * 1024)
  ------------------
  |  Branch (1302:9): [True: 1.25k, False: 33.6k]
  ------------------
 1303|  1.25k|    {
 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.25k|        const uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|  1.25k|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 1308|  1.25k|        if (datasize > filesize)
  ------------------
  |  Branch (1308:13): [True: 1.25k, False: 0]
  ------------------
 1309|  1.25k|        {
 1310|  1.25k|            TIFFWarningExtR(tif, "ReadDirEntryArray",
 1311|  1.25k|                            "Requested memory size for tag %d (0x%x) %" PRIu32
 1312|  1.25k|                            " is greater than filesize %" PRIu64
 1313|  1.25k|                            ". Memory not allocated, tag not read",
 1314|  1.25k|                            direntry->tdir_tag, direntry->tdir_tag, datasize,
 1315|  1.25k|                            filesize);
 1316|  1.25k|            return (TIFFReadDirEntryErrAlloc);
 1317|  1.25k|        }
 1318|  1.25k|    }
 1319|       |
 1320|  33.6k|    if (isMapped(tif) && datasize > (uint64_t)tif->tif_size)
  ------------------
  |  |  279|  67.3k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  33.6k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 33.6k]
  |  |  ------------------
  ------------------
  |  Branch (1320:26): [True: 0, False: 0]
  ------------------
 1321|      0|        return TIFFReadDirEntryErrIo;
 1322|       |
 1323|  33.6k|    if (!isMapped(tif) && (((tif->tif_flags & TIFF_BIGTIFF) && datasize > 8) ||
  ------------------
  |  |  279|  67.3k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  33.6k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
                  if (!isMapped(tif) && (((tif->tif_flags & TIFF_BIGTIFF) && datasize > 8) ||
  ------------------
  |  |  140|  33.6k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1323:9): [True: 33.6k, False: 0]
  |  Branch (1323:29): [True: 164, False: 33.4k]
  |  Branch (1323:64): [True: 97, False: 67]
  ------------------
 1324|  33.5k|                           (!(tif->tif_flags & TIFF_BIGTIFF) && datasize > 4)))
  ------------------
  |  |  140|  33.5k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1324:29): [True: 33.4k, False: 67]
  |  Branch (1324:65): [True: 23.6k, False: 9.86k]
  ------------------
 1325|  23.7k|    {
 1326|  23.7k|        data = NULL;
 1327|  23.7k|    }
 1328|  9.93k|    else
 1329|  9.93k|    {
 1330|  9.93k|        data = _TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
 1331|  9.93k|        if (data == 0)
  ------------------
  |  Branch (1331:13): [True: 0, False: 9.93k]
  ------------------
 1332|      0|            return (TIFFReadDirEntryErrAlloc);
 1333|  9.93k|    }
 1334|  33.6k|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  33.6k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1334:9): [True: 33.4k, False: 164]
  ------------------
 1335|  33.4k|    {
 1336|       |        /* Only the condition on original_datasize_clamped. The second
 1337|       |         * one is implied, but Coverity Scan cannot see it. */
 1338|  33.4k|        if (original_datasize_clamped <= 4 && datasize <= 4)
  ------------------
  |  Branch (1338:13): [True: 7.15k, False: 26.3k]
  |  Branch (1338:47): [True: 7.15k, False: 0]
  ------------------
 1339|  7.15k|            _TIFFmemcpy(data, &direntry->tdir_offset, datasize);
 1340|  26.3k|        else
 1341|  26.3k|        {
 1342|  26.3k|            enum TIFFReadDirEntryErr err;
 1343|  26.3k|            uint32_t offset = direntry->tdir_offset.toff_long;
 1344|  26.3k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  26.3k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1344:17): [True: 555, False: 25.7k]
  ------------------
 1345|    555|                TIFFSwabLong(&offset);
 1346|  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]
  |  |  ------------------
  ------------------
 1347|      0|                err = TIFFReadDirEntryData(tif, (uint64_t)offset,
 1348|      0|                                           (tmsize_t)datasize, data);
 1349|  26.3k|            else
 1350|  26.3k|                err = TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset,
 1351|  26.3k|                                                     (tmsize_t)datasize, &data);
 1352|  26.3k|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1352:17): [True: 5.89k, False: 20.4k]
  ------------------
 1353|  5.89k|            {
 1354|  5.89k|                _TIFFfreeExt(tif, data);
 1355|  5.89k|                return (err);
 1356|  5.89k|            }
 1357|  26.3k|        }
 1358|  33.4k|    }
 1359|    164|    else
 1360|    164|    {
 1361|       |        /* See above comment for the Classic TIFF case */
 1362|    164|        if (original_datasize_clamped <= 8 && datasize <= 8)
  ------------------
  |  Branch (1362:13): [True: 32, False: 132]
  |  Branch (1362:47): [True: 32, False: 0]
  ------------------
 1363|     32|            _TIFFmemcpy(data, &direntry->tdir_offset, datasize);
 1364|    132|        else
 1365|    132|        {
 1366|    132|            enum TIFFReadDirEntryErr err;
 1367|    132|            uint64_t offset = direntry->tdir_offset.toff_long8;
 1368|    132|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    132|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1368:17): [True: 1, False: 131]
  ------------------
 1369|      1|                TIFFSwabLong8(&offset);
 1370|    132|            if (isMapped(tif))
  ------------------
  |  |  279|    132|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|    132|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 132]
  |  |  ------------------
  ------------------
 1371|      0|                err = TIFFReadDirEntryData(tif, (uint64_t)offset,
 1372|      0|                                           (tmsize_t)datasize, data);
 1373|    132|            else
 1374|    132|                err = TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset,
 1375|    132|                                                     (tmsize_t)datasize, &data);
 1376|    132|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1376:17): [True: 47, False: 85]
  ------------------
 1377|     47|            {
 1378|     47|                _TIFFfreeExt(tif, data);
 1379|     47|                return (err);
 1380|     47|            }
 1381|    132|        }
 1382|    164|    }
 1383|  27.7k|    *value = data;
 1384|  27.7k|    return (TIFFReadDirEntryErrOk);
 1385|  33.6k|}
tif_dirread.c:TIFFReadDirEntryDataAndRealloc:
 1199|  26.4k|{
 1200|  26.4k|#if SIZEOF_SIZE_T == 8
 1201|  26.4k|    tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  | 1189|  26.4k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
 1202|  26.4k|#endif
 1203|  26.4k|    tmsize_t already_read = 0;
 1204|       |
 1205|  26.4k|    assert(!isMapped(tif));
  ------------------
  |  Branch (1205:5): [True: 0, False: 26.4k]
  |  Branch (1205:5): [True: 26.4k, False: 0]
  ------------------
 1206|       |
 1207|  26.4k|    if (!SeekOK(tif, offset))
  ------------------
  |  |  303|  26.4k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (1207:9): [True: 5.88k, False: 20.5k]
  ------------------
 1208|  5.88k|        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|  41.1k|    while (already_read < size)
  ------------------
  |  Branch (1216:12): [True: 20.5k, False: 20.5k]
  ------------------
 1217|  20.5k|    {
 1218|  20.5k|        void *new_dest;
 1219|  20.5k|        tmsize_t bytes_read;
 1220|  20.5k|        tmsize_t to_read = size - already_read;
 1221|  20.5k|#if SIZEOF_SIZE_T == 8
 1222|  20.5k|        if (to_read >= threshold && threshold < MAX_THRESHOLD)
  ------------------
  |  | 1192|     15|    (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|     15|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|     15|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|     15|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  | 1193|     15|     INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  | 1189|     15|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (1222:13): [True: 15, False: 20.5k]
  |  Branch (1222:37): [True: 15, False: 0]
  ------------------
 1223|     15|        {
 1224|     15|            to_read = threshold;
 1225|     15|            threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  | 1190|     15|#define THRESHOLD_MULTIPLIER 10
  ------------------
 1226|     15|        }
 1227|  20.5k|#endif
 1228|       |
 1229|  20.5k|        new_dest =
 1230|  20.5k|            (uint8_t *)_TIFFreallocExt(tif, *pdest, already_read + to_read);
 1231|  20.5k|        if (new_dest == NULL)
  ------------------
  |  Branch (1231:13): [True: 0, False: 20.5k]
  ------------------
 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.5k|        *pdest = new_dest;
 1242|       |
 1243|  20.5k|        bytes_read = TIFFReadFile(tif, (char *)*pdest + already_read, to_read);
  ------------------
  |  |  283|  20.5k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 1244|  20.5k|        if (bytes_read < 0)
  ------------------
  |  Branch (1244:13): [True: 0, False: 20.5k]
  ------------------
 1245|      0|            return TIFFReadDirEntryErrIo;
 1246|  20.5k|        already_read += bytes_read;
 1247|  20.5k|        if (bytes_read != to_read)
  ------------------
  |  Branch (1247:13): [True: 64, False: 20.5k]
  ------------------
 1248|     64|        {
 1249|     64|            return TIFFReadDirEntryErrIo;
 1250|     64|        }
 1251|  20.5k|    }
 1252|  20.5k|    return TIFFReadDirEntryErrOk;
 1253|  20.5k|}
tif_dirread.c:TIFFReadDirEntryShortArray:
 1767|  7.06k|{
 1768|  7.06k|    enum TIFFReadDirEntryErr err;
 1769|  7.06k|    uint32_t count;
 1770|  7.06k|    void *origdata;
 1771|  7.06k|    uint16_t *data;
 1772|  7.06k|    switch (direntry->tdir_type)
 1773|  7.06k|    {
 1774|    401|        case TIFF_BYTE:
  ------------------
  |  Branch (1774:9): [True: 401, False: 6.66k]
  ------------------
 1775|    434|        case TIFF_SBYTE:
  ------------------
  |  Branch (1775:9): [True: 33, False: 7.02k]
  ------------------
 1776|  6.16k|        case TIFF_SHORT:
  ------------------
  |  Branch (1776:9): [True: 5.73k, False: 1.32k]
  ------------------
 1777|  6.96k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1777:9): [True: 796, False: 6.26k]
  ------------------
 1778|  6.97k|        case TIFF_LONG:
  ------------------
  |  Branch (1778:9): [True: 14, False: 7.04k]
  ------------------
 1779|  6.98k|        case TIFF_SLONG:
  ------------------
  |  Branch (1779:9): [True: 2, False: 7.06k]
  ------------------
 1780|  6.98k|        case TIFF_LONG8:
  ------------------
  |  Branch (1780:9): [True: 4, False: 7.05k]
  ------------------
 1781|  6.99k|        case TIFF_SLONG8:
  ------------------
  |  Branch (1781:9): [True: 12, False: 7.05k]
  ------------------
 1782|  6.99k|            break;
 1783|     66|        default:
  ------------------
  |  Branch (1783:9): [True: 66, False: 6.99k]
  ------------------
 1784|     66|            return (TIFFReadDirEntryErrType);
 1785|  7.06k|    }
 1786|  6.99k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 2, &origdata);
 1787|  6.99k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1787:9): [True: 1.39k, False: 5.60k]
  |  Branch (1787:43): [True: 66, False: 5.53k]
  ------------------
 1788|  1.45k|    {
 1789|  1.45k|        *value = 0;
 1790|  1.45k|        return (err);
 1791|  1.45k|    }
 1792|  5.53k|    switch (direntry->tdir_type)
 1793|  5.53k|    {
 1794|  4.28k|        case TIFF_SHORT:
  ------------------
  |  Branch (1794:9): [True: 4.28k, False: 1.25k]
  ------------------
 1795|  4.28k|            *value = (uint16_t *)origdata;
 1796|  4.28k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  4.28k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1796:17): [True: 339, False: 3.95k]
  ------------------
 1797|    339|                TIFFSwabArrayOfShort(*value, count);
 1798|  4.28k|            return (TIFFReadDirEntryErrOk);
 1799|    794|        case TIFF_SSHORT:
  ------------------
  |  Branch (1799:9): [True: 794, False: 4.74k]
  ------------------
 1800|    794|        {
 1801|    794|            int16_t *m;
 1802|    794|            uint32_t n;
 1803|    794|            m = (int16_t *)origdata;
 1804|  2.64k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1804:25): [True: 1.86k, False: 783]
  ------------------
 1805|  1.86k|            {
 1806|  1.86k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.86k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1806:21): [True: 133, False: 1.72k]
  ------------------
 1807|    133|                    TIFFSwabShort((uint16_t *)m);
 1808|  1.86k|                err = TIFFReadDirEntryCheckRangeShortSshort(*m);
 1809|  1.86k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1809:21): [True: 11, False: 1.84k]
  ------------------
 1810|     11|                {
 1811|     11|                    _TIFFfreeExt(tif, origdata);
 1812|     11|                    return (err);
 1813|     11|                }
 1814|  1.84k|                m++;
 1815|  1.84k|            }
 1816|    783|            *value = (uint16_t *)origdata;
 1817|    783|            return (TIFFReadDirEntryErrOk);
 1818|    794|        }
 1819|    456|        default:
  ------------------
  |  Branch (1819:9): [True: 456, False: 5.08k]
  ------------------
 1820|    456|            break;
 1821|  5.53k|    }
 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|    398|        case TIFF_BYTE:
  ------------------
  |  Branch (1831:9): [True: 398, False: 58]
  ------------------
 1832|    398|        {
 1833|    398|            uint8_t *ma;
 1834|    398|            uint16_t *mb;
 1835|    398|            uint32_t n;
 1836|    398|            ma = (uint8_t *)origdata;
 1837|    398|            mb = data;
 1838|  12.5k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1838:25): [True: 12.1k, False: 398]
  ------------------
 1839|  12.1k|                *mb++ = (uint16_t)(*ma++);
 1840|    398|        }
 1841|    398|        break;
 1842|     32|        case TIFF_SBYTE:
  ------------------
  |  Branch (1842:9): [True: 32, False: 424]
  ------------------
 1843|     32|        {
 1844|     32|            int8_t *ma;
 1845|     32|            uint16_t *mb;
 1846|     32|            uint32_t n;
 1847|     32|            ma = (int8_t *)origdata;
 1848|     32|            mb = data;
 1849|    345|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1849:25): [True: 313, False: 32]
  ------------------
 1850|    313|            {
 1851|    313|                err = TIFFReadDirEntryCheckRangeShortSbyte(*ma);
 1852|    313|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1852:21): [True: 0, False: 313]
  ------------------
 1853|      0|                    break;
 1854|    313|                *mb++ = (uint16_t)(*ma++);
 1855|    313|            }
 1856|     32|        }
 1857|     32|        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|    364|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1865:25): [True: 353, False: 11]
  ------------------
 1866|    353|            {
 1867|    353|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    353|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1867:21): [True: 139, False: 214]
  ------------------
 1868|    139|                    TIFFSwabLong(ma);
 1869|    353|                err = TIFFReadDirEntryCheckRangeShortLong(*ma);
 1870|    353|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1870:21): [True: 1, False: 352]
  ------------------
 1871|      1|                    break;
 1872|    352|                *mb++ = (uint16_t)(*ma++);
 1873|    352|            }
 1874|     12|        }
 1875|     12|        break;
 1876|      2|        case TIFF_SLONG:
  ------------------
  |  Branch (1876:9): [True: 2, False: 454]
  ------------------
 1877|      2|        {
 1878|      2|            int32_t *ma;
 1879|      2|            uint16_t *mb;
 1880|      2|            uint32_t n;
 1881|      2|            ma = (int32_t *)origdata;
 1882|      2|            mb = data;
 1883|    274|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1883:25): [True: 273, False: 1]
  ------------------
 1884|    273|            {
 1885|    273|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    273|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1885:21): [True: 129, False: 144]
  ------------------
 1886|    129|                    TIFFSwabLong((uint32_t *)ma);
 1887|    273|                err = TIFFReadDirEntryCheckRangeShortSlong(*ma);
 1888|    273|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1888:21): [True: 1, False: 272]
  ------------------
 1889|      1|                    break;
 1890|    272|                *mb++ = (uint16_t)(*ma++);
 1891|    272|            }
 1892|      2|        }
 1893|      2|        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|    470|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1901:25): [True: 469, False: 1]
  ------------------
 1902|    469|            {
 1903|    469|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    469|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1903:21): [True: 198, False: 271]
  ------------------
 1904|    198|                    TIFFSwabLong8(ma);
 1905|    469|                err = TIFFReadDirEntryCheckRangeShortLong8(*ma);
 1906|    469|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1906:21): [True: 3, False: 466]
  ------------------
 1907|      3|                    break;
 1908|    466|                *mb++ = (uint16_t)(*ma++);
 1909|    466|            }
 1910|      4|        }
 1911|      4|        break;
 1912|      8|        case TIFF_SLONG8:
  ------------------
  |  Branch (1912:9): [True: 8, False: 448]
  ------------------
 1913|      8|        {
 1914|      8|            int64_t *ma;
 1915|      8|            uint16_t *mb;
 1916|      8|            uint32_t n;
 1917|      8|            ma = (int64_t *)origdata;
 1918|      8|            mb = data;
 1919|    504|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1919:25): [True: 502, False: 2]
  ------------------
 1920|    502|            {
 1921|    502|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    502|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1921:21): [True: 287, False: 215]
  ------------------
 1922|    287|                    TIFFSwabLong8((uint64_t *)ma);
 1923|    502|                err = TIFFReadDirEntryCheckRangeShortSlong8(*ma);
 1924|    502|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1924:21): [True: 6, False: 496]
  ------------------
 1925|      6|                    break;
 1926|    496|                *mb++ = (uint16_t)(*ma++);
 1927|    496|            }
 1928|      8|        }
 1929|      8|        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: 11, False: 445]
  ------------------
 1935|     11|    {
 1936|     11|        _TIFFfreeExt(tif, data);
 1937|     11|        return (err);
 1938|     11|    }
 1939|    445|    *value = data;
 1940|    445|    return (TIFFReadDirEntryErrOk);
 1941|    456|}
tif_dirread.c:CalcFinalIFDdatasizeReading:
 4260|  6.18k|{
 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|  6.18k|    if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (4264:9): [True: 6.18k, False: 0]
  ------------------
 4265|  6.18k|        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.82k|{
 4116|  5.82k|    switch (photometric)
 4117|  5.82k|    {
 4118|    149|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|    149|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (4118:9): [True: 149, False: 5.67k]
  ------------------
 4119|  2.78k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  2.78k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (4119:9): [True: 2.63k, False: 3.19k]
  ------------------
 4120|  2.86k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  2.86k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (4120:9): [True: 76, False: 5.74k]
  ------------------
 4121|  2.86k|            return 1;
 4122|  2.55k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  2.55k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4122:9): [True: 2.55k, False: 3.26k]
  ------------------
 4123|  2.77k|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|  2.77k|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4123:9): [True: 215, False: 5.61k]
  ------------------
 4124|  2.78k|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|  2.78k|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (4124:9): [True: 15, False: 5.81k]
  ------------------
 4125|  2.81k|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|  2.81k|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (4125:9): [True: 26, False: 5.79k]
  ------------------
 4126|  2.81k|        case PHOTOMETRIC_ITULAB:
  ------------------
  |  |  230|  2.81k|#define PHOTOMETRIC_ITULAB 10              /* ITU L*a*b* */
  ------------------
  |  Branch (4126:9): [True: 1, False: 5.82k]
  ------------------
 4127|  2.81k|        case PHOTOMETRIC_ICCLAB:
  ------------------
  |  |  229|  2.81k|#define PHOTOMETRIC_ICCLAB 9               /* ICC L*a*b* [Adobe TIFF Technote 4] */
  ------------------
  |  Branch (4127:9): [True: 0, False: 5.82k]
  ------------------
 4128|  2.81k|            return 3;
 4129|     48|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     48|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (4129:9): [True: 48, False: 5.77k]
  ------------------
 4130|     49|        case PHOTOMETRIC_MASK:
  ------------------
  |  |  225|     49|#define PHOTOMETRIC_MASK 4                 /* $holdout mask */
  ------------------
  |  Branch (4130:9): [True: 1, False: 5.82k]
  ------------------
 4131|     49|            return 4;
 4132|     28|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     28|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (4132:9): [True: 28, False: 5.79k]
  ------------------
 4133|     28|        case PHOTOMETRIC_CFA:
  ------------------
  |  |  231|     28|#define PHOTOMETRIC_CFA 32803              /* color filter array */
  ------------------
  |  Branch (4133:9): [True: 0, False: 5.82k]
  ------------------
 4134|    103|        default:
  ------------------
  |  Branch (4134:9): [True: 75, False: 5.75k]
  ------------------
 4135|    103|            return 0;
 4136|  5.82k|    }
 4137|  5.82k|}
tif_dirread.c:ByteCountLooksBad:
 4140|  2.18k|{
 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.18k|    uint64_t bytecount = TIFFGetStrileByteCount(tif, 0);
 4155|  2.18k|    uint64_t offset = TIFFGetStrileOffset(tif, 0);
 4156|  2.18k|    uint64_t filesize;
 4157|       |
 4158|  2.18k|    if (offset == 0)
  ------------------
  |  Branch (4158:9): [True: 8, False: 2.17k]
  ------------------
 4159|      8|        return 0;
 4160|  2.17k|    if (bytecount == 0)
  ------------------
  |  Branch (4160:9): [True: 88, False: 2.08k]
  ------------------
 4161|     88|        return 1;
 4162|  2.08k|    if (tif->tif_dir.td_compression != COMPRESSION_NONE)
  ------------------
  |  |  182|  2.08k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (4162:9): [True: 2.04k, False: 47]
  ------------------
 4163|  2.04k|        return 0;
 4164|     47|    filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|     47|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 4165|     47|    if (offset <= filesize && bytecount > filesize - offset)
  ------------------
  |  Branch (4165:9): [True: 33, False: 14]
  |  Branch (4165:31): [True: 16, False: 17]
  ------------------
 4166|     16|        return 1;
 4167|     31|    if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (4167:9): [True: 31, False: 0]
  ------------------
 4168|     31|    {
 4169|     31|        uint64_t scanlinesize = TIFFScanlineSize64(tif);
 4170|     31|        if (tif->tif_dir.td_imagelength > 0 &&
  ------------------
  |  Branch (4170:13): [True: 30, False: 1]
  ------------------
 4171|     30|            scanlinesize > UINT64_MAX / tif->tif_dir.td_imagelength)
  ------------------
  |  Branch (4171:13): [True: 0, False: 30]
  ------------------
 4172|      0|        {
 4173|      0|            return 1;
 4174|      0|        }
 4175|     31|        if (bytecount < scanlinesize * tif->tif_dir.td_imagelength)
  ------------------
  |  Branch (4175:13): [True: 14, False: 17]
  ------------------
 4176|     14|            return 1;
 4177|     31|    }
 4178|     17|    return 0;
 4179|     31|}
tif_dirread.c:TIFFReadDirectoryCheckOrder:
 5311|  6.24k|{
 5312|  6.24k|    static const char module[] = "TIFFReadDirectoryCheckOrder";
 5313|  6.24k|    uint32_t m;
 5314|  6.24k|    uint16_t n;
 5315|  6.24k|    TIFFDirEntry *o;
 5316|  6.24k|    m = 0;
 5317|  31.9k|    for (n = 0, o = dir; n < dircount; n++, o++)
  ------------------
  |  Branch (5317:26): [True: 31.9k, False: 54]
  ------------------
 5318|  31.9k|    {
 5319|  31.9k|        if (o->tdir_tag < m)
  ------------------
  |  Branch (5319:13): [True: 6.19k, False: 25.7k]
  ------------------
 5320|  6.19k|        {
 5321|  6.19k|            TIFFWarningExtR(tif, module,
 5322|  6.19k|                            "Invalid TIFF directory; tags are not sorted in "
 5323|  6.19k|                            "ascending order");
 5324|  6.19k|            break;
 5325|  6.19k|        }
 5326|  25.7k|        m = o->tdir_tag + 1U;
 5327|  25.7k|    }
 5328|  6.24k|}
tif_dirread.c:TIFFReadDirectoryFindEntry:
 5333|  13.2k|{
 5334|  13.2k|    TIFFDirEntry *m;
 5335|  13.2k|    uint16_t n;
 5336|  13.2k|    (void)tif;
 5337|   280k|    for (m = dir, n = 0; n < dircount; m++, n++)
  ------------------
  |  Branch (5337:26): [True: 276k, False: 4.21k]
  ------------------
 5338|   276k|    {
 5339|   276k|        if (m->tdir_tag == tagid)
  ------------------
  |  Branch (5339:13): [True: 9.02k, False: 267k]
  ------------------
 5340|  9.02k|            return (m);
 5341|   276k|    }
 5342|  4.21k|    return (0);
 5343|  13.2k|}
tif_dirread.c:TIFFReadDirectoryFindFieldInfo:
 5347|   429k|{
 5348|   429k|    int32_t ma, mb, mc;
 5349|   429k|    ma = -1;
 5350|   429k|    mc = (int32_t)tif->tif_nfields;
 5351|  3.39M|    while (1)
  ------------------
  |  Branch (5351:12): [True: 3.39M, Folded]
  ------------------
 5352|  3.39M|    {
 5353|  3.39M|        if (ma + 1 == mc)
  ------------------
  |  Branch (5353:13): [True: 115k, False: 3.28M]
  ------------------
 5354|   115k|        {
 5355|   115k|            *fii = FAILED_FII;
  ------------------
  |  |   44|   115k|#define FAILED_FII ((uint32_t)-1)
  ------------------
 5356|   115k|            return;
 5357|   115k|        }
 5358|  3.28M|        mb = (ma + mc) / 2;
 5359|  3.28M|        if (tif->tif_fields[mb]->field_tag == (uint32_t)tagid)
  ------------------
  |  Branch (5359:13): [True: 314k, False: 2.96M]
  ------------------
 5360|   314k|            break;
 5361|  2.96M|        if (tif->tif_fields[mb]->field_tag < (uint32_t)tagid)
  ------------------
  |  Branch (5361:13): [True: 1.46M, False: 1.50M]
  ------------------
 5362|  1.46M|            ma = mb;
 5363|  1.50M|        else
 5364|  1.50M|            mc = mb;
 5365|  2.96M|    }
 5366|   314k|    while (1)
  ------------------
  |  Branch (5366:12): [True: 314k, Folded]
  ------------------
 5367|   314k|    {
 5368|   314k|        if (mb == 0)
  ------------------
  |  Branch (5368:13): [True: 9.32k, False: 305k]
  ------------------
 5369|  9.32k|            break;
 5370|   305k|        if (tif->tif_fields[mb - 1]->field_tag != (uint32_t)tagid)
  ------------------
  |  Branch (5370:13): [True: 305k, False: 0]
  ------------------
 5371|   305k|            break;
 5372|      0|        mb--;
 5373|      0|    }
 5374|   314k|    *fii = (uint32_t)mb;
 5375|   314k|}
tif_dirread.c:EstimateStripByteCounts:
 5582|    426|{
 5583|    426|    static const char module[] = "EstimateStripByteCounts";
 5584|       |
 5585|    426|    TIFFDirEntry *dp;
 5586|    426|    TIFFDirectory *td = &tif->tif_dir;
 5587|    426|    uint32_t strip;
 5588|       |
 5589|       |    /* Do not try to load stripbytecount as we will compute it */
 5590|    426|    if (!_TIFFFillStrilesInternal(tif, 0))
  ------------------
  |  Branch (5590:9): [True: 0, False: 426]
  ------------------
 5591|      0|        return -1;
 5592|       |
 5593|    426|    const uint64_t allocsize = (uint64_t)td->td_nstrips * sizeof(uint64_t);
 5594|    426|    uint64_t filesize = 0;
 5595|    426|    if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (5595:9): [True: 0, False: 426]
  ------------------
 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|    426|    if (td->td_stripbytecount_p)
  ------------------
  |  Branch (5611:9): [True: 121, False: 305]
  ------------------
 5612|    121|        _TIFFfreeExt(tif, td->td_stripbytecount_p);
 5613|    426|    td->td_stripbytecount_p = (uint64_t *)_TIFFCheckMalloc(
 5614|    426|        tif, td->td_nstrips, sizeof(uint64_t), "for \"StripByteCounts\" array");
 5615|    426|    if (td->td_stripbytecount_p == NULL)
  ------------------
  |  Branch (5615:9): [True: 0, False: 426]
  ------------------
 5616|      0|        return -1;
 5617|       |
 5618|    426|    if (td->td_compression != COMPRESSION_NONE)
  ------------------
  |  |  182|    426|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5618:9): [True: 368, False: 58]
  ------------------
 5619|    368|    {
 5620|    368|        uint64_t space;
 5621|    368|        uint16_t n;
 5622|    368|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|    368|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (5622:13): [True: 363, False: 5]
  ------------------
 5623|    363|            space = sizeof(TIFFHeaderClassic) + 2 +
 5624|    363|                    (unsigned long)dircount * 12 + 4;
 5625|      5|        else
 5626|      5|            space =
 5627|      5|                sizeof(TIFFHeaderBig) + 8 + (unsigned long)dircount * 20 + 8;
 5628|       |        /* calculate amount of space used by indirect values */
 5629|  5.34k|        for (dp = dir, n = dircount; n > 0; n--, dp++)
  ------------------
  |  Branch (5629:38): [True: 4.99k, False: 357]
  ------------------
 5630|  4.99k|        {
 5631|  4.99k|            uint32_t typewidth;
 5632|  4.99k|            uint64_t datasize;
 5633|  4.99k|            typewidth = (uint32_t)TIFFDataWidth((TIFFDataType)dp->tdir_type);
 5634|  4.99k|            if (typewidth == 0)
  ------------------
  |  Branch (5634:17): [True: 11, False: 4.98k]
  ------------------
 5635|     11|            {
 5636|     11|                TIFFErrorExtR(
 5637|     11|                    tif, module,
 5638|     11|                    "Cannot determine size of unknown tag type %" PRIu16,
 5639|     11|                    dp->tdir_type);
 5640|     11|                return -1;
 5641|     11|            }
 5642|  4.98k|            if (dp->tdir_count > UINT64_MAX / typewidth)
  ------------------
  |  Branch (5642:17): [True: 0, False: 4.98k]
  ------------------
 5643|      0|                return -1;
 5644|  4.98k|            datasize = (uint64_t)typewidth * dp->tdir_count;
 5645|  4.98k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  4.98k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (5645:17): [True: 4.68k, False: 295]
  ------------------
 5646|  4.68k|            {
 5647|  4.68k|                if (datasize <= 4)
  ------------------
  |  Branch (5647:21): [True: 3.32k, False: 1.36k]
  ------------------
 5648|  3.32k|                    datasize = 0;
 5649|  4.68k|            }
 5650|    295|            else
 5651|    295|            {
 5652|    295|                if (datasize <= 8)
  ------------------
  |  Branch (5652:21): [True: 260, False: 35]
  ------------------
 5653|    260|                    datasize = 0;
 5654|    295|            }
 5655|  4.98k|            if (space > UINT64_MAX - datasize)
  ------------------
  |  Branch (5655:17): [True: 0, False: 4.98k]
  ------------------
 5656|      0|                return -1;
 5657|  4.98k|            space += datasize;
 5658|  4.98k|        }
 5659|    357|        if (filesize == 0)
  ------------------
  |  Branch (5659:13): [True: 357, False: 0]
  ------------------
 5660|    357|            filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|    357|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 5661|    357|        if (filesize < space)
  ------------------
  |  Branch (5661:13): [True: 280, False: 77]
  ------------------
 5662|       |            /* we should perhaps return in error ? */
 5663|    280|            space = filesize;
 5664|     77|        else
 5665|     77|            space = filesize - space;
 5666|    357|        if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|    357|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5666:13): [True: 3, False: 354]
  ------------------
 5667|      3|            space /= td->td_samplesperpixel;
 5668|    716|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5668:25): [True: 359, False: 357]
  ------------------
 5669|    359|            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|    357|        strip--;
 5678|    357|        if (td->td_stripoffset_p[strip] >
  ------------------
  |  Branch (5678:13): [True: 0, False: 357]
  ------------------
 5679|    357|            UINT64_MAX - td->td_stripbytecount_p[strip])
 5680|      0|            return -1;
 5681|    357|        if (td->td_stripoffset_p[strip] + td->td_stripbytecount_p[strip] >
  ------------------
  |  Branch (5681:13): [True: 183, False: 174]
  ------------------
 5682|    357|            filesize)
 5683|    183|        {
 5684|    183|            if (td->td_stripoffset_p[strip] >= filesize)
  ------------------
  |  Branch (5684:17): [True: 5, False: 178]
  ------------------
 5685|      5|            {
 5686|       |                /* Not sure what we should in that case... */
 5687|      5|                td->td_stripbytecount_p[strip] = 0;
 5688|      5|            }
 5689|    178|            else
 5690|    178|            {
 5691|    178|                td->td_stripbytecount_p[strip] =
 5692|    178|                    filesize - td->td_stripoffset_p[strip];
 5693|    178|            }
 5694|    183|        }
 5695|    357|    }
 5696|     58|    else if (isTiled(tif))
  ------------------
  |  |  278|     58|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     58|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 5, False: 53]
  |  |  ------------------
  ------------------
 5697|      5|    {
 5698|      5|        uint64_t bytespertile = TIFFTileSize64(tif);
 5699|       |
 5700|     25|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5700:25): [True: 20, False: 5]
  ------------------
 5701|     20|            td->td_stripbytecount_p[strip] = bytespertile;
 5702|      5|    }
 5703|     53|    else
 5704|     53|    {
 5705|     53|        uint64_t rowbytes = TIFFScanlineSize64(tif);
 5706|     53|        uint32_t rowsperstrip = td->td_imagelength / td->td_stripsperimage;
 5707|    191|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5707:25): [True: 138, False: 53]
  ------------------
 5708|    138|        {
 5709|    138|            if (rowbytes > 0 && rowsperstrip > UINT64_MAX / rowbytes)
  ------------------
  |  Branch (5709:17): [True: 137, False: 1]
  |  Branch (5709:33): [True: 0, False: 137]
  ------------------
 5710|      0|                return -1;
 5711|    138|            td->td_stripbytecount_p[strip] = rowbytes * rowsperstrip;
 5712|    138|        }
 5713|     53|    }
 5714|    415|    TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
  ------------------
  |  |  249|    415|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    415|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    415|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 5715|    415|    if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
  ------------------
  |  |  248|    415|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|    415|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|    415|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5715:9): [True: 131, False: 284]
  ------------------
 5716|    131|        td->td_rowsperstrip = td->td_imagelength;
 5717|    415|    return 1;
 5718|    426|}
tif_dirread.c:MissingRequired:
 5721|    194|{
 5722|    194|    static const char module[] = "MissingRequired";
 5723|       |
 5724|    194|    TIFFErrorExtR(tif, module,
 5725|    194|                  "TIFF directory is missing required \"%s\" field", tagname);
 5726|    194|}
tif_dirread.c:hashFuncOffsetToNumber:
 5729|  18.7k|{
 5730|  18.7k|    const TIFFOffsetAndDirNumber *offsetAndDirNumber =
 5731|  18.7k|        (const TIFFOffsetAndDirNumber *)elt;
 5732|  18.7k|    const uint32_t hash = (uint32_t)(offsetAndDirNumber->offset >> 32) ^
 5733|  18.7k|                          ((uint32_t)offsetAndDirNumber->offset & 0xFFFFFFFFU);
 5734|  18.7k|    return hash;
 5735|  18.7k|}
tif_dirread.c:hashFuncNumberToOffset:
 5747|  18.7k|{
 5748|  18.7k|    const TIFFOffsetAndDirNumber *offsetAndDirNumber =
 5749|  18.7k|        (const TIFFOffsetAndDirNumber *)elt;
 5750|  18.7k|    return offsetAndDirNumber->dirNumber;
 5751|  18.7k|}
tif_dirread.c:TIFFFetchDirectory:
 6087|  6.24k|{
 6088|  6.24k|    static const char module[] = "TIFFFetchDirectory";
 6089|       |
 6090|  6.24k|    void *origdir;
 6091|  6.24k|    uint16_t dircount16;
 6092|  6.24k|    uint32_t dirsize;
 6093|  6.24k|    TIFFDirEntry *dir;
 6094|  6.24k|    uint8_t *ma;
 6095|  6.24k|    TIFFDirEntry *mb;
 6096|  6.24k|    uint16_t n;
 6097|       |
 6098|  6.24k|    assert(pdir);
  ------------------
  |  Branch (6098:5): [True: 0, False: 6.24k]
  |  Branch (6098:5): [True: 6.24k, False: 0]
  ------------------
 6099|       |
 6100|  6.24k|    tif->tif_diroff = diroff;
 6101|  6.24k|    if (nextdiroff)
  ------------------
  |  Branch (6101:9): [True: 6.24k, False: 0]
  ------------------
 6102|  6.24k|        *nextdiroff = 0;
 6103|  6.24k|    if (!isMapped(tif))
  ------------------
  |  |  279|  6.24k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  6.24k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (6103:9): [True: 6.24k, False: 0]
  ------------------
 6104|  6.24k|    {
 6105|  6.24k|        if (!SeekOK(tif, tif->tif_diroff))
  ------------------
  |  |  303|  6.24k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (6105:13): [True: 0, False: 6.24k]
  ------------------
 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|  6.24k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  6.24k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6112:13): [True: 6.19k, False: 47]
  ------------------
 6113|  6.19k|        {
 6114|  6.19k|            if (!ReadOK(tif, &dircount16, sizeof(uint16_t)))
  ------------------
  |  |  300|  6.19k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  6.19k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6114:17): [True: 1, False: 6.19k]
  ------------------
 6115|      1|            {
 6116|      1|                TIFFErrorExtR(tif, module,
 6117|      1|                              "%s: Can not read TIFF directory count",
 6118|      1|                              tif->tif_name);
 6119|      1|                return 0;
 6120|      1|            }
 6121|  6.19k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  6.19k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6121:17): [True: 253, False: 5.94k]
  ------------------
 6122|    253|                TIFFSwabShort(&dircount16);
 6123|  6.19k|            if (dircount16 > 4096)
  ------------------
  |  Branch (6123:17): [True: 0, False: 6.19k]
  ------------------
 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|  6.19k|            dirsize = 12;
 6131|  6.19k|        }
 6132|     47|        else
 6133|     47|        {
 6134|     47|            uint64_t dircount64;
 6135|     47|            if (!ReadOK(tif, &dircount64, sizeof(uint64_t)))
  ------------------
  |  |  300|     47|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|     47|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6135:17): [True: 0, False: 47]
  ------------------
 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|     47|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     47|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6142:17): [True: 3, False: 44]
  ------------------
 6143|      3|                TIFFSwabLong8(&dircount64);
 6144|     47|            if (dircount64 > 4096)
  ------------------
  |  Branch (6144:17): [True: 0, False: 47]
  ------------------
 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|     47|            dircount16 = (uint16_t)dircount64;
 6152|     47|            dirsize = 20;
 6153|     47|        }
 6154|  6.24k|        origdir = _TIFFCheckMalloc(tif, dircount16, dirsize,
 6155|  6.24k|                                   "to read TIFF directory");
 6156|  6.24k|        if (origdir == NULL)
  ------------------
  |  Branch (6156:13): [True: 0, False: 6.24k]
  ------------------
 6157|      0|            return 0;
 6158|  6.24k|        if (!ReadOK(tif, origdir, (tmsize_t)dircount16 * dirsize))
  ------------------
  |  |  300|  6.24k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  6.24k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6158:13): [True: 1, False: 6.24k]
  ------------------
 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|  6.24k|        if (nextdiroff)
  ------------------
  |  Branch (6169:13): [True: 6.24k, False: 0]
  ------------------
 6170|  6.24k|        {
 6171|  6.24k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  6.24k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6171:17): [True: 6.19k, False: 47]
  ------------------
 6172|  6.19k|            {
 6173|  6.19k|                uint32_t nextdiroff32;
 6174|  6.19k|                if (!ReadOK(tif, &nextdiroff32, sizeof(uint32_t)))
  ------------------
  |  |  300|  6.19k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  6.19k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6174:21): [True: 57, False: 6.14k]
  ------------------
 6175|     57|                    nextdiroff32 = 0;
 6176|  6.19k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  6.19k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6176:21): [True: 253, False: 5.94k]
  ------------------
 6177|    253|                    TIFFSwabLong(&nextdiroff32);
 6178|  6.19k|                *nextdiroff = nextdiroff32;
 6179|  6.19k|            }
 6180|     47|            else
 6181|     47|            {
 6182|     47|                if (!ReadOK(tif, nextdiroff, sizeof(uint64_t)))
  ------------------
  |  |  300|     47|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|     47|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6182:21): [True: 10, False: 37]
  ------------------
 6183|     10|                    *nextdiroff = 0;
 6184|     47|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     47|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6184:21): [True: 3, False: 44]
  ------------------
 6185|      3|                    TIFFSwabLong8(nextdiroff);
 6186|     47|            }
 6187|  6.24k|        }
 6188|  6.24k|    }
 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|  6.24k|    dir = (TIFFDirEntry *)_TIFFCheckMalloc(
 6333|  6.24k|        tif, dircount16, sizeof(TIFFDirEntry), "to read TIFF directory");
 6334|  6.24k|    if (dir == 0)
  ------------------
  |  Branch (6334:9): [True: 0, False: 6.24k]
  ------------------
 6335|      0|    {
 6336|      0|        _TIFFfreeExt(tif, origdir);
 6337|      0|        return 0;
 6338|      0|    }
 6339|  6.24k|    ma = (uint8_t *)origdir;
 6340|  6.24k|    mb = dir;
 6341|   355k|    for (n = 0; n < dircount16; n++)
  ------------------
  |  Branch (6341:17): [True: 348k, False: 6.24k]
  ------------------
 6342|   348k|    {
 6343|   348k|        mb->tdir_ignore = FALSE;
  ------------------
  |  |   72|   348k|#define FALSE 0
  ------------------
 6344|   348k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|   348k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6344:13): [True: 8.01k, False: 340k]
  ------------------
 6345|  8.01k|            TIFFSwabShort((uint16_t *)ma);
 6346|   348k|        mb->tdir_tag = *(uint16_t *)ma;
 6347|   348k|        ma += sizeof(uint16_t);
 6348|   348k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|   348k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6348:13): [True: 8.01k, False: 340k]
  ------------------
 6349|  8.01k|            TIFFSwabShort((uint16_t *)ma);
 6350|   348k|        mb->tdir_type = *(uint16_t *)ma;
 6351|   348k|        ma += sizeof(uint16_t);
 6352|   348k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|   348k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6352:13): [True: 347k, False: 1.45k]
  ------------------
 6353|   347k|        {
 6354|   347k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|   347k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6354:17): [True: 7.80k, False: 339k]
  ------------------
 6355|  7.80k|                TIFFSwabLong((uint32_t *)ma);
 6356|   347k|            mb->tdir_count = (uint64_t)(*(uint32_t *)ma);
 6357|   347k|            ma += sizeof(uint32_t);
 6358|   347k|            mb->tdir_offset.toff_long8 = 0;
 6359|   347k|            *(uint32_t *)(&mb->tdir_offset) = *(uint32_t *)ma;
 6360|   347k|            ma += sizeof(uint32_t);
 6361|   347k|        }
 6362|  1.45k|        else
 6363|  1.45k|        {
 6364|  1.45k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.45k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6364:17): [True: 204, False: 1.25k]
  ------------------
 6365|    204|                TIFFSwabLong8((uint64_t *)ma);
 6366|  1.45k|            mb->tdir_count = TIFFReadUInt64(ma);
 6367|  1.45k|            ma += sizeof(uint64_t);
 6368|  1.45k|            mb->tdir_offset.toff_long8 = TIFFReadUInt64(ma);
 6369|  1.45k|            ma += sizeof(uint64_t);
 6370|  1.45k|        }
 6371|   348k|        mb++;
 6372|   348k|    }
 6373|  6.24k|    _TIFFfreeExt(tif, origdir);
 6374|  6.24k|    *pdir = dir;
 6375|  6.24k|    return dircount16;
 6376|  6.24k|}
tif_dirread.c:TIFFReadUInt64:
  283|  2.91k|{
  284|  2.91k|    UInt64Aligned_t result;
  285|       |
  286|  2.91k|    result.c[0] = value[0];
  287|  2.91k|    result.c[1] = value[1];
  288|  2.91k|    result.c[2] = value[2];
  289|  2.91k|    result.c[3] = value[3];
  290|  2.91k|    result.c[4] = value[4];
  291|  2.91k|    result.c[5] = value[5];
  292|  2.91k|    result.c[6] = value[6];
  293|  2.91k|    result.c[7] = value[7];
  294|       |
  295|  2.91k|    return result.l;
  296|  2.91k|}
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|  85.3k|        case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (6405:9): [True: 85.3k, False: 60.0k]
  ------------------
 6406|  85.3k|            TIFFErrorExtR(
 6407|  85.3k|                tif, "TIFFFetchNormalTag",
 6408|  85.3k|                "Defined set_get_field_type of custom tag %u (%s) is "
 6409|  85.3k|                "TIFF_SETGET_UNDEFINED and thus tag is not read from file",
 6410|  85.3k|                fip->field_tag, fip->field_name);
 6411|  85.3k|            break;
 6412|  1.64k|        case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (6412:9): [True: 1.64k, False: 143k]
  ------------------
 6413|  1.64k|        {
 6414|  1.64k|            uint8_t *data;
 6415|  1.64k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6415:13): [True: 0, False: 1.64k]
  |  Branch (6415:13): [True: 1.64k, False: 0]
  ------------------
 6416|  1.64k|            err = TIFFReadDirEntryByteArray(tif, dp, &data);
 6417|  1.64k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6417:17): [True: 892, False: 750]
  ------------------
 6418|    892|            {
 6419|    892|                size_t mb = 0;
 6420|    892|                int n;
 6421|    892|                if (data != NULL)
  ------------------
  |  Branch (6421:21): [True: 878, False: 14]
  ------------------
 6422|    878|                {
 6423|    878|                    if (dp->tdir_count > 0 && data[dp->tdir_count - 1] == 0)
  ------------------
  |  Branch (6423:25): [True: 878, False: 0]
  |  Branch (6423:47): [True: 421, False: 457]
  ------------------
 6424|    421|                    {
 6425|       |                        /* optimization: if data is known to be 0 terminated, we
 6426|       |                         * can use strlen() */
 6427|    421|                        mb = strlen((const char *)data);
 6428|    421|                    }
 6429|    457|                    else
 6430|    457|                    {
 6431|       |                        /* general case. equivalent to non-portable */
 6432|       |                        /* mb = strnlen((const char*)data,
 6433|       |                         * (uint32_t)dp->tdir_count); */
 6434|    457|                        uint8_t *ma = data;
 6435|   115k|                        while (mb < (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6435:32): [True: 115k, False: 196]
  ------------------
 6436|   115k|                        {
 6437|   115k|                            if (*ma == 0)
  ------------------
  |  Branch (6437:33): [True: 261, False: 114k]
  ------------------
 6438|    261|                                break;
 6439|   114k|                            ma++;
 6440|   114k|                            mb++;
 6441|   114k|                        }
 6442|    457|                    }
 6443|    878|                }
 6444|    892|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6444:21): [True: 10, False: 882]
  ------------------
 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|    882|                if (mb + 1 < (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6450:21): [True: 399, False: 483]
  ------------------
 6451|    399|                    TIFFWarningExtR(
 6452|    399|                        tif, module,
 6453|    399|                        "ASCII value for tag \"%s\" contains null byte in "
 6454|    399|                        "value; value incorrectly truncated during reading due "
 6455|    399|                        "to implementation limitations",
 6456|    399|                        fip->field_name);
 6457|    483|                else if (mb + 1 > (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6457:26): [True: 210, False: 273]
  ------------------
 6458|    210|                {
 6459|    210|                    TIFFWarningExtR(tif, module,
 6460|    210|                                    "ASCII value for tag \"%s\" does not end "
 6461|    210|                                    "in null byte. Forcing it to be null",
 6462|    210|                                    fip->field_name);
 6463|       |                    /* TIFFReadDirEntryArrayWithLimit() ensures this can't be
 6464|       |                     * larger than MAX_SIZE_TAG_DATA */
 6465|    210|                    assert((uint32_t)dp->tdir_count + 1 == dp->tdir_count + 1);
  ------------------
  |  Branch (6465:21): [True: 0, False: 210]
  |  Branch (6465:21): [True: 210, False: 0]
  ------------------
 6466|    210|                    uint8_t *o = (uint8_t *)_TIFFmallocExt(
 6467|    210|                        tif, (uint32_t)dp->tdir_count + 1);
 6468|    210|                    if (o == NULL)
  ------------------
  |  Branch (6468:25): [True: 0, False: 210]
  ------------------
 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|    210|                    if (dp->tdir_count > 0)
  ------------------
  |  Branch (6474:25): [True: 196, False: 14]
  ------------------
 6475|    196|                    {
 6476|    196|                        _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 6477|    196|                    }
 6478|    210|                    o[(uint32_t)dp->tdir_count] = 0;
 6479|    210|                    if (data != 0)
  ------------------
  |  Branch (6479:25): [True: 196, False: 14]
  ------------------
 6480|    196|                        _TIFFfreeExt(tif, data);
 6481|    210|                    data = o;
 6482|    210|                }
 6483|    882|                n = TIFFSetField(tif, dp->tdir_tag, data);
 6484|    882|                if (data != 0)
  ------------------
  |  Branch (6484:21): [True: 882, False: 0]
  ------------------
 6485|    882|                    _TIFFfreeExt(tif, data);
 6486|    882|                if (!n)
  ------------------
  |  Branch (6486:21): [True: 0, False: 882]
  ------------------
 6487|      0|                    return (0);
 6488|    882|            }
 6489|  1.64k|        }
 6490|  1.63k|        break;
 6491|  1.63k|        case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (6491:9): [True: 40, False: 145k]
  ------------------
 6492|     40|        {
 6493|     40|            uint8_t data = 0;
 6494|     40|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6494:13): [True: 0, False: 40]
  |  Branch (6494:13): [True: 40, False: 0]
  ------------------
 6495|     40|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6495:13): [True: 0, False: 40]
  |  Branch (6495:13): [True: 40, False: 0]
  ------------------
 6496|     40|            err = TIFFReadDirEntryByte(tif, dp, &data);
 6497|     40|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6497:17): [True: 9, False: 31]
  ------------------
 6498|      9|            {
 6499|      9|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6499:21): [True: 0, False: 9]
  ------------------
 6500|      0|                    return (0);
 6501|      9|            }
 6502|     40|        }
 6503|     40|        break;
 6504|     40|        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|  10.3k|        case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (6517:9): [True: 10.3k, False: 135k]
  ------------------
 6518|  10.3k|        {
 6519|  10.3k|            uint16_t data;
 6520|  10.3k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6520:13): [True: 0, False: 10.3k]
  |  Branch (6520:13): [True: 10.3k, False: 0]
  ------------------
 6521|  10.3k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6521:13): [True: 0, False: 10.3k]
  |  Branch (6521:13): [True: 10.3k, False: 0]
  ------------------
 6522|  10.3k|            err = TIFFReadDirEntryShort(tif, dp, &data);
 6523|  10.3k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6523:17): [True: 8.00k, False: 2.33k]
  ------------------
 6524|  8.00k|            {
 6525|  8.00k|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6525:21): [True: 90, False: 7.91k]
  ------------------
 6526|     90|                    return (0);
 6527|  8.00k|            }
 6528|  10.3k|        }
 6529|  10.2k|        break;
 6530|  10.2k|        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|  19.3k|        case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (6543:9): [True: 19.3k, False: 126k]
  ------------------
 6544|  19.3k|        {
 6545|  19.3k|            uint32_t data;
 6546|  19.3k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6546:13): [True: 0, False: 19.3k]
  |  Branch (6546:13): [True: 19.3k, False: 0]
  ------------------
 6547|  19.3k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6547:13): [True: 0, False: 19.3k]
  |  Branch (6547:13): [True: 19.3k, False: 0]
  ------------------
 6548|  19.3k|            err = TIFFReadDirEntryLong(tif, dp, &data);
 6549|  19.3k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6549:17): [True: 19.0k, False: 312]
  ------------------
 6550|  19.0k|            {
 6551|  19.0k|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6551:21): [True: 0, False: 19.0k]
  ------------------
 6552|      0|                    return (0);
 6553|  19.0k|            }
 6554|  19.3k|        }
 6555|  19.3k|        break;
 6556|  19.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|    882|        case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (6569:9): [True: 882, False: 144k]
  ------------------
 6570|    882|        {
 6571|    882|            uint64_t data;
 6572|    882|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6572:13): [True: 0, False: 882]
  |  Branch (6572:13): [True: 882, False: 0]
  ------------------
 6573|    882|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6573:13): [True: 0, False: 882]
  |  Branch (6573:13): [True: 882, False: 0]
  ------------------
 6574|    882|            err = TIFFReadDirEntryLong8(tif, dp, &data);
 6575|    882|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6575:17): [True: 389, False: 493]
  ------------------
 6576|    389|            {
 6577|    389|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6577:21): [True: 0, False: 389]
  ------------------
 6578|      0|                    return 0;
 6579|    389|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6579:21): [True: 0, False: 389]
  ------------------
 6580|      0|                    return (0);
 6581|    389|            }
 6582|    882|        }
 6583|    882|        break;
 6584|    882|        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.91k|        case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (6599:9): [True: 1.91k, False: 143k]
  ------------------
 6600|  1.91k|        {
 6601|  1.91k|            float data;
 6602|  1.91k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6602:13): [True: 0, False: 1.91k]
  |  Branch (6602:13): [True: 1.91k, False: 0]
  ------------------
 6603|  1.91k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6603:13): [True: 0, False: 1.91k]
  |  Branch (6603:13): [True: 1.91k, False: 0]
  ------------------
 6604|  1.91k|            err = TIFFReadDirEntryFloat(tif, dp, &data);
 6605|  1.91k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6605:17): [True: 760, False: 1.15k]
  ------------------
 6606|    760|            {
 6607|    760|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6607:21): [True: 0, False: 760]
  ------------------
 6608|      0|                    return 0;
 6609|    760|                if (!TIFFSetField(tif, dp->tdir_tag, (double)data))
  ------------------
  |  Branch (6609:21): [True: 7, False: 753]
  ------------------
 6610|      7|                    return (0);
 6611|    760|            }
 6612|  1.91k|        }
 6613|  1.90k|        break;
 6614|  1.90k|        case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (6614:9): [True: 0, False: 145k]
  ------------------
 6615|      0|        {
 6616|      0|            double data;
 6617|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6617:13): [True: 0, False: 0]
  |  Branch (6617:13): [True: 0, False: 0]
  ------------------
 6618|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6618:13): [True: 0, False: 0]
  |  Branch (6618:13): [True: 0, False: 0]
  ------------------
 6619|      0|            err = TIFFReadDirEntryDouble(tif, dp, &data);
 6620|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6620:17): [True: 0, False: 0]
  ------------------
 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|      0|        }
 6628|      0|        break;
 6629|     52|        case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (6629:9): [True: 52, False: 145k]
  ------------------
 6630|     52|        {
 6631|     52|            uint64_t data;
 6632|     52|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6632:13): [True: 0, False: 52]
  |  Branch (6632:13): [True: 52, False: 0]
  ------------------
 6633|     52|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6633:13): [True: 0, False: 52]
  |  Branch (6633:13): [True: 52, False: 0]
  ------------------
 6634|     52|            err = TIFFReadDirEntryIfd8(tif, dp, &data);
 6635|     52|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6635:17): [True: 13, False: 39]
  ------------------
 6636|     13|            {
 6637|     13|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6637:21): [True: 0, False: 13]
  ------------------
 6638|      0|                    return 0;
 6639|     13|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6639:21): [True: 0, False: 13]
  ------------------
 6640|      0|                    return (0);
 6641|     13|            }
 6642|     52|        }
 6643|     52|        break;
 6644|  1.35k|        case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (6644:9): [True: 1.35k, False: 144k]
  ------------------
 6645|  1.35k|        {
 6646|  1.35k|            uint16_t *data;
 6647|  1.35k|            assert(fip->field_readcount == 2);
  ------------------
  |  Branch (6647:13): [True: 0, False: 1.35k]
  |  Branch (6647:13): [True: 1.35k, False: 0]
  ------------------
 6648|  1.35k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6648:13): [True: 0, False: 1.35k]
  |  Branch (6648:13): [True: 1.35k, False: 0]
  ------------------
 6649|  1.35k|            if (dp->tdir_count != 2)
  ------------------
  |  Branch (6649:17): [True: 160, False: 1.19k]
  ------------------
 6650|    160|            {
 6651|    160|                TIFFWarningExtR(tif, module,
 6652|    160|                                "incorrect count for field \"%s\", expected 2, "
 6653|    160|                                "got %" PRIu64,
 6654|    160|                                fip->field_name, dp->tdir_count);
 6655|    160|                return (0);
 6656|    160|            }
 6657|  1.19k|            err = TIFFReadDirEntryShortArray(tif, dp, &data);
 6658|  1.19k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6658:17): [True: 1.13k, False: 63]
  ------------------
 6659|  1.13k|            {
 6660|  1.13k|                int m;
 6661|  1.13k|                assert(data); /* avoid CLang static Analyzer false positive */
  ------------------
  |  Branch (6661:17): [True: 0, False: 1.13k]
  |  Branch (6661:17): [True: 1.13k, False: 0]
  ------------------
 6662|  1.13k|                m = TIFFSetField(tif, dp->tdir_tag, data[0], data[1]);
 6663|  1.13k|                _TIFFfreeExt(tif, data);
 6664|  1.13k|                if (!m)
  ------------------
  |  Branch (6664:21): [True: 0, False: 1.13k]
  ------------------
 6665|      0|                    return (0);
 6666|  1.13k|            }
 6667|  1.19k|        }
 6668|  1.19k|        break;
 6669|  1.19k|        case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (6669:9): [True: 124, False: 145k]
  ------------------
 6670|    124|        {
 6671|    124|            uint8_t *data;
 6672|    124|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6672:13): [True: 0, False: 124]
  |  Branch (6672:13): [True: 124, False: 0]
  ------------------
 6673|    124|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6673:13): [True: 0, False: 124]
  |  Branch (6673:13): [True: 124, False: 0]
  ------------------
 6674|    124|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6674:17): [True: 94, False: 30]
  ------------------
 6675|     94|            {
 6676|     94|                TIFFWarningExtR(tif, module,
 6677|     94|                                "incorrect count for field \"%s\", expected "
 6678|     94|                                "%d, got %" PRIu64,
 6679|     94|                                fip->field_name, (int)fip->field_readcount,
 6680|     94|                                dp->tdir_count);
 6681|     94|                return (0);
 6682|     94|            }
 6683|     30|            else
 6684|     30|            {
 6685|     30|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 6686|     30|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6686:21): [True: 24, False: 6]
  ------------------
 6687|     24|                {
 6688|     24|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6688:25): [True: 0, False: 24]
  ------------------
 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|     24|                    int m;
 6695|     24|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6696|     24|                    if (data != 0)
  ------------------
  |  Branch (6696:25): [True: 24, False: 0]
  ------------------
 6697|     24|                        _TIFFfreeExt(tif, data);
 6698|     24|                    if (!m)
  ------------------
  |  Branch (6698:25): [True: 0, False: 24]
  ------------------
 6699|      0|                        return (0);
 6700|     24|                }
 6701|     30|            }
 6702|    124|        }
 6703|     30|        break;
 6704|     30|        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|      5|        case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (6739:9): [True: 5, False: 145k]
  ------------------
 6740|      5|        {
 6741|      5|            uint16_t *data;
 6742|      5|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6742:13): [True: 0, False: 5]
  |  Branch (6742:13): [True: 5, False: 0]
  ------------------
 6743|      5|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6743:13): [True: 0, False: 5]
  |  Branch (6743:13): [True: 5, False: 0]
  ------------------
 6744|      5|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6744:17): [True: 5, False: 0]
  ------------------
 6745|      5|            {
 6746|      5|                TIFFWarningExtR(tif, module,
 6747|      5|                                "incorrect count for field \"%s\", expected "
 6748|      5|                                "%d, got %" PRIu64,
 6749|      5|                                fip->field_name, (int)fip->field_readcount,
 6750|      5|                                dp->tdir_count);
 6751|      5|                return (0);
 6752|      5|            }
 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|      5|        }
 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|     52|        case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (6809:9): [True: 52, False: 145k]
  ------------------
 6810|     52|        {
 6811|     52|            uint32_t *data;
 6812|     52|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6812:13): [True: 0, False: 52]
  |  Branch (6812:13): [True: 52, False: 0]
  ------------------
 6813|     52|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6813:13): [True: 0, False: 52]
  |  Branch (6813:13): [True: 52, False: 0]
  ------------------
 6814|     52|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6814:17): [True: 5, False: 47]
  ------------------
 6815|      5|            {
 6816|      5|                TIFFWarningExtR(tif, module,
 6817|      5|                                "incorrect count for field \"%s\", expected "
 6818|      5|                                "%d, got %" PRIu64,
 6819|      5|                                fip->field_name, (int)fip->field_readcount,
 6820|      5|                                dp->tdir_count);
 6821|      5|                return (0);
 6822|      5|            }
 6823|     47|            else
 6824|     47|            {
 6825|     47|                err = TIFFReadDirEntryLongArray(tif, dp, &data);
 6826|     47|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6826:21): [True: 17, False: 30]
  ------------------
 6827|     17|                {
 6828|     17|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6828:25): [True: 0, False: 17]
  ------------------
 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|     17|                    int m;
 6835|     17|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6836|     17|                    if (data != 0)
  ------------------
  |  Branch (6836:25): [True: 17, False: 0]
  ------------------
 6837|     17|                        _TIFFfreeExt(tif, data);
 6838|     17|                    if (!m)
  ------------------
  |  Branch (6838:25): [True: 0, False: 17]
  ------------------
 6839|      0|                        return (0);
 6840|     17|                }
 6841|     47|            }
 6842|     52|        }
 6843|     47|        break;
 6844|     47|        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|    210|        case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (6949:9): [True: 210, False: 145k]
  ------------------
 6950|    210|        {
 6951|    210|            float *data;
 6952|    210|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6952:13): [True: 0, False: 210]
  |  Branch (6952:13): [True: 210, False: 0]
  ------------------
 6953|    210|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6953:13): [True: 0, False: 210]
  |  Branch (6953:13): [True: 210, False: 0]
  ------------------
 6954|    210|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6954:17): [True: 164, False: 46]
  ------------------
 6955|    164|            {
 6956|    164|                TIFFWarningExtR(tif, module,
 6957|    164|                                "incorrect count for field \"%s\", expected "
 6958|    164|                                "%d, got %" PRIu64,
 6959|    164|                                fip->field_name, (int)fip->field_readcount,
 6960|    164|                                dp->tdir_count);
 6961|    164|                return (0);
 6962|    164|            }
 6963|     46|            else
 6964|     46|            {
 6965|     46|                err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 6966|     46|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6966:21): [True: 30, False: 16]
  ------------------
 6967|     30|                {
 6968|     30|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6968:25): [True: 0, False: 30]
  ------------------
 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|     30|                    int m;
 6975|     30|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6976|     30|                    if (data != 0)
  ------------------
  |  Branch (6976:25): [True: 30, False: 0]
  ------------------
 6977|     30|                        _TIFFfreeExt(tif, data);
 6978|     30|                    if (!m)
  ------------------
  |  Branch (6978:25): [True: 0, False: 30]
  ------------------
 6979|      0|                        return (0);
 6980|     30|                }
 6981|     46|            }
 6982|    210|        }
 6983|     46|        break;
 6984|       |        /*--: Rational2Double: Extend for Double Arrays and Rational-Arrays read
 6985|       |         * into Double-Arrays. */
 6986|     46|        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: 15, False: 15]
  ------------------
 7062|     15|                err = TIFFReadDirEntryErrCount;
 7063|     15|            else
 7064|     15|            {
 7065|     15|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7066|     15|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7066:21): [True: 13, False: 2]
  ------------------
 7067|     13|                {
 7068|     13|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7068:25): [True: 1, False: 12]
  ------------------
 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|     12|                    int m;
 7075|     12|                    if (data != 0 && dp->tdir_count > 0 &&
  ------------------
  |  Branch (7075:25): [True: 12, False: 0]
  |  Branch (7075:38): [True: 12, False: 0]
  ------------------
 7076|     12|                        data[dp->tdir_count - 1] != '\0')
  ------------------
  |  Branch (7076:25): [True: 8, False: 4]
  ------------------
 7077|      8|                    {
 7078|      8|                        TIFFWarningExtR(tif, module,
 7079|      8|                                        "ASCII value for ASCII array tag "
 7080|      8|                                        "\"%s\" does not end in null "
 7081|      8|                                        "byte. Forcing it to be null",
 7082|      8|                                        fip->field_name);
 7083|       |                        /* Enlarge buffer and add terminating null. */
 7084|      8|                        uint8_t *o = (uint8_t *)_TIFFmallocExt(
 7085|      8|                            tif, (uint32_t)dp->tdir_count + 1);
 7086|      8|                        if (o == NULL)
  ------------------
  |  Branch (7086:29): [True: 0, False: 8]
  ------------------
 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|      8|                        if (dp->tdir_count > 0)
  ------------------
  |  Branch (7092:29): [True: 8, False: 0]
  ------------------
 7093|      8|                        {
 7094|      8|                            _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 7095|      8|                        }
 7096|      8|                        o[(uint32_t)dp->tdir_count] = 0;
 7097|      8|                        dp->tdir_count++; /* Increment for added null. */
 7098|      8|                        if (data != 0)
  ------------------
  |  Branch (7098:29): [True: 8, False: 0]
  ------------------
 7099|      8|                            _TIFFfreeExt(tif, data);
 7100|      8|                        data = o;
 7101|      8|                    }
 7102|     12|                    m = TIFFSetField(tif, dp->tdir_tag,
 7103|     12|                                     (uint16_t)(dp->tdir_count), data);
 7104|     12|                    if (data != 0)
  ------------------
  |  Branch (7104:25): [True: 12, False: 0]
  ------------------
 7105|     12|                        _TIFFfreeExt(tif, data);
 7106|     12|                    if (!m)
  ------------------
  |  Branch (7106:25): [True: 0, False: 12]
  ------------------
 7107|      0|                        return (0);
 7108|     12|                }
 7109|     15|            }
 7110|     30|        }
 7111|     29|        break;
 7112|     32|        case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (7112:9): [True: 32, False: 145k]
  ------------------
 7113|     32|        {
 7114|     32|            uint8_t *data;
 7115|     32|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7115:13): [True: 0, False: 32]
  |  Branch (7115:13): [True: 32, False: 0]
  ------------------
 7116|     32|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7116:13): [True: 0, False: 32]
  |  Branch (7116:13): [True: 32, False: 0]
  ------------------
 7117|     32|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7117:17): [True: 6, False: 26]
  ------------------
 7118|      6|                err = TIFFReadDirEntryErrCount;
 7119|     26|            else
 7120|     26|            {
 7121|     26|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7122|     26|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7122:21): [True: 11, False: 15]
  ------------------
 7123|     11|                {
 7124|     11|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7124:25): [True: 1, False: 10]
  ------------------
 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|     10|                    int m;
 7131|     10|                    m = TIFFSetField(tif, dp->tdir_tag,
 7132|     10|                                     (uint16_t)(dp->tdir_count), data);
 7133|     10|                    if (data != 0)
  ------------------
  |  Branch (7133:25): [True: 1, False: 9]
  ------------------
 7134|      1|                        _TIFFfreeExt(tif, data);
 7135|     10|                    if (!m)
  ------------------
  |  Branch (7135:25): [True: 0, False: 10]
  ------------------
 7136|      0|                        return (0);
 7137|     10|                }
 7138|     26|            }
 7139|     32|        }
 7140|     31|        break;
 7141|     31|        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|    216|        case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (7170:9): [True: 216, False: 145k]
  ------------------
 7171|    216|        {
 7172|    216|            uint16_t *data;
 7173|    216|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7173:13): [True: 0, False: 216]
  |  Branch (7173:13): [True: 216, False: 0]
  ------------------
 7174|    216|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7174:13): [True: 0, False: 216]
  |  Branch (7174:13): [True: 216, False: 0]
  ------------------
 7175|    216|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7175:17): [True: 11, False: 205]
  ------------------
 7176|     11|                err = TIFFReadDirEntryErrCount;
 7177|    205|            else
 7178|    205|            {
 7179|    205|                err = TIFFReadDirEntryShortArray(tif, dp, &data);
 7180|    205|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7180:21): [True: 201, False: 4]
  ------------------
 7181|    201|                {
 7182|    201|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7182:25): [True: 0, False: 201]
  ------------------
 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|    201|                    int m;
 7189|    201|                    m = TIFFSetField(tif, dp->tdir_tag,
 7190|    201|                                     (uint16_t)(dp->tdir_count), data);
 7191|    201|                    if (data != 0)
  ------------------
  |  Branch (7191:25): [True: 201, False: 0]
  ------------------
 7192|    201|                        _TIFFfreeExt(tif, data);
 7193|    201|                    if (!m)
  ------------------
  |  Branch (7193:25): [True: 1, False: 200]
  ------------------
 7194|      1|                        return (0);
 7195|    201|                }
 7196|    205|            }
 7197|    216|        }
 7198|    215|        break;
 7199|    215|        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|    140|        case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (7228:9): [True: 140, False: 145k]
  ------------------
 7229|    140|        {
 7230|    140|            uint32_t *data;
 7231|    140|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7231:13): [True: 0, False: 140]
  |  Branch (7231:13): [True: 140, False: 0]
  ------------------
 7232|    140|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7232:13): [True: 0, False: 140]
  |  Branch (7232:13): [True: 140, False: 0]
  ------------------
 7233|    140|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7233:17): [True: 38, False: 102]
  ------------------
 7234|     38|                err = TIFFReadDirEntryErrCount;
 7235|    102|            else
 7236|    102|            {
 7237|    102|                err = TIFFReadDirEntryLongArray(tif, dp, &data);
 7238|    102|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7238:21): [True: 28, False: 74]
  ------------------
 7239|     28|                {
 7240|     28|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7240:25): [True: 0, False: 28]
  ------------------
 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|     28|                    int m;
 7247|     28|                    m = TIFFSetField(tif, dp->tdir_tag,
 7248|     28|                                     (uint16_t)(dp->tdir_count), data);
 7249|     28|                    if (data != 0)
  ------------------
  |  Branch (7249:25): [True: 28, False: 0]
  ------------------
 7250|     28|                        _TIFFfreeExt(tif, data);
 7251|     28|                    if (!m)
  ------------------
  |  Branch (7251:25): [True: 0, False: 28]
  ------------------
 7252|      0|                        return (0);
 7253|     28|                }
 7254|    102|            }
 7255|    140|        }
 7256|    140|        break;
 7257|    140|        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|    216|        case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (7344:9): [True: 216, False: 145k]
  ------------------
 7345|    216|        {
 7346|    216|            float *data;
 7347|    216|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7347:13): [True: 0, False: 216]
  |  Branch (7347:13): [True: 216, False: 0]
  ------------------
 7348|    216|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7348:13): [True: 0, False: 216]
  |  Branch (7348:13): [True: 216, False: 0]
  ------------------
 7349|    216|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7349:17): [True: 25, False: 191]
  ------------------
 7350|     25|                err = TIFFReadDirEntryErrCount;
 7351|    191|            else
 7352|    191|            {
 7353|    191|                err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 7354|    191|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7354:21): [True: 113, False: 78]
  ------------------
 7355|    113|                {
 7356|    113|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7356:25): [True: 0, False: 113]
  ------------------
 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|    113|                    int m;
 7363|    113|                    m = TIFFSetField(tif, dp->tdir_tag,
 7364|    113|                                     (uint16_t)(dp->tdir_count), data);
 7365|    113|                    if (data != 0)
  ------------------
  |  Branch (7365:25): [True: 113, False: 0]
  ------------------
 7366|    113|                        _TIFFfreeExt(tif, data);
 7367|    113|                    if (!m)
  ------------------
  |  Branch (7367:25): [True: 0, False: 113]
  ------------------
 7368|      0|                        return (0);
 7369|    113|                }
 7370|    191|            }
 7371|    216|        }
 7372|    216|        break;
 7373|    216|        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|     52|        case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (7402:9): [True: 52, False: 145k]
  ------------------
 7403|     52|        {
 7404|     52|            uint64_t *data;
 7405|     52|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7405:13): [True: 0, False: 52]
  |  Branch (7405:13): [True: 52, False: 0]
  ------------------
 7406|     52|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7406:13): [True: 0, False: 52]
  |  Branch (7406:13): [True: 52, False: 0]
  ------------------
 7407|     52|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7407:17): [True: 43, False: 9]
  ------------------
 7408|     43|                err = TIFFReadDirEntryErrCount;
 7409|      9|            else
 7410|      9|            {
 7411|      9|                err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7412|      9|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7412:21): [True: 4, False: 5]
  ------------------
 7413|      4|                {
 7414|      4|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7414:25): [True: 0, False: 4]
  ------------------
 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|      4|                    int m;
 7421|      4|                    m = TIFFSetField(tif, dp->tdir_tag,
 7422|      4|                                     (uint16_t)(dp->tdir_count), data);
 7423|      4|                    if (data != 0)
  ------------------
  |  Branch (7423:25): [True: 4, False: 0]
  ------------------
 7424|      4|                        _TIFFfreeExt(tif, data);
 7425|      4|                    if (!m)
  ------------------
  |  Branch (7425:25): [True: 0, False: 4]
  ------------------
 7426|      0|                        return (0);
 7427|      4|                }
 7428|      9|            }
 7429|     52|        }
 7430|     52|        break;
 7431|  5.68k|        case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (7431:9): [True: 5.68k, False: 139k]
  ------------------
 7432|  5.68k|        {
 7433|  5.68k|            uint8_t *data;
 7434|  5.68k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7434:13): [True: 0, False: 5.68k]
  |  Branch (7434:13): [True: 5.68k, False: 0]
  ------------------
 7435|  5.68k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7435:13): [True: 0, False: 5.68k]
  |  Branch (7435:13): [True: 5.68k, False: 0]
  ------------------
 7436|  5.68k|            err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7437|  5.68k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7437:17): [True: 2.62k, False: 3.06k]
  ------------------
 7438|  2.62k|            {
 7439|  2.62k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7439:21): [True: 16, False: 2.60k]
  ------------------
 7440|     16|                {
 7441|     16|                    if (data != 0)
  ------------------
  |  Branch (7441:25): [True: 16, False: 0]
  ------------------
 7442|     16|                        _TIFFfreeExt(tif, data);
 7443|     16|                    return 0;
 7444|     16|                }
 7445|  2.60k|                int m;
 7446|  2.60k|                if (data != 0 && dp->tdir_count > 0 &&
  ------------------
  |  Branch (7446:21): [True: 2.56k, False: 40]
  |  Branch (7446:34): [True: 2.56k, False: 0]
  ------------------
 7447|  2.56k|                    data[dp->tdir_count - 1] != '\0')
  ------------------
  |  Branch (7447:21): [True: 1.55k, False: 1.00k]
  ------------------
 7448|  1.55k|                {
 7449|  1.55k|                    TIFFWarningExtR(
 7450|  1.55k|                        tif, module,
 7451|  1.55k|                        "ASCII value for ASCII array tag \"%s\" does not end "
 7452|  1.55k|                        "in null byte. Forcing it to be null",
 7453|  1.55k|                        fip->field_name);
 7454|       |                    /* Enlarge buffer and add terminating null. */
 7455|  1.55k|                    uint8_t *o = (uint8_t *)_TIFFmallocExt(
 7456|  1.55k|                        tif, (uint32_t)dp->tdir_count + 1);
 7457|  1.55k|                    if (o == NULL)
  ------------------
  |  Branch (7457:25): [True: 0, False: 1.55k]
  ------------------
 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.55k|                    if (dp->tdir_count > 0)
  ------------------
  |  Branch (7463:25): [True: 1.55k, False: 0]
  ------------------
 7464|  1.55k|                    {
 7465|  1.55k|                        _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 7466|  1.55k|                    }
 7467|  1.55k|                    o[(uint32_t)dp->tdir_count] = 0;
 7468|  1.55k|                    dp->tdir_count++; /* Increment for added null. */
 7469|  1.55k|                    if (data != 0)
  ------------------
  |  Branch (7469:25): [True: 1.55k, False: 0]
  ------------------
 7470|  1.55k|                        _TIFFfreeExt(tif, data);
 7471|  1.55k|                    data = o;
 7472|  1.55k|                }
 7473|  2.60k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7474|  2.60k|                                 data);
 7475|  2.60k|                if (data != 0)
  ------------------
  |  Branch (7475:21): [True: 2.56k, False: 40]
  ------------------
 7476|  2.56k|                    _TIFFfreeExt(tif, data);
 7477|  2.60k|                if (!m)
  ------------------
  |  Branch (7477:21): [True: 0, False: 2.60k]
  ------------------
 7478|      0|                    return (0);
 7479|  2.60k|            }
 7480|  5.68k|        }
 7481|  5.66k|        break;
 7482|  5.66k|        case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (7482:9): [True: 4.74k, False: 140k]
  ------------------
 7483|  4.74k|        {
 7484|  4.74k|            uint8_t *data;
 7485|  4.74k|            uint32_t count = 0;
 7486|  4.74k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7486:13): [True: 0, False: 4.74k]
  |  Branch (7486:13): [True: 4.74k, False: 0]
  ------------------
 7487|  4.74k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7487:13): [True: 0, False: 4.74k]
  |  Branch (7487:13): [True: 4.74k, False: 0]
  ------------------
 7488|  4.74k|            if (fip->field_tag == TIFFTAG_RICHTIFFIPTC &&
  ------------------
  |  |  448|  9.49k|#define TIFFTAG_RICHTIFFIPTC 33723
  ------------------
  |  Branch (7488:17): [True: 0, False: 4.74k]
  ------------------
 7489|      0|                dp->tdir_type == TIFF_LONG)
  ------------------
  |  Branch (7489:17): [True: 0, False: 0]
  ------------------
 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.74k|            else
 7509|  4.74k|            {
 7510|  4.74k|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7511|  4.74k|                count = (uint32_t)(dp->tdir_count);
 7512|  4.74k|            }
 7513|  4.74k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7513:17): [True: 3.03k, False: 1.71k]
  ------------------
 7514|  3.03k|            {
 7515|  3.03k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7515:21): [True: 13, False: 3.02k]
  ------------------
 7516|     13|                {
 7517|     13|                    if (data != 0)
  ------------------
  |  Branch (7517:25): [True: 13, False: 0]
  ------------------
 7518|     13|                        _TIFFfreeExt(tif, data);
 7519|     13|                    return 0;
 7520|     13|                }
 7521|  3.02k|                int m;
 7522|  3.02k|                m = TIFFSetField(tif, dp->tdir_tag, count, data);
 7523|  3.02k|                if (data != 0)
  ------------------
  |  Branch (7523:21): [True: 1.51k, False: 1.50k]
  ------------------
 7524|  1.51k|                    _TIFFfreeExt(tif, data);
 7525|  3.02k|                if (!m)
  ------------------
  |  Branch (7525:21): [True: 14, False: 3.00k]
  ------------------
 7526|     14|                    return (0);
 7527|  3.02k|            }
 7528|  4.74k|        }
 7529|  4.71k|        break;
 7530|  4.71k|        case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (7530:9): [True: 348, False: 145k]
  ------------------
 7531|    348|        {
 7532|    348|            int8_t *data = NULL;
 7533|    348|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7533:13): [True: 0, False: 348]
  |  Branch (7533:13): [True: 348, False: 0]
  ------------------
 7534|    348|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7534:13): [True: 0, False: 348]
  |  Branch (7534:13): [True: 348, False: 0]
  ------------------
 7535|    348|            err = TIFFReadDirEntrySbyteArray(tif, dp, &data);
 7536|    348|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7536:17): [True: 68, False: 280]
  ------------------
 7537|     68|            {
 7538|     68|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7538:21): [True: 10, False: 58]
  ------------------
 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|     58|                int m;
 7545|     58|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7546|     58|                                 data);
 7547|     58|                if (data != 0)
  ------------------
  |  Branch (7547:21): [True: 51, False: 7]
  ------------------
 7548|     51|                    _TIFFfreeExt(tif, data);
 7549|     58|                if (!m)
  ------------------
  |  Branch (7549:21): [True: 0, False: 58]
  ------------------
 7550|      0|                    return (0);
 7551|     58|            }
 7552|    348|        }
 7553|    338|        break;
 7554|  3.54k|        case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (7554:9): [True: 3.54k, False: 141k]
  ------------------
 7555|  3.54k|        {
 7556|  3.54k|            uint16_t *data;
 7557|  3.54k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7557:13): [True: 0, False: 3.54k]
  |  Branch (7557:13): [True: 3.54k, False: 0]
  ------------------
 7558|  3.54k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7558:13): [True: 0, False: 3.54k]
  |  Branch (7558:13): [True: 3.54k, False: 0]
  ------------------
 7559|  3.54k|            err = TIFFReadDirEntryShortArray(tif, dp, &data);
 7560|  3.54k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7560:17): [True: 2.17k, False: 1.37k]
  ------------------
 7561|  2.17k|            {
 7562|  2.17k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7562:21): [True: 9, False: 2.16k]
  ------------------
 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.16k|                int m;
 7569|  2.16k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7570|  2.16k|                                 data);
 7571|  2.16k|                if (data != 0)
  ------------------
  |  Branch (7571:21): [True: 2.09k, False: 66]
  ------------------
 7572|  2.09k|                    _TIFFfreeExt(tif, data);
 7573|  2.16k|                if (!m)
  ------------------
  |  Branch (7573:21): [True: 0, False: 2.16k]
  ------------------
 7574|      0|                    return (0);
 7575|  2.16k|            }
 7576|  3.54k|        }
 7577|  3.53k|        break;
 7578|  3.53k|        case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (7578:9): [True: 427, False: 144k]
  ------------------
 7579|    427|        {
 7580|    427|            int16_t *data = NULL;
 7581|    427|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7581:13): [True: 0, False: 427]
  |  Branch (7581:13): [True: 427, False: 0]
  ------------------
 7582|    427|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7582:13): [True: 0, False: 427]
  |  Branch (7582:13): [True: 427, False: 0]
  ------------------
 7583|    427|            err = TIFFReadDirEntrySshortArray(tif, dp, &data);
 7584|    427|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7584:17): [True: 89, False: 338]
  ------------------
 7585|     89|            {
 7586|     89|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7586:21): [True: 9, False: 80]
  ------------------
 7587|      9|                {
 7588|      9|                    if (data != 0)
  ------------------
  |  Branch (7588:25): [True: 9, False: 0]
  ------------------
 7589|      9|                        _TIFFfreeExt(tif, data);
 7590|      9|                    return 0;
 7591|      9|                }
 7592|     80|                int m;
 7593|     80|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7594|     80|                                 data);
 7595|     80|                if (data != 0)
  ------------------
  |  Branch (7595:21): [True: 69, False: 11]
  ------------------
 7596|     69|                    _TIFFfreeExt(tif, data);
 7597|     80|                if (!m)
  ------------------
  |  Branch (7597:21): [True: 0, False: 80]
  ------------------
 7598|      0|                    return (0);
 7599|     80|            }
 7600|    427|        }
 7601|    418|        break;
 7602|  1.09k|        case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (7602:9): [True: 1.09k, False: 144k]
  ------------------
 7603|  1.09k|        {
 7604|  1.09k|            uint32_t *data;
 7605|  1.09k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7605:13): [True: 0, False: 1.09k]
  |  Branch (7605:13): [True: 1.09k, False: 0]
  ------------------
 7606|  1.09k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7606:13): [True: 0, False: 1.09k]
  |  Branch (7606:13): [True: 1.09k, False: 0]
  ------------------
 7607|  1.09k|            err = TIFFReadDirEntryLongArray(tif, dp, &data);
 7608|  1.09k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7608:17): [True: 316, False: 781]
  ------------------
 7609|    316|            {
 7610|    316|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7610:21): [True: 0, False: 316]
  ------------------
 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|    316|                int m;
 7617|    316|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7618|    316|                                 data);
 7619|    316|                if (data != 0)
  ------------------
  |  Branch (7619:21): [True: 127, False: 189]
  ------------------
 7620|    127|                    _TIFFfreeExt(tif, data);
 7621|    316|                if (!m)
  ------------------
  |  Branch (7621:21): [True: 0, False: 316]
  ------------------
 7622|      0|                    return (0);
 7623|    316|            }
 7624|  1.09k|        }
 7625|  1.09k|        break;
 7626|  1.09k|        case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (7626:9): [True: 200, False: 145k]
  ------------------
 7627|    200|        {
 7628|    200|            int32_t *data = NULL;
 7629|    200|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7629:13): [True: 0, False: 200]
  |  Branch (7629:13): [True: 200, False: 0]
  ------------------
 7630|    200|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7630:13): [True: 0, False: 200]
  |  Branch (7630:13): [True: 200, False: 0]
  ------------------
 7631|    200|            err = TIFFReadDirEntrySlongArray(tif, dp, &data);
 7632|    200|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7632:17): [True: 50, False: 150]
  ------------------
 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: 5, False: 45]
  ------------------
 7644|      5|                    _TIFFfreeExt(tif, data);
 7645|     50|                if (!m)
  ------------------
  |  Branch (7645:21): [True: 0, False: 50]
  ------------------
 7646|      0|                    return (0);
 7647|     50|            }
 7648|    200|        }
 7649|    200|        break;
 7650|  2.79k|        case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (7650:9): [True: 2.79k, False: 142k]
  ------------------
 7651|  2.79k|        {
 7652|  2.79k|            uint64_t *data;
 7653|  2.79k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7653:13): [True: 0, False: 2.79k]
  |  Branch (7653:13): [True: 2.79k, False: 0]
  ------------------
 7654|  2.79k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7654:13): [True: 0, False: 2.79k]
  |  Branch (7654:13): [True: 2.79k, False: 0]
  ------------------
 7655|  2.79k|            err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 7656|  2.79k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7656:17): [True: 2.61k, False: 187]
  ------------------
 7657|  2.61k|            {
 7658|  2.61k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7658:21): [True: 7, False: 2.60k]
  ------------------
 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.60k|                int m;
 7665|  2.60k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7666|  2.60k|                                 data);
 7667|  2.60k|                if (data != 0)
  ------------------
  |  Branch (7667:21): [True: 2.59k, False: 6]
  ------------------
 7668|  2.59k|                    _TIFFfreeExt(tif, data);
 7669|  2.60k|                if (!m)
  ------------------
  |  Branch (7669:21): [True: 20, False: 2.58k]
  ------------------
 7670|     20|                    return (0);
 7671|  2.60k|            }
 7672|  2.79k|        }
 7673|  2.77k|        break;
 7674|  2.77k|        case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (7674:9): [True: 273, False: 145k]
  ------------------
 7675|    273|        {
 7676|    273|            int64_t *data = NULL;
 7677|    273|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7677:13): [True: 0, False: 273]
  |  Branch (7677:13): [True: 273, False: 0]
  ------------------
 7678|    273|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7678:13): [True: 0, False: 273]
  |  Branch (7678:13): [True: 273, False: 0]
  ------------------
 7679|    273|            err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 7680|    273|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7680:17): [True: 139, False: 134]
  ------------------
 7681|    139|            {
 7682|    139|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7682:21): [True: 0, False: 139]
  ------------------
 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|    139|                int m;
 7689|    139|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7690|    139|                                 data);
 7691|    139|                if (data != 0)
  ------------------
  |  Branch (7691:21): [True: 101, False: 38]
  ------------------
 7692|    101|                    _TIFFfreeExt(tif, data);
 7693|    139|                if (!m)
  ------------------
  |  Branch (7693:21): [True: 90, False: 49]
  ------------------
 7694|     90|                    return (0);
 7695|    139|            }
 7696|    273|        }
 7697|    183|        break;
 7698|  1.07k|        case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (7698:9): [True: 1.07k, False: 144k]
  ------------------
 7699|  1.07k|        {
 7700|  1.07k|            float *data;
 7701|  1.07k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7701:13): [True: 0, False: 1.07k]
  |  Branch (7701:13): [True: 1.07k, False: 0]
  ------------------
 7702|  1.07k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7702:13): [True: 0, False: 1.07k]
  |  Branch (7702:13): [True: 1.07k, False: 0]
  ------------------
 7703|  1.07k|            err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 7704|  1.07k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7704:17): [True: 188, False: 882]
  ------------------
 7705|    188|            {
 7706|    188|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7706:21): [True: 0, False: 188]
  ------------------
 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|    188|                int m;
 7713|    188|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7714|    188|                                 data);
 7715|    188|                if (data != 0)
  ------------------
  |  Branch (7715:21): [True: 167, False: 21]
  ------------------
 7716|    167|                    _TIFFfreeExt(tif, data);
 7717|    188|                if (!m)
  ------------------
  |  Branch (7717:21): [True: 0, False: 188]
  ------------------
 7718|      0|                    return (0);
 7719|    188|            }
 7720|  1.07k|        }
 7721|  1.07k|        break;
 7722|  3.08k|        case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (7722:9): [True: 3.08k, False: 142k]
  ------------------
 7723|  3.08k|        {
 7724|  3.08k|            double *data;
 7725|  3.08k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7725:13): [True: 0, False: 3.08k]
  |  Branch (7725:13): [True: 3.08k, False: 0]
  ------------------
 7726|  3.08k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7726:13): [True: 0, False: 3.08k]
  |  Branch (7726:13): [True: 3.08k, False: 0]
  ------------------
 7727|  3.08k|            err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 7728|  3.08k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7728:17): [True: 2.76k, False: 311]
  ------------------
 7729|  2.76k|            {
 7730|  2.76k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7730:21): [True: 0, False: 2.76k]
  ------------------
 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.76k|                int m;
 7737|  2.76k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7738|  2.76k|                                 data);
 7739|  2.76k|                if (data != 0)
  ------------------
  |  Branch (7739:21): [True: 2.64k, False: 124]
  ------------------
 7740|  2.64k|                    _TIFFfreeExt(tif, data);
 7741|  2.76k|                if (!m)
  ------------------
  |  Branch (7741:21): [True: 0, False: 2.76k]
  ------------------
 7742|      0|                    return (0);
 7743|  2.76k|            }
 7744|  3.08k|        }
 7745|  3.08k|        break;
 7746|  3.08k|        case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (7746:9): [True: 190, False: 145k]
  ------------------
 7747|    190|        {
 7748|    190|            uint64_t *data;
 7749|    190|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7749:13): [True: 0, False: 190]
  |  Branch (7749:13): [True: 190, False: 0]
  ------------------
 7750|    190|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7750:13): [True: 0, False: 190]
  |  Branch (7750:13): [True: 190, False: 0]
  ------------------
 7751|    190|            err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7752|    190|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7752:17): [True: 53, False: 137]
  ------------------
 7753|     53|            {
 7754|     53|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7754:21): [True: 0, False: 53]
  ------------------
 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|     53|                int m;
 7761|     53|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7762|     53|                                 data);
 7763|     53|                if (data != 0)
  ------------------
  |  Branch (7763:21): [True: 41, False: 12]
  ------------------
 7764|     41|                    _TIFFfreeExt(tif, data);
 7765|     53|                if (!m)
  ------------------
  |  Branch (7765:21): [True: 10, False: 43]
  ------------------
 7766|     10|                    return (0);
 7767|     53|            }
 7768|    190|        }
 7769|    180|        break;
 7770|    180|        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|   144k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7779:9): [True: 14.8k, False: 129k]
  ------------------
 7780|  14.8k|    {
 7781|  14.8k|        TIFFReadDirEntryOutputErr(tif, err, module, fip->field_name, recover);
 7782|  14.8k|        return (0);
 7783|  14.8k|    }
 7784|   129k|    return (1);
 7785|   144k|}
tif_dirread.c:TIFFReadDirEntryByteArray:
 1397|  12.1k|{
 1398|  12.1k|    enum TIFFReadDirEntryErr err;
 1399|  12.1k|    uint32_t count;
 1400|  12.1k|    void *origdata;
 1401|  12.1k|    uint8_t *data;
 1402|  12.1k|    switch (direntry->tdir_type)
 1403|  12.1k|    {
 1404|  6.60k|        case TIFF_ASCII:
  ------------------
  |  Branch (1404:9): [True: 6.60k, False: 5.53k]
  ------------------
 1405|  7.92k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1405:9): [True: 1.32k, False: 10.8k]
  ------------------
 1406|  11.2k|        case TIFF_BYTE:
  ------------------
  |  Branch (1406:9): [True: 3.35k, False: 8.78k]
  ------------------
 1407|  11.2k|        case TIFF_SBYTE:
  ------------------
  |  Branch (1407:9): [True: 17, False: 12.1k]
  ------------------
 1408|  11.4k|        case TIFF_SHORT:
  ------------------
  |  Branch (1408:9): [True: 177, False: 11.9k]
  ------------------
 1409|  11.4k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1409:9): [True: 16, False: 12.1k]
  ------------------
 1410|  11.4k|        case TIFF_LONG:
  ------------------
  |  Branch (1410:9): [True: 9, False: 12.1k]
  ------------------
 1411|  11.5k|        case TIFF_SLONG:
  ------------------
  |  Branch (1411:9): [True: 8, False: 12.1k]
  ------------------
 1412|  11.5k|        case TIFF_LONG8:
  ------------------
  |  Branch (1412:9): [True: 9, False: 12.1k]
  ------------------
 1413|  11.5k|        case TIFF_SLONG8:
  ------------------
  |  Branch (1413:9): [True: 11, False: 12.1k]
  ------------------
 1414|  11.5k|            break;
 1415|    612|        default:
  ------------------
  |  Branch (1415:9): [True: 612, False: 11.5k]
  ------------------
 1416|    612|            return (TIFFReadDirEntryErrType);
 1417|  12.1k|    }
 1418|  11.5k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 1, &origdata);
 1419|  11.5k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1419:9): [True: 4.87k, False: 6.65k]
  |  Branch (1419:43): [True: 1.56k, False: 5.08k]
  ------------------
 1420|  6.43k|    {
 1421|  6.43k|        *value = 0;
 1422|  6.43k|        return (err);
 1423|  6.43k|    }
 1424|  5.08k|    switch (direntry->tdir_type)
 1425|  5.08k|    {
 1426|  3.34k|        case TIFF_ASCII:
  ------------------
  |  Branch (1426:9): [True: 3.34k, False: 1.74k]
  ------------------
 1427|  4.38k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1427:9): [True: 1.04k, False: 4.04k]
  ------------------
 1428|  4.90k|        case TIFF_BYTE:
  ------------------
  |  Branch (1428:9): [True: 515, False: 4.57k]
  ------------------
 1429|  4.90k|            *value = (uint8_t *)origdata;
 1430|  4.90k|            return (TIFFReadDirEntryErrOk);
 1431|     10|        case TIFF_SBYTE:
  ------------------
  |  Branch (1431:9): [True: 10, False: 5.07k]
  ------------------
 1432|     10|        {
 1433|     10|            int8_t *m;
 1434|     10|            uint32_t n;
 1435|     10|            m = (int8_t *)origdata;
 1436|     20|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1436:25): [True: 10, False: 10]
  ------------------
 1437|     10|            {
 1438|     10|                err = TIFFReadDirEntryCheckRangeByteSbyte(*m);
 1439|     10|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1439:21): [True: 0, False: 10]
  ------------------
 1440|      0|                {
 1441|      0|                    _TIFFfreeExt(tif, origdata);
 1442|      0|                    return (err);
 1443|      0|                }
 1444|     10|                m++;
 1445|     10|            }
 1446|     10|            *value = (uint8_t *)origdata;
 1447|     10|            return (TIFFReadDirEntryErrOk);
 1448|     10|        }
 1449|    176|        default:
  ------------------
  |  Branch (1449:9): [True: 176, False: 4.91k]
  ------------------
 1450|    176|            break;
 1451|  5.08k|    }
 1452|    176|    data = (uint8_t *)_TIFFmallocExt(tif, count);
 1453|    176|    if (data == 0)
  ------------------
  |  Branch (1453:9): [True: 0, False: 176]
  ------------------
 1454|      0|    {
 1455|      0|        _TIFFfreeExt(tif, origdata);
 1456|      0|        return (TIFFReadDirEntryErrAlloc);
 1457|      0|    }
 1458|    176|    switch (direntry->tdir_type)
 1459|    176|    {
 1460|    148|        case TIFF_SHORT:
  ------------------
  |  Branch (1460:9): [True: 148, False: 28]
  ------------------
 1461|    148|        {
 1462|    148|            uint16_t *ma;
 1463|    148|            uint8_t *mb;
 1464|    148|            uint32_t n;
 1465|    148|            ma = (uint16_t *)origdata;
 1466|    148|            mb = data;
 1467|    678|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1467:25): [True: 571, False: 107]
  ------------------
 1468|    571|            {
 1469|    571|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    571|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1469:21): [True: 156, False: 415]
  ------------------
 1470|    156|                    TIFFSwabShort(ma);
 1471|    571|                err = TIFFReadDirEntryCheckRangeByteShort(*ma);
 1472|    571|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1472:21): [True: 41, False: 530]
  ------------------
 1473|     41|                    break;
 1474|    530|                *mb++ = (uint8_t)(*ma++);
 1475|    530|            }
 1476|    148|        }
 1477|    148|        break;
 1478|      3|        case TIFF_SSHORT:
  ------------------
  |  Branch (1478:9): [True: 3, False: 173]
  ------------------
 1479|      3|        {
 1480|      3|            int16_t *ma;
 1481|      3|            uint8_t *mb;
 1482|      3|            uint32_t n;
 1483|      3|            ma = (int16_t *)origdata;
 1484|      3|            mb = data;
 1485|    288|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1485:25): [True: 286, False: 2]
  ------------------
 1486|    286|            {
 1487|    286|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    286|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1487:21): [True: 137, False: 149]
  ------------------
 1488|    137|                    TIFFSwabShort((uint16_t *)ma);
 1489|    286|                err = TIFFReadDirEntryCheckRangeByteSshort(*ma);
 1490|    286|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1490:21): [True: 1, False: 285]
  ------------------
 1491|      1|                    break;
 1492|    285|                *mb++ = (uint8_t)(*ma++);
 1493|    285|            }
 1494|      3|        }
 1495|      3|        break;
 1496|      6|        case TIFF_LONG:
  ------------------
  |  Branch (1496:9): [True: 6, False: 170]
  ------------------
 1497|      6|        {
 1498|      6|            uint32_t *ma;
 1499|      6|            uint8_t *mb;
 1500|      6|            uint32_t n;
 1501|      6|            ma = (uint32_t *)origdata;
 1502|      6|            mb = data;
 1503|    325|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1503:25): [True: 324, False: 1]
  ------------------
 1504|    324|            {
 1505|    324|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    324|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1505:21): [True: 141, False: 183]
  ------------------
 1506|    141|                    TIFFSwabLong(ma);
 1507|    324|                err = TIFFReadDirEntryCheckRangeByteLong(*ma);
 1508|    324|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1508:21): [True: 5, False: 319]
  ------------------
 1509|      5|                    break;
 1510|    319|                *mb++ = (uint8_t)(*ma++);
 1511|    319|            }
 1512|      6|        }
 1513|      6|        break;
 1514|      3|        case TIFF_SLONG:
  ------------------
  |  Branch (1514:9): [True: 3, False: 173]
  ------------------
 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|      8|        case TIFF_LONG8:
  ------------------
  |  Branch (1532:9): [True: 8, False: 168]
  ------------------
 1533|      8|        {
 1534|      8|            uint64_t *ma;
 1535|      8|            uint8_t *mb;
 1536|      8|            uint32_t n;
 1537|      8|            ma = (uint64_t *)origdata;
 1538|      8|            mb = data;
 1539|    412|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1539:25): [True: 410, False: 2]
  ------------------
 1540|    410|            {
 1541|    410|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    410|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1541:21): [True: 188, False: 222]
  ------------------
 1542|    188|                    TIFFSwabLong8(ma);
 1543|    410|                err = TIFFReadDirEntryCheckRangeByteLong8(*ma);
 1544|    410|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1544:21): [True: 6, False: 404]
  ------------------
 1545|      6|                    break;
 1546|    404|                *mb++ = (uint8_t)(*ma++);
 1547|    404|            }
 1548|      8|        }
 1549|      8|        break;
 1550|      8|        case TIFF_SLONG8:
  ------------------
  |  Branch (1550:9): [True: 8, False: 168]
  ------------------
 1551|      8|        {
 1552|      8|            int64_t *ma;
 1553|      8|            uint8_t *mb;
 1554|      8|            uint32_t n;
 1555|      8|            ma = (int64_t *)origdata;
 1556|      8|            mb = data;
 1557|    432|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1557:25): [True: 431, False: 1]
  ------------------
 1558|    431|            {
 1559|    431|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    431|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1559:21): [True: 180, False: 251]
  ------------------
 1560|    180|                    TIFFSwabLong8((uint64_t *)ma);
 1561|    431|                err = TIFFReadDirEntryCheckRangeByteSlong8(*ma);
 1562|    431|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1562:21): [True: 7, False: 424]
  ------------------
 1563|      7|                    break;
 1564|    424|                *mb++ = (uint8_t)(*ma++);
 1565|    424|            }
 1566|      8|        }
 1567|      8|        break;
 1568|      0|        default:
  ------------------
  |  Branch (1568:9): [True: 0, False: 176]
  ------------------
 1569|      0|            break;
 1570|    176|    }
 1571|    176|    _TIFFfreeExt(tif, origdata);
 1572|    176|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1572:9): [True: 61, False: 115]
  ------------------
 1573|     61|    {
 1574|     61|        _TIFFfreeExt(tif, data);
 1575|     61|        return (err);
 1576|     61|    }
 1577|    115|    *value = data;
 1578|    115|    return (TIFFReadDirEntryErrOk);
 1579|    176|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSbyte:
 3646|     10|{
 3647|     10|    if (value < 0)
  ------------------
  |  Branch (3647:9): [True: 0, False: 10]
  ------------------
 3648|      0|        return (TIFFReadDirEntryErrRange);
 3649|     10|    else
 3650|     10|        return (TIFFReadDirEntryErrOk);
 3651|     10|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteShort:
 3655|    577|{
 3656|    577|    if (value > 0xFF)
  ------------------
  |  Branch (3656:9): [True: 42, False: 535]
  ------------------
 3657|     42|        return (TIFFReadDirEntryErrRange);
 3658|    535|    else
 3659|    535|        return (TIFFReadDirEntryErrOk);
 3660|    577|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSshort:
 3664|    286|{
 3665|    286|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3665:9): [True: 0, False: 286]
  |  Branch (3665:24): [True: 1, False: 285]
  ------------------
 3666|      1|        return (TIFFReadDirEntryErrRange);
 3667|    285|    else
 3668|    285|        return (TIFFReadDirEntryErrOk);
 3669|    286|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteLong:
 3673|    324|{
 3674|    324|    if (value > 0xFF)
  ------------------
  |  Branch (3674:9): [True: 5, False: 319]
  ------------------
 3675|      5|        return (TIFFReadDirEntryErrRange);
 3676|    319|    else
 3677|    319|        return (TIFFReadDirEntryErrOk);
 3678|    324|}
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|    412|{
 3692|    412|    if (value > 0xFF)
  ------------------
  |  Branch (3692:9): [True: 6, False: 406]
  ------------------
 3693|      6|        return (TIFFReadDirEntryErrRange);
 3694|    406|    else
 3695|    406|        return (TIFFReadDirEntryErrOk);
 3696|    412|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSlong8:
 3700|    431|{
 3701|    431|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3701:9): [True: 2, False: 429]
  |  Branch (3701:24): [True: 5, False: 424]
  ------------------
 3702|      7|        return (TIFFReadDirEntryErrRange);
 3703|    424|    else
 3704|    424|        return (TIFFReadDirEntryErrOk);
 3705|    431|}
tif_dirread.c:TIFFReadDirEntryByte:
  300|     40|{
  301|     40|    enum TIFFReadDirEntryErr err;
  302|     40|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (302:9): [True: 30, False: 10]
  ------------------
  303|     30|        return (TIFFReadDirEntryErrCount);
  304|     10|    switch (direntry->tdir_type)
  305|     10|    {
  306|      2|        case TIFF_BYTE:
  ------------------
  |  Branch (306:9): [True: 2, False: 8]
  ------------------
  307|      2|        case TIFF_UNDEFINED: /* Support to read TIFF_UNDEFINED with
  ------------------
  |  Branch (307:9): [True: 0, False: 10]
  ------------------
  308|       |                                field_readcount==1 */
  309|      2|            TIFFReadDirEntryCheckedByte(tif, direntry, value);
  310|      2|            return (TIFFReadDirEntryErrOk);
  311|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (311:9): [True: 0, False: 10]
  ------------------
  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|      6|        case TIFF_SHORT:
  ------------------
  |  Branch (321:9): [True: 6, False: 4]
  ------------------
  322|      6|        {
  323|      6|            uint16_t m;
  324|      6|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  325|      6|            err = TIFFReadDirEntryCheckRangeByteShort(m);
  326|      6|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (326:17): [True: 1, False: 5]
  ------------------
  327|      1|                return (err);
  328|      5|            *value = (uint8_t)m;
  329|      5|            return (TIFFReadDirEntryErrOk);
  330|      6|        }
  331|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (331:9): [True: 0, False: 10]
  ------------------
  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: 10]
  ------------------
  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: 10]
  ------------------
  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|      2|        case TIFF_LONG8:
  ------------------
  |  Branch (361:9): [True: 2, False: 8]
  ------------------
  362|      2|        {
  363|      2|            uint64_t m;
  364|      2|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  365|      2|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (365:17): [True: 0, False: 2]
  ------------------
  366|      0|                return (err);
  367|      2|            err = TIFFReadDirEntryCheckRangeByteLong8(m);
  368|      2|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (368:17): [True: 0, False: 2]
  ------------------
  369|      0|                return (err);
  370|      2|            *value = (uint8_t)m;
  371|      2|            return (TIFFReadDirEntryErrOk);
  372|      2|        }
  373|      0|        case TIFF_SLONG8:
  ------------------
  |  Branch (373:9): [True: 0, False: 10]
  ------------------
  374|      0|        {
  375|      0|            int64_t m;
  376|      0|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  377|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (377:17): [True: 0, False: 0]
  ------------------
  378|      0|                return (err);
  379|      0|            err = TIFFReadDirEntryCheckRangeByteSlong8(m);
  380|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (380:17): [True: 0, False: 0]
  ------------------
  381|      0|                return (err);
  382|      0|            *value = (uint8_t)m;
  383|      0|            return (TIFFReadDirEntryErrOk);
  384|      0|        }
  385|      0|        default:
  ------------------
  |  Branch (385:9): [True: 0, False: 10]
  ------------------
  386|      0|            return (TIFFReadDirEntryErrType);
  387|     10|    }
  388|     10|}
tif_dirread.c:TIFFReadDirEntryLong:
  657|  19.3k|{
  658|  19.3k|    enum TIFFReadDirEntryErr err;
  659|  19.3k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (659:9): [True: 306, False: 19.0k]
  ------------------
  660|    306|        return (TIFFReadDirEntryErrCount);
  661|  19.0k|    switch (direntry->tdir_type)
  662|  19.0k|    {
  663|  3.44k|        case TIFF_BYTE:
  ------------------
  |  Branch (663:9): [True: 3.44k, False: 15.5k]
  ------------------
  664|  3.44k|        {
  665|  3.44k|            uint8_t m;
  666|  3.44k|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  667|  3.44k|            *value = (uint32_t)m;
  668|  3.44k|            return (TIFFReadDirEntryErrOk);
  669|      0|        }
  670|    370|        case TIFF_SBYTE:
  ------------------
  |  Branch (670:9): [True: 370, False: 18.6k]
  ------------------
  671|    370|        {
  672|    370|            int8_t m;
  673|    370|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  674|    370|            err = TIFFReadDirEntryCheckRangeLongSbyte(m);
  675|    370|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (675:17): [True: 0, False: 370]
  ------------------
  676|      0|                return (err);
  677|    370|            *value = (uint32_t)m;
  678|    370|            return (TIFFReadDirEntryErrOk);
  679|    370|        }
  680|  14.4k|        case TIFF_SHORT:
  ------------------
  |  Branch (680:9): [True: 14.4k, False: 4.62k]
  ------------------
  681|  14.4k|        {
  682|  14.4k|            uint16_t m;
  683|  14.4k|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  684|  14.4k|            *value = (uint32_t)m;
  685|  14.4k|            return (TIFFReadDirEntryErrOk);
  686|    370|        }
  687|    261|        case TIFF_SSHORT:
  ------------------
  |  Branch (687:9): [True: 261, False: 18.7k]
  ------------------
  688|    261|        {
  689|    261|            int16_t m;
  690|    261|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  691|    261|            err = TIFFReadDirEntryCheckRangeLongSshort(m);
  692|    261|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (692:17): [True: 0, False: 261]
  ------------------
  693|      0|                return (err);
  694|    261|            *value = (uint32_t)m;
  695|    261|            return (TIFFReadDirEntryErrOk);
  696|    261|        }
  697|    402|        case TIFF_LONG:
  ------------------
  |  Branch (697:9): [True: 402, False: 18.6k]
  ------------------
  698|    404|        case TIFF_IFD:
  ------------------
  |  Branch (698:9): [True: 2, False: 19.0k]
  ------------------
  699|    404|            TIFFReadDirEntryCheckedLong(tif, direntry, value);
  700|    404|            return (TIFFReadDirEntryErrOk);
  701|    129|        case TIFF_SLONG:
  ------------------
  |  Branch (701:9): [True: 129, False: 18.8k]
  ------------------
  702|    129|        {
  703|    129|            int32_t m;
  704|    129|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  705|    129|            err = TIFFReadDirEntryCheckRangeLongSlong(m);
  706|    129|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (706:17): [True: 0, False: 129]
  ------------------
  707|      0|                return (err);
  708|    129|            *value = (uint32_t)m;
  709|    129|            return (TIFFReadDirEntryErrOk);
  710|    129|        }
  711|      2|        case TIFF_LONG8:
  ------------------
  |  Branch (711:9): [True: 2, False: 19.0k]
  ------------------
  712|      4|        case TIFF_IFD8:
  ------------------
  |  Branch (712:9): [True: 2, False: 19.0k]
  ------------------
  713|      4|        {
  714|      4|            uint64_t m;
  715|      4|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  716|      4|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (716:17): [True: 0, False: 4]
  ------------------
  717|      0|                return (err);
  718|      4|            err = TIFFReadDirEntryCheckRangeLongLong8(m);
  719|      4|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (719:17): [True: 0, False: 4]
  ------------------
  720|      0|                return (err);
  721|      4|            *value = (uint32_t)m;
  722|      4|            return (TIFFReadDirEntryErrOk);
  723|      4|        }
  724|      0|        case TIFF_SLONG8:
  ------------------
  |  Branch (724:9): [True: 0, False: 19.0k]
  ------------------
  725|      0|        {
  726|      0|            int64_t m;
  727|      0|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  728|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (728:17): [True: 0, False: 0]
  ------------------
  729|      0|                return (err);
  730|      0|            err = TIFFReadDirEntryCheckRangeLongSlong8(m);
  731|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (731:17): [True: 0, False: 0]
  ------------------
  732|      0|                return (err);
  733|      0|            *value = (uint32_t)m;
  734|      0|            return (TIFFReadDirEntryErrOk);
  735|      0|        }
  736|      6|        default:
  ------------------
  |  Branch (736:9): [True: 6, False: 19.0k]
  ------------------
  737|      6|            return (TIFFReadDirEntryErrType);
  738|  19.0k|    }
  739|  19.0k|} /*-- TIFFReadDirEntryLong() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSbyte:
 3871|    370|{
 3872|    370|    if (value < 0)
  ------------------
  |  Branch (3872:9): [True: 0, False: 370]
  ------------------
 3873|      0|        return (TIFFReadDirEntryErrRange);
 3874|    370|    else
 3875|    370|        return (TIFFReadDirEntryErrOk);
 3876|    370|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSshort:
 3880|    431|{
 3881|    431|    if (value < 0)
  ------------------
  |  Branch (3881:9): [True: 4, False: 427]
  ------------------
 3882|      4|        return (TIFFReadDirEntryErrRange);
 3883|    427|    else
 3884|    427|        return (TIFFReadDirEntryErrOk);
 3885|    431|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong:
 3889|    532|{
 3890|    532|    if (value < 0)
  ------------------
  |  Branch (3890:9): [True: 1, False: 531]
  ------------------
 3891|      1|        return (TIFFReadDirEntryErrRange);
 3892|    531|    else
 3893|    531|        return (TIFFReadDirEntryErrOk);
 3894|    532|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongLong8:
 3898|    603|{
 3899|    603|    if (value > UINT32_MAX)
  ------------------
  |  Branch (3899:9): [True: 27, False: 576]
  ------------------
 3900|     27|        return (TIFFReadDirEntryErrRange);
 3901|    576|    else
 3902|    576|        return (TIFFReadDirEntryErrOk);
 3903|    603|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong8:
 3907|    485|{
 3908|    485|    if ((value < 0) || (value > (int64_t)UINT32_MAX))
  ------------------
  |  Branch (3908:9): [True: 11, False: 474]
  |  Branch (3908:24): [True: 13, False: 461]
  ------------------
 3909|     24|        return (TIFFReadDirEntryErrRange);
 3910|    461|    else
 3911|    461|        return (TIFFReadDirEntryErrOk);
 3912|    485|}
tif_dirread.c:TIFFReadDirEntryLong8:
  821|    882|{
  822|    882|    enum TIFFReadDirEntryErr err;
  823|    882|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (823:9): [True: 489, False: 393]
  ------------------
  824|    489|        return (TIFFReadDirEntryErrCount);
  825|    393|    switch (direntry->tdir_type)
  826|    393|    {
  827|     15|        case TIFF_BYTE:
  ------------------
  |  Branch (827:9): [True: 15, False: 378]
  ------------------
  828|     15|        {
  829|     15|            uint8_t m;
  830|     15|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  831|     15|            *value = (uint64_t)m;
  832|     15|            return (TIFFReadDirEntryErrOk);
  833|      0|        }
  834|    113|        case TIFF_SBYTE:
  ------------------
  |  Branch (834:9): [True: 113, False: 280]
  ------------------
  835|    113|        {
  836|    113|            int8_t m;
  837|    113|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  838|    113|            err = TIFFReadDirEntryCheckRangeLong8Sbyte(m);
  839|    113|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (839:17): [True: 0, False: 113]
  ------------------
  840|      0|                return (err);
  841|    113|            *value = (uint64_t)m;
  842|    113|            return (TIFFReadDirEntryErrOk);
  843|    113|        }
  844|      1|        case TIFF_SHORT:
  ------------------
  |  Branch (844:9): [True: 1, False: 392]
  ------------------
  845|      1|        {
  846|      1|            uint16_t m;
  847|      1|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  848|      1|            *value = (uint64_t)m;
  849|      1|            return (TIFFReadDirEntryErrOk);
  850|    113|        }
  851|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (851:9): [True: 0, False: 393]
  ------------------
  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|    257|        case TIFF_LONG:
  ------------------
  |  Branch (861:9): [True: 257, False: 136]
  ------------------
  862|    259|        case TIFF_IFD:
  ------------------
  |  Branch (862:9): [True: 2, False: 391]
  ------------------
  863|    259|        {
  864|    259|            uint32_t m;
  865|    259|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  866|    259|            *value = (uint64_t)m;
  867|    259|            return (TIFFReadDirEntryErrOk);
  868|    257|        }
  869|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (869:9): [True: 0, False: 393]
  ------------------
  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|      2|        case TIFF_LONG8:
  ------------------
  |  Branch (879:9): [True: 2, False: 391]
  ------------------
  880|      2|        case TIFF_IFD8:
  ------------------
  |  Branch (880:9): [True: 0, False: 393]
  ------------------
  881|      2|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, value);
  882|      2|            return (err);
  883|      1|        case TIFF_SLONG8:
  ------------------
  |  Branch (883:9): [True: 1, False: 392]
  ------------------
  884|      1|        {
  885|      1|            int64_t m;
  886|      1|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  887|      1|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (887:17): [True: 1, False: 0]
  ------------------
  888|      1|                return (err);
  889|      0|            err = TIFFReadDirEntryCheckRangeLong8Slong8(m);
  890|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (890:17): [True: 0, False: 0]
  ------------------
  891|      0|                return (err);
  892|      0|            *value = (uint64_t)m;
  893|      0|            return (TIFFReadDirEntryErrOk);
  894|      0|        }
  895|      2|        default:
  ------------------
  |  Branch (895:9): [True: 2, False: 391]
  ------------------
  896|      2|            return (TIFFReadDirEntryErrType);
  897|    393|    }
  898|    393|} /*-- TIFFReadDirEntryLong8() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sbyte:
 3945|    151|{
 3946|    151|    if (value < 0)
  ------------------
  |  Branch (3946:9): [True: 12, False: 139]
  ------------------
 3947|     12|        return (TIFFReadDirEntryErrRange);
 3948|    139|    else
 3949|    139|        return (TIFFReadDirEntryErrOk);
 3950|    151|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sshort:
 3954|    655|{
 3955|    655|    if (value < 0)
  ------------------
  |  Branch (3955:9): [True: 0, False: 655]
  ------------------
 3956|      0|        return (TIFFReadDirEntryErrRange);
 3957|    655|    else
 3958|    655|        return (TIFFReadDirEntryErrOk);
 3959|    655|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong:
 3963|    375|{
 3964|    375|    if (value < 0)
  ------------------
  |  Branch (3964:9): [True: 1, False: 374]
  ------------------
 3965|      1|        return (TIFFReadDirEntryErrRange);
 3966|    374|    else
 3967|    374|        return (TIFFReadDirEntryErrOk);
 3968|    375|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong8:
 3972|    442|{
 3973|    442|    if (value < 0)
  ------------------
  |  Branch (3973:9): [True: 4, False: 438]
  ------------------
 3974|      4|        return (TIFFReadDirEntryErrRange);
 3975|    438|    else
 3976|    438|        return (TIFFReadDirEntryErrOk);
 3977|    442|}
tif_dirread.c:TIFFReadDirEntryFloat:
  972|  1.91k|{
  973|  1.91k|    enum TIFFReadDirEntryErr err;
  974|  1.91k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (974:9): [True: 1.00k, False: 902]
  ------------------
  975|  1.00k|        return (TIFFReadDirEntryErrCount);
  976|    902|    switch (direntry->tdir_type)
  977|    902|    {
  978|      1|        case TIFF_BYTE:
  ------------------
  |  Branch (978:9): [True: 1, False: 901]
  ------------------
  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: 902]
  ------------------
  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|    123|        case TIFF_SHORT:
  ------------------
  |  Branch (992:9): [True: 123, False: 779]
  ------------------
  993|    123|        {
  994|    123|            uint16_t m;
  995|    123|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  996|    123|            *value = (float)m;
  997|    123|            return (TIFFReadDirEntryErrOk);
  998|      0|        }
  999|      3|        case TIFF_SSHORT:
  ------------------
  |  Branch (999:9): [True: 3, False: 899]
  ------------------
 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: 894]
  ------------------
 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|      4|        case TIFF_SLONG:
  ------------------
  |  Branch (1013:9): [True: 4, False: 898]
  ------------------
 1014|      4|        {
 1015|      4|            int32_t m;
 1016|      4|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
 1017|      4|            *value = (float)m;
 1018|      4|            return (TIFFReadDirEntryErrOk);
 1019|      0|        }
 1020|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (1020:9): [True: 0, False: 902]
  ------------------
 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|      2|        case TIFF_SLONG8:
  ------------------
  |  Branch (1029:9): [True: 2, False: 900]
  ------------------
 1030|      2|        {
 1031|      2|            int64_t m;
 1032|      2|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
 1033|      2|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1033:17): [True: 1, False: 1]
  ------------------
 1034|      1|                return (err);
 1035|      1|            *value = (float)m;
 1036|      1|            return (TIFFReadDirEntryErrOk);
 1037|      2|        }
 1038|    668|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1038:9): [True: 668, False: 234]
  ------------------
 1039|    668|        {
 1040|    668|            double m;
 1041|    668|            err = TIFFReadDirEntryCheckedRational(tif, direntry, &m);
 1042|    668|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1042:17): [True: 71, False: 597]
  ------------------
 1043|     71|                return (err);
 1044|    597|            *value = (float)m;
 1045|    597|            return (TIFFReadDirEntryErrOk);
 1046|    668|        }
 1047|     35|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1047:9): [True: 35, False: 867]
  ------------------
 1048|     35|        {
 1049|     35|            double m;
 1050|     35|            err = TIFFReadDirEntryCheckedSrational(tif, direntry, &m);
 1051|     35|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1051:17): [True: 17, False: 18]
  ------------------
 1052|     17|                return (err);
 1053|     18|            *value = (float)m;
 1054|     18|            return (TIFFReadDirEntryErrOk);
 1055|     35|        }
 1056|      2|        case TIFF_FLOAT:
  ------------------
  |  Branch (1056:9): [True: 2, False: 900]
  ------------------
 1057|      2|            TIFFReadDirEntryCheckedFloat(tif, direntry, value);
 1058|      2|            return (TIFFReadDirEntryErrOk);
 1059|     24|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1059:9): [True: 24, False: 878]
  ------------------
 1060|     24|        {
 1061|     24|            double m;
 1062|     24|            err = TIFFReadDirEntryCheckedDouble(tif, direntry, &m);
 1063|     24|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1063:17): [True: 11, False: 13]
  ------------------
 1064|     11|                return (err);
 1065|     13|            if ((m > (double)FLT_MAX) || (m < -(double)FLT_MAX))
  ------------------
  |  Branch (1065:17): [True: 5, False: 8]
  |  Branch (1065:42): [True: 5, False: 3]
  ------------------
 1066|     10|                return (TIFFReadDirEntryErrRange);
 1067|      3|            *value = (float)m;
 1068|      3|            return (TIFFReadDirEntryErrOk);
 1069|     13|        }
 1070|     32|        default:
  ------------------
  |  Branch (1070:9): [True: 32, False: 870]
  ------------------
 1071|     32|            return (TIFFReadDirEntryErrType);
 1072|    902|    }
 1073|    902|}
tif_dirread.c:TIFFReadDirEntryCheckedRational:
 3494|    668|{
 3495|    668|    UInt64Aligned_t m;
 3496|       |
 3497|    668|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3497:5): [True: 0, Folded]
  |  Branch (3497:5): [True: 668, Folded]
  ------------------
 3498|    668|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3498:5): [True: 0, Folded]
  |  Branch (3498:5): [True: 668, Folded]
  ------------------
 3499|    668|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3499:5): [True: 0, Folded]
  |  Branch (3499:5): [True: 668, Folded]
  ------------------
 3500|    668|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|    668|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3500:9): [True: 660, False: 8]
  ------------------
 3501|    660|    {
 3502|    660|        enum TIFFReadDirEntryErr err;
 3503|    660|        uint32_t offset = direntry->tdir_offset.toff_long;
 3504|    660|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    660|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3504:13): [True: 6, False: 654]
  ------------------
 3505|      6|            TIFFSwabLong(&offset);
 3506|    660|        err = TIFFReadDirEntryData(tif, offset, 8, m.i);
 3507|    660|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3507:13): [True: 71, False: 589]
  ------------------
 3508|     71|            return (err);
 3509|    660|    }
 3510|      8|    else
 3511|      8|        m.l = direntry->tdir_offset.toff_long8;
 3512|    597|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    597|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3512:9): [True: 5, False: 592]
  ------------------
 3513|      5|        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|    597|    if (m.i[0] == 0 || m.i[1] == 0)
  ------------------
  |  Branch (3517:9): [True: 25, False: 572]
  |  Branch (3517:24): [True: 70, False: 502]
  ------------------
 3518|     95|        *value = 0.0;
 3519|    502|    else
 3520|    502|        *value = (double)m.i[0] / (double)m.i[1];
 3521|    597|    return (TIFFReadDirEntryErrOk);
 3522|    668|}
tif_dirread.c:TIFFReadDirEntryCheckedSrational:
 3527|     35|{
 3528|     35|    UInt64Aligned_t m;
 3529|     35|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3529:5): [True: 0, Folded]
  |  Branch (3529:5): [True: 35, Folded]
  ------------------
 3530|     35|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3530:5): [True: 0, Folded]
  |  Branch (3530:5): [True: 35, Folded]
  ------------------
 3531|     35|    assert(sizeof(int32_t) == 4);
  ------------------
  |  Branch (3531:5): [True: 0, Folded]
  |  Branch (3531:5): [True: 35, Folded]
  ------------------
 3532|     35|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3532:5): [True: 0, Folded]
  |  Branch (3532:5): [True: 35, Folded]
  ------------------
 3533|     35|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|     35|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3533:9): [True: 32, False: 3]
  ------------------
 3534|     32|    {
 3535|     32|        enum TIFFReadDirEntryErr err;
 3536|     32|        uint32_t offset = direntry->tdir_offset.toff_long;
 3537|     32|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     32|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3537:13): [True: 0, False: 32]
  ------------------
 3538|      0|            TIFFSwabLong(&offset);
 3539|     32|        err = TIFFReadDirEntryData(tif, offset, 8, m.i);
 3540|     32|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3540:13): [True: 17, False: 15]
  ------------------
 3541|     17|            return (err);
 3542|     32|    }
 3543|      3|    else
 3544|      3|        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: 2, False: 16]
  |  Branch (3550:33): [True: 1, False: 15]
  ------------------
 3551|      3|        *value = 0.0;
 3552|     15|    else
 3553|     15|        *value = (double)((int32_t)m.i[0]) / (double)m.i[1];
 3554|     18|    return (TIFFReadDirEntryErrOk);
 3555|     35|}
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|     24|{
 3620|     24|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3620:5): [True: 0, Folded]
  |  Branch (3620:5): [True: 24, Folded]
  ------------------
 3621|     24|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3621:5): [True: 0, Folded]
  |  Branch (3621:5): [True: 24, Folded]
  ------------------
 3622|     24|    assert(sizeof(UInt64Aligned_t) == 8);
  ------------------
  |  Branch (3622:5): [True: 0, Folded]
  |  Branch (3622:5): [True: 24, Folded]
  ------------------
 3623|     24|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|     24|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3623:9): [True: 24, False: 0]
  ------------------
 3624|     24|    {
 3625|     24|        enum TIFFReadDirEntryErr err;
 3626|     24|        uint32_t offset = direntry->tdir_offset.toff_long;
 3627|     24|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     24|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3627:13): [True: 5, False: 19]
  ------------------
 3628|      5|            TIFFSwabLong(&offset);
 3629|     24|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3630|     24|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3630:13): [True: 11, False: 13]
  ------------------
 3631|     11|            return (err);
 3632|     24|    }
 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|     24|}
tif_dirread.c:TIFFReadDirEntryIfd8:
 1166|     52|{
 1167|     52|    enum TIFFReadDirEntryErr err;
 1168|     52|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (1168:9): [True: 34, False: 18]
  ------------------
 1169|     34|        return (TIFFReadDirEntryErrCount);
 1170|     18|    switch (direntry->tdir_type)
 1171|     18|    {
 1172|     11|        case TIFF_LONG:
  ------------------
  |  Branch (1172:9): [True: 11, False: 7]
  ------------------
 1173|     13|        case TIFF_IFD:
  ------------------
  |  Branch (1173:9): [True: 2, False: 16]
  ------------------
 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|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (1180:9): [True: 0, False: 18]
  ------------------
 1181|      0|        case TIFF_IFD8:
  ------------------
  |  Branch (1181:9): [True: 0, False: 18]
  ------------------
 1182|      0|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, value);
 1183|      0|            return (err);
 1184|      5|        default:
  ------------------
  |  Branch (1184:9): [True: 5, False: 13]
  ------------------
 1185|      5|            return (TIFFReadDirEntryErrType);
 1186|     18|    }
 1187|     18|}
tif_dirread.c:TIFFReadDirEntrySbyteArray:
 1583|    348|{
 1584|    348|    enum TIFFReadDirEntryErr err;
 1585|    348|    uint32_t count;
 1586|    348|    void *origdata;
 1587|    348|    int8_t *data;
 1588|    348|    switch (direntry->tdir_type)
 1589|    348|    {
 1590|      0|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1590:9): [True: 0, False: 348]
  ------------------
 1591|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1591:9): [True: 0, False: 348]
  ------------------
 1592|    348|        case TIFF_SBYTE:
  ------------------
  |  Branch (1592:9): [True: 348, False: 0]
  ------------------
 1593|    348|        case TIFF_SHORT:
  ------------------
  |  Branch (1593:9): [True: 0, False: 348]
  ------------------
 1594|    348|        case TIFF_SSHORT:
  ------------------
  |  Branch (1594:9): [True: 0, False: 348]
  ------------------
 1595|    348|        case TIFF_LONG:
  ------------------
  |  Branch (1595:9): [True: 0, False: 348]
  ------------------
 1596|    348|        case TIFF_SLONG:
  ------------------
  |  Branch (1596:9): [True: 0, False: 348]
  ------------------
 1597|    348|        case TIFF_LONG8:
  ------------------
  |  Branch (1597:9): [True: 0, False: 348]
  ------------------
 1598|    348|        case TIFF_SLONG8:
  ------------------
  |  Branch (1598:9): [True: 0, False: 348]
  ------------------
 1599|    348|            break;
 1600|      0|        default:
  ------------------
  |  Branch (1600:9): [True: 0, False: 348]
  ------------------
 1601|      0|            return (TIFFReadDirEntryErrType);
 1602|    348|    }
 1603|    348|    err = TIFFReadDirEntryArray(tif, direntry, &count, 1, &origdata);
 1604|    348|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1604:9): [True: 280, False: 68]
  |  Branch (1604:43): [True: 7, False: 61]
  ------------------
 1605|    287|    {
 1606|    287|        *value = 0;
 1607|    287|        return (err);
 1608|    287|    }
 1609|     61|    switch (direntry->tdir_type)
 1610|     61|    {
 1611|      0|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1611:9): [True: 0, False: 61]
  ------------------
 1612|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1612:9): [True: 0, False: 61]
  ------------------
 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|     61|        case TIFF_SBYTE:
  ------------------
  |  Branch (1630:9): [True: 61, False: 0]
  ------------------
 1631|     61|            *value = (int8_t *)origdata;
 1632|     61|            return (TIFFReadDirEntryErrOk);
 1633|      0|        default:
  ------------------
  |  Branch (1633:9): [True: 0, False: 61]
  ------------------
 1634|      0|            break;
 1635|     61|    }
 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|    427|{
 1946|    427|    enum TIFFReadDirEntryErr err;
 1947|    427|    uint32_t count;
 1948|    427|    void *origdata;
 1949|    427|    int16_t *data;
 1950|    427|    switch (direntry->tdir_type)
 1951|    427|    {
 1952|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1952:9): [True: 0, False: 427]
  ------------------
 1953|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (1953:9): [True: 0, False: 427]
  ------------------
 1954|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1954:9): [True: 0, False: 427]
  ------------------
 1955|    427|        case TIFF_SSHORT:
  ------------------
  |  Branch (1955:9): [True: 427, False: 0]
  ------------------
 1956|    427|        case TIFF_LONG:
  ------------------
  |  Branch (1956:9): [True: 0, False: 427]
  ------------------
 1957|    427|        case TIFF_SLONG:
  ------------------
  |  Branch (1957:9): [True: 0, False: 427]
  ------------------
 1958|    427|        case TIFF_LONG8:
  ------------------
  |  Branch (1958:9): [True: 0, False: 427]
  ------------------
 1959|    427|        case TIFF_SLONG8:
  ------------------
  |  Branch (1959:9): [True: 0, False: 427]
  ------------------
 1960|    427|            break;
 1961|      0|        default:
  ------------------
  |  Branch (1961:9): [True: 0, False: 427]
  ------------------
 1962|      0|            return (TIFFReadDirEntryErrType);
 1963|    427|    }
 1964|    427|    err = TIFFReadDirEntryArray(tif, direntry, &count, 2, &origdata);
 1965|    427|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1965:9): [True: 338, False: 89]
  |  Branch (1965:43): [True: 11, False: 78]
  ------------------
 1966|    349|    {
 1967|    349|        *value = 0;
 1968|    349|        return (err);
 1969|    349|    }
 1970|     78|    switch (direntry->tdir_type)
 1971|     78|    {
 1972|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1972:9): [True: 0, False: 78]
  ------------------
 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|     78|        case TIFF_SSHORT:
  ------------------
  |  Branch (1992:9): [True: 78, False: 0]
  ------------------
 1993|     78|            *value = (int16_t *)origdata;
 1994|     78|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     78|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1994:17): [True: 3, False: 75]
  ------------------
 1995|      3|                TIFFSwabArrayOfShort((uint16_t *)(*value), count);
 1996|     78|            return (TIFFReadDirEntryErrOk);
 1997|      0|        default:
  ------------------
  |  Branch (1997:9): [True: 0, False: 78]
  ------------------
 1998|      0|            break;
 1999|     78|    }
 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.24k|{
 2119|  1.24k|    enum TIFFReadDirEntryErr err;
 2120|  1.24k|    uint32_t count;
 2121|  1.24k|    void *origdata;
 2122|  1.24k|    uint32_t *data;
 2123|  1.24k|    switch (direntry->tdir_type)
 2124|  1.24k|    {
 2125|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2125:9): [True: 0, False: 1.24k]
  ------------------
 2126|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2126:9): [True: 0, False: 1.24k]
  ------------------
 2127|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2127:9): [True: 0, False: 1.24k]
  ------------------
 2128|     13|        case TIFF_SSHORT:
  ------------------
  |  Branch (2128:9): [True: 13, False: 1.23k]
  ------------------
 2129|  1.11k|        case TIFF_LONG:
  ------------------
  |  Branch (2129:9): [True: 1.09k, False: 149]
  ------------------
 2130|  1.11k|        case TIFF_SLONG:
  ------------------
  |  Branch (2130:9): [True: 7, False: 1.23k]
  ------------------
 2131|  1.15k|        case TIFF_LONG8:
  ------------------
  |  Branch (2131:9): [True: 33, False: 1.21k]
  ------------------
 2132|  1.20k|        case TIFF_SLONG8:
  ------------------
  |  Branch (2132:9): [True: 54, False: 1.19k]
  ------------------
 2133|  1.22k|        case TIFF_IFD:
  ------------------
  |  Branch (2133:9): [True: 18, False: 1.22k]
  ------------------
 2134|  1.23k|        case TIFF_IFD8:
  ------------------
  |  Branch (2134:9): [True: 16, False: 1.23k]
  ------------------
 2135|  1.23k|            break;
 2136|      8|        default:
  ------------------
  |  Branch (2136:9): [True: 8, False: 1.23k]
  ------------------
 2137|      8|            return (TIFFReadDirEntryErrType);
 2138|  1.24k|    }
 2139|  1.23k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2140|  1.23k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2140:9): [True: 821, False: 417]
  |  Branch (2140:43): [True: 189, False: 228]
  ------------------
 2141|  1.01k|    {
 2142|  1.01k|        *value = 0;
 2143|  1.01k|        return (err);
 2144|  1.01k|    }
 2145|    228|    switch (direntry->tdir_type)
 2146|    228|    {
 2147|    127|        case TIFF_LONG:
  ------------------
  |  Branch (2147:9): [True: 127, False: 101]
  ------------------
 2148|    136|        case TIFF_IFD:
  ------------------
  |  Branch (2148:9): [True: 9, False: 219]
  ------------------
 2149|    136|            *value = (uint32_t *)origdata;
 2150|    136|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    136|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2150:17): [True: 33, False: 103]
  ------------------
 2151|     33|                TIFFSwabArrayOfLong(*value, count);
 2152|    136|            return (TIFFReadDirEntryErrOk);
 2153|      5|        case TIFF_SLONG:
  ------------------
  |  Branch (2153:9): [True: 5, False: 223]
  ------------------
 2154|      5|        {
 2155|      5|            int32_t *m;
 2156|      5|            uint32_t n;
 2157|      5|            m = (int32_t *)origdata;
 2158|    407|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2158:25): [True: 403, False: 4]
  ------------------
 2159|    403|            {
 2160|    403|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    403|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2160:21): [True: 260, False: 143]
  ------------------
 2161|    260|                    TIFFSwabLong((uint32_t *)m);
 2162|    403|                err = TIFFReadDirEntryCheckRangeLongSlong(*m);
 2163|    403|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2163:21): [True: 1, False: 402]
  ------------------
 2164|      1|                {
 2165|      1|                    _TIFFfreeExt(tif, origdata);
 2166|      1|                    return (err);
 2167|      1|                }
 2168|    402|                m++;
 2169|    402|            }
 2170|      4|            *value = (uint32_t *)origdata;
 2171|      4|            return (TIFFReadDirEntryErrOk);
 2172|      5|        }
 2173|     87|        default:
  ------------------
  |  Branch (2173:9): [True: 87, False: 141]
  ------------------
 2174|     87|            break;
 2175|    228|    }
 2176|     87|    data = (uint32_t *)_TIFFCheckMalloc(tif, count, sizeof(uint32_t),
 2177|     87|                                        "TIFFReadDirEntryLongArray");
 2178|     87|    if (data == 0)
  ------------------
  |  Branch (2178:9): [True: 0, False: 87]
  ------------------
 2179|      0|    {
 2180|      0|        _TIFFfreeExt(tif, origdata);
 2181|      0|        return (TIFFReadDirEntryErrAlloc);
 2182|      0|    }
 2183|     87|    switch (direntry->tdir_type)
 2184|     87|    {
 2185|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2185:9): [True: 0, False: 87]
  ------------------
 2186|      0|        {
 2187|      0|            uint8_t *ma;
 2188|      0|            uint32_t *mb;
 2189|      0|            uint32_t n;
 2190|      0|            ma = (uint8_t *)origdata;
 2191|      0|            mb = data;
 2192|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2192:25): [True: 0, False: 0]
  ------------------
 2193|      0|                *mb++ = (uint32_t)(*ma++);
 2194|      0|        }
 2195|      0|        break;
 2196|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2196:9): [True: 0, False: 87]
  ------------------
 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: 87]
  ------------------
 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|     13|        case TIFF_SSHORT:
  ------------------
  |  Branch (2227:9): [True: 13, False: 74]
  ------------------
 2228|     13|        {
 2229|     13|            int16_t *ma;
 2230|     13|            uint32_t *mb;
 2231|     13|            uint32_t n;
 2232|     13|            ma = (int16_t *)origdata;
 2233|     13|            mb = data;
 2234|    179|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2234:25): [True: 170, False: 9]
  ------------------
 2235|    170|            {
 2236|    170|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    170|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2236:21): [True: 0, False: 170]
  ------------------
 2237|      0|                    TIFFSwabShort((uint16_t *)ma);
 2238|    170|                err = TIFFReadDirEntryCheckRangeLongSshort(*ma);
 2239|    170|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2239:21): [True: 4, False: 166]
  ------------------
 2240|      4|                    break;
 2241|    166|                *mb++ = (uint32_t)(*ma++);
 2242|    166|            }
 2243|     13|        }
 2244|     13|        break;
 2245|     31|        case TIFF_LONG8:
  ------------------
  |  Branch (2245:9): [True: 31, False: 56]
  ------------------
 2246|     40|        case TIFF_IFD8:
  ------------------
  |  Branch (2246:9): [True: 9, False: 78]
  ------------------
 2247|     40|        {
 2248|     40|            uint64_t *ma;
 2249|     40|            uint32_t *mb;
 2250|     40|            uint32_t n;
 2251|     40|            ma = (uint64_t *)origdata;
 2252|     40|            mb = data;
 2253|    612|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2253:25): [True: 599, False: 13]
  ------------------
 2254|    599|            {
 2255|    599|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    599|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2255:21): [True: 168, False: 431]
  ------------------
 2256|    168|                    TIFFSwabLong8(ma);
 2257|    599|                err = TIFFReadDirEntryCheckRangeLongLong8(*ma);
 2258|    599|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2258:21): [True: 27, False: 572]
  ------------------
 2259|     27|                    break;
 2260|    572|                *mb++ = (uint32_t)(*ma++);
 2261|    572|            }
 2262|     40|        }
 2263|     40|        break;
 2264|     34|        case TIFF_SLONG8:
  ------------------
  |  Branch (2264:9): [True: 34, False: 53]
  ------------------
 2265|     34|        {
 2266|     34|            int64_t *ma;
 2267|     34|            uint32_t *mb;
 2268|     34|            uint32_t n;
 2269|     34|            ma = (int64_t *)origdata;
 2270|     34|            mb = data;
 2271|    495|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2271:25): [True: 485, False: 10]
  ------------------
 2272|    485|            {
 2273|    485|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    485|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2273:21): [True: 223, False: 262]
  ------------------
 2274|    223|                    TIFFSwabLong8((uint64_t *)ma);
 2275|    485|                err = TIFFReadDirEntryCheckRangeLongSlong8(*ma);
 2276|    485|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2276:21): [True: 24, False: 461]
  ------------------
 2277|     24|                    break;
 2278|    461|                *mb++ = (uint32_t)(*ma++);
 2279|    461|            }
 2280|     34|        }
 2281|     34|        break;
 2282|      0|        default:
  ------------------
  |  Branch (2282:9): [True: 0, False: 87]
  ------------------
 2283|      0|            break;
 2284|     87|    }
 2285|     87|    _TIFFfreeExt(tif, origdata);
 2286|     87|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2286:9): [True: 55, False: 32]
  ------------------
 2287|     55|    {
 2288|     55|        _TIFFfreeExt(tif, data);
 2289|     55|        return (err);
 2290|     55|    }
 2291|     32|    *value = data;
 2292|     32|    return (TIFFReadDirEntryErrOk);
 2293|     87|}
tif_dirread.c:TIFFReadDirEntrySlongArray:
 2297|    200|{
 2298|    200|    enum TIFFReadDirEntryErr err;
 2299|    200|    uint32_t count;
 2300|    200|    void *origdata;
 2301|    200|    int32_t *data;
 2302|    200|    switch (direntry->tdir_type)
 2303|    200|    {
 2304|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2304:9): [True: 0, False: 200]
  ------------------
 2305|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2305:9): [True: 0, False: 200]
  ------------------
 2306|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2306:9): [True: 0, False: 200]
  ------------------
 2307|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2307:9): [True: 0, False: 200]
  ------------------
 2308|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2308:9): [True: 0, False: 200]
  ------------------
 2309|    200|        case TIFF_SLONG:
  ------------------
  |  Branch (2309:9): [True: 200, False: 0]
  ------------------
 2310|    200|        case TIFF_LONG8:
  ------------------
  |  Branch (2310:9): [True: 0, False: 200]
  ------------------
 2311|    200|        case TIFF_SLONG8:
  ------------------
  |  Branch (2311:9): [True: 0, False: 200]
  ------------------
 2312|    200|            break;
 2313|      0|        default:
  ------------------
  |  Branch (2313:9): [True: 0, False: 200]
  ------------------
 2314|      0|            return (TIFFReadDirEntryErrType);
 2315|    200|    }
 2316|    200|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2317|    200|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2317:9): [True: 150, False: 50]
  |  Branch (2317:43): [True: 45, False: 5]
  ------------------
 2318|    195|    {
 2319|    195|        *value = 0;
 2320|    195|        return (err);
 2321|    195|    }
 2322|      5|    switch (direntry->tdir_type)
 2323|      5|    {
 2324|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2324:9): [True: 0, False: 5]
  ------------------
 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|      5|        case TIFF_SLONG:
  ------------------
  |  Branch (2344:9): [True: 5, False: 0]
  ------------------
 2345|      5|            *value = (int32_t *)origdata;
 2346|      5|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      5|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2346:17): [True: 2, False: 3]
  ------------------
 2347|      2|                TIFFSwabArrayOfLong((uint32_t *)(*value), count);
 2348|      5|            return (TIFFReadDirEntryErrOk);
 2349|      0|        default:
  ------------------
  |  Branch (2349:9): [True: 0, False: 5]
  ------------------
 2350|      0|            break;
 2351|      5|    }
 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.79k|{
 2643|  2.79k|    return TIFFReadDirEntryLong8ArrayWithLimit(tif, direntry, value,
 2644|  2.79k|                                               ~((uint64_t)0));
 2645|  2.79k|}
tif_dirread.c:TIFFReadDirEntryLong8ArrayWithLimit:
 2465|  13.9k|{
 2466|  13.9k|    enum TIFFReadDirEntryErr err;
 2467|  13.9k|    uint32_t count;
 2468|  13.9k|    void *origdata;
 2469|  13.9k|    uint64_t *data;
 2470|  13.9k|    switch (direntry->tdir_type)
 2471|  13.9k|    {
 2472|  4.58k|        case TIFF_BYTE:
  ------------------
  |  Branch (2472:9): [True: 4.58k, False: 9.31k]
  ------------------
 2473|  4.64k|        case TIFF_SBYTE:
  ------------------
  |  Branch (2473:9): [True: 56, False: 13.8k]
  ------------------
 2474|  7.48k|        case TIFF_SHORT:
  ------------------
  |  Branch (2474:9): [True: 2.84k, False: 11.0k]
  ------------------
 2475|  7.53k|        case TIFF_SSHORT:
  ------------------
  |  Branch (2475:9): [True: 51, False: 13.8k]
  ------------------
 2476|  12.3k|        case TIFF_LONG:
  ------------------
  |  Branch (2476:9): [True: 4.85k, False: 9.04k]
  ------------------
 2477|  12.4k|        case TIFF_SLONG:
  ------------------
  |  Branch (2477:9): [True: 11, False: 13.8k]
  ------------------
 2478|  13.8k|        case TIFF_LONG8:
  ------------------
  |  Branch (2478:9): [True: 1.41k, False: 12.4k]
  ------------------
 2479|  13.8k|        case TIFF_SLONG8:
  ------------------
  |  Branch (2479:9): [True: 5, False: 13.8k]
  ------------------
 2480|  13.8k|        case TIFF_IFD:
  ------------------
  |  Branch (2480:9): [True: 6, False: 13.8k]
  ------------------
 2481|  13.8k|        case TIFF_IFD8:
  ------------------
  |  Branch (2481:9): [True: 25, False: 13.8k]
  ------------------
 2482|  13.8k|            break;
 2483|     44|        default:
  ------------------
  |  Branch (2483:9): [True: 44, False: 13.8k]
  ------------------
 2484|     44|            return (TIFFReadDirEntryErrType);
 2485|  13.9k|    }
 2486|  13.8k|    err = TIFFReadDirEntryArrayWithLimit(tif, direntry, &count, 8, &origdata,
 2487|  13.8k|                                         maxcount);
 2488|  13.8k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2488:9): [True: 266, False: 13.5k]
  |  Branch (2488:43): [True: 191, False: 13.3k]
  ------------------
 2489|    457|    {
 2490|    457|        *value = 0;
 2491|    457|        return (err);
 2492|    457|    }
 2493|  13.3k|    switch (direntry->tdir_type)
 2494|  13.3k|    {
 2495|  1.25k|        case TIFF_LONG8:
  ------------------
  |  Branch (2495:9): [True: 1.25k, False: 12.1k]
  ------------------
 2496|  1.27k|        case TIFF_IFD8:
  ------------------
  |  Branch (2496:9): [True: 25, False: 13.3k]
  ------------------
 2497|  1.27k|            *value = (uint64_t *)origdata;
 2498|  1.27k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.27k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2498:17): [True: 2, False: 1.27k]
  ------------------
 2499|      2|                TIFFSwabArrayOfLong8(*value, count);
 2500|  1.27k|            return (TIFFReadDirEntryErrOk);
 2501|      5|        case TIFF_SLONG8:
  ------------------
  |  Branch (2501:9): [True: 5, False: 13.3k]
  ------------------
 2502|      5|        {
 2503|      5|            int64_t *m;
 2504|      5|            uint32_t n;
 2505|      5|            m = (int64_t *)origdata;
 2506|    443|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2506:25): [True: 442, False: 1]
  ------------------
 2507|    442|            {
 2508|    442|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    442|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2508:21): [True: 184, False: 258]
  ------------------
 2509|    184|                    TIFFSwabLong8((uint64_t *)m);
 2510|    442|                err = TIFFReadDirEntryCheckRangeLong8Slong8(*m);
 2511|    442|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2511:21): [True: 4, False: 438]
  ------------------
 2512|      4|                {
 2513|      4|                    _TIFFfreeExt(tif, origdata);
 2514|      4|                    return (err);
 2515|      4|                }
 2516|    438|                m++;
 2517|    438|            }
 2518|      1|            *value = (uint64_t *)origdata;
 2519|      1|            return (TIFFReadDirEntryErrOk);
 2520|      5|        }
 2521|  12.1k|        default:
  ------------------
  |  Branch (2521:9): [True: 12.1k, False: 1.28k]
  ------------------
 2522|  12.1k|            break;
 2523|  13.3k|    }
 2524|  12.1k|    data = (uint64_t *)_TIFFCheckMalloc(tif, count, sizeof(uint64_t),
 2525|  12.1k|                                        "TIFFReadDirEntryLong8ArrayWithLimit");
 2526|  12.1k|    if (data == 0)
  ------------------
  |  Branch (2526:9): [True: 0, False: 12.1k]
  ------------------
 2527|      0|    {
 2528|      0|        _TIFFfreeExt(tif, origdata);
 2529|      0|        return (TIFFReadDirEntryErrAlloc);
 2530|      0|    }
 2531|  12.1k|    switch (direntry->tdir_type)
 2532|  12.1k|    {
 2533|  4.38k|        case TIFF_BYTE:
  ------------------
  |  Branch (2533:9): [True: 4.38k, False: 7.72k]
  ------------------
 2534|  4.38k|        {
 2535|  4.38k|            uint8_t *ma;
 2536|  4.38k|            uint64_t *mb;
 2537|  4.38k|            uint32_t n;
 2538|  4.38k|            ma = (uint8_t *)origdata;
 2539|  4.38k|            mb = data;
 2540|   612k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2540:25): [True: 607k, False: 4.38k]
  ------------------
 2541|   607k|                *mb++ = (uint64_t)(*ma++);
 2542|  4.38k|        }
 2543|  4.38k|        break;
 2544|     23|        case TIFF_SBYTE:
  ------------------
  |  Branch (2544:9): [True: 23, False: 12.0k]
  ------------------
 2545|     23|        {
 2546|     23|            int8_t *ma;
 2547|     23|            uint64_t *mb;
 2548|     23|            uint32_t n;
 2549|     23|            ma = (int8_t *)origdata;
 2550|     23|            mb = data;
 2551|     49|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2551:25): [True: 38, False: 11]
  ------------------
 2552|     38|            {
 2553|     38|                err = TIFFReadDirEntryCheckRangeLong8Sbyte(*ma);
 2554|     38|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2554:21): [True: 12, False: 26]
  ------------------
 2555|     12|                    break;
 2556|     26|                *mb++ = (uint64_t)(*ma++);
 2557|     26|            }
 2558|     23|        }
 2559|     23|        break;
 2560|  2.82k|        case TIFF_SHORT:
  ------------------
  |  Branch (2560:9): [True: 2.82k, False: 9.28k]
  ------------------
 2561|  2.82k|        {
 2562|  2.82k|            uint16_t *ma;
 2563|  2.82k|            uint64_t *mb;
 2564|  2.82k|            uint32_t n;
 2565|  2.82k|            ma = (uint16_t *)origdata;
 2566|  2.82k|            mb = data;
 2567|  12.5k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2567:25): [True: 9.68k, False: 2.82k]
  ------------------
 2568|  9.68k|            {
 2569|  9.68k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  9.68k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2569:21): [True: 312, False: 9.37k]
  ------------------
 2570|    312|                    TIFFSwabShort(ma);
 2571|  9.68k|                *mb++ = (uint64_t)(*ma++);
 2572|  9.68k|            }
 2573|  2.82k|        }
 2574|  2.82k|        break;
 2575|     41|        case TIFF_SSHORT:
  ------------------
  |  Branch (2575:9): [True: 41, False: 12.0k]
  ------------------
 2576|     41|        {
 2577|     41|            int16_t *ma;
 2578|     41|            uint64_t *mb;
 2579|     41|            uint32_t n;
 2580|     41|            ma = (int16_t *)origdata;
 2581|     41|            mb = data;
 2582|    696|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2582:25): [True: 655, False: 41]
  ------------------
 2583|    655|            {
 2584|    655|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    655|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2584:21): [True: 129, False: 526]
  ------------------
 2585|    129|                    TIFFSwabShort((uint16_t *)ma);
 2586|    655|                err = TIFFReadDirEntryCheckRangeLong8Sshort(*ma);
 2587|    655|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2587:21): [True: 0, False: 655]
  ------------------
 2588|      0|                    break;
 2589|    655|                *mb++ = (uint64_t)(*ma++);
 2590|    655|            }
 2591|     41|        }
 2592|     41|        break;
 2593|  4.82k|        case TIFF_LONG:
  ------------------
  |  Branch (2593:9): [True: 4.82k, False: 7.29k]
  ------------------
 2594|  4.82k|        case TIFF_IFD:
  ------------------
  |  Branch (2594:9): [True: 6, False: 12.1k]
  ------------------
 2595|  4.82k|        {
 2596|  4.82k|            uint32_t *ma;
 2597|  4.82k|            uint64_t *mb;
 2598|  4.82k|            uint32_t n;
 2599|  4.82k|            ma = (uint32_t *)origdata;
 2600|  4.82k|            mb = data;
 2601|  47.6k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2601:25): [True: 42.8k, False: 4.82k]
  ------------------
 2602|  42.8k|            {
 2603|  42.8k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  42.8k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2603:21): [True: 718, False: 42.1k]
  ------------------
 2604|    718|                    TIFFSwabLong(ma);
 2605|  42.8k|                *mb++ = (uint64_t)(*ma++);
 2606|  42.8k|            }
 2607|  4.82k|        }
 2608|  4.82k|        break;
 2609|     10|        case TIFF_SLONG:
  ------------------
  |  Branch (2609:9): [True: 10, False: 12.1k]
  ------------------
 2610|     10|        {
 2611|     10|            int32_t *ma;
 2612|     10|            uint64_t *mb;
 2613|     10|            uint32_t n;
 2614|     10|            ma = (int32_t *)origdata;
 2615|     10|            mb = data;
 2616|    384|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2616:25): [True: 375, False: 9]
  ------------------
 2617|    375|            {
 2618|    375|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    375|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2618:21): [True: 130, False: 245]
  ------------------
 2619|    130|                    TIFFSwabLong((uint32_t *)ma);
 2620|    375|                err = TIFFReadDirEntryCheckRangeLong8Slong(*ma);
 2621|    375|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2621:21): [True: 1, False: 374]
  ------------------
 2622|      1|                    break;
 2623|    374|                *mb++ = (uint64_t)(*ma++);
 2624|    374|            }
 2625|     10|        }
 2626|     10|        break;
 2627|      0|        default:
  ------------------
  |  Branch (2627:9): [True: 0, False: 12.1k]
  ------------------
 2628|      0|            break;
 2629|  12.1k|    }
 2630|  12.1k|    _TIFFfreeExt(tif, origdata);
 2631|  12.1k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2631:9): [True: 13, False: 12.1k]
  ------------------
 2632|     13|    {
 2633|     13|        _TIFFfreeExt(tif, data);
 2634|     13|        return (err);
 2635|     13|    }
 2636|  12.1k|    *value = data;
 2637|  12.1k|    return (TIFFReadDirEntryErrOk);
 2638|  12.1k|}
tif_dirread.c:TIFFReadDirEntrySlong8Array:
 2649|    273|{
 2650|    273|    enum TIFFReadDirEntryErr err;
 2651|    273|    uint32_t count;
 2652|    273|    void *origdata;
 2653|    273|    int64_t *data;
 2654|    273|    switch (direntry->tdir_type)
 2655|    273|    {
 2656|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2656:9): [True: 0, False: 273]
  ------------------
 2657|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2657:9): [True: 0, False: 273]
  ------------------
 2658|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2658:9): [True: 0, False: 273]
  ------------------
 2659|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2659:9): [True: 0, False: 273]
  ------------------
 2660|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2660:9): [True: 0, False: 273]
  ------------------
 2661|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (2661:9): [True: 0, False: 273]
  ------------------
 2662|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (2662:9): [True: 0, False: 273]
  ------------------
 2663|    273|        case TIFF_SLONG8:
  ------------------
  |  Branch (2663:9): [True: 273, False: 0]
  ------------------
 2664|    273|            break;
 2665|      0|        default:
  ------------------
  |  Branch (2665:9): [True: 0, False: 273]
  ------------------
 2666|      0|            return (TIFFReadDirEntryErrType);
 2667|    273|    }
 2668|    273|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 2669|    273|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2669:9): [True: 134, False: 139]
  |  Branch (2669:43): [True: 38, False: 101]
  ------------------
 2670|    172|    {
 2671|    172|        *value = 0;
 2672|    172|        return (err);
 2673|    172|    }
 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: 7, False: 94]
  ------------------
 2699|      7|                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.30k|{
 2806|  1.30k|    enum TIFFReadDirEntryErr err;
 2807|  1.30k|    uint32_t count;
 2808|  1.30k|    void *origdata;
 2809|  1.30k|    float *data;
 2810|  1.30k|    switch (direntry->tdir_type)
 2811|  1.30k|    {
 2812|     11|        case TIFF_BYTE:
  ------------------
  |  Branch (2812:9): [True: 11, False: 1.29k]
  ------------------
 2813|     26|        case TIFF_SBYTE:
  ------------------
  |  Branch (2813:9): [True: 15, False: 1.29k]
  ------------------
 2814|     28|        case TIFF_SHORT:
  ------------------
  |  Branch (2814:9): [True: 2, False: 1.30k]
  ------------------
 2815|     30|        case TIFF_SSHORT:
  ------------------
  |  Branch (2815:9): [True: 2, False: 1.30k]
  ------------------
 2816|     36|        case TIFF_LONG:
  ------------------
  |  Branch (2816:9): [True: 6, False: 1.30k]
  ------------------
 2817|     38|        case TIFF_SLONG:
  ------------------
  |  Branch (2817:9): [True: 2, False: 1.30k]
  ------------------
 2818|     55|        case TIFF_LONG8:
  ------------------
  |  Branch (2818:9): [True: 17, False: 1.29k]
  ------------------
 2819|     78|        case TIFF_SLONG8:
  ------------------
  |  Branch (2819:9): [True: 23, False: 1.28k]
  ------------------
 2820|    890|        case TIFF_RATIONAL:
  ------------------
  |  Branch (2820:9): [True: 812, False: 495]
  ------------------
 2821|  1.10k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (2821:9): [True: 212, False: 1.09k]
  ------------------
 2822|  1.24k|        case TIFF_FLOAT:
  ------------------
  |  Branch (2822:9): [True: 143, False: 1.16k]
  ------------------
 2823|  1.27k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (2823:9): [True: 33, False: 1.27k]
  ------------------
 2824|  1.27k|            break;
 2825|     29|        default:
  ------------------
  |  Branch (2825:9): [True: 29, False: 1.27k]
  ------------------
 2826|     29|            return (TIFFReadDirEntryErrType);
 2827|  1.30k|    }
 2828|  1.27k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2829|  1.27k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2829:9): [True: 947, False: 331]
  |  Branch (2829:43): [True: 21, False: 310]
  ------------------
 2830|    968|    {
 2831|    968|        *value = 0;
 2832|    968|        return (err);
 2833|    968|    }
 2834|    310|    switch (direntry->tdir_type)
 2835|    310|    {
 2836|     15|        case TIFF_FLOAT:
  ------------------
  |  Branch (2836:9): [True: 15, False: 295]
  ------------------
 2837|     15|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     15|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2837:17): [True: 0, False: 15]
  ------------------
 2838|      0|                TIFFSwabArrayOfLong((uint32_t *)origdata, count);
 2839|     15|            TIFFCvtIEEEFloatToNative(tif, count, (float *)origdata);
 2840|     15|            *value = (float *)origdata;
 2841|     15|            return (TIFFReadDirEntryErrOk);
 2842|    295|        default:
  ------------------
  |  Branch (2842:9): [True: 295, False: 15]
  ------------------
 2843|    295|            break;
 2844|    310|    }
 2845|    295|    data = (float *)_TIFFCheckMalloc(tif, count, sizeof(float),
 2846|    295|                                     "TIFFReadDirEntryFloatArray");
 2847|    295|    if (data == 0)
  ------------------
  |  Branch (2847:9): [True: 0, False: 295]
  ------------------
 2848|      0|    {
 2849|      0|        _TIFFfreeExt(tif, origdata);
 2850|      0|        return (TIFFReadDirEntryErrAlloc);
 2851|      0|    }
 2852|    295|    switch (direntry->tdir_type)
 2853|    295|    {
 2854|     11|        case TIFF_BYTE:
  ------------------
  |  Branch (2854:9): [True: 11, False: 284]
  ------------------
 2855|     11|        {
 2856|     11|            uint8_t *ma;
 2857|     11|            float *mb;
 2858|     11|            uint32_t n;
 2859|     11|            ma = (uint8_t *)origdata;
 2860|     11|            mb = data;
 2861|     55|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2861:25): [True: 44, False: 11]
  ------------------
 2862|     44|                *mb++ = (float)(*ma++);
 2863|     11|        }
 2864|     11|        break;
 2865|     13|        case TIFF_SBYTE:
  ------------------
  |  Branch (2865:9): [True: 13, False: 282]
  ------------------
 2866|     13|        {
 2867|     13|            int8_t *ma;
 2868|     13|            float *mb;
 2869|     13|            uint32_t n;
 2870|     13|            ma = (int8_t *)origdata;
 2871|     13|            mb = data;
 2872|    606|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2872:25): [True: 593, False: 13]
  ------------------
 2873|    593|                *mb++ = (float)(*ma++);
 2874|     13|        }
 2875|     13|        break;
 2876|      2|        case TIFF_SHORT:
  ------------------
  |  Branch (2876:9): [True: 2, False: 293]
  ------------------
 2877|      2|        {
 2878|      2|            uint16_t *ma;
 2879|      2|            float *mb;
 2880|      2|            uint32_t n;
 2881|      2|            ma = (uint16_t *)origdata;
 2882|      2|            mb = data;
 2883|     66|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2883:25): [True: 64, False: 2]
  ------------------
 2884|     64|            {
 2885|     64|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     64|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2885:21): [True: 0, False: 64]
  ------------------
 2886|      0|                    TIFFSwabShort(ma);
 2887|     64|                *mb++ = (float)(*ma++);
 2888|     64|            }
 2889|      2|        }
 2890|      2|        break;
 2891|      2|        case TIFF_SSHORT:
  ------------------
  |  Branch (2891:9): [True: 2, False: 293]
  ------------------
 2892|      2|        {
 2893|      2|            int16_t *ma;
 2894|      2|            float *mb;
 2895|      2|            uint32_t n;
 2896|      2|            ma = (int16_t *)origdata;
 2897|      2|            mb = data;
 2898|    184|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2898:25): [True: 182, False: 2]
  ------------------
 2899|    182|            {
 2900|    182|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    182|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2900:21): [True: 0, False: 182]
  ------------------
 2901|      0|                    TIFFSwabShort((uint16_t *)ma);
 2902|    182|                *mb++ = (float)(*ma++);
 2903|    182|            }
 2904|      2|        }
 2905|      2|        break;
 2906|      4|        case TIFF_LONG:
  ------------------
  |  Branch (2906:9): [True: 4, False: 291]
  ------------------
 2907|      4|        {
 2908|      4|            uint32_t *ma;
 2909|      4|            float *mb;
 2910|      4|            uint32_t n;
 2911|      4|            ma = (uint32_t *)origdata;
 2912|      4|            mb = data;
 2913|    356|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2913:25): [True: 352, False: 4]
  ------------------
 2914|    352|            {
 2915|    352|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    352|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2915:21): [True: 222, False: 130]
  ------------------
 2916|    222|                    TIFFSwabLong(ma);
 2917|    352|                *mb++ = (float)(*ma++);
 2918|    352|            }
 2919|      4|        }
 2920|      4|        break;
 2921|      2|        case TIFF_SLONG:
  ------------------
  |  Branch (2921:9): [True: 2, False: 293]
  ------------------
 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|     13|        case TIFF_LONG8:
  ------------------
  |  Branch (2936:9): [True: 13, False: 282]
  ------------------
 2937|     13|        {
 2938|     13|            uint64_t *ma;
 2939|     13|            float *mb;
 2940|     13|            uint32_t n;
 2941|     13|            ma = (uint64_t *)origdata;
 2942|     13|            mb = data;
 2943|    456|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2943:25): [True: 443, False: 13]
  ------------------
 2944|    443|            {
 2945|    443|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    443|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2945:21): [True: 128, False: 315]
  ------------------
 2946|    128|                    TIFFSwabLong8(ma);
 2947|    443|                *mb++ = (float)(*ma++);
 2948|    443|            }
 2949|     13|        }
 2950|     13|        break;
 2951|     14|        case TIFF_SLONG8:
  ------------------
  |  Branch (2951:9): [True: 14, False: 281]
  ------------------
 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|    610|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2958:25): [True: 596, False: 14]
  ------------------
 2959|    596|            {
 2960|    596|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    596|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2960:21): [True: 128, False: 468]
  ------------------
 2961|    128|                    TIFFSwabLong8((uint64_t *)ma);
 2962|    596|                *mb++ = (float)(*ma++);
 2963|    596|            }
 2964|     14|        }
 2965|     14|        break;
 2966|    154|        case TIFF_RATIONAL:
  ------------------
  |  Branch (2966:9): [True: 154, False: 141]
  ------------------
 2967|    154|        {
 2968|    154|            uint32_t *ma;
 2969|    154|            uint32_t maa;
 2970|    154|            uint32_t mab;
 2971|    154|            float *mb;
 2972|    154|            uint32_t n;
 2973|    154|            ma = (uint32_t *)origdata;
 2974|    154|            mb = data;
 2975|  2.38k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2975:25): [True: 2.22k, False: 154]
  ------------------
 2976|  2.22k|            {
 2977|  2.22k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  2.22k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2977:21): [True: 384, False: 1.84k]
  ------------------
 2978|    384|                    TIFFSwabLong(ma);
 2979|  2.22k|                maa = *ma++;
 2980|  2.22k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  2.22k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2980:21): [True: 384, False: 1.84k]
  ------------------
 2981|    384|                    TIFFSwabLong(ma);
 2982|  2.22k|                mab = *ma++;
 2983|  2.22k|                if (mab == 0)
  ------------------
  |  Branch (2983:21): [True: 248, False: 1.97k]
  ------------------
 2984|    248|                    *mb++ = 0.0;
 2985|  1.97k|                else
 2986|  1.97k|                    *mb++ = (float)maa / (float)mab;
 2987|  2.22k|            }
 2988|    154|        }
 2989|    154|        break;
 2990|     59|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (2990:9): [True: 59, False: 236]
  ------------------
 2991|     59|        {
 2992|     59|            uint32_t *ma;
 2993|     59|            int32_t maa;
 2994|     59|            uint32_t mab;
 2995|     59|            float *mb;
 2996|     59|            uint32_t n;
 2997|     59|            ma = (uint32_t *)origdata;
 2998|     59|            mb = data;
 2999|    974|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2999:25): [True: 915, False: 59]
  ------------------
 3000|    915|            {
 3001|    915|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    915|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3001:21): [True: 129, False: 786]
  ------------------
 3002|    129|                    TIFFSwabLong(ma);
 3003|    915|                maa = *(int32_t *)ma;
 3004|    915|                ma++;
 3005|    915|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    915|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3005:21): [True: 129, False: 786]
  ------------------
 3006|    129|                    TIFFSwabLong(ma);
 3007|    915|                mab = *ma++;
 3008|    915|                if (mab == 0)
  ------------------
  |  Branch (3008:21): [True: 248, False: 667]
  ------------------
 3009|    248|                    *mb++ = 0.0;
 3010|    667|                else
 3011|    667|                    *mb++ = (float)maa / (float)mab;
 3012|    915|            }
 3013|     59|        }
 3014|     59|        break;
 3015|     21|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3015:9): [True: 21, False: 274]
  ------------------
 3016|     21|        {
 3017|     21|            double *ma;
 3018|     21|            float *mb;
 3019|     21|            uint32_t n;
 3020|     21|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     21|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3020:17): [True: 2, False: 19]
  ------------------
 3021|      2|                TIFFSwabArrayOfLong8((uint64_t *)origdata, count);
 3022|     21|            TIFFCvtIEEEDoubleToNative(tif, count, (double *)origdata);
 3023|     21|            ma = (double *)origdata;
 3024|     21|            mb = data;
 3025|  1.28k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3025:25): [True: 1.26k, False: 21]
  ------------------
 3026|  1.26k|            {
 3027|  1.26k|                double val = *ma++;
 3028|  1.26k|                if (val > (double)FLT_MAX)
  ------------------
  |  Branch (3028:21): [True: 351, False: 915]
  ------------------
 3029|    351|                    val = (double)FLT_MAX;
 3030|    915|                else if (val < -(double)FLT_MAX)
  ------------------
  |  Branch (3030:26): [True: 363, False: 552]
  ------------------
 3031|    363|                    val = -(double)FLT_MAX;
 3032|  1.26k|                *mb++ = (float)val;
 3033|  1.26k|            }
 3034|     21|        }
 3035|     21|        break;
 3036|      0|        default:
  ------------------
  |  Branch (3036:9): [True: 0, False: 295]
  ------------------
 3037|      0|            break;
 3038|    295|    }
 3039|    295|    _TIFFfreeExt(tif, origdata);
 3040|    295|    *value = data;
 3041|    295|    return (TIFFReadDirEntryErrOk);
 3042|    295|}
tif_dirread.c:TIFFReadDirEntryIfd8Array:
 3280|    199|{
 3281|    199|    enum TIFFReadDirEntryErr err;
 3282|    199|    uint32_t count;
 3283|    199|    void *origdata;
 3284|    199|    uint64_t *data;
 3285|    199|    switch (direntry->tdir_type)
 3286|    199|    {
 3287|      9|        case TIFF_LONG:
  ------------------
  |  Branch (3287:9): [True: 9, False: 190]
  ------------------
 3288|      9|        case TIFF_LONG8:
  ------------------
  |  Branch (3288:9): [True: 0, False: 199]
  ------------------
 3289|    138|        case TIFF_IFD:
  ------------------
  |  Branch (3289:9): [True: 129, False: 70]
  ------------------
 3290|    199|        case TIFF_IFD8:
  ------------------
  |  Branch (3290:9): [True: 61, False: 138]
  ------------------
 3291|    199|            break;
 3292|      0|        default:
  ------------------
  |  Branch (3292:9): [True: 0, False: 199]
  ------------------
 3293|      0|            return (TIFFReadDirEntryErrType);
 3294|    199|    }
 3295|    199|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 3296|    199|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (3296:9): [True: 142, False: 57]
  |  Branch (3296:43): [True: 12, False: 45]
  ------------------
 3297|    154|    {
 3298|    154|        *value = 0;
 3299|    154|        return (err);
 3300|    154|    }
 3301|     45|    switch (direntry->tdir_type)
 3302|     45|    {
 3303|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (3303:9): [True: 0, False: 45]
  ------------------
 3304|     10|        case TIFF_IFD8:
  ------------------
  |  Branch (3304:9): [True: 10, False: 35]
  ------------------
 3305|     10|            *value = (uint64_t *)origdata;
 3306|     10|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     10|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3306:17): [True: 9, False: 1]
  ------------------
 3307|      9|                TIFFSwabArrayOfLong8(*value, count);
 3308|     10|            return (TIFFReadDirEntryErrOk);
 3309|     35|        default:
  ------------------
  |  Branch (3309:9): [True: 35, False: 10]
  ------------------
 3310|     35|            break;
 3311|     45|    }
 3312|     35|    data = (uint64_t *)_TIFFCheckMalloc(tif, count, sizeof(uint64_t),
 3313|     35|                                        "TIFFReadDirEntryIfd8Array");
 3314|     35|    if (data == 0)
  ------------------
  |  Branch (3314:9): [True: 0, False: 35]
  ------------------
 3315|      0|    {
 3316|      0|        _TIFFfreeExt(tif, origdata);
 3317|      0|        return (TIFFReadDirEntryErrAlloc);
 3318|      0|    }
 3319|     35|    switch (direntry->tdir_type)
 3320|     35|    {
 3321|      4|        case TIFF_LONG:
  ------------------
  |  Branch (3321:9): [True: 4, False: 31]
  ------------------
 3322|     35|        case TIFF_IFD:
  ------------------
  |  Branch (3322:9): [True: 31, False: 4]
  ------------------
 3323|     35|        {
 3324|     35|            uint32_t *ma;
 3325|     35|            uint64_t *mb;
 3326|     35|            uint32_t n;
 3327|     35|            ma = (uint32_t *)origdata;
 3328|     35|            mb = data;
 3329|  1.24k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3329:25): [True: 1.21k, False: 35]
  ------------------
 3330|  1.21k|            {
 3331|  1.21k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.21k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3331:21): [True: 184, False: 1.02k]
  ------------------
 3332|    184|                    TIFFSwabLong(ma);
 3333|  1.21k|                *mb++ = (uint64_t)(*ma++);
 3334|  1.21k|            }
 3335|     35|        }
 3336|     35|        break;
 3337|      0|        default:
  ------------------
  |  Branch (3337:9): [True: 0, False: 35]
  ------------------
 3338|      0|            break;
 3339|     35|    }
 3340|     35|    _TIFFfreeExt(tif, origdata);
 3341|     35|    *value = data;
 3342|     35|    return (TIFFReadDirEntryErrOk);
 3343|     35|}
tif_dirread.c:TIFFFetchStripThing:
 7793|  11.1k|{
 7794|  11.1k|    static const char module[] = "TIFFFetchStripThing";
 7795|  11.1k|    enum TIFFReadDirEntryErr err;
 7796|  11.1k|    uint64_t *data;
 7797|  11.1k|    err = TIFFReadDirEntryLong8ArrayWithLimit(tif, dir, &data, nstrips);
 7798|  11.1k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7798:9): [True: 140, False: 10.9k]
  ------------------
 7799|    140|    {
 7800|    140|        const TIFFField *fip = TIFFFieldWithTag(tif, dir->tdir_tag);
 7801|    140|        TIFFReadDirEntryOutputErr(tif, err, module,
 7802|    140|                                  fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (7802:35): [True: 140, False: 0]
  ------------------
 7803|    140|        return (0);
 7804|    140|    }
 7805|  10.9k|    if (dir->tdir_count < (uint64_t)nstrips)
  ------------------
  |  Branch (7805:9): [True: 1.75k, False: 9.20k]
  ------------------
 7806|  1.75k|    {
 7807|  1.75k|        uint64_t *resizeddata;
 7808|  1.75k|        const TIFFField *fip = TIFFFieldWithTag(tif, dir->tdir_tag);
 7809|  1.75k|        const char *pszMax = getenv("LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT");
 7810|  1.75k|        uint32_t max_nstrips = 1000000;
 7811|  1.75k|        if (pszMax)
  ------------------
  |  Branch (7811:13): [True: 0, False: 1.75k]
  ------------------
 7812|      0|            max_nstrips = (uint32_t)atoi(pszMax);
 7813|  1.75k|        TIFFReadDirEntryOutputErr(tif, TIFFReadDirEntryErrCount, module,
 7814|  1.75k|                                  fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (7814:35): [True: 1.75k, False: 0]
  ------------------
 7815|  1.75k|                                  (nstrips <= max_nstrips));
 7816|       |
 7817|  1.75k|        if (nstrips > max_nstrips)
  ------------------
  |  Branch (7817:13): [True: 0, False: 1.75k]
  ------------------
 7818|      0|        {
 7819|      0|            _TIFFfreeExt(tif, data);
 7820|      0|            return (0);
 7821|      0|        }
 7822|       |
 7823|  1.75k|        const uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t);
 7824|  1.75k|        if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (7824:13): [True: 0, False: 1.75k]
  ------------------
 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.75k|        resizeddata = (uint64_t *)_TIFFCheckMalloc(
 7843|  1.75k|            tif, nstrips, sizeof(uint64_t), "for strip array");
 7844|  1.75k|        if (resizeddata == 0)
  ------------------
  |  Branch (7844:13): [True: 0, False: 1.75k]
  ------------------
 7845|      0|        {
 7846|      0|            _TIFFfreeExt(tif, data);
 7847|      0|            return (0);
 7848|      0|        }
 7849|  1.75k|        if (dir->tdir_count)
  ------------------
  |  Branch (7849:13): [True: 1.57k, False: 185]
  ------------------
 7850|  1.57k|            _TIFFmemcpy(resizeddata, data,
 7851|  1.57k|                        (tmsize_t)((size_t)dir->tdir_count * sizeof(uint64_t)));
 7852|  1.75k|        _TIFFmemset(resizeddata + (uint32_t)dir->tdir_count, 0,
 7853|  1.75k|                    (tmsize_t)((size_t)(nstrips - (uint32_t)dir->tdir_count) *
 7854|  1.75k|                               sizeof(uint64_t)));
 7855|  1.75k|        _TIFFfreeExt(tif, data);
 7856|  1.75k|        data = resizeddata;
 7857|  1.75k|    }
 7858|  10.9k|    *lpp = data;
 7859|  10.9k|    return (1);
 7860|  10.9k|}
tif_dirread.c:ChopUpSingleUncompressedStrip:
 8017|     74|{
 8018|     74|    TIFFDirectory *td = &tif->tif_dir;
 8019|     74|    uint64_t bytecount;
 8020|     74|    uint64_t offset;
 8021|     74|    uint32_t rowblock;
 8022|     74|    uint64_t rowblockbytes;
 8023|     74|    uint64_t stripbytes;
 8024|     74|    uint32_t nstrips;
 8025|     74|    uint32_t rowsperstrip;
 8026|       |
 8027|     74|    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|     74|    if (bytecount == 0 && tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (8031:9): [True: 9, False: 65]
  |  Branch (8031:27): [True: 0, False: 9]
  ------------------
 8032|      0|        return;
 8033|     74|    offset = TIFFGetStrileOffset(tif, 0);
 8034|     74|    assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
  ------------------
  |  Branch (8034:5): [True: 0, False: 74]
  |  Branch (8034:5): [True: 74, False: 0]
  ------------------
 8035|     74|    if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|     74|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                  if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  281|     25|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  133|     25|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (8035:9): [True: 25, False: 49]
  |  Branch (8035:54): [True: 25, False: 0]
  ------------------
 8036|     25|        rowblock = td->td_ycbcrsubsampling[1];
 8037|     49|    else
 8038|     49|        rowblock = 1;
 8039|     74|    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|     74|    if (rowblockbytes > STRIP_SIZE_DEFAULT)
  ------------------
  |  |  119|     74|#define STRIP_SIZE_DEFAULT 8192
  ------------------
  |  Branch (8044:9): [True: 22, False: 52]
  ------------------
 8045|     22|    {
 8046|     22|        stripbytes = rowblockbytes;
 8047|     22|        rowsperstrip = rowblock;
 8048|     22|    }
 8049|     52|    else if (rowblockbytes > 0)
  ------------------
  |  Branch (8049:14): [True: 50, False: 2]
  ------------------
 8050|     50|    {
 8051|     50|        uint32_t rowblocksperstrip;
 8052|     50|        rowblocksperstrip = (uint32_t)(STRIP_SIZE_DEFAULT / rowblockbytes);
  ------------------
  |  |  119|     50|#define STRIP_SIZE_DEFAULT 8192
  ------------------
 8053|     50|        rowsperstrip = rowblocksperstrip * rowblock;
 8054|     50|        stripbytes = rowblocksperstrip * rowblockbytes;
 8055|     50|    }
 8056|      2|    else
 8057|      2|        return;
 8058|       |
 8059|       |    /*
 8060|       |     * never increase the number of rows per strip
 8061|       |     */
 8062|     72|    if (rowsperstrip >= td->td_rowsperstrip || rowsperstrip == 0)
  ------------------
  |  Branch (8062:9): [True: 46, False: 26]
  |  Branch (8062:48): [True: 0, False: 26]
  ------------------
 8063|     46|        return;
 8064|     26|    nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  312|     26|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 25, False: 1]
  |  |  ------------------
  |  |  313|     26|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|     26|         : 0U)
  ------------------
 8065|     26|    if (nstrips == 0)
  ------------------
  |  Branch (8065:9): [True: 3, False: 23]
  ------------------
 8066|      3|        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|     23|    if (tif->tif_mode == O_RDONLY && nstrips > 1000000 &&
  ------------------
  |  Branch (8070:9): [True: 23, False: 0]
  |  Branch (8070:38): [True: 13, False: 10]
  ------------------
 8071|     13|        (offset >= TIFFGetFileSize(tif) ||
  ------------------
  |  |  289|     26|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
  |  Branch (8071:10): [True: 10, 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|     13|    {
 8074|     13|        return;
 8075|     13|    }
 8076|       |
 8077|     10|    allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 8078|     10|}
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: 9, False: 7]
  ------------------
 7936|      7|        last_offset + last_bytecount < offset)
  ------------------
  |  Branch (7936:9): [True: 0, False: 7]
  ------------------
 7937|      9|    {
 7938|      9|        return;
 7939|      9|    }
 7940|      7|    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|      7|    const uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t) * 2;
 7947|      7|    if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (7947:9): [True: 0, False: 7]
  ------------------
 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|      7|    newcounts =
 7963|      7|        (uint64_t *)_TIFFCheckMalloc(tif, nstrips, sizeof(uint64_t),
 7964|      7|                                     "for chopped \"StripByteCounts\" array");
 7965|      7|    newoffsets = (uint64_t *)_TIFFCheckMalloc(
 7966|      7|        tif, nstrips, sizeof(uint64_t), "for chopped \"StripOffsets\" array");
 7967|      7|    if (newcounts == NULL || newoffsets == NULL)
  ------------------
  |  Branch (7967:9): [True: 0, False: 7]
  |  Branch (7967:30): [True: 0, False: 7]
  ------------------
 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|  66.0k|    for (i = 0; i < nstrips; i++)
  ------------------
  |  Branch (7984:17): [True: 66.0k, False: 7]
  ------------------
 7985|  66.0k|    {
 7986|  66.0k|        if (stripbytes > bytecount)
  ------------------
  |  Branch (7986:13): [True: 5, False: 66.0k]
  ------------------
 7987|      5|            stripbytes = bytecount;
 7988|  66.0k|        newcounts[i] = stripbytes;
 7989|  66.0k|        newoffsets[i] = stripbytes ? offset : 0;
  ------------------
  |  Branch (7989:25): [True: 66.0k, False: 0]
  ------------------
 7990|  66.0k|        offset += stripbytes;
 7991|  66.0k|        bytecount -= stripbytes;
 7992|  66.0k|    }
 7993|       |
 7994|       |    /*
 7995|       |     * Replace old single strip info with multi-strip info.
 7996|       |     */
 7997|      7|    td->td_stripsperimage = td->td_nstrips = nstrips;
 7998|      7|    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
  ------------------
  |  |  258|      7|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 7999|       |
 8000|      7|    _TIFFfreeExt(tif, td->td_stripbytecount_p);
 8001|      7|    _TIFFfreeExt(tif, td->td_stripoffset_p);
 8002|      7|    td->td_stripbytecount_p = newcounts;
 8003|      7|    td->td_stripoffset_p = newoffsets;
 8004|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 8005|       |    td->td_stripbytecountsorted = 1;
 8006|       |#endif
 8007|      7|    tif->tif_flags |= TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  153|      7|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
 8008|      7|}
tif_dirread.c:TryChopUpUncompressedBigTiff:
 8087|     19|{
 8088|     19|    TIFFDirectory *td = &tif->tif_dir;
 8089|     19|    uint32_t rowblock;
 8090|     19|    uint64_t rowblockbytes;
 8091|     19|    uint32_t i;
 8092|     19|    uint64_t stripsize;
 8093|     19|    uint32_t rowblocksperstrip;
 8094|     19|    uint32_t rowsperstrip;
 8095|     19|    uint64_t stripbytes;
 8096|     19|    uint32_t nstrips;
 8097|       |
 8098|     19|    stripsize = TIFFStripSize64(tif);
 8099|       |
 8100|     19|    assert(tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG);
  ------------------
  |  Branch (8100:5): [True: 0, False: 19]
  |  Branch (8100:5): [True: 19, False: 0]
  ------------------
 8101|     19|    assert(tif->tif_dir.td_compression == COMPRESSION_NONE);
  ------------------
  |  Branch (8101:5): [True: 0, False: 19]
  |  Branch (8101:5): [True: 19, False: 0]
  ------------------
 8102|     19|    assert((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) ==
  ------------------
  |  Branch (8102:5): [True: 0, False: 19]
  |  Branch (8102:5): [True: 19, False: 0]
  ------------------
 8103|     19|           TIFF_STRIPCHOP);
 8104|     19|    assert(stripsize > 0x7FFFFFFFUL);
  ------------------
  |  Branch (8104:5): [True: 0, False: 19]
  |  Branch (8104:5): [True: 19, 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|     19|    if (TIFFGetStrileByteCount(tif, 0) == 0 && tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (8109:9): [True: 0, False: 19]
  |  Branch (8109:48): [True: 0, False: 0]
  ------------------
 8110|      0|        return;
 8111|       |
 8112|     19|    if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|     19|#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: 19]
  |  Branch (8112:54): [True: 0, False: 0]
  ------------------
 8113|      0|        rowblock = td->td_ycbcrsubsampling[1];
 8114|     19|    else
 8115|     19|        rowblock = 1;
 8116|     19|    rowblockbytes = TIFFVStripSize64(tif, rowblock);
 8117|     19|    if (rowblockbytes == 0 || rowblockbytes > 0x7FFFFFFFUL)
  ------------------
  |  Branch (8117:9): [True: 0, False: 19]
  |  Branch (8117:31): [True: 6, False: 13]
  ------------------
 8118|      6|    {
 8119|       |        /* In case of file with gigantic width */
 8120|      6|        return;
 8121|      6|    }
 8122|       |
 8123|       |    /* Check that the strips are contiguous and of the expected size */
 8124|     26|    for (i = 0; i < td->td_nstrips; i++)
  ------------------
  |  Branch (8124:17): [True: 13, False: 13]
  ------------------
 8125|     13|    {
 8126|     13|        if (i == td->td_nstrips - 1)
  ------------------
  |  Branch (8126:13): [True: 13, False: 0]
  ------------------
 8127|     13|        {
 8128|     13|            if (TIFFGetStrileByteCount(tif, i) <
  ------------------
  |  Branch (8128:17): [True: 0, False: 13]
  ------------------
 8129|     13|                TIFFVStripSize64(tif,
 8130|     13|                                 td->td_imagelength - i * td->td_rowsperstrip))
 8131|      0|            {
 8132|      0|                return;
 8133|      0|            }
 8134|     13|        }
 8135|      0|        else
 8136|      0|        {
 8137|      0|            if (TIFFGetStrileByteCount(tif, i) != stripsize)
  ------------------
  |  Branch (8137:17): [True: 0, False: 0]
  ------------------
 8138|      0|            {
 8139|      0|                return;
 8140|      0|            }
 8141|      0|            if (i > 0 && TIFFGetStrileOffset(tif, i) !=
  ------------------
  |  Branch (8141:17): [True: 0, False: 0]
  |  Branch (8141:26): [True: 0, False: 0]
  ------------------
 8142|      0|                             TIFFGetStrileOffset(tif, i - 1) +
 8143|      0|                                 TIFFGetStrileByteCount(tif, i - 1))
 8144|      0|            {
 8145|      0|                return;
 8146|      0|            }
 8147|      0|        }
 8148|     13|    }
 8149|       |
 8150|       |    /* Aim for 512 MB strips (that will still be manageable by 32 bit builds */
 8151|     13|    rowblocksperstrip = (uint32_t)(512 * 1024 * 1024 / rowblockbytes);
 8152|     13|    if (rowblocksperstrip == 0)
  ------------------
  |  Branch (8152:9): [True: 5, False: 8]
  ------------------
 8153|      5|        rowblocksperstrip = 1;
 8154|     13|    rowsperstrip = rowblocksperstrip * rowblock;
 8155|     13|    stripbytes = rowblocksperstrip * rowblockbytes;
 8156|     13|    assert(stripbytes <= 0x7FFFFFFFUL);
  ------------------
  |  Branch (8156:5): [True: 0, False: 13]
  |  Branch (8156:5): [True: 13, False: 0]
  ------------------
 8157|       |
 8158|     13|    if (rowsperstrip == 0)
  ------------------
  |  Branch (8158:9): [True: 0, False: 13]
  ------------------
 8159|      0|        return;
 8160|     13|    nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  312|     13|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 12, False: 1]
  |  |  ------------------
  |  |  313|     13|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|     13|         : 0U)
  ------------------
 8161|     13|    if (nstrips == 0)
  ------------------
  |  Branch (8161:9): [True: 1, False: 12]
  ------------------
 8162|      1|        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|     12|    if (tif->tif_mode == O_RDONLY && nstrips > 1000000)
  ------------------
  |  Branch (8166:9): [True: 12, False: 0]
  |  Branch (8166:38): [True: 6, False: 6]
  ------------------
 8167|      6|    {
 8168|      6|        uint64_t last_offset = TIFFGetStrileOffset(tif, td->td_nstrips - 1);
 8169|      6|        uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|      6|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 8170|      6|        uint64_t last_bytecount =
 8171|      6|            TIFFGetStrileByteCount(tif, td->td_nstrips - 1);
 8172|      6|        if (last_offset > filesize || last_bytecount > filesize - last_offset)
  ------------------
  |  Branch (8172:13): [True: 1, False: 5]
  |  Branch (8172:39): [True: 5, False: 0]
  ------------------
 8173|      6|        {
 8174|      6|            return;
 8175|      6|        }
 8176|      6|    }
 8177|       |
 8178|      6|    allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 8179|      6|}
tif_dirread.c:_TIFFGetStrileOffsetOrByteCountValue:
 8456|  17.1M|{
 8457|  17.1M|    TIFFDirectory *td = &tif->tif_dir;
 8458|  17.1M|    if (pbErr)
  ------------------
  |  Branch (8458:9): [True: 15.5M, False: 1.68M]
  ------------------
 8459|  15.5M|        *pbErr = 0;
 8460|       |
 8461|  17.1M|    if (strile >= td->td_nstrips)
  ------------------
  |  Branch (8461:9): [True: 0, False: 17.1M]
  ------------------
 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|  17.1M|    if ((td->td_stripoffset_entry.tdir_count <= 4) !=
  ------------------
  |  Branch (8472:9): [True: 354k, False: 16.8M]
  ------------------
 8473|  17.1M|        (td->td_stripbytecount_entry.tdir_count <= 4))
 8474|   354k|    {
 8475|   354k|        TIFFErrorExtR(tif, "_TIFFGetStrileOffsetOrByteCountValue",
 8476|   354k|                      "Inconsistent directory count between StripOffsets and "
 8477|   354k|                      "StripByteCounts");
 8478|   354k|        if (pbErr)
  ------------------
  |  Branch (8478:13): [True: 354k, False: 36]
  ------------------
 8479|   354k|            *pbErr = 1;
 8480|   354k|        return 0;
 8481|   354k|    }
 8482|       |
 8483|  16.8M|    if ((tif->tif_flags & TIFF_DEFERSTRILELOAD) &&
  ------------------
  |  |  147|  16.8M|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (8483:9): [True: 0, False: 16.8M]
  ------------------
 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|  16.8M|    if (*parray == NULL)
  ------------------
  |  Branch (8510:9): [True: 8.77k, False: 16.8M]
  ------------------
 8511|  8.77k|    {
 8512|  8.77k|        if (pbErr)
  ------------------
  |  Branch (8512:13): [True: 8.77k, False: 0]
  ------------------
 8513|  8.77k|            *pbErr = 1;
 8514|  8.77k|        return 0;
 8515|  8.77k|    }
 8516|  16.8M|    return (*parray)[strile];
 8517|  16.8M|}
tif_dirread.c:_TIFFFillStrilesInternal:
 8556|  1.14k|{
 8557|  1.14k|    TIFFDirectory *td = &tif->tif_dir;
 8558|  1.14k|    int return_value = 1;
 8559|       |
 8560|       |    /* Do not do anything if TIFF_DEFERSTRILELOAD is not set */
 8561|  1.14k|    if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) ||
  ------------------
  |  |  147|  1.14k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (8561:9): [True: 1.14k, 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.14k|        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|  6.24k|{
  127|  6.24k|    (void)scheme;
  128|  6.24k|    tif->tif_fixuptags = DumpFixupTags;
  129|  6.24k|    tif->tif_decoderow = DumpModeDecode;
  130|  6.24k|    tif->tif_decodestrip = DumpModeDecode;
  131|  6.24k|    tif->tif_decodetile = DumpModeDecode;
  132|  6.24k|    tif->tif_encoderow = DumpModeEncode;
  133|  6.24k|    tif->tif_encodestrip = DumpModeEncode;
  134|  6.24k|    tif->tif_encodetile = DumpModeEncode;
  135|  6.24k|    tif->tif_seek = DumpModeSeek;
  136|  6.24k|    return (1);
  137|  6.24k|}
tif_dumpmode.c:DumpFixupTags:
   33|    301|{
   34|    301|    (void)tif;
   35|    301|    return (1);
   36|    301|}
tif_dumpmode.c:DumpModeDecode:
   74|  3.43k|{
   75|  3.43k|    static const char module[] = "DumpModeDecode";
   76|  3.43k|    (void)s;
   77|  3.43k|    if (tif->tif_rawcc < cc)
  ------------------
  |  Branch (77:9): [True: 372, False: 3.06k]
  ------------------
   78|    372|    {
   79|    372|        TIFFErrorExtR(tif, module,
   80|    372|                      "Not enough data for scanline %" PRIu32
   81|    372|                      ", expected a request for at most %" TIFF_SSIZE_FORMAT
   82|    372|                      " bytes, got a request for %" TIFF_SSIZE_FORMAT " bytes",
   83|    372|                      tif->tif_dir.td_row, tif->tif_rawcc, cc);
   84|    372|        return (0);
   85|    372|    }
   86|       |    /*
   87|       |     * Avoid copy if client has setup raw
   88|       |     * data buffer to avoid extra copy.
   89|       |     */
   90|  3.06k|    if (tif->tif_rawcp != buf)
  ------------------
  |  Branch (90:9): [True: 3.06k, False: 0]
  ------------------
   91|  3.06k|        _TIFFmemcpy(buf, tif->tif_rawcp, cc);
   92|  3.06k|    tif->tif_rawcp += cc;
   93|  3.06k|    tif->tif_rawcc -= cc;
   94|  3.06k|    return (1);
   95|  3.43k|}

TIFFSetErrorHandler:
   33|  6.25k|{
   34|  6.25k|    TIFFErrorHandler prev = _TIFFerrorHandler;
   35|  6.25k|    _TIFFerrorHandler = handler;
   36|  6.25k|    return (prev);
   37|  6.25k|}
TIFFErrorExtR:
  108|  2.07M|{
  109|  2.07M|    va_list ap;
  110|  2.07M|    if (tif && tif->tif_errorhandler)
  ------------------
  |  Branch (110:9): [True: 2.07M, False: 0]
  |  Branch (110:16): [True: 0, False: 2.07M]
  ------------------
  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.07M|    if (_TIFFerrorHandler)
  ------------------
  |  Branch (119:9): [True: 2.07M, False: 0]
  ------------------
  120|  2.07M|    {
  121|  2.07M|        va_start(ap, fmt);
  122|  2.07M|        (*_TIFFerrorHandler)(module, fmt, ap);
  123|  2.07M|        va_end(ap);
  124|  2.07M|    }
  125|  2.07M|    if (_TIFFerrorHandlerExt)
  ------------------
  |  Branch (125:9): [True: 0, False: 2.07M]
  ------------------
  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.07M|}

_TIFFFax3fillruns:
  464|  1.52M|{
  465|  1.52M|    static const unsigned char _fillmasks[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
  466|  1.52M|                                               0xf8, 0xfc, 0xfe, 0xff};
  467|  1.52M|    unsigned char *cp;
  468|  1.52M|    uint32_t x, bx, run;
  469|  1.52M|    int32_t n, nw;
  470|  1.52M|    int64_t *lp;
  471|       |
  472|  1.52M|    if ((erun - runs) & 1)
  ------------------
  |  Branch (472:9): [True: 1.39M, False: 126k]
  ------------------
  473|  1.39M|        *erun++ = 0;
  474|  1.52M|    x = 0;
  475|  4.29M|    for (; runs < erun; runs += 2)
  ------------------
  |  Branch (475:12): [True: 2.77M, False: 1.52M]
  ------------------
  476|  2.77M|    {
  477|  2.77M|        run = runs[0];
  478|  2.77M|        if (x + run > lastx || run > lastx)
  ------------------
  |  Branch (478:13): [True: 308k, False: 2.46M]
  |  Branch (478:32): [True: 0, False: 2.46M]
  ------------------
  479|   308k|            run = runs[0] = (uint32_t)(lastx - x);
  480|  2.77M|        if (run)
  ------------------
  |  Branch (480:13): [True: 2.22M, False: 551k]
  ------------------
  481|  2.22M|        {
  482|  2.22M|            cp = buf + (x >> 3);
  483|  2.22M|            bx = x & 7;
  484|  2.22M|            if (run > 8 - bx)
  ------------------
  |  Branch (484:17): [True: 1.49M, False: 728k]
  ------------------
  485|  1.49M|            {
  486|  1.49M|                if (bx)
  ------------------
  |  Branch (486:21): [True: 320k, False: 1.17M]
  ------------------
  487|   320k|                { /* align to byte boundary */
  488|   320k|                    *cp++ &= (unsigned char)(0xff << (8 - bx));
  489|   320k|                    run -= 8 - bx;
  490|   320k|                }
  491|  1.49M|                if ((n = (int32_t)(run >> 3)) != 0)
  ------------------
  |  Branch (491:21): [True: 1.27M, False: 214k]
  ------------------
  492|  1.27M|                { /* multiple bytes to fill */
  493|  1.27M|                    if (((size_t)n / sizeof(int64_t)) > 1)
  ------------------
  |  Branch (493:25): [True: 238k, False: 1.04M]
  ------------------
  494|   238k|                    {
  495|       |                        /*
  496|       |                         * Align to int64_tword boundary and fill.
  497|       |                         */
  498|   768k|                        for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |  112|   768k|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (498:32): [True: 768k, False: 0]
  |  Branch (498:37): [True: 530k, False: 238k]
  ------------------
  499|   530k|                            *cp++ = 0x00;
  500|   238k|                        lp = (int64_t *)cp;
  501|   238k|                        nw = (int32_t)((size_t)n / sizeof(int64_t));
  502|   238k|                        n -= (int32_t)((size_t)nw * sizeof(int64_t));
  503|   238k|                        do
  504|   368M|                        {
  505|   368M|                            *lp++ = 0L;
  506|   368M|                        } while (--nw);
  ------------------
  |  Branch (506:34): [True: 367M, False: 238k]
  ------------------
  507|   238k|                        cp = (unsigned char *)lp;
  508|   238k|                    }
  509|  1.27M|                    ZERO(n, cp);
  ------------------
  |  |  452|  3.58M|    for (int32_t izero = 0; izero < (n); ++izero)                              \
  |  |  ------------------
  |  |  |  Branch (452:29): [True: 2.31M, False: 1.27M]
  |  |  ------------------
  |  |  453|  2.31M|    {                                                                          \
  |  |  454|  2.31M|        (cp)[izero] = 0;                                                       \
  |  |  455|  2.31M|    }                                                                          \
  |  |  456|  1.27M|    (cp) += (n);
  ------------------
  510|  1.27M|                    run &= 7;
  511|  1.27M|                }
  512|  1.49M|                if (run)
  ------------------
  |  Branch (512:21): [True: 1.38M, False: 110k]
  ------------------
  513|  1.38M|                    cp[0] &= (unsigned char)(0xff >> run);
  514|  1.49M|            }
  515|   728k|            else
  516|   728k|                cp[0] &= (unsigned char)~(_fillmasks[run] >> bx);
  517|  2.22M|            x += runs[0];
  518|  2.22M|        }
  519|  2.77M|        run = runs[1];
  520|  2.77M|        if (x + run > lastx || run > lastx)
  ------------------
  |  Branch (520:13): [True: 0, False: 2.77M]
  |  Branch (520:32): [True: 0, False: 2.77M]
  ------------------
  521|      0|            run = runs[1] = lastx - x;
  522|  2.77M|        if (run)
  ------------------
  |  Branch (522:13): [True: 717k, False: 2.05M]
  ------------------
  523|   717k|        {
  524|   717k|            cp = buf + (x >> 3);
  525|   717k|            bx = x & 7;
  526|   717k|            if (run > 8 - bx)
  ------------------
  |  Branch (526:17): [True: 275k, False: 442k]
  ------------------
  527|   275k|            {
  528|   275k|                if (bx)
  ------------------
  |  Branch (528:21): [True: 267k, False: 7.91k]
  ------------------
  529|   267k|                { /* align to byte boundary */
  530|   267k|                    *cp++ |= (unsigned char)(0xff >> bx);
  531|   267k|                    run -= 8 - bx;
  532|   267k|                }
  533|   275k|                if ((n = (int32_t)(run >> 3)) != 0)
  ------------------
  |  Branch (533:21): [True: 39.5k, False: 236k]
  ------------------
  534|  39.5k|                { /* multiple bytes to fill */
  535|  39.5k|                    if (((size_t)n / sizeof(int64_t)) > 1)
  ------------------
  |  Branch (535:25): [True: 5.93k, False: 33.5k]
  ------------------
  536|  5.93k|                    {
  537|       |                        /*
  538|       |                         * Align to int64_t boundary and fill.
  539|       |                         */
  540|  29.5k|                        for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |  112|  29.5k|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (540:32): [True: 29.5k, False: 0]
  |  Branch (540:37): [True: 23.6k, False: 5.93k]
  ------------------
  541|  23.6k|                            *cp++ = 0xff;
  542|  5.93k|                        lp = (int64_t *)cp;
  543|  5.93k|                        nw = (int32_t)((size_t)n / sizeof(int64_t));
  544|  5.93k|                        n -= (int32_t)((size_t)nw * sizeof(int64_t));
  545|  5.93k|                        do
  546|  30.4M|                        {
  547|  30.4M|                            *lp++ = -1L;
  548|  30.4M|                        } while (--nw);
  ------------------
  |  Branch (548:34): [True: 30.4M, False: 5.93k]
  ------------------
  549|  5.93k|                        cp = (unsigned char *)lp;
  550|  5.93k|                    }
  551|  39.5k|                    FILL(n, cp);
  ------------------
  |  |  445|   110k|    for (int32_t ifill = 0; ifill < (n); ++ifill)                              \
  |  |  ------------------
  |  |  |  Branch (445:29): [True: 70.8k, False: 39.5k]
  |  |  ------------------
  |  |  446|  70.8k|    {                                                                          \
  |  |  447|  70.8k|        (cp)[ifill] = 0xff;                                                    \
  |  |  448|  70.8k|    }                                                                          \
  |  |  449|  39.5k|    (cp) += (n);
  ------------------
  552|  39.5k|                    run &= 7;
  553|  39.5k|                }
  554|       |                /* Explicit 0xff masking to make icc -check=conversions happy */
  555|   275k|                if (run)
  ------------------
  |  Branch (555:21): [True: 269k, False: 5.94k]
  ------------------
  556|   269k|                    cp[0] = (unsigned char)((cp[0] | (0xff00 >> run)) & 0xff);
  557|   275k|            }
  558|   442k|            else
  559|   442k|                cp[0] |= (unsigned char)(_fillmasks[run] >> bx);
  560|   717k|            x += runs[1];
  561|   717k|        }
  562|  2.77M|    }
  563|       |    assert(x == lastx);
  ------------------
  |  Branch (563:5): [True: 0, False: 1.52M]
  |  Branch (563:5): [True: 1.52M, False: 0]
  ------------------
  564|  1.52M|}
TIFFInitCCITTFax3:
 1607|    191|{
 1608|    191|    (void)scheme;
 1609|    191|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1609:9): [True: 191, False: 0]
  ------------------
 1610|    191|    {
 1611|       |        /*
 1612|       |         * Merge codec-specific tag information.
 1613|       |         */
 1614|    191|        if (!_TIFFMergeFields(tif, fax3Fields, TIFFArrayCount(fax3Fields)))
  ------------------
  |  |  339|    191|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1614:13): [True: 0, False: 191]
  ------------------
 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|    191|        return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  697|    191|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
                      return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  703|    191|#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
  |  |  ------------------
  |  |  |  |  699|    191|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  |  |  ------------------
  ------------------
 1625|    191|    }
 1626|      0|    else
 1627|      0|        return 01;
 1628|    191|}
TIFFInitCCITTFax4:
 1762|     77|{
 1763|     77|    (void)scheme;
 1764|     77|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1764:9): [True: 77, False: 0]
  ------------------
 1765|     77|    { /* reuse G3 support */
 1766|       |        /*
 1767|       |         * Merge codec-specific tag information.
 1768|       |         */
 1769|     77|        if (!_TIFFMergeFields(tif, fax4Fields, TIFFArrayCount(fax4Fields)))
  ------------------
  |  |  339|     77|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1769:13): [True: 0, False: 77]
  ------------------
 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|     77|        tif->tif_decoderow = Fax4Decode;
 1777|     77|        tif->tif_decodestrip = Fax4Decode;
 1778|     77|        tif->tif_decodetile = Fax4Decode;
 1779|     77|        tif->tif_encoderow = Fax4Encode;
 1780|     77|        tif->tif_encodestrip = Fax4Encode;
 1781|     77|        tif->tif_encodetile = Fax4Encode;
 1782|     77|        tif->tif_postencode = Fax4PostEncode;
 1783|     77|        tif->tif_getmaxcompressionratio = Fax4GetMaxCompressionRatio;
 1784|       |        /*
 1785|       |         * Suppress RTC at the end of each strip.
 1786|       |         */
 1787|     77|        return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  697|     77|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
                      return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  699|     77|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
 1788|     77|    }
 1789|      0|    else
 1790|      0|        return (0);
 1791|     77|}
TIFFInitCCITTRLE:
 1871|     27|{
 1872|     27|    (void)scheme;
 1873|     27|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1873:9): [True: 27, False: 0]
  ------------------
 1874|     27|    { /* reuse G3 support */
 1875|     27|        tif->tif_decoderow = Fax3DecodeRLE;
 1876|     27|        tif->tif_decodestrip = Fax3DecodeRLE;
 1877|     27|        tif->tif_decodetile = Fax3DecodeRLE;
 1878|     27|        tif->tif_getmaxcompressionratio = Fax3RLEGetMaxCompressionRatio;
 1879|       |        /*
 1880|       |         * Suppress RTC+EOLs when encoding and byte-align data.
 1881|       |         */
 1882|     27|        return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  697|     27|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
 1883|     27|                            FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  699|     27|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  700|     27|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  701|     27|#define FAXMODE_BYTEALIGN 0x0004     /* byte align row */
  ------------------
 1884|     27|    }
 1885|      0|    else
 1886|      0|        return (0);
 1887|     27|}
TIFFInitCCITTRLEW:
 1890|     24|{
 1891|     24|    (void)scheme;
 1892|     24|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1892:9): [True: 24, False: 0]
  ------------------
 1893|     24|    { /* reuse G3 support */
 1894|     24|        tif->tif_decoderow = Fax3DecodeRLE;
 1895|     24|        tif->tif_decodestrip = Fax3DecodeRLE;
 1896|     24|        tif->tif_decodetile = Fax3DecodeRLE;
 1897|     24|        tif->tif_getmaxcompressionratio = Fax3RLEGetMaxCompressionRatio;
 1898|       |        /*
 1899|       |         * Suppress RTC+EOLs when encoding and word-align data.
 1900|       |         */
 1901|     24|        return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  697|     24|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
 1902|     24|                            FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  699|     24|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  700|     24|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  702|     24|#define FAXMODE_WORDALIGN 0x0008     /* word align row */
  ------------------
 1903|     24|    }
 1904|      0|    else
 1905|      0|        return (0);
 1906|     24|}
tif_fax3.c:InitCCITTFax3:
 1538|    319|{
 1539|    319|    static const char module[] = "InitCCITTFax3";
 1540|    319|    Fax3BaseState *sp;
 1541|       |
 1542|       |    /*
 1543|       |     * Merge codec-specific tag information.
 1544|       |     */
 1545|    319|    if (!_TIFFMergeFields(tif, faxFields, TIFFArrayCount(faxFields)))
  ------------------
  |  |  339|    319|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1545:9): [True: 0, False: 319]
  ------------------
 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|    319|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(Fax3CodecState));
 1556|       |
 1557|    319|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1557:9): [True: 0, False: 319]
  ------------------
 1558|      0|    {
 1559|      0|        TIFFErrorExtR(tif, module, "No space for state block");
 1560|      0|        return (0);
 1561|      0|    }
 1562|    319|    _TIFFmemset(tif->tif_data, 0, sizeof(Fax3CodecState));
 1563|       |
 1564|    319|    sp = Fax3State(tif);
  ------------------
  |  |   72|    319|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1565|    319|    sp->rw_mode = tif->tif_mode;
 1566|       |
 1567|       |    /*
 1568|       |     * Override parent get/set field methods.
 1569|       |     */
 1570|    319|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1571|    319|    tif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */
 1572|    319|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1573|    319|    tif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */
 1574|    319|    sp->printdir = tif->tif_tagmethods.printdir;
 1575|    319|    tif->tif_tagmethods.printdir = Fax3PrintDir; /* hook for codec tags */
 1576|    319|    sp->groupoptions = 0;
 1577|       |
 1578|    319|    if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */
  ------------------
  |  Branch (1578:9): [True: 319, False: 0]
  ------------------
 1579|    319|        tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
  ------------------
  |  |  127|    319|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 1580|    319|    DecoderState(tif)->runs = NULL;
  ------------------
  |  |  108|    319|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    319|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1581|    319|    TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
  ------------------
  |  |  713|    319|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
 1582|    319|    EncoderState(tif)->refline = NULL;
  ------------------
  |  |  109|    319|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    319|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1583|       |
 1584|       |    /*
 1585|       |     * Install codec methods.
 1586|       |     */
 1587|    319|    tif->tif_fixuptags = Fax3FixupTags;
 1588|    319|    tif->tif_setupdecode = Fax3SetupState;
 1589|    319|    tif->tif_predecode = Fax3PreDecode;
 1590|    319|    tif->tif_decoderow = Fax3Decode1D;
 1591|    319|    tif->tif_decodestrip = Fax3Decode1D;
 1592|    319|    tif->tif_decodetile = Fax3Decode1D;
 1593|    319|    tif->tif_setupencode = Fax3SetupState;
 1594|    319|    tif->tif_preencode = Fax3PreEncode;
 1595|    319|    tif->tif_postencode = Fax3PostEncode;
 1596|    319|    tif->tif_encoderow = Fax3Encode;
 1597|    319|    tif->tif_encodestrip = Fax3Encode;
 1598|    319|    tif->tif_encodetile = Fax3Encode;
 1599|    319|    tif->tif_close = Fax3Close;
 1600|    319|    tif->tif_cleanup = Fax3Cleanup;
 1601|    319|    tif->tif_getmaxcompressionratio = Fax3GetMaxCompressionRatio;
 1602|       |
 1603|    319|    return (1);
 1604|    319|}
tif_fax3.c:Fax3VGetField:
 1424|  2.76k|{
 1425|  2.76k|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|  2.76k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1426|       |
 1427|  2.76k|    assert(sp != 0);
  ------------------
  |  Branch (1427:5): [True: 0, False: 2.76k]
  |  Branch (1427:5): [True: 2.76k, False: 0]
  ------------------
 1428|       |
 1429|  2.76k|    switch (tag)
 1430|  2.76k|    {
 1431|      0|        case TIFFTAG_FAXMODE:
  ------------------
  |  |  697|      0|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
  |  Branch (1431:9): [True: 0, False: 2.76k]
  ------------------
 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.76k]
  ------------------
 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.76k]
  ------------------
 1438|      0|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|      0|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1438:9): [True: 0, False: 2.76k]
  ------------------
 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.76k]
  ------------------
 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.76k]
  ------------------
 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.76k]
  ------------------
 1448|      0|            *va_arg(ap, uint32_t *) = sp->badfaxrun;
 1449|      0|            break;
 1450|  2.76k|        default:
  ------------------
  |  Branch (1450:9): [True: 2.76k, False: 0]
  ------------------
 1451|  2.76k|            return (*sp->vgetparent)(tif, tag, ap);
 1452|  2.76k|    }
 1453|      0|    return (1);
 1454|  2.76k|}
tif_fax3.c:Fax3VSetField:
 1376|  2.77k|{
 1377|  2.77k|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|  2.77k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1378|  2.77k|    const TIFFField *fip;
 1379|       |
 1380|  2.77k|    assert(sp != 0);
  ------------------
  |  Branch (1380:5): [True: 0, False: 2.77k]
  |  Branch (1380:5): [True: 2.77k, False: 0]
  ------------------
 1381|  2.77k|    assert(sp->vsetparent != 0);
  ------------------
  |  Branch (1381:5): [True: 0, False: 2.77k]
  |  Branch (1381:5): [True: 2.77k, False: 0]
  ------------------
 1382|       |
 1383|  2.77k|    switch (tag)
 1384|  2.77k|    {
 1385|    319|        case TIFFTAG_FAXMODE:
  ------------------
  |  |  697|    319|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
  |  Branch (1385:9): [True: 319, False: 2.45k]
  ------------------
 1386|    319|            sp->mode = (int)va_arg(ap, int);
 1387|    319|            return 1; /* NB: pseudo tag */
 1388|    319|        case TIFFTAG_FAXFILLFUNC:
  ------------------
  |  |  713|    319|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
  |  Branch (1388:9): [True: 319, False: 2.45k]
  ------------------
 1389|    319|            DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
  ------------------
  |  |  108|    319|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    319|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1390|    319|            return 1; /* NB: pseudo tag */
 1391|    142|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|    142|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1391:9): [True: 142, False: 2.62k]
  ------------------
 1392|       |            /* XXX: avoid reading options if compression mismatches. */
 1393|    142|            if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  184|    142|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1393:17): [True: 142, False: 0]
  ------------------
 1394|    142|                sp->groupoptions = (uint32_t)va_arg(ap, uint32_t);
 1395|    142|            break;
 1396|      0|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|      0|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1396:9): [True: 0, False: 2.77k]
  ------------------
 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|      3|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      3|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1401:9): [True: 3, False: 2.76k]
  ------------------
 1402|      3|            sp->badfaxlines = (uint32_t)va_arg(ap, uint32_t);
 1403|      3|            break;
 1404|      8|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|      8|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1404:9): [True: 8, False: 2.76k]
  ------------------
 1405|      8|            sp->cleanfaxdata = (uint16_t)va_arg(ap, uint16_vap);
 1406|      8|            break;
 1407|      4|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|      4|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1407:9): [True: 4, False: 2.76k]
  ------------------
 1408|      4|            sp->badfaxrun = (uint32_t)va_arg(ap, uint32_t);
 1409|      4|            break;
 1410|  1.97k|        default:
  ------------------
  |  Branch (1410:9): [True: 1.97k, False: 795]
  ------------------
 1411|  1.97k|            return (*sp->vsetparent)(tif, tag, ap);
 1412|  2.77k|    }
 1413|       |
 1414|    157|    if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
  ------------------
  |  Branch (1414:9): [True: 157, False: 0]
  ------------------
 1415|    157|        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|    157|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    157|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    157|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1416|      0|    else
 1417|      0|        return 0;
 1418|       |
 1419|    157|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|    157|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1420|    157|    return 1;
 1421|    157|}
tif_fax3.c:Fax3FixupTags:
  569|    275|{
  570|    275|    (void)tif;
  571|    275|    return (1);
  572|    275|}
tif_fax3.c:Fax3SetupState:
  582|    266|{
  583|    266|    static const char module[] = "Fax3SetupState";
  584|    266|    TIFFDirectory *td = &tif->tif_dir;
  585|    266|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|    266|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
  586|    266|    int needsRefLine;
  587|    266|    Fax3CodecState *dsp = (Fax3CodecState *)Fax3State(tif);
  ------------------
  |  |   72|    266|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
  588|    266|    tmsize_t rowbytes;
  589|    266|    uint32_t rowpixels;
  590|       |
  591|    266|    if (td->td_bitspersample != 1)
  ------------------
  |  Branch (591:9): [True: 2, False: 264]
  ------------------
  592|      2|    {
  593|      2|        TIFFErrorExtR(tif, module,
  594|      2|                      "Bits/sample must be 1 for Group 3/4 encoding/decoding");
  595|      2|        return (0);
  596|      2|    }
  597|    264|    if (td->td_samplesperpixel != 1 &&
  ------------------
  |  Branch (597:9): [True: 1, False: 263]
  ------------------
  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|    264|    if (isTiled(tif))
  ------------------
  |  |  278|    264|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    264|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 133, False: 131]
  |  |  ------------------
  ------------------
  610|    133|    {
  611|    133|        rowbytes = TIFFTileRowSize(tif);
  612|    133|        rowpixels = td->td_tilewidth;
  613|    133|    }
  614|    131|    else
  615|    131|    {
  616|    131|        rowbytes = TIFFScanlineSize(tif);
  617|    131|        rowpixels = td->td_imagewidth;
  618|    131|    }
  619|    264|    if ((int64_t)rowbytes < ((int64_t)rowpixels + 7) / 8)
  ------------------
  |  Branch (619:9): [True: 0, False: 264]
  ------------------
  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|    264|    sp->rowbytes = rowbytes;
  628|    264|    sp->rowpixels = rowpixels;
  629|       |    /*
  630|       |     * Allocate any additional space required for decoding/encoding.
  631|       |     */
  632|    264|    needsRefLine = ((sp->groupoptions & GROUP3OPT_2DENCODING) ||
  ------------------
  |  |  281|    264|#define GROUP3OPT_2DENCODING 0x1           /* 2-dimensional coding */
  ------------------
  |  Branch (632:21): [True: 137, False: 127]
  ------------------
  633|    127|                    td->td_compression == COMPRESSION_CCITTFAX4);
  ------------------
  |  |  186|    127|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (633:21): [True: 62, False: 65]
  ------------------
  634|       |
  635|       |    /*
  636|       |      Assure that allocation computations do not overflow.
  637|       |
  638|       |      TIFFroundup and TIFFSafeMultiply return zero on integer overflow
  639|       |    */
  640|    264|    if (dsp->runs != NULL)
  ------------------
  |  Branch (640:9): [True: 0, False: 264]
  ------------------
  641|      0|    {
  642|      0|        _TIFFfreeExt(tif, dsp->runs);
  643|      0|        dsp->runs = (uint32_t *)NULL;
  644|      0|    }
  645|    264|    dsp->nruns = TIFFroundup_32(rowpixels + 1, 32);
  ------------------
  |  |  322|    264|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  312|    264|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (312:6): [True: 264, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  313|    264|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  314|    264|         : 0U)
  |  |  ------------------
  ------------------
  646|    264|    if (needsRefLine)
  ------------------
  |  Branch (646:9): [True: 199, False: 65]
  ------------------
  647|    199|    {
  648|    199|        dsp->nruns = TIFFSafeMultiply(uint32_t, dsp->nruns, 2);
  ------------------
  |  |  332|    199|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 199, Folded]
  |  |  |  Branch (332:27): [True: 199, False: 0]
  |  |  ------------------
  |  |  333|    199|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    199|         : (t)0)
  ------------------
  649|    199|    }
  650|    264|    if ((dsp->nruns == 0) || (TIFFSafeMultiply(uint32_t, dsp->nruns, 2) == 0))
  ------------------
  |  |  332|    264|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 264, Folded]
  |  |  |  Branch (332:27): [True: 264, False: 0]
  |  |  ------------------
  |  |  333|    264|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    264|         : (t)0)
  ------------------
  |  Branch (650:9): [True: 0, False: 264]
  |  Branch (650:30): [True: 0, False: 264]
  ------------------
  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|    264|    dsp->runs = (uint32_t *)_TIFFCheckMalloc(
  658|    264|        tif, TIFFSafeMultiply(uint32_t, dsp->nruns, 2), sizeof(uint32_t),
  ------------------
  |  |  332|    264|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 264, Folded]
  |  |  |  Branch (332:27): [True: 264, False: 0]
  |  |  ------------------
  |  |  333|    264|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    264|         : (t)0)
  ------------------
  659|    264|        "for Group 3/4 run arrays");
  660|    264|    if (dsp->runs == NULL)
  ------------------
  |  Branch (660:9): [True: 0, False: 264]
  ------------------
  661|      0|        return (0);
  662|    264|    memset(dsp->runs, 0,
  663|    264|           TIFFSafeMultiply(uint32_t, dsp->nruns, 2) * sizeof(uint32_t));
  ------------------
  |  |  332|    264|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 264, Folded]
  |  |  |  Branch (332:27): [True: 264, False: 0]
  |  |  ------------------
  |  |  333|    264|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    264|         : (t)0)
  ------------------
  664|    264|    dsp->curruns = dsp->runs;
  665|    264|    if (needsRefLine)
  ------------------
  |  Branch (665:9): [True: 199, False: 65]
  ------------------
  666|    199|        dsp->refruns = dsp->runs + dsp->nruns;
  667|     65|    else
  668|     65|        dsp->refruns = NULL;
  669|    264|    if (td->td_compression == COMPRESSION_CCITTFAX3 && is2DEncoding(dsp))
  ------------------
  |  |  184|    528|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
                  if (td->td_compression == COMPRESSION_CCITTFAX3 && is2DEncoding(dsp))
  ------------------
  |  |  111|    169|#define is2DEncoding(sp) (sp->b.groupoptions & GROUP3OPT_2DENCODING)
  |  |  ------------------
  |  |  |  |  281|    169|#define GROUP3OPT_2DENCODING 0x1           /* 2-dimensional coding */
  |  |  ------------------
  |  |  |  Branch (111:26): [True: 137, False: 32]
  |  |  ------------------
  ------------------
  |  Branch (669:9): [True: 169, False: 95]
  ------------------
  670|    137|    { /* NB: default is 1D routine */
  671|    137|        tif->tif_decoderow = Fax3Decode2D;
  672|    137|        tif->tif_decodestrip = Fax3Decode2D;
  673|    137|        tif->tif_decodetile = Fax3Decode2D;
  674|    137|    }
  675|       |
  676|    264|    if (needsRefLine)
  ------------------
  |  Branch (676:9): [True: 199, False: 65]
  ------------------
  677|    199|    { /* 2d encoding */
  678|    199|        Fax3CodecState *esp = EncoderState(tif);
  ------------------
  |  |  109|    199|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    199|#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|    199|        if (esp->refline != NULL)
  ------------------
  |  Branch (686:13): [True: 0, False: 199]
  ------------------
  687|      0|        {
  688|      0|            _TIFFfreeExt(tif, esp->refline);
  689|      0|        }
  690|    199|        esp->refline = (unsigned char *)_TIFFmallocExt(tif, rowbytes);
  691|    199|        if (esp->refline == NULL)
  ------------------
  |  Branch (691:13): [True: 0, False: 199]
  ------------------
  692|      0|        {
  693|      0|            TIFFErrorExtR(tif, module, "No space for Group 3/4 reference line");
  694|      0|            return (0);
  695|      0|        }
  696|    199|    }
  697|     65|    else /* 1d encoding */
  698|     65|        EncoderState(tif)->refline = NULL;
  ------------------
  |  |  109|     65|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|     65|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  699|       |
  700|    264|    return (1);
  701|    264|}
tif_fax3.c:Fax3Decode2D:
  385|  23.5k|{
  386|  23.5k|    DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
  ------------------
  |  |  139|  23.5k|    DECLARE_STATE(tif, sp, mod);                                               \
  |  |  ------------------
  |  |  |  |  123|  23.5k|    static const char module[] = mod;                                          \
  |  |  |  |  124|  23.5k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  23.5k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|  23.5k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  125|  23.5k|    int a0;                                   /* reference element */          \
  |  |  |  |  126|  23.5k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  |  |  127|  23.5k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  |  |  128|  23.5k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  |  |  129|  23.5k|    int RunLength;                            /* length of current run */      \
  |  |  |  |  130|  23.5k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  |  |  131|  23.5k|    unsigned char *ep;                        /* end of input data */          \
  |  |  |  |  132|  23.5k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  |  |  133|  23.5k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  |  |  134|  23.5k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  |  |  135|  23.5k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  |  |  136|  23.5k|    const TIFFFaxTabEnt *TabEnt
  |  |  ------------------
  |  |  140|  23.5k|    int b1; /* next change on prev line */                                     \
  |  |  141|  23.5k|    uint32_t                                                                   \
  |  |  142|  23.5k|        *pb /* next run in reference line */ /*                                \
  ------------------
  387|  23.5k|    int is1D; /* current line is 1d/2d-encoded */
  388|  23.5k|    (void)s;
  389|  23.5k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (389:9): [True: 0, False: 23.5k]
  ------------------
  390|      0|    {
  391|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  392|      0|        return (-1);
  393|      0|    }
  394|  23.5k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (394:9): [True: 1, False: 23.5k]
  ------------------
  395|      1|        return (-1);
  396|  23.6k|RETRY_WITHOUT_EOL_2D:
  397|  23.6k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  23.6k|    do                                                                         \
  |  |  148|  23.6k|    {                                                                          \
  |  |  149|  23.6k|        BitAcc = sp->data;                                                     \
  |  |  150|  23.6k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  23.6k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  23.6k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  23.6k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  23.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 23.6k]
  |  |  ------------------
  ------------------
  398|   939k|    while (occ > 0)
  ------------------
  |  Branch (398:12): [True: 933k, False: 6.58k]
  ------------------
  399|   933k|    {
  400|   933k|        a0 = 0;
  401|   933k|        RunLength = 0;
  402|   933k|        pa = thisrun = sp->curruns;
  403|       |#ifdef FAX3_DEBUG
  404|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d EOLcnt = %d", BitAcc,
  405|       |               BitsAvail, EOLcnt);
  406|       |#endif
  407|   933k|        SYNC_EOL(EOF2D, RETRY_WITHOUT_EOL_2D);
  ------------------
  |  |  293|   933k|    do                                                                         \
  |  |  294|   933k|    {                                                                          \
  |  |  295|   933k|        if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */      \
  |  |  ------------------
  |  |  |  |  700|   933k|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  |  Branch (295:13): [True: 24.7k, False: 908k]
  |  |  ------------------
  |  |  296|   933k|        {                                                                      \
  |  |  297|  24.7k|            if (EOLcnt == 0)                                                   \
  |  |  ------------------
  |  |  |  Branch (297:17): [True: 17.1k, False: 7.54k]
  |  |  ------------------
  |  |  298|  24.7k|            {                                                                  \
  |  |  299|  17.1k|                for (;;)                                                       \
  |  |  300|  18.5M|                {                                                              \
  |  |  301|  18.5M|                    NeedBits16(11, eoflab);                                    \
  |  |  ------------------
  |  |  |  |  164|  18.5M|    do                                                                         \
  |  |  |  |  165|  18.5M|    {                                                                          \
  |  |  |  |  166|  18.5M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (166:13): [True: 2.32M, False: 16.2M]
  |  |  |  |  ------------------
  |  |  |  |  167|  18.5M|        {                                                                      \
  |  |  |  |  168|  2.32M|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  2.32M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 1.04k, False: 2.32M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  169|  2.32M|            {                                                                  \
  |  |  |  |  170|  1.04k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:21): [True: 148, False: 898]
  |  |  |  |  ------------------
  |  |  |  |  171|  1.04k|                    goto eoflab;                                               \
  |  |  |  |  172|  1.04k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  173|    898|            }                                                                  \
  |  |  |  |  174|  2.32M|            else                                                               \
  |  |  |  |  175|  2.32M|            {                                                                  \
  |  |  |  |  176|  2.32M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  177|  2.32M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:21): [True: 3.16k, False: 2.32M]
  |  |  |  |  ------------------
  |  |  |  |  178|  2.32M|                {                                                              \
  |  |  |  |  179|  3.16k|                    if (EndOfData())                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  3.16k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 38, False: 3.12k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  180|  3.16k|                    {                                                          \
  |  |  |  |  181|     38|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  182|     38|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  183|     38|                    }                                                          \
  |  |  |  |  184|  3.16k|                    else                                                       \
  |  |  |  |  185|  3.16k|                    {                                                          \
  |  |  |  |  186|  3.12k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  187|  3.12k|                        BitsAvail += 8;                                        \
  |  |  |  |  188|  3.12k|                    }                                                          \
  |  |  |  |  189|  3.16k|                }                                                              \
  |  |  |  |  190|  2.32M|            }                                                                  \
  |  |  |  |  191|  2.32M|        }                                                                      \
  |  |  |  |  192|  18.5M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:14): [Folded, False: 18.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  18.5M|                    if (GetBits(11) == 0)                                      \
  |  |  ------------------
  |  |  |  |  194|  18.5M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (302:25): [True: 17.0k, False: 18.5M]
  |  |  ------------------
  |  |  303|  18.5M|                        break; /* EOL found */                                 \
  |  |  304|  18.5M|                    ClrBits(1);                                                \
  |  |  ------------------
  |  |  |  |  196|  18.5M|    do                                                                         \
  |  |  |  |  197|  18.5M|    {                                                                          \
  |  |  |  |  198|  18.5M|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  18.5M|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  18.5M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 18.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  18.5M|                }                                                              \
  |  |  306|  17.1k|            }                                                                  \
  |  |  307|  24.7k|            /* Now move after EOL or detect missing EOL. */                    \
  |  |  308|  24.7k|            for (;;)                                                           \
  |  |  309|  1.65M|            {                                                                  \
  |  |  310|  1.65M|                NeedBits8(8, noEOLFound);                                      \
  |  |  ------------------
  |  |  |  |  144|  1.65M|    do                                                                         \
  |  |  |  |  145|  1.65M|    {                                                                          \
  |  |  |  |  146|  1.65M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 1.62M, False: 27.3k]
  |  |  |  |  ------------------
  |  |  |  |  147|  1.65M|        {                                                                      \
  |  |  |  |  148|  1.62M|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  1.62M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 395, False: 1.62M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  1.62M|            {                                                                  \
  |  |  |  |  150|    395|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 133, False: 262]
  |  |  |  |  ------------------
  |  |  |  |  151|    395|                    goto eoflab;                                               \
  |  |  |  |  152|    395|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|    262|            }                                                                  \
  |  |  |  |  154|  1.62M|            else                                                               \
  |  |  |  |  155|  1.62M|            {                                                                  \
  |  |  |  |  156|  1.62M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  1.62M|                BitsAvail += 8;                                                \
  |  |  |  |  158|  1.62M|            }                                                                  \
  |  |  |  |  159|  1.62M|        }                                                                      \
  |  |  |  |  160|  1.65M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 1.65M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|  1.65M|                if (GetBits(8))                                                \
  |  |  ------------------
  |  |  |  |  194|  1.65M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 24.4k, False: 1.62M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|  1.65M|                    break;                                                     \
  |  |  313|  1.65M|                ClrBits(8);                                                    \
  |  |  ------------------
  |  |  |  |  196|  1.62M|    do                                                                         \
  |  |  |  |  197|  1.62M|    {                                                                          \
  |  |  |  |  198|  1.62M|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  1.62M|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  1.62M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 1.62M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|  1.62M|            }                                                                  \
  |  |  315|   112k|            while (GetBits(1) == 0)                                            \
  |  |  ------------------
  |  |  |  |  194|   112k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (315:20): [True: 87.7k, False: 24.4k]
  |  |  ------------------
  |  |  316|  87.7k|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|   112k|    do                                                                         \
  |  |  |  |  197|   112k|    {                                                                          \
  |  |  |  |  198|  87.7k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  87.7k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  87.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 87.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  24.4k|            ClrBits(1); /* EOL bit */                                          \
  |  |  ------------------
  |  |  |  |  196|  24.4k|    do                                                                         \
  |  |  |  |  197|  24.4k|    {                                                                          \
  |  |  |  |  198|  24.4k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  24.4k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  24.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 24.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  24.4k|            EOLcnt = 0; /* reset EOL counter/flag */                           \
  |  |  319|  24.4k|            break;      /* existing EOL skipped, leave macro */                \
  |  |  320|  24.5k|        noEOLFound:                                                            \
  |  |  321|    133|            sp->b.mode |= FAXMODE_NOEOL;                                       \
  |  |  ------------------
  |  |  |  |  700|    133|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  322|    133|            tryG3WithoutEOL(a0);                                               \
  |  |  ------------------
  |  |  |  |  289|    133|    do                                                                         \
  |  |  |  |  290|    133|    {                                                                          \
  |  |  |  |  291|    133|        Fax3TryG3WithoutEOL(module, tif, (uint32_t)sp->line, (uint32_t)(a0));  \
  |  |  |  |  292|    133|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (292:14): [Folded, False: 133]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|    133|            goto retrywithouteol;                                              \
  |  |  324|  24.5k|        }                                                                      \
  |  |  325|   933k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (325:14): [Folded, False: 908k]
  |  |  ------------------
  ------------------
  408|   933k|        NeedBits8(1, EOF2D);
  ------------------
  |  |  144|   933k|    do                                                                         \
  |  |  145|   933k|    {                                                                          \
  |  |  146|   933k|        if (BitsAvail < (n))                                                   \
  |  |  ------------------
  |  |  |  Branch (146:13): [True: 63.6k, False: 869k]
  |  |  ------------------
  |  |  147|   933k|        {                                                                      \
  |  |  148|  63.6k|            if (EndOfData())                                                   \
  |  |  ------------------
  |  |  |  |  117|  63.6k|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 822, False: 62.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  149|  63.6k|            {                                                                  \
  |  |  150|    822|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  ------------------
  |  |  |  Branch (150:21): [True: 822, False: 0]
  |  |  ------------------
  |  |  151|    822|                    goto eoflab;                                               \
  |  |  152|    822|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  153|      0|            }                                                                  \
  |  |  154|  63.6k|            else                                                               \
  |  |  155|  63.6k|            {                                                                  \
  |  |  156|  62.8k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  157|  62.8k|                BitsAvail += 8;                                                \
  |  |  158|  62.8k|            }                                                                  \
  |  |  159|  63.6k|        }                                                                      \
  |  |  160|   933k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (160:14): [Folded, False: 932k]
  |  |  ------------------
  ------------------
  409|   932k|        is1D = GetBits(1); /* 1D/2D-encoding tag bit */
  ------------------
  |  |  194|   932k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  ------------------
  410|   932k|        ClrBits(1);
  ------------------
  |  |  196|   932k|    do                                                                         \
  |  |  197|   932k|    {                                                                          \
  |  |  198|   932k|        BitsAvail -= (n);                                                      \
  |  |  199|   932k|        BitAcc >>= (n);                                                        \
  |  |  200|   932k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 932k]
  |  |  ------------------
  ------------------
  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|   932k|        pb = sp->refruns;
  417|   932k|        b1 = (int)*pb++;
  418|   932k|        if (is1D)
  ------------------
  |  Branch (418:13): [True: 302k, False: 629k]
  ------------------
  419|   302k|            EXPAND1D(EOF2Da);
  ------------------
  |  |  371|   302k|    do                                                                         \
  |  |  372|   302k|    {                                                                          \
  |  |  373|   302k|        for (;;)                                                               \
  |  |  374|   512k|        {                                                                      \
  |  |  375|   512k|            for (;;)                                                           \
  |  |  376|  2.35M|            {                                                                  \
  |  |  377|  2.35M|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  2.35M|    do                                                                         \
  |  |  |  |  255|  2.35M|    {                                                                          \
  |  |  |  |  256|  2.35M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  2.35M|    do                                                                         \
  |  |  |  |  |  |  165|  2.35M|    {                                                                          \
  |  |  |  |  |  |  166|  2.35M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 2.11M, False: 238k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  2.35M|        {                                                                      \
  |  |  |  |  |  |  168|  2.11M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.11M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 5.45k, False: 2.11M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  2.11M|            {                                                                  \
  |  |  |  |  |  |  170|  5.45k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 236, False: 5.22k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  5.45k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  5.45k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  5.22k|            }                                                                  \
  |  |  |  |  |  |  174|  2.11M|            else                                                               \
  |  |  |  |  |  |  175|  2.11M|            {                                                                  \
  |  |  |  |  |  |  176|  2.11M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  2.11M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 120k, False: 1.98M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  2.11M|                {                                                              \
  |  |  |  |  |  |  179|   120k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   120k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 186, False: 120k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|   120k|                    {                                                          \
  |  |  |  |  |  |  181|    186|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    186|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    186|                    }                                                          \
  |  |  |  |  |  |  184|   120k|                    else                                                       \
  |  |  |  |  |  |  185|   120k|                    {                                                          \
  |  |  |  |  |  |  186|   120k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|   120k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|   120k|                    }                                                          \
  |  |  |  |  |  |  189|   120k|                }                                                              \
  |  |  |  |  |  |  190|  2.11M|            }                                                                  \
  |  |  |  |  |  |  191|  2.11M|        }                                                                      \
  |  |  |  |  |  |  192|  2.35M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 2.35M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  2.35M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  2.35M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  2.35M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  2.35M|    do                                                                         \
  |  |  |  |  |  |  197|  2.35M|    {                                                                          \
  |  |  |  |  |  |  198|  2.35M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  2.35M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  2.35M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 2.35M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  2.35M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 2.35M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  2.35M|                switch (TabEnt->State)                                         \
  |  |  379|  2.35M|                {                                                              \
  |  |  380|  20.7k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  20.7k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 20.7k, False: 2.33M]
  |  |  ------------------
  |  |  381|  20.7k|                        EOLcnt = 1;                                            \
  |  |  382|  20.7k|                        goto done1d;                                           \
  |  |  383|   483k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|   483k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 483k, False: 1.87M]
  |  |  ------------------
  |  |  384|   483k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   483k|    do                                                                         \
  |  |  |  |  267|   483k|    {                                                                          \
  |  |  |  |  268|   483k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 483k]
  |  |  |  |  ------------------
  |  |  |  |  269|   483k|        {                                                                      \
  |  |  |  |  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|   483k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   483k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   483k|        RunLength = 0;                                                         \
  |  |  |  |  279|   483k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 483k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|   483k|                        goto doneWhite1d;                                      \
  |  |  386|  1.66M|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|  1.66M|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 1.66M, False: 688k]
  |  |  ------------------
  |  |  387|  1.84M|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  1.84M|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 176k, False: 2.17M]
  |  |  ------------------
  |  |  388|  1.84M|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|  1.84M|                        RunLength =                                            \
  |  |  390|  1.84M|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|  1.84M|                        break;                                                 \
  |  |  392|  1.66M|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 7.96k, False: 2.34M]
  |  |  ------------------
  |  |  393|  7.96k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  7.96k|    do                                                                         \
  |  |  |  |  221|  7.96k|    {                                                                          \
  |  |  |  |  222|  7.96k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  7.96k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  7.96k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 7.96k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  7.96k|                        goto done1d;                                           \
  |  |  395|  2.35M|                }                                                              \
  |  |  396|  2.35M|            }                                                                  \
  |  |  397|   512k|        doneWhite1d:                                                           \
  |  |  398|   483k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 213k, False: 269k]
  |  |  ------------------
  |  |  399|   483k|                goto done1d;                                                   \
  |  |  400|   483k|            for (;;)                                                           \
  |  |  401|   270k|            {                                                                  \
  |  |  402|   270k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   270k|    do                                                                         \
  |  |  |  |  255|   270k|    {                                                                          \
  |  |  |  |  256|   270k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   270k|    do                                                                         \
  |  |  |  |  |  |  165|   270k|    {                                                                          \
  |  |  |  |  |  |  166|   270k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 184k, False: 86.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   270k|        {                                                                      \
  |  |  |  |  |  |  168|   184k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   184k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.47k, False: 182k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   184k|            {                                                                  \
  |  |  |  |  |  |  170|  2.47k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 131, False: 2.34k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.47k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.47k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  2.34k|            }                                                                  \
  |  |  |  |  |  |  174|   184k|            else                                                               \
  |  |  |  |  |  |  175|   184k|            {                                                                  \
  |  |  |  |  |  |  176|   182k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   182k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2.86k, False: 179k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   182k|                {                                                              \
  |  |  |  |  |  |  179|  2.86k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.86k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 173, False: 2.69k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  2.86k|                    {                                                          \
  |  |  |  |  |  |  181|    173|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    173|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    173|                    }                                                          \
  |  |  |  |  |  |  184|  2.86k|                    else                                                       \
  |  |  |  |  |  |  185|  2.86k|                    {                                                          \
  |  |  |  |  |  |  186|  2.69k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  2.69k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  2.69k|                    }                                                          \
  |  |  |  |  |  |  189|  2.86k|                }                                                              \
  |  |  |  |  |  |  190|   182k|            }                                                                  \
  |  |  |  |  |  |  191|   184k|        }                                                                      \
  |  |  |  |  |  |  192|   270k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 270k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   270k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   270k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   270k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   270k|    do                                                                         \
  |  |  |  |  |  |  197|   270k|    {                                                                          \
  |  |  |  |  |  |  198|   270k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   270k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   270k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 270k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   270k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 270k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|   270k|                switch (TabEnt->State)                                         \
  |  |  404|   270k|                {                                                              \
  |  |  405|  8.79k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  8.79k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 8.79k, False: 262k]
  |  |  ------------------
  |  |  406|  8.79k|                        EOLcnt = 1;                                            \
  |  |  407|  8.79k|                        goto done1d;                                           \
  |  |  408|   255k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|   255k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 255k, False: 14.9k]
  |  |  ------------------
  |  |  409|   255k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   255k|    do                                                                         \
  |  |  |  |  267|   255k|    {                                                                          \
  |  |  |  |  268|   255k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 255k]
  |  |  |  |  ------------------
  |  |  |  |  269|   255k|        {                                                                      \
  |  |  |  |  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|   255k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   255k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   255k|        RunLength = 0;                                                         \
  |  |  |  |  279|   255k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 255k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|   255k|                        goto doneBlack1d;                                      \
  |  |  411|   255k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|    603|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 603, False: 270k]
  |  |  ------------------
  |  |  412|  1.39k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  1.39k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 795, False: 270k]
  |  |  ------------------
  |  |  413|  1.39k|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|  1.39k|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|  1.39k|                        break;                                                 \
  |  |  416|  4.80k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 4.80k, False: 266k]
  |  |  ------------------
  |  |  417|  4.80k|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  4.80k|    do                                                                         \
  |  |  |  |  221|  4.80k|    {                                                                          \
  |  |  |  |  222|  4.80k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  4.80k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  4.80k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 4.80k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|  4.80k|                        goto done1d;                                           \
  |  |  419|   270k|                }                                                              \
  |  |  420|   270k|            }                                                                  \
  |  |  421|   269k|        doneBlack1d:                                                           \
  |  |  422|   255k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 46.4k, False: 209k]
  |  |  ------------------
  |  |  423|   255k|                goto done1d;                                                   \
  |  |  424|   255k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 130, False: 209k]
  |  |  |  Branch (424:35): [True: 128, False: 2]
  |  |  ------------------
  |  |  425|   209k|                pa -= 2;                                                       \
  |  |  426|   209k|        }                                                                      \
  |  |  427|   302k|    eof1d:                                                                     \
  |  |  428|    367|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|    367|    do                                                                         \
  |  |  |  |  272|    367|    {                                                                          \
  |  |  |  |  273|    367|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|    367|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|    367|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 367]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|    367|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|    367|    do                                                                         \
  |  |  |  |  334|    367|    {                                                                          \
  |  |  |  |  335|    367|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 320, False: 47]
  |  |  |  |  ------------------
  |  |  |  |  336|    367|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    320|    do                                                                         \
  |  |  |  |  |  |  267|    320|    {                                                                          \
  |  |  |  |  |  |  268|    320|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 320]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    320|        {                                                                      \
  |  |  |  |  |  |  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|    320|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    320|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    320|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    320|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 320]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|    367|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 367, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|    367|        {                                                                      \
  |  |  |  |  339|    367|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    367|    do                                                                         \
  |  |  |  |  |  |  254|    367|    {                                                                          \
  |  |  |  |  |  |  255|    367|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    367|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    367|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    367|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 367]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|    684|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 317, False: 367]
  |  |  |  |  |  Branch (340:39): [True: 317, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    367|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    367|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 367, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    367|            {                                                                  \
  |  |  |  |  344|    367|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 367]
  |  |  |  |  ------------------
  |  |  |  |  345|    367|                    a0 = 0;                                                    \
  |  |  |  |  346|    367|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 134, False: 233]
  |  |  |  |  ------------------
  |  |  |  |  347|    367|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    134|    do                                                                         \
  |  |  |  |  |  |  267|    134|    {                                                                          \
  |  |  |  |  |  |  268|    134|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 134]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    134|        {                                                                      \
  |  |  |  |  |  |  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|    134|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    134|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    134|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    134|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 134]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    367|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    367|    do                                                                         \
  |  |  |  |  |  |  267|    367|    {                                                                          \
  |  |  |  |  |  |  268|    367|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 367]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    367|        {                                                                      \
  |  |  |  |  |  |  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|    367|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    367|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    367|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    367|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 367]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    367|            }                                                                  \
  |  |  |  |  350|    367|            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|    367|        }                                                                      \
  |  |  |  |  356|    367|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 367]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|    367|        goto eoflab;                                                           \
  |  |  431|   302k|    done1d:                                                                    \
  |  |  432|   302k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   302k|    do                                                                         \
  |  |  |  |  334|   302k|    {                                                                          \
  |  |  |  |  335|   302k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 5.66k, False: 296k]
  |  |  |  |  ------------------
  |  |  |  |  336|   302k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  5.66k|    do                                                                         \
  |  |  |  |  |  |  267|  5.66k|    {                                                                          \
  |  |  |  |  |  |  268|  5.66k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 5.66k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  5.66k|        {                                                                      \
  |  |  |  |  |  |  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.66k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  5.66k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  5.66k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  5.66k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 5.66k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   302k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 278k, False: 23.8k]
  |  |  |  |  ------------------
  |  |  |  |  338|   302k|        {                                                                      \
  |  |  |  |  339|   278k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   278k|    do                                                                         \
  |  |  |  |  |  |  254|   278k|    {                                                                          \
  |  |  |  |  |  |  255|   278k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   278k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   278k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   278k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 278k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   520k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 241k, False: 278k]
  |  |  |  |  |  Branch (340:39): [True: 241k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   278k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   278k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 278k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|   278k|            {                                                                  \
  |  |  |  |  344|   278k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 278k]
  |  |  |  |  ------------------
  |  |  |  |  345|   278k|                    a0 = 0;                                                    \
  |  |  |  |  346|   278k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 46.1k, False: 232k]
  |  |  |  |  ------------------
  |  |  |  |  347|   278k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  46.1k|    do                                                                         \
  |  |  |  |  |  |  267|  46.1k|    {                                                                          \
  |  |  |  |  |  |  268|  46.1k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 46.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  46.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|  46.1k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  46.1k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  46.1k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  46.1k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 46.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   278k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   278k|    do                                                                         \
  |  |  |  |  |  |  267|   278k|    {                                                                          \
  |  |  |  |  |  |  268|   278k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 278k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   278k|        {                                                                      \
  |  |  |  |  |  |  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|   278k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   278k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   278k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   278k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 278k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   278k|            }                                                                  \
  |  |  |  |  350|   278k|            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|   278k|        }                                                                      \
  |  |  |  |  356|   302k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 302k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|   302k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 302k]
  |  |  ------------------
  ------------------
  420|   629k|        else
  421|   629k|            EXPAND2D(EOF2Da);
  ------------------
  |  |  463|   629k|    do                                                                         \
  |  |  464|   629k|    {                                                                          \
  |  |  465|  1.79M|        while (a0 < (int)lastx)                                                \
  |  |  ------------------
  |  |  |  Branch (465:16): [True: 1.48M, False: 305k]
  |  |  ------------------
  |  |  466|  1.48M|        {                                                                      \
  |  |  467|  1.48M|            if (pa >= thisrun + sp->nruns)                                     \
  |  |  ------------------
  |  |  |  Branch (467:17): [True: 353, False: 1.48M]
  |  |  ------------------
  |  |  468|  1.48M|            {                                                                  \
  |  |  469|    353|                TIFFErrorExtR(tif, module,                                     \
  |  |  470|    353|                              "Buffer overflow at line %d of %s %u", sp->line, \
  |  |  471|    353|                              isTiled(tif) ? "tile" : "strip",                 \
  |  |  ------------------
  |  |  |  |  278|    353|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    353|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 161, False: 192]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|    353|                              isTiled(tif) ? tif->tif_dir.td_curtile           \
  |  |  ------------------
  |  |  |  |  278|    353|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    353|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 161, False: 192]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|    353|                                           : tif->tif_dir.td_curstrip);        \
  |  |  474|    353|                return (-1);                                                   \
  |  |  475|    353|            }                                                                  \
  |  |  476|  1.48M|            LOOKUP8(7, TIFFFaxMainTable, eof2d);                               \
  |  |  ------------------
  |  |  |  |  247|  1.48M|    do                                                                         \
  |  |  |  |  248|  1.48M|    {                                                                          \
  |  |  |  |  249|  1.48M|        NeedBits8(wid, eoflab);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  1.48M|    do                                                                         \
  |  |  |  |  |  |  145|  1.48M|    {                                                                          \
  |  |  |  |  |  |  146|  1.48M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:13): [True: 650k, False: 834k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.48M|        {                                                                      \
  |  |  |  |  |  |  148|   650k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   650k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 14.7k, False: 635k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  149|   650k|            {                                                                  \
  |  |  |  |  |  |  150|  14.7k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:21): [True: 2.31k, False: 12.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  14.7k|                    goto eoflab;                                               \
  |  |  |  |  |  |  152|  14.7k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  153|  12.4k|            }                                                                  \
  |  |  |  |  |  |  154|   650k|            else                                                               \
  |  |  |  |  |  |  155|   650k|            {                                                                  \
  |  |  |  |  |  |  156|   635k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  157|   635k|                BitsAvail += 8;                                                \
  |  |  |  |  |  |  158|   635k|            }                                                                  \
  |  |  |  |  |  |  159|   650k|        }                                                                      \
  |  |  |  |  |  |  160|  1.48M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (160:14): [Folded, False: 1.48M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  250|  1.48M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  1.48M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  251|  1.48M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  1.48M|    do                                                                         \
  |  |  |  |  |  |  197|  1.48M|    {                                                                          \
  |  |  |  |  |  |  198|  1.48M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  1.48M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  1.48M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 1.48M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|  1.48M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (252:14): [Folded, False: 1.48M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|  1.48M|            switch (TabEnt->State)                                             \
  |  |  478|  1.48M|            {                                                                  \
  |  |  479|  59.8k|                case S_Pass:                                                   \
  |  |  ------------------
  |  |  |  |   71|  59.8k|#define S_Pass 1
  |  |  ------------------
  |  |  |  Branch (479:17): [True: 59.8k, False: 1.42M]
  |  |  ------------------
  |  |  480|  59.8k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  59.8k|    do                                                                         \
  |  |  |  |  441|  59.8k|    {                                                                          \
  |  |  |  |  442|  59.8k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 15.0k, False: 44.8k]
  |  |  |  |  ------------------
  |  |  |  |  443|  59.8k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 38.6k, False: 14.5k]
  |  |  |  |  |  Branch (443:32): [True: 38.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  38.6k|            {                                                                  \
  |  |  |  |  445|  38.6k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 490, False: 38.1k]
  |  |  |  |  ------------------
  |  |  |  |  446|  38.6k|                {                                                              \
  |  |  |  |  447|    490|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    490|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    490|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    490|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    490|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 147, False: 343]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    490|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    490|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    490|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 147, False: 343]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    490|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    490|                    return (-1);                                               \
  |  |  |  |  453|    490|                }                                                              \
  |  |  |  |  454|  38.6k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  38.1k|                pb += 2;                                                       \
  |  |  |  |  456|  38.1k|            }                                                                  \
  |  |  |  |  457|  59.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 59.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|  59.8k|                    if (pb + 1 >= sp->refruns + sp->nruns)                     \
  |  |  ------------------
  |  |  |  Branch (481:25): [True: 514, False: 58.8k]
  |  |  ------------------
  |  |  482|  59.3k|                    {                                                          \
  |  |  483|    514|                        TIFFErrorExtR(                                         \
  |  |  484|    514|                            tif, module,                                       \
  |  |  485|    514|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  486|    514|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    514|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    514|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 229, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|    514|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    514|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    514|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 229, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    514|                                         : tif->tif_dir.td_curstrip);          \
  |  |  489|    514|                        return (-1);                                           \
  |  |  490|    514|                    }                                                          \
  |  |  491|  59.3k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  492|  58.8k|                    RunLength =                                                \
  |  |  493|  58.8k|                        (int)((uint32_t)RunLength + (uint32_t)(b1 - a0));      \
  |  |  494|  58.8k|                    a0 = b1;                                                   \
  |  |  495|  58.8k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  496|  58.8k|                    break;                                                     \
  |  |  497|  82.9k|                case S_Horiz:                                                  \
  |  |  ------------------
  |  |  |  |   72|  82.9k|#define S_Horiz 2
  |  |  ------------------
  |  |  |  Branch (497:17): [True: 82.9k, False: 1.39M]
  |  |  ------------------
  |  |  498|  82.9k|                    if ((pa - thisrun) & 1)                                    \
  |  |  ------------------
  |  |  |  Branch (498:25): [True: 32.8k, False: 50.0k]
  |  |  ------------------
  |  |  499|  82.9k|                    {                                                          \
  |  |  500|  32.8k|                        for (;;)                                               \
  |  |  501|  35.3k|                        { /* black first */                                    \
  |  |  502|  35.3k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  35.3k|    do                                                                         \
  |  |  |  |  255|  35.3k|    {                                                                          \
  |  |  |  |  256|  35.3k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  35.3k|    do                                                                         \
  |  |  |  |  |  |  165|  35.3k|    {                                                                          \
  |  |  |  |  |  |  166|  35.3k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 35.0k, False: 274]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  35.3k|        {                                                                      \
  |  |  |  |  |  |  168|  35.0k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  35.0k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 296, False: 34.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  35.0k|            {                                                                  \
  |  |  |  |  |  |  170|    296|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 131, False: 165]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    296|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    296|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    165|            }                                                                  \
  |  |  |  |  |  |  174|  35.0k|            else                                                               \
  |  |  |  |  |  |  175|  35.0k|            {                                                                  \
  |  |  |  |  |  |  176|  34.7k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  34.7k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2.45k, False: 32.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  34.7k|                {                                                              \
  |  |  |  |  |  |  179|  2.45k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.45k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 136, False: 2.32k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  2.45k|                    {                                                          \
  |  |  |  |  |  |  181|    136|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    136|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    136|                    }                                                          \
  |  |  |  |  |  |  184|  2.45k|                    else                                                       \
  |  |  |  |  |  |  185|  2.45k|                    {                                                          \
  |  |  |  |  |  |  186|  2.32k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  2.32k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  2.32k|                    }                                                          \
  |  |  |  |  |  |  189|  2.45k|                }                                                              \
  |  |  |  |  |  |  190|  34.7k|            }                                                                  \
  |  |  |  |  |  |  191|  35.0k|        }                                                                      \
  |  |  |  |  |  |  192|  35.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 35.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  35.3k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  35.1k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  35.1k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  35.1k|    do                                                                         \
  |  |  |  |  |  |  197|  35.1k|    {                                                                          \
  |  |  |  |  |  |  198|  35.1k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  35.1k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  35.1k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 35.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  35.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 35.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  35.3k|                            switch (TabEnt->State)                             \
  |  |  504|  35.1k|                            {                                                  \
  |  |  505|  30.6k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  30.6k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (505:33): [True: 30.6k, False: 4.56k]
  |  |  ------------------
  |  |  506|  30.6k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  30.6k|    do                                                                         \
  |  |  |  |  267|  30.6k|    {                                                                          \
  |  |  |  |  268|  30.6k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 30.6k]
  |  |  |  |  ------------------
  |  |  |  |  269|  30.6k|        {                                                                      \
  |  |  |  |  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|  30.6k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  30.6k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  30.6k|        RunLength = 0;                                                         \
  |  |  |  |  279|  30.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 30.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  507|  30.6k|                                    goto doneWhite2da;                         \
  |  |  508|  30.6k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|  1.03k|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (508:33): [True: 1.03k, False: 34.1k]
  |  |  ------------------
  |  |  509|  2.42k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  2.42k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (509:33): [True: 1.39k, False: 33.7k]
  |  |  ------------------
  |  |  510|  2.42k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  511|  2.42k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  512|  2.42k|                                                      TabEnt->Param);          \
  |  |  513|  2.42k|                                    break;                                     \
  |  |  514|  2.14k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (514:33): [True: 2.14k, False: 33.0k]
  |  |  ------------------
  |  |  515|  2.14k|                                    goto badBlack2d;                           \
  |  |  516|  35.1k|                            }                                                  \
  |  |  517|  35.1k|                        }                                                      \
  |  |  518|  32.8k|                    doneWhite2da:;                                             \
  |  |  519|  30.6k|                        for (;;)                                               \
  |  |  520|   430k|                        { /* then white */                                     \
  |  |  521|   430k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   430k|    do                                                                         \
  |  |  |  |  255|   430k|    {                                                                          \
  |  |  |  |  256|   430k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   430k|    do                                                                         \
  |  |  |  |  |  |  165|   430k|    {                                                                          \
  |  |  |  |  |  |  166|   430k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 403k, False: 26.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   430k|        {                                                                      \
  |  |  |  |  |  |  168|   403k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   403k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 1.09k, False: 402k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   403k|            {                                                                  \
  |  |  |  |  |  |  170|  1.09k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 629, False: 470]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.09k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  1.09k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    470|            }                                                                  \
  |  |  |  |  |  |  174|   403k|            else                                                               \
  |  |  |  |  |  |  175|   403k|            {                                                                  \
  |  |  |  |  |  |  176|   402k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   402k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 22.6k, False: 379k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   402k|                {                                                              \
  |  |  |  |  |  |  179|  22.6k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  22.6k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 195, False: 22.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  22.6k|                    {                                                          \
  |  |  |  |  |  |  181|    195|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    195|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    195|                    }                                                          \
  |  |  |  |  |  |  184|  22.6k|                    else                                                       \
  |  |  |  |  |  |  185|  22.6k|                    {                                                          \
  |  |  |  |  |  |  186|  22.4k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  22.4k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  22.4k|                    }                                                          \
  |  |  |  |  |  |  189|  22.6k|                }                                                              \
  |  |  |  |  |  |  190|   402k|            }                                                                  \
  |  |  |  |  |  |  191|   403k|        }                                                                      \
  |  |  |  |  |  |  192|   430k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 429k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   430k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   429k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   429k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   429k|    do                                                                         \
  |  |  |  |  |  |  197|   429k|    {                                                                          \
  |  |  |  |  |  |  198|   429k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   429k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   429k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 429k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   429k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 429k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|   430k|                            switch (TabEnt->State)                             \
  |  |  523|   429k|                            {                                                  \
  |  |  524|  28.8k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  28.8k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (524:33): [True: 28.8k, False: 400k]
  |  |  ------------------
  |  |  525|  28.8k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  28.8k|    do                                                                         \
  |  |  |  |  267|  28.8k|    {                                                                          \
  |  |  |  |  268|  28.8k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 371, False: 28.5k]
  |  |  |  |  ------------------
  |  |  |  |  269|  28.8k|        {                                                                      \
  |  |  |  |  270|    371|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|    371|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    371|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    371|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 135, False: 236]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|    371|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    371|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    371|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 135, False: 236]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|    371|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|    371|            return (-1);                                                       \
  |  |  |  |  275|    371|        }                                                                      \
  |  |  |  |  276|  28.8k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  28.5k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  28.5k|        RunLength = 0;                                                         \
  |  |  |  |  279|  28.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 28.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  28.8k|                                    goto doneBlack2da;                         \
  |  |  527|   355k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|   355k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (527:33): [True: 355k, False: 73.9k]
  |  |  ------------------
  |  |  528|   399k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|   399k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (528:33): [True: 43.9k, False: 385k]
  |  |  ------------------
  |  |  529|   399k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  530|   399k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  531|   399k|                                                      TabEnt->Param);          \
  |  |  532|   399k|                                    break;                                     \
  |  |  533|   355k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (533:33): [True: 1.12k, False: 428k]
  |  |  ------------------
  |  |  534|  1.12k|                                    goto badWhite2d;                           \
  |  |  535|   429k|                            }                                                  \
  |  |  536|   429k|                        }                                                      \
  |  |  537|  30.6k|                    doneBlack2da:;                                             \
  |  |  538|  28.5k|                    }                                                          \
  |  |  539|  82.9k|                    else                                                       \
  |  |  540|  82.9k|                    {                                                          \
  |  |  541|  50.0k|                        for (;;)                                               \
  |  |  542|   257k|                        { /* white first */                                    \
  |  |  543|   257k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   257k|    do                                                                         \
  |  |  |  |  255|   257k|    {                                                                          \
  |  |  |  |  256|   257k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   257k|    do                                                                         \
  |  |  |  |  |  |  165|   257k|    {                                                                          \
  |  |  |  |  |  |  166|   257k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 254k, False: 3.31k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   257k|        {                                                                      \
  |  |  |  |  |  |  168|   254k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   254k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 705, False: 253k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   254k|            {                                                                  \
  |  |  |  |  |  |  170|    705|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 12, False: 693]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    705|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    705|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    693|            }                                                                  \
  |  |  |  |  |  |  174|   254k|            else                                                               \
  |  |  |  |  |  |  175|   254k|            {                                                                  \
  |  |  |  |  |  |  176|   253k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   253k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 11.3k, False: 242k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   253k|                {                                                              \
  |  |  |  |  |  |  179|  11.3k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  11.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 134, False: 11.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  11.3k|                    {                                                          \
  |  |  |  |  |  |  181|    134|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    134|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    134|                    }                                                          \
  |  |  |  |  |  |  184|  11.3k|                    else                                                       \
  |  |  |  |  |  |  185|  11.3k|                    {                                                          \
  |  |  |  |  |  |  186|  11.1k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  11.1k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  11.1k|                    }                                                          \
  |  |  |  |  |  |  189|  11.3k|                }                                                              \
  |  |  |  |  |  |  190|   253k|            }                                                                  \
  |  |  |  |  |  |  191|   254k|        }                                                                      \
  |  |  |  |  |  |  192|   257k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 257k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   257k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   257k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   257k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   257k|    do                                                                         \
  |  |  |  |  |  |  197|   257k|    {                                                                          \
  |  |  |  |  |  |  198|   257k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   257k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   257k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 257k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   257k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 257k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|   257k|                            switch (TabEnt->State)                             \
  |  |  545|   257k|                            {                                                  \
  |  |  546|  39.6k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  39.6k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (546:33): [True: 39.6k, False: 217k]
  |  |  ------------------
  |  |  547|  39.6k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  39.6k|    do                                                                         \
  |  |  |  |  267|  39.6k|    {                                                                          \
  |  |  |  |  268|  39.6k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 39.6k]
  |  |  |  |  ------------------
  |  |  |  |  269|  39.6k|        {                                                                      \
  |  |  |  |  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.6k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  39.6k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  39.6k|        RunLength = 0;                                                         \
  |  |  |  |  279|  39.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 39.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|  39.6k|                                    goto doneWhite2db;                         \
  |  |  549|   183k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|   183k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (549:33): [True: 183k, False: 74.4k]
  |  |  ------------------
  |  |  550|   207k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|   207k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (550:33): [True: 24.4k, False: 233k]
  |  |  ------------------
  |  |  551|   207k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  552|   207k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  553|   207k|                                                      TabEnt->Param);          \
  |  |  554|   207k|                                    break;                                     \
  |  |  555|   183k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (555:33): [True: 10.3k, False: 247k]
  |  |  ------------------
  |  |  556|  10.3k|                                    goto badWhite2d;                           \
  |  |  557|   257k|                            }                                                  \
  |  |  558|   257k|                        }                                                      \
  |  |  559|  50.0k|                    doneWhite2db:;                                             \
  |  |  560|  39.6k|                        for (;;)                                               \
  |  |  561|  41.3k|                        { /* then black */                                     \
  |  |  562|  41.3k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  41.3k|    do                                                                         \
  |  |  |  |  255|  41.3k|    {                                                                          \
  |  |  |  |  256|  41.3k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  41.3k|    do                                                                         \
  |  |  |  |  |  |  165|  41.3k|    {                                                                          \
  |  |  |  |  |  |  166|  41.3k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 32.7k, False: 8.59k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  41.3k|        {                                                                      \
  |  |  |  |  |  |  168|  32.7k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  32.7k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 692, False: 32.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  32.7k|            {                                                                  \
  |  |  |  |  |  |  170|    692|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 267, False: 425]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    692|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    692|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    425|            }                                                                  \
  |  |  |  |  |  |  174|  32.7k|            else                                                               \
  |  |  |  |  |  |  175|  32.7k|            {                                                                  \
  |  |  |  |  |  |  176|  32.0k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  32.0k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2.53k, False: 29.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  32.0k|                {                                                              \
  |  |  |  |  |  |  179|  2.53k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.53k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 319, False: 2.21k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  2.53k|                    {                                                          \
  |  |  |  |  |  |  181|    319|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    319|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    319|                    }                                                          \
  |  |  |  |  |  |  184|  2.53k|                    else                                                       \
  |  |  |  |  |  |  185|  2.53k|                    {                                                          \
  |  |  |  |  |  |  186|  2.21k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  2.21k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  2.21k|                    }                                                          \
  |  |  |  |  |  |  189|  2.53k|                }                                                              \
  |  |  |  |  |  |  190|  32.0k|            }                                                                  \
  |  |  |  |  |  |  191|  32.7k|        }                                                                      \
  |  |  |  |  |  |  192|  41.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 41.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  41.3k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  41.1k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  41.1k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  41.1k|    do                                                                         \
  |  |  |  |  |  |  197|  41.1k|    {                                                                          \
  |  |  |  |  |  |  198|  41.1k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  41.1k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  41.1k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 41.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  41.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 41.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|  41.3k|                            switch (TabEnt->State)                             \
  |  |  564|  41.1k|                            {                                                  \
  |  |  565|  33.7k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  33.7k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (565:33): [True: 33.7k, False: 7.40k]
  |  |  ------------------
  |  |  566|  33.7k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  33.7k|    do                                                                         \
  |  |  |  |  267|  33.7k|    {                                                                          \
  |  |  |  |  268|  33.7k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 33.7k]
  |  |  |  |  ------------------
  |  |  |  |  269|  33.7k|        {                                                                      \
  |  |  |  |  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.7k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  33.7k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  33.7k|        RunLength = 0;                                                         \
  |  |  |  |  279|  33.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 33.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  567|  33.7k|                                    goto doneBlack2db;                         \
  |  |  568|  33.7k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|    388|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (568:33): [True: 388, False: 40.7k]
  |  |  ------------------
  |  |  569|  1.68k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  1.68k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (569:33): [True: 1.29k, False: 39.8k]
  |  |  ------------------
  |  |  570|  1.68k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  571|  1.68k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  572|  1.68k|                                                      TabEnt->Param);          \
  |  |  573|  1.68k|                                    break;                                     \
  |  |  574|  5.72k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (574:33): [True: 5.72k, False: 35.3k]
  |  |  ------------------
  |  |  575|  5.72k|                                    goto badBlack2d;                           \
  |  |  576|  41.1k|                            }                                                  \
  |  |  577|  41.1k|                        }                                                      \
  |  |  578|  39.6k|                    doneBlack2db:;                                             \
  |  |  579|  33.7k|                    }                                                          \
  |  |  580|  82.9k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  62.2k|    do                                                                         \
  |  |  |  |  441|  62.2k|    {                                                                          \
  |  |  |  |  442|  62.2k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 62.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  443|   112k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 94.5k, False: 17.7k]
  |  |  |  |  |  Branch (443:32): [True: 50.4k, False: 44.0k]
  |  |  |  |  ------------------
  |  |  |  |  444|  62.2k|            {                                                                  \
  |  |  |  |  445|  50.4k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 333, False: 50.1k]
  |  |  |  |  ------------------
  |  |  |  |  446|  50.4k|                {                                                              \
  |  |  |  |  447|    333|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    333|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    333|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    333|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    333|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 164, False: 169]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    333|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    333|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    333|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 164, False: 169]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    333|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    333|                    return (-1);                                               \
  |  |  |  |  453|    333|                }                                                              \
  |  |  |  |  454|  50.4k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  50.1k|                pb += 2;                                                       \
  |  |  |  |  456|  50.1k|            }                                                                  \
  |  |  |  |  457|  62.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 61.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|  62.2k|                    break;                                                     \
  |  |  582|   292k|                case S_V0:                                                     \
  |  |  ------------------
  |  |  |  |   73|   292k|#define S_V0 3
  |  |  ------------------
  |  |  |  Branch (582:17): [True: 292k, False: 1.19M]
  |  |  ------------------
  |  |  583|   292k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   292k|    do                                                                         \
  |  |  |  |  441|   292k|    {                                                                          \
  |  |  |  |  442|   292k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 143k, False: 149k]
  |  |  |  |  ------------------
  |  |  |  |  443|   292k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 65.4k, False: 142k]
  |  |  |  |  |  Branch (443:32): [True: 65.4k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   143k|            {                                                                  \
  |  |  |  |  445|  65.4k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 396, False: 65.0k]
  |  |  |  |  ------------------
  |  |  |  |  446|  65.4k|                {                                                              \
  |  |  |  |  447|    396|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    396|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    396|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    396|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    396|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 266]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    396|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    396|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    396|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 266]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    396|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    396|                    return (-1);                                               \
  |  |  |  |  453|    396|                }                                                              \
  |  |  |  |  454|  65.4k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  65.0k|                pb += 2;                                                       \
  |  |  |  |  456|  65.0k|            }                                                                  \
  |  |  |  |  457|   292k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 291k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|   292k|                    SETVALUE(b1 - a0);                                         \
  |  |  ------------------
  |  |  |  |  266|   291k|    do                                                                         \
  |  |  |  |  267|   291k|    {                                                                          \
  |  |  |  |  268|   291k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 291k]
  |  |  |  |  ------------------
  |  |  |  |  269|   291k|        {                                                                      \
  |  |  |  |  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|   291k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   291k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   291k|        RunLength = 0;                                                         \
  |  |  |  |  279|   291k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 291k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|   291k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (585:25): [True: 351, False: 291k]
  |  |  ------------------
  |  |  586|   291k|                    {                                                          \
  |  |  587|    351|                        TIFFErrorExtR(                                         \
  |  |  588|    351|                            tif, module,                                       \
  |  |  589|    351|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  590|    351|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    351|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    351|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 133, False: 218]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  591|    351|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    351|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    351|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 133, False: 218]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|    351|                                         : tif->tif_dir.td_curstrip);          \
  |  |  593|    351|                        return (-1);                                           \
  |  |  594|    351|                    }                                                          \
  |  |  595|   291k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  596|   291k|                    break;                                                     \
  |  |  597|   291k|                case S_VR:                                                     \
  |  |  ------------------
  |  |  |  |   74|   128k|#define S_VR 4
  |  |  ------------------
  |  |  |  Branch (597:17): [True: 128k, False: 1.35M]
  |  |  ------------------
  |  |  598|   128k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   128k|    do                                                                         \
  |  |  |  |  441|   128k|    {                                                                          \
  |  |  |  |  442|   128k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 67.4k, False: 61.1k]
  |  |  |  |  ------------------
  |  |  |  |  443|   128k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 42.4k, False: 67.0k]
  |  |  |  |  |  Branch (443:32): [True: 42.4k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  67.4k|            {                                                                  \
  |  |  |  |  445|  42.4k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 319, False: 42.1k]
  |  |  |  |  ------------------
  |  |  |  |  446|  42.4k|                {                                                              \
  |  |  |  |  447|    319|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    319|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    319|                                  sp->line, 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: 131, False: 188]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    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: 131, False: 188]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    319|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    319|                    return (-1);                                               \
  |  |  |  |  453|    319|                }                                                              \
  |  |  |  |  454|  42.4k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  42.1k|                pb += 2;                                                       \
  |  |  |  |  456|  42.1k|            }                                                                  \
  |  |  |  |  457|   128k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 128k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|   128k|                    SETVALUE((int)((uint32_t)(b1 - a0) + 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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|   128k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (600:25): [True: 395, False: 127k]
  |  |  ------------------
  |  |  601|   128k|                    {                                                          \
  |  |  602|    395|                        TIFFErrorExtR(                                         \
  |  |  603|    395|                            tif, module,                                       \
  |  |  604|    395|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  605|    395|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    395|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    395|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 160, False: 235]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  606|    395|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    395|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    395|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 160, False: 235]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  607|    395|                                         : tif->tif_dir.td_curstrip);          \
  |  |  608|    395|                        return (-1);                                           \
  |  |  609|    395|                    }                                                          \
  |  |  610|   128k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  611|   127k|                    break;                                                     \
  |  |  612|   623k|                case S_VL:                                                     \
  |  |  ------------------
  |  |  |  |   75|   623k|#define S_VL 5
  |  |  ------------------
  |  |  |  Branch (612:17): [True: 623k, False: 859k]
  |  |  ------------------
  |  |  613|   623k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   623k|    do                                                                         \
  |  |  |  |  441|   623k|    {                                                                          \
  |  |  |  |  442|   623k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 525k, False: 98.3k]
  |  |  |  |  ------------------
  |  |  |  |  443|   819k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 294k, False: 524k]
  |  |  |  |  |  Branch (443:32): [True: 294k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   525k|            {                                                                  \
  |  |  |  |  445|   294k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 472, False: 294k]
  |  |  |  |  ------------------
  |  |  |  |  446|   294k|                {                                                              \
  |  |  |  |  447|    472|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    472|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    472|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    472|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    472|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 170, False: 302]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    472|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    472|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    472|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 170, False: 302]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    472|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    472|                    return (-1);                                               \
  |  |  |  |  453|    472|                }                                                              \
  |  |  |  |  454|   294k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   294k|                pb += 2;                                                       \
  |  |  |  |  456|   294k|            }                                                                  \
  |  |  |  |  457|   623k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 622k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  614|   623k|                    if (b1 < (int)((uint32_t)a0 + TabEnt->Param))              \
  |  |  ------------------
  |  |  |  Branch (614:25): [True: 1.61k, False: 621k]
  |  |  ------------------
  |  |  615|   622k|                    {                                                          \
  |  |  616|  1.61k|                        unexpected("VL", a0);                                  \
  |  |  ------------------
  |  |  |  |  220|  1.61k|    do                                                                         \
  |  |  |  |  221|  1.61k|    {                                                                          \
  |  |  |  |  222|  1.61k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  1.61k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  1.61k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 1.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  617|  1.61k|                        goto eol2d;                                            \
  |  |  618|  1.61k|                    }                                                          \
  |  |  619|   622k|                    SETVALUE((int)((uint32_t)(b1 - a0) - TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   621k|    do                                                                         \
  |  |  |  |  267|   621k|    {                                                                          \
  |  |  |  |  268|   621k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 621k]
  |  |  |  |  ------------------
  |  |  |  |  269|   621k|        {                                                                      \
  |  |  |  |  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|   621k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   621k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   621k|        RunLength = 0;                                                         \
  |  |  |  |  279|   621k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 621k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  620|   621k|                    b1 = b1 - (int)*--pb;                                      \
  |  |  621|   621k|                    break;                                                     \
  |  |  622|   621k|                case S_Ext:                                                    \
  |  |  ------------------
  |  |  |  |   76|  63.7k|#define S_Ext 6
  |  |  ------------------
  |  |  |  Branch (622:17): [True: 63.7k, False: 1.41M]
  |  |  ------------------
  |  |  623|  63.7k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  624|  63.7k|                    extension(a0);                                             \
  |  |  ------------------
  |  |  |  |  238|  63.7k|    Fax3Extension(module, tif, (uint32_t)sp->line, (uint32_t)(a0))
  |  |  ------------------
  |  |  625|  63.7k|                    goto eol2d;                                                \
  |  |  626|   621k|                case S_EOL:                                                    \
  |  |  ------------------
  |  |  |  |   82|   231k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (626:17): [True: 231k, False: 1.25M]
  |  |  ------------------
  |  |  627|   231k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  628|   231k|                    NeedBits8(4, eof2d);                                       \
  |  |  ------------------
  |  |  |  |  144|   231k|    do                                                                         \
  |  |  |  |  145|   231k|    {                                                                          \
  |  |  |  |  146|   231k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 126k, False: 104k]
  |  |  |  |  ------------------
  |  |  |  |  147|   231k|        {                                                                      \
  |  |  |  |  148|   126k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|   126k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 7.57k, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|   126k|            {                                                                  \
  |  |  |  |  150|  7.57k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 7.16k, False: 411]
  |  |  |  |  ------------------
  |  |  |  |  151|  7.57k|                    goto eoflab;                                               \
  |  |  |  |  152|  7.57k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|    411|            }                                                                  \
  |  |  |  |  154|   126k|            else                                                               \
  |  |  |  |  155|   126k|            {                                                                  \
  |  |  |  |  156|   119k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|   119k|                BitsAvail += 8;                                                \
  |  |  |  |  158|   119k|            }                                                                  \
  |  |  |  |  159|   126k|        }                                                                      \
  |  |  |  |  160|   231k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 224k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|   231k|                    if (GetBits(4))                                            \
  |  |  ------------------
  |  |  |  |  194|   224k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 70.2k, False: 154k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  630|   224k|                        unexpected("EOL", a0);                                 \
  |  |  ------------------
  |  |  |  |  220|  70.2k|    do                                                                         \
  |  |  |  |  221|  70.2k|    {                                                                          \
  |  |  |  |  222|  70.2k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  70.2k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  70.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 70.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  631|   224k|                    ClrBits(4);                                                \
  |  |  ------------------
  |  |  |  |  196|   224k|    do                                                                         \
  |  |  |  |  197|   224k|    {                                                                          \
  |  |  |  |  198|   224k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|   224k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|   224k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 224k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|   224k|                    EOLcnt = 1;                                                \
  |  |  633|   224k|                    goto eol2d;                                                \
  |  |  634|   231k|                default:                                                       \
  |  |  ------------------
  |  |  |  Branch (634:17): [True: 0, False: 1.48M]
  |  |  ------------------
  |  |  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|  7.86k|                badBlack2d:                                                    \
  |  |  639|  7.86k|                    unexpected("BlackTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  7.86k|    do                                                                         \
  |  |  |  |  221|  7.86k|    {                                                                          \
  |  |  |  |  222|  7.86k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  7.86k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  7.86k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 7.86k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  640|  7.86k|                    goto eol2d;                                                \
  |  |  641|  11.4k|                badWhite2d:                                                    \
  |  |  642|  11.4k|                    unexpected("WhiteTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  11.4k|    do                                                                         \
  |  |  |  |  221|  11.4k|    {                                                                          \
  |  |  |  |  222|  11.4k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  11.4k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  11.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 11.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  643|  11.4k|                    goto eol2d;                                                \
  |  |  644|  10.5k|                eof2d:                                                         \
  |  |  645|  10.5k|                    prematureEOF(a0);                                          \
  |  |  ------------------
  |  |  |  |  271|  10.5k|    do                                                                         \
  |  |  |  |  272|  10.5k|    {                                                                          \
  |  |  |  |  273|  10.5k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  10.5k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  10.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 10.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  646|  10.5k|                    CLEANUP_RUNS();                                            \
  |  |  ------------------
  |  |  |  |  333|  10.5k|    do                                                                         \
  |  |  |  |  334|  10.5k|    {                                                                          \
  |  |  |  |  335|  10.5k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 1.08k, False: 9.43k]
  |  |  |  |  ------------------
  |  |  |  |  336|  10.5k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.08k|    do                                                                         \
  |  |  |  |  |  |  267|  1.08k|    {                                                                          \
  |  |  |  |  |  |  268|  1.08k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 495, False: 591]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.08k|        {                                                                      \
  |  |  |  |  |  |  270|    495|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    495|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    495|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    495|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 179, False: 316]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    495|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    495|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    495|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 179, False: 316]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    495|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    495|            return (-1);                                                       \
  |  |  |  |  |  |  275|    495|        }                                                                      \
  |  |  |  |  |  |  276|  1.08k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    591|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    591|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    591|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 591]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  10.5k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 10.0k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|  10.0k|        {                                                                      \
  |  |  |  |  339|  10.0k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  10.0k|    do                                                                         \
  |  |  |  |  |  |  254|  10.0k|    {                                                                          \
  |  |  |  |  |  |  255|  10.0k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  10.0k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  10.0k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  10.0k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 10.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  10.8k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 811, False: 10.0k]
  |  |  |  |  |  Branch (340:39): [True: 811, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  10.0k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  10.0k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 9.89k, False: 133]
  |  |  |  |  ------------------
  |  |  |  |  343|  10.0k|            {                                                                  \
  |  |  |  |  344|  9.89k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 9.89k]
  |  |  |  |  ------------------
  |  |  |  |  345|  9.89k|                    a0 = 0;                                                    \
  |  |  |  |  346|  9.89k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 5.58k, False: 4.31k]
  |  |  |  |  ------------------
  |  |  |  |  347|  9.89k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  5.58k|    do                                                                         \
  |  |  |  |  |  |  267|  5.58k|    {                                                                          \
  |  |  |  |  |  |  268|  5.58k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 5.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  5.58k|        {                                                                      \
  |  |  |  |  |  |  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.58k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  5.58k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  5.58k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  5.58k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 5.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  9.89k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  9.89k|    do                                                                         \
  |  |  |  |  |  |  267|  9.89k|    {                                                                          \
  |  |  |  |  |  |  268|  9.89k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 387, False: 9.50k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  9.89k|        {                                                                      \
  |  |  |  |  |  |  270|    387|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    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: 137, False: 250]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    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: 137, False: 250]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    387|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    387|            return (-1);                                                       \
  |  |  |  |  |  |  275|    387|        }                                                                      \
  |  |  |  |  |  |  276|  9.89k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  9.50k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  9.50k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  9.50k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 9.50k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  9.89k|            }                                                                  \
  |  |  |  |  350|  10.0k|            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|  10.0k|        }                                                                      \
  |  |  |  |  356|  10.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 9.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  647|  10.5k|                    goto eoflab;                                               \
  |  |  648|  1.48M|            }                                                                  \
  |  |  649|  1.48M|        }                                                                      \
  |  |  650|   629k|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (650:13): [True: 46.7k, False: 259k]
  |  |  ------------------
  |  |  651|   305k|        {                                                                      \
  |  |  652|  46.7k|            if (RunLength + a0 < lastx)                                        \
  |  |  ------------------
  |  |  |  Branch (652:17): [True: 0, False: 46.7k]
  |  |  ------------------
  |  |  653|  46.7k|            {                                                                  \
  |  |  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|  46.7k|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|  46.7k|    do                                                                         \
  |  |  |  |  267|  46.7k|    {                                                                          \
  |  |  |  |  268|  46.7k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 46.7k]
  |  |  |  |  ------------------
  |  |  |  |  269|  46.7k|        {                                                                      \
  |  |  |  |  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.7k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  46.7k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  46.7k|        RunLength = 0;                                                         \
  |  |  |  |  279|  46.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 46.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  661|  46.7k|        }                                                                      \
  |  |  662|   614k|    eol2d:                                                                     \
  |  |  663|   614k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   614k|    do                                                                         \
  |  |  |  |  334|   614k|    {                                                                          \
  |  |  |  |  335|   614k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 3.10k, False: 611k]
  |  |  |  |  ------------------
  |  |  |  |  336|   614k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  3.10k|    do                                                                         \
  |  |  |  |  |  |  267|  3.10k|    {                                                                          \
  |  |  |  |  |  |  268|  3.10k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 537, False: 2.56k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  3.10k|        {                                                                      \
  |  |  |  |  |  |  270|    537|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    537|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    537|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    537|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 252, False: 285]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    537|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    537|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    537|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 252, False: 285]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    537|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    537|            return (-1);                                                       \
  |  |  |  |  |  |  275|    537|        }                                                                      \
  |  |  |  |  |  |  276|  3.10k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  2.56k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  2.56k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  2.56k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 2.56k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   614k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 417k, False: 197k]
  |  |  |  |  ------------------
  |  |  |  |  338|   614k|        {                                                                      \
  |  |  |  |  339|   417k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   417k|    do                                                                         \
  |  |  |  |  |  |  254|   417k|    {                                                                          \
  |  |  |  |  |  |  255|   417k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   417k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   417k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   417k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 417k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   559k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 142k, False: 417k]
  |  |  |  |  |  Branch (340:39): [True: 142k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   417k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   417k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 412k, False: 4.91k]
  |  |  |  |  ------------------
  |  |  |  |  343|   417k|            {                                                                  \
  |  |  |  |  344|   412k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 412k]
  |  |  |  |  ------------------
  |  |  |  |  345|   412k|                    a0 = 0;                                                    \
  |  |  |  |  346|   412k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 298k, False: 113k]
  |  |  |  |  ------------------
  |  |  |  |  347|   412k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   298k|    do                                                                         \
  |  |  |  |  |  |  267|   298k|    {                                                                          \
  |  |  |  |  |  |  268|   298k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 298k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   298k|        {                                                                      \
  |  |  |  |  |  |  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|   298k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   298k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   298k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   298k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 298k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   412k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   412k|    do                                                                         \
  |  |  |  |  |  |  267|   412k|    {                                                                          \
  |  |  |  |  |  |  268|   412k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 570, False: 411k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   412k|        {                                                                      \
  |  |  |  |  |  |  270|    570|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    570|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    570|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    570|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 262, False: 308]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    570|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    570|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    570|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 262, False: 308]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    570|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    570|            return (-1);                                                       \
  |  |  |  |  |  |  275|    570|        }                                                                      \
  |  |  |  |  |  |  276|   412k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   411k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   411k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   411k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 411k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   412k|            }                                                                  \
  |  |  |  |  350|   417k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 4.91k]
  |  |  |  |  ------------------
  |  |  |  |  351|  4.91k|            {                                                                  \
  |  |  |  |  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|   417k|        }                                                                      \
  |  |  |  |  356|   614k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 613k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  664|   614k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (664:14): [Folded, False: 613k]
  |  |  ------------------
  ------------------
  422|   916k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  423|   916k|        if (pa < thisrun + sp->nruns)
  ------------------
  |  Branch (423:13): [True: 913k, False: 2.63k]
  ------------------
  424|   913k|        {
  425|   913k|            SETVALUE(0); /* imaginary change for reference */
  ------------------
  |  |  266|   913k|    do                                                                         \
  |  |  267|   913k|    {                                                                          \
  |  |  268|   913k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  ------------------
  |  |  |  Branch (268:13): [True: 0, False: 913k]
  |  |  ------------------
  |  |  269|   913k|        {                                                                      \
  |  |  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|   913k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  277|   913k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  278|   913k|        RunLength = 0;                                                         \
  |  |  279|   913k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (279:14): [Folded, False: 913k]
  |  |  ------------------
  ------------------
  426|   913k|        }
  427|   916k|        SWAP(uint32_t *, sp->curruns, sp->refruns);
  ------------------
  |  |  375|   916k|    {                                                                          \
  |  |  376|   916k|        t x;                                                                   \
  |  |  377|   916k|        x = (a);                                                               \
  |  |  378|   916k|        (a) = (b);                                                             \
  |  |  379|   916k|        (b) = x;                                                               \
  |  |  380|   916k|    }
  ------------------
  428|   916k|        buf += sp->b.rowbytes;
  429|   916k|        occ -= sp->b.rowbytes;
  430|   916k|        sp->line++;
  431|   916k|        continue;
  432|    970|    EOF2D: /* premature EOF */
  433|    970|        CLEANUP_RUNS();
  ------------------
  |  |  333|    970|    do                                                                         \
  |  |  334|    970|    {                                                                          \
  |  |  335|    970|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (335:13): [True: 0, False: 970]
  |  |  ------------------
  |  |  336|    970|            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|    970|        if (a0 != (int)lastx)                                                  \
  |  |  ------------------
  |  |  |  Branch (337:13): [True: 970, False: 0]
  |  |  ------------------
  |  |  338|    970|        {                                                                      \
  |  |  339|    970|            badlength(a0, lastx);                                              \
  |  |  ------------------
  |  |  |  |  253|    970|    do                                                                         \
  |  |  |  |  254|    970|    {                                                                          \
  |  |  |  |  255|    970|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  256|    970|                      (uint32_t)(lastx));                                      \
  |  |  |  |  257|    970|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  258|    970|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:14): [Folded, False: 970]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|    970|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  ------------------
  |  |  |  Branch (340:20): [True: 0, False: 970]
  |  |  |  Branch (340:39): [True: 0, False: 0]
  |  |  ------------------
  |  |  341|    970|                a0 -= (int)*--pa;                                              \
  |  |  342|    970|            if (a0 < (int)lastx)                                               \
  |  |  ------------------
  |  |  |  Branch (342:17): [True: 970, False: 0]
  |  |  ------------------
  |  |  343|    970|            {                                                                  \
  |  |  344|    970|                if (a0 < 0)                                                    \
  |  |  ------------------
  |  |  |  Branch (344:21): [True: 0, False: 970]
  |  |  ------------------
  |  |  345|    970|                    a0 = 0;                                                    \
  |  |  346|    970|                if ((pa - thisrun) & 1)                                        \
  |  |  ------------------
  |  |  |  Branch (346:21): [True: 0, False: 970]
  |  |  ------------------
  |  |  347|    970|                    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|    970|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  ------------------
  |  |  |  |  266|    970|    do                                                                         \
  |  |  |  |  267|    970|    {                                                                          \
  |  |  |  |  268|    970|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 970]
  |  |  |  |  ------------------
  |  |  |  |  269|    970|        {                                                                      \
  |  |  |  |  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|    970|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|    970|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|    970|        RunLength = 0;                                                         \
  |  |  |  |  279|    970|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 970]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  349|    970|            }                                                                  \
  |  |  350|    970|            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|    970|        }                                                                      \
  |  |  356|    970|    } while (0)
  |  |  ------------------
  |  |  |  Branch (356:14): [Folded, False: 970]
  |  |  ------------------
  ------------------
  434|  10.9k|    EOF2Da: /* premature EOF */
  435|  10.9k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  436|  10.9k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  10.9k|    do                                                                         \
  |  |  160|  10.9k|    {                                                                          \
  |  |  161|  10.9k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  10.9k|        sp->data = BitAcc;                                                     \
  |  |  163|  10.9k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  10.9k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  10.9k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  10.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 10.9k]
  |  |  ------------------
  ------------------
  437|  10.9k|        return (-1);
  438|    970|    }
  439|  6.58k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  6.58k|    do                                                                         \
  |  |  160|  6.58k|    {                                                                          \
  |  |  161|  6.58k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  6.58k|        sp->data = BitAcc;                                                     \
  |  |  163|  6.58k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  6.58k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  6.58k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  6.58k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 6.58k]
  |  |  ------------------
  ------------------
  440|  6.58k|    return (1);
  441|  23.6k|}
tif_fax3.c:CheckReachedCounters:
  296|  48.0k|{
  297|  48.0k|    if (sp->eofReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|  48.0k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (297:9): [True: 0, False: 48.0k]
  ------------------
  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|  48.0k|    if (sp->eolReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|  48.0k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (305:9): [True: 1, False: 48.0k]
  ------------------
  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|  48.0k|    if (sp->unexpectedReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|  48.0k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (313:9): [True: 1, False: 48.0k]
  ------------------
  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|  48.0k|    return (0);
  323|  48.0k|}
tif_fax3.c:Fax3TryG3WithoutEOL:
  279|    154|{
  280|    154|    TIFFWarningExtR(
  281|    154|        tif, module,
  282|    154|        "Try to decode (read) fax Group 3 data without EOL at line %" PRIu32
  283|    154|        " of %s %" PRIu32 " (x %" PRIu32 "). Please check result",
  284|    154|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|    154|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    154|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 71, False: 83]
  |  |  ------------------
  ------------------
  285|    154|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|    154|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    154|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 71, False: 83]
  |  |  ------------------
  ------------------
  286|    154|        a0);
  287|    154|}
tif_fax3.c:Fax3Unexpected:
  211|   268k|{
  212|   268k|    TIFFErrorExtR(
  213|   268k|        tif, module,
  214|   268k|        "Bad code word at line %" PRIu32 " of %s %" PRIu32 " (x %" PRIu32 ")",
  215|   268k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|   268k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|   268k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 185k, False: 82.8k]
  |  |  ------------------
  ------------------
  216|   268k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|   268k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|   268k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 185k, False: 82.8k]
  |  |  ------------------
  ------------------
  217|   268k|        a0);
  218|   268k|}
tif_fax3.c:Fax3PrematureEOF:
  262|  14.3k|{
  263|  14.3k|    TIFFWarningExtR(
  264|  14.3k|        tif, module,
  265|  14.3k|        "Premature EOF at line %" PRIu32 " of %s %" PRIu32 " (x %" PRIu32 ")",
  266|  14.3k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|  14.3k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  14.3k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 8.06k, False: 6.27k]
  |  |  ------------------
  ------------------
  267|  14.3k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|  14.3k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  14.3k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 8.06k, False: 6.27k]
  |  |  ------------------
  ------------------
  268|  14.3k|        a0);
  269|  14.3k|}
tif_fax3.c:Fax3BadLength:
  242|  1.10M|{
  243|  1.10M|    TIFFWarningExtR(
  244|  1.10M|        tif, module,
  245|  1.10M|        "%s at line %" PRIu32 " of %s %" PRIu32 " (got %" PRIu32
  246|  1.10M|        ", expected %" PRIu32 ")",
  247|  1.10M|        a0 < lastx ? "Premature EOL" : "Line length mismatch", line,
  ------------------
  |  Branch (247:9): [True: 545k, False: 557k]
  ------------------
  248|  1.10M|        isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|  1.10M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  1.10M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 666k, False: 436k]
  |  |  ------------------
  ------------------
  249|  1.10M|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip), a0,
  ------------------
  |  |  278|  1.10M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  1.10M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 666k, False: 436k]
  |  |  ------------------
  ------------------
  250|  1.10M|        lastx);
  251|  1.10M|}
tif_fax3.c:Fax3Extension:
  228|  69.3k|{
  229|  69.3k|    TIFFErrorExtR(
  230|  69.3k|        tif, module,
  231|  69.3k|        "Uncompressed data (not supported) at line %" PRIu32 " of %s %" PRIu32
  232|  69.3k|        " (x %" PRIu32 ")",
  233|  69.3k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|  69.3k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  69.3k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 52.4k, False: 16.9k]
  |  |  ------------------
  ------------------
  234|  69.3k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|  69.3k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  69.3k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 52.4k, False: 16.9k]
  |  |  ------------------
  ------------------
  235|  69.3k|        a0);
  236|  69.3k|}
tif_fax3.c:Fax3PreDecode:
  172|  30.5k|{
  173|  30.5k|    Fax3CodecState *sp = DecoderState(tif);
  ------------------
  |  |  108|  30.5k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|  30.5k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  174|       |
  175|  30.5k|    (void)s;
  176|  30.5k|    assert(sp != NULL);
  ------------------
  |  Branch (176:5): [True: 0, False: 30.5k]
  |  Branch (176:5): [True: 30.5k, False: 0]
  ------------------
  177|  30.5k|    sp->bit = 0; /* force initial read */
  178|  30.5k|    sp->data = 0;
  179|  30.5k|    sp->EOLcnt = 0; /* force initial scan for EOL */
  180|  30.5k|    sp->eofReachedCount = 0;
  181|  30.5k|    sp->eolReachedCount = 0;
  182|  30.5k|    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|  30.5k|    sp->bitmap =
  191|  30.5k|        TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB);
  ------------------
  |  |  242|  30.5k|#define FILLORDER_LSB2MSB 2                /* least significant -> most */
  ------------------
  192|  30.5k|    sp->curruns = sp->runs;
  193|  30.5k|    if (sp->refruns)
  ------------------
  |  Branch (193:9): [True: 29.0k, False: 1.54k]
  ------------------
  194|  29.0k|    { /* init reference line to white */
  195|  29.0k|        sp->refruns = sp->runs + sp->nruns;
  196|  29.0k|        sp->refruns[0] = (uint32_t)sp->b.rowpixels;
  197|  29.0k|        sp->refruns[1] = 0;
  198|  29.0k|    }
  199|  30.5k|    sp->line = 0;
  200|  30.5k|    return (1);
  201|  30.5k|}
tif_fax3.c:Fax3Decode1D:
  333|  2.61k|{
  334|  2.61k|    DECLARE_STATE(tif, sp, "Fax3Decode1D");
  ------------------
  |  |  123|  2.61k|    static const char module[] = mod;                                          \
  |  |  124|  2.61k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  ------------------
  |  |  |  |  108|  2.61k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  2.61k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  125|  2.61k|    int a0;                                   /* reference element */          \
  |  |  126|  2.61k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  127|  2.61k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  128|  2.61k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  129|  2.61k|    int RunLength;                            /* length of current run */      \
  |  |  130|  2.61k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  131|  2.61k|    unsigned char *ep;                        /* end of input data */          \
  |  |  132|  2.61k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  133|  2.61k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  134|  2.61k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  135|  2.61k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  136|  2.61k|    const TIFFFaxTabEnt *TabEnt
  ------------------
  335|  2.61k|    (void)s;
  336|  2.61k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (336:9): [True: 0, False: 2.61k]
  ------------------
  337|      0|    {
  338|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  339|      0|        return (-1);
  340|      0|    }
  341|  2.61k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (341:9): [True: 0, False: 2.61k]
  ------------------
  342|      0|        return (-1);
  343|  2.63k|RETRY_WITHOUT_EOL_1D:
  344|  2.63k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  2.63k|    do                                                                         \
  |  |  148|  2.63k|    {                                                                          \
  |  |  149|  2.63k|        BitAcc = sp->data;                                                     \
  |  |  150|  2.63k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  2.63k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  2.63k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  2.63k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  2.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 2.63k]
  |  |  ------------------
  ------------------
  345|  2.63k|    thisrun = sp->curruns;
  346|   122k|    while (occ > 0)
  ------------------
  |  Branch (346:12): [True: 120k, False: 2.08k]
  ------------------
  347|   120k|    {
  348|   120k|        a0 = 0;
  349|   120k|        RunLength = 0;
  350|   120k|        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|   120k|        SYNC_EOL(EOF1D, RETRY_WITHOUT_EOL_1D);
  ------------------
  |  |  293|   120k|    do                                                                         \
  |  |  294|   120k|    {                                                                          \
  |  |  295|   120k|        if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */      \
  |  |  ------------------
  |  |  |  |  700|   120k|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  |  Branch (295:13): [True: 3.51k, False: 116k]
  |  |  ------------------
  |  |  296|   120k|        {                                                                      \
  |  |  297|  3.51k|            if (EOLcnt == 0)                                                   \
  |  |  ------------------
  |  |  |  Branch (297:17): [True: 2.42k, False: 1.08k]
  |  |  ------------------
  |  |  298|  3.51k|            {                                                                  \
  |  |  299|  2.42k|                for (;;)                                                       \
  |  |  300|   551k|                {                                                              \
  |  |  301|   551k|                    NeedBits16(11, eoflab);                                    \
  |  |  ------------------
  |  |  |  |  164|   551k|    do                                                                         \
  |  |  |  |  165|   551k|    {                                                                          \
  |  |  |  |  166|   551k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (166:13): [True: 70.3k, False: 481k]
  |  |  |  |  ------------------
  |  |  |  |  167|   551k|        {                                                                      \
  |  |  |  |  168|  70.3k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  70.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 77, False: 70.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  169|  70.3k|            {                                                                  \
  |  |  |  |  170|     77|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:21): [True: 0, False: 77]
  |  |  |  |  ------------------
  |  |  |  |  171|     77|                    goto eoflab;                                               \
  |  |  |  |  172|     77|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  173|     77|            }                                                                  \
  |  |  |  |  174|  70.3k|            else                                                               \
  |  |  |  |  175|  70.3k|            {                                                                  \
  |  |  |  |  176|  70.3k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  177|  70.3k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:21): [True: 298, False: 70.0k]
  |  |  |  |  ------------------
  |  |  |  |  178|  70.3k|                {                                                              \
  |  |  |  |  179|    298|                    if (EndOfData())                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|    298|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 2, False: 296]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  180|    298|                    {                                                          \
  |  |  |  |  181|      2|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  182|      2|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  183|      2|                    }                                                          \
  |  |  |  |  184|    298|                    else                                                       \
  |  |  |  |  185|    298|                    {                                                          \
  |  |  |  |  186|    296|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  187|    296|                        BitsAvail += 8;                                        \
  |  |  |  |  188|    296|                    }                                                          \
  |  |  |  |  189|    298|                }                                                              \
  |  |  |  |  190|  70.3k|            }                                                                  \
  |  |  |  |  191|  70.3k|        }                                                                      \
  |  |  |  |  192|   551k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:14): [Folded, False: 551k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|   551k|                    if (GetBits(11) == 0)                                      \
  |  |  ------------------
  |  |  |  |  194|   551k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (302:25): [True: 2.42k, False: 549k]
  |  |  ------------------
  |  |  303|   551k|                        break; /* EOL found */                                 \
  |  |  304|   551k|                    ClrBits(1);                                                \
  |  |  ------------------
  |  |  |  |  196|   549k|    do                                                                         \
  |  |  |  |  197|   549k|    {                                                                          \
  |  |  |  |  198|   549k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|   549k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|   549k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 549k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|   549k|                }                                                              \
  |  |  306|  2.42k|            }                                                                  \
  |  |  307|  3.51k|            /* Now move after EOL or detect missing EOL. */                    \
  |  |  308|  3.51k|            for (;;)                                                           \
  |  |  309|  9.34k|            {                                                                  \
  |  |  310|  9.34k|                NeedBits8(8, noEOLFound);                                      \
  |  |  ------------------
  |  |  |  |  144|  9.34k|    do                                                                         \
  |  |  |  |  145|  9.34k|    {                                                                          \
  |  |  |  |  146|  9.34k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 5.15k, False: 4.18k]
  |  |  |  |  ------------------
  |  |  |  |  147|  9.34k|        {                                                                      \
  |  |  |  |  148|  5.15k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  5.15k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 43, False: 5.11k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  5.15k|            {                                                                  \
  |  |  |  |  150|     43|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 21, False: 22]
  |  |  |  |  ------------------
  |  |  |  |  151|     43|                    goto eoflab;                                               \
  |  |  |  |  152|     43|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|     22|            }                                                                  \
  |  |  |  |  154|  5.15k|            else                                                               \
  |  |  |  |  155|  5.15k|            {                                                                  \
  |  |  |  |  156|  5.11k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  5.11k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  5.11k|            }                                                                  \
  |  |  |  |  159|  5.15k|        }                                                                      \
  |  |  |  |  160|  9.34k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 9.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|  9.34k|                if (GetBits(8))                                                \
  |  |  ------------------
  |  |  |  |  194|  9.32k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 3.48k, False: 5.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|  9.32k|                    break;                                                     \
  |  |  313|  9.32k|                ClrBits(8);                                                    \
  |  |  ------------------
  |  |  |  |  196|  5.83k|    do                                                                         \
  |  |  |  |  197|  5.83k|    {                                                                          \
  |  |  |  |  198|  5.83k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  5.83k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  5.83k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 5.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|  5.83k|            }                                                                  \
  |  |  315|  15.4k|            while (GetBits(1) == 0)                                            \
  |  |  ------------------
  |  |  |  |  194|  15.4k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (315:20): [True: 11.9k, False: 3.48k]
  |  |  ------------------
  |  |  316|  11.9k|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|  15.4k|    do                                                                         \
  |  |  |  |  197|  15.4k|    {                                                                          \
  |  |  |  |  198|  11.9k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  11.9k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  11.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 11.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  3.48k|            ClrBits(1); /* EOL bit */                                          \
  |  |  ------------------
  |  |  |  |  196|  3.48k|    do                                                                         \
  |  |  |  |  197|  3.48k|    {                                                                          \
  |  |  |  |  198|  3.48k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  3.48k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  3.48k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 3.48k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  3.48k|            EOLcnt = 0; /* reset EOL counter/flag */                           \
  |  |  319|  3.48k|            break;      /* existing EOL skipped, leave macro */                \
  |  |  320|  3.51k|        noEOLFound:                                                            \
  |  |  321|     21|            sp->b.mode |= FAXMODE_NOEOL;                                       \
  |  |  ------------------
  |  |  |  |  700|     21|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  322|     21|            tryG3WithoutEOL(a0);                                               \
  |  |  ------------------
  |  |  |  |  289|     21|    do                                                                         \
  |  |  |  |  290|     21|    {                                                                          \
  |  |  |  |  291|     21|        Fax3TryG3WithoutEOL(module, tif, (uint32_t)sp->line, (uint32_t)(a0));  \
  |  |  |  |  292|     21|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (292:14): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|     21|            goto retrywithouteol;                                              \
  |  |  324|  3.51k|        }                                                                      \
  |  |  325|   120k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (325:14): [Folded, False: 116k]
  |  |  ------------------
  ------------------
  357|   120k|        EXPAND1D(EOF1Da);
  ------------------
  |  |  371|   120k|    do                                                                         \
  |  |  372|   120k|    {                                                                          \
  |  |  373|   120k|        for (;;)                                                               \
  |  |  374|   225k|        {                                                                      \
  |  |  375|   225k|            for (;;)                                                           \
  |  |  376|   712k|            {                                                                  \
  |  |  377|   712k|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   712k|    do                                                                         \
  |  |  |  |  255|   712k|    {                                                                          \
  |  |  |  |  256|   712k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   712k|    do                                                                         \
  |  |  |  |  |  |  165|   712k|    {                                                                          \
  |  |  |  |  |  |  166|   712k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 535k, False: 177k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   712k|        {                                                                      \
  |  |  |  |  |  |  168|   535k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   535k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 12.3k, False: 522k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   535k|            {                                                                  \
  |  |  |  |  |  |  170|  12.3k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 401, False: 11.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  12.3k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  12.3k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  11.9k|            }                                                                  \
  |  |  |  |  |  |  174|   535k|            else                                                               \
  |  |  |  |  |  |  175|   535k|            {                                                                  \
  |  |  |  |  |  |  176|   522k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   522k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 26.6k, False: 496k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   522k|                {                                                              \
  |  |  |  |  |  |  179|  26.6k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  26.6k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 40, False: 26.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  26.6k|                    {                                                          \
  |  |  |  |  |  |  181|     40|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|     40|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|     40|                    }                                                          \
  |  |  |  |  |  |  184|  26.6k|                    else                                                       \
  |  |  |  |  |  |  185|  26.6k|                    {                                                          \
  |  |  |  |  |  |  186|  26.5k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  26.5k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  26.5k|                    }                                                          \
  |  |  |  |  |  |  189|  26.6k|                }                                                              \
  |  |  |  |  |  |  190|   522k|            }                                                                  \
  |  |  |  |  |  |  191|   535k|        }                                                                      \
  |  |  |  |  |  |  192|   712k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 712k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   712k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   712k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   712k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   712k|    do                                                                         \
  |  |  |  |  |  |  197|   712k|    {                                                                          \
  |  |  |  |  |  |  198|   712k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   712k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   712k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 712k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   712k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 712k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|   712k|                switch (TabEnt->State)                                         \
  |  |  379|   712k|                {                                                              \
  |  |  380|  14.8k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  14.8k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 14.8k, False: 697k]
  |  |  ------------------
  |  |  381|  14.8k|                        EOLcnt = 1;                                            \
  |  |  382|  14.8k|                        goto done1d;                                           \
  |  |  383|   113k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|   113k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 113k, False: 599k]
  |  |  ------------------
  |  |  384|   113k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   113k|    do                                                                         \
  |  |  |  |  267|   113k|    {                                                                          \
  |  |  |  |  268|   113k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 113k]
  |  |  |  |  ------------------
  |  |  |  |  269|   113k|        {                                                                      \
  |  |  |  |  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|   113k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   113k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   113k|        RunLength = 0;                                                         \
  |  |  |  |  279|   113k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 113k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|   113k|                        goto doneWhite1d;                                      \
  |  |  386|   438k|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|   438k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 438k, False: 273k]
  |  |  ------------------
  |  |  387|   487k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|   487k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 48.4k, False: 664k]
  |  |  ------------------
  |  |  388|   487k|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|   487k|                        RunLength =                                            \
  |  |  390|   487k|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|   487k|                        break;                                                 \
  |  |  392|   438k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 97.1k, False: 615k]
  |  |  ------------------
  |  |  393|  97.1k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  97.1k|    do                                                                         \
  |  |  |  |  221|  97.1k|    {                                                                          \
  |  |  |  |  222|  97.1k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  97.1k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  97.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 97.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  97.1k|                        goto done1d;                                           \
  |  |  395|   712k|                }                                                              \
  |  |  396|   712k|            }                                                                  \
  |  |  397|   225k|        doneWhite1d:                                                           \
  |  |  398|   113k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 4.55k, False: 108k]
  |  |  ------------------
  |  |  399|   113k|                goto done1d;                                                   \
  |  |  400|   113k|            for (;;)                                                           \
  |  |  401|   109k|            {                                                                  \
  |  |  402|   109k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   109k|    do                                                                         \
  |  |  |  |  255|   109k|    {                                                                          \
  |  |  |  |  256|   109k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   109k|    do                                                                         \
  |  |  |  |  |  |  165|   109k|    {                                                                          \
  |  |  |  |  |  |  166|   109k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 76.4k, False: 33.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   109k|        {                                                                      \
  |  |  |  |  |  |  168|  76.4k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  76.4k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 335, False: 76.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  76.4k|            {                                                                  \
  |  |  |  |  |  |  170|    335|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 135, False: 200]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    335|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    335|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    200|            }                                                                  \
  |  |  |  |  |  |  174|  76.4k|            else                                                               \
  |  |  |  |  |  |  175|  76.4k|            {                                                                  \
  |  |  |  |  |  |  176|  76.0k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  76.0k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 581, False: 75.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  76.0k|                {                                                              \
  |  |  |  |  |  |  179|    581|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|    581|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 581]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|    581|                    {                                                          \
  |  |  |  |  |  |  181|      0|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      0|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      0|                    }                                                          \
  |  |  |  |  |  |  184|    581|                    else                                                       \
  |  |  |  |  |  |  185|    581|                    {                                                          \
  |  |  |  |  |  |  186|    581|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|    581|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|    581|                    }                                                          \
  |  |  |  |  |  |  189|    581|                }                                                              \
  |  |  |  |  |  |  190|  76.0k|            }                                                                  \
  |  |  |  |  |  |  191|  76.4k|        }                                                                      \
  |  |  |  |  |  |  192|   109k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 109k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   109k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   109k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   109k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   109k|    do                                                                         \
  |  |  |  |  |  |  197|   109k|    {                                                                          \
  |  |  |  |  |  |  198|   109k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   109k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   109k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 109k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   109k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 109k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|   109k|                switch (TabEnt->State)                                         \
  |  |  404|   109k|                {                                                              \
  |  |  405|    753|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|    753|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 753, False: 108k]
  |  |  ------------------
  |  |  406|    753|                        EOLcnt = 1;                                            \
  |  |  407|    753|                        goto done1d;                                           \
  |  |  408|   107k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|   107k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 107k, False: 1.79k]
  |  |  ------------------
  |  |  409|   107k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   107k|    do                                                                         \
  |  |  |  |  267|   107k|    {                                                                          \
  |  |  |  |  268|   107k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 107k]
  |  |  |  |  ------------------
  |  |  |  |  269|   107k|        {                                                                      \
  |  |  |  |  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|   107k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   107k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   107k|        RunLength = 0;                                                         \
  |  |  |  |  279|   107k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 107k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|   107k|                        goto doneBlack1d;                                      \
  |  |  411|   107k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|    336|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 336, False: 109k]
  |  |  ------------------
  |  |  412|    934|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|    934|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 598, False: 108k]
  |  |  ------------------
  |  |  413|    934|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|    934|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|    934|                        break;                                                 \
  |  |  416|    336|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 111, False: 109k]
  |  |  ------------------
  |  |  417|    111|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|    111|    do                                                                         \
  |  |  |  |  221|    111|    {                                                                          \
  |  |  |  |  222|    111|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|    111|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|    111|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 111]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|    111|                        goto done1d;                                           \
  |  |  419|   109k|                }                                                              \
  |  |  420|   109k|            }                                                                  \
  |  |  421|   108k|        doneBlack1d:                                                           \
  |  |  422|   107k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 2.33k, False: 105k]
  |  |  ------------------
  |  |  423|   107k|                goto done1d;                                                   \
  |  |  424|   107k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 162, False: 105k]
  |  |  |  Branch (424:35): [True: 162, False: 0]
  |  |  ------------------
  |  |  425|   105k|                pa -= 2;                                                       \
  |  |  426|   105k|        }                                                                      \
  |  |  427|   120k|    eof1d:                                                                     \
  |  |  428|    536|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|    536|    do                                                                         \
  |  |  |  |  272|    536|    {                                                                          \
  |  |  |  |  273|    536|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|    536|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|    536|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 536]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|    536|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|    536|    do                                                                         \
  |  |  |  |  334|    536|    {                                                                          \
  |  |  |  |  335|    536|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 269, False: 267]
  |  |  |  |  ------------------
  |  |  |  |  336|    536|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    269|    do                                                                         \
  |  |  |  |  |  |  267|    269|    {                                                                          \
  |  |  |  |  |  |  268|    269|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 269]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    269|        {                                                                      \
  |  |  |  |  |  |  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|    269|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    269|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    269|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    269|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 269]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|    536|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 536, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|    536|        {                                                                      \
  |  |  |  |  339|    536|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    536|    do                                                                         \
  |  |  |  |  |  |  254|    536|    {                                                                          \
  |  |  |  |  |  |  255|    536|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    536|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    536|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    536|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 536]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|    799|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 263, False: 536]
  |  |  |  |  |  Branch (340:39): [True: 263, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    536|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    536|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 536, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    536|            {                                                                  \
  |  |  |  |  344|    536|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 536]
  |  |  |  |  ------------------
  |  |  |  |  345|    536|                    a0 = 0;                                                    \
  |  |  |  |  346|    536|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 141, False: 395]
  |  |  |  |  ------------------
  |  |  |  |  347|    536|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    141|    do                                                                         \
  |  |  |  |  |  |  267|    141|    {                                                                          \
  |  |  |  |  |  |  268|    141|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 141]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    141|        {                                                                      \
  |  |  |  |  |  |  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|    141|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    141|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    141|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    141|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 141]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    536|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    536|    do                                                                         \
  |  |  |  |  |  |  267|    536|    {                                                                          \
  |  |  |  |  |  |  268|    536|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 536]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    536|        {                                                                      \
  |  |  |  |  |  |  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|    536|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    536|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    536|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    536|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 536]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    536|            }                                                                  \
  |  |  |  |  350|    536|            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|    536|        }                                                                      \
  |  |  |  |  356|    536|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 536]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|    536|        goto eoflab;                                                           \
  |  |  431|   119k|    done1d:                                                                    \
  |  |  432|   119k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   119k|    do                                                                         \
  |  |  |  |  334|   119k|    {                                                                          \
  |  |  |  |  335|   119k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 503, False: 119k]
  |  |  |  |  ------------------
  |  |  |  |  336|   119k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    503|    do                                                                         \
  |  |  |  |  |  |  267|    503|    {                                                                          \
  |  |  |  |  |  |  268|    503|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 503]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    503|        {                                                                      \
  |  |  |  |  |  |  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|    503|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    503|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    503|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    503|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 503]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   119k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 119k, False: 701]
  |  |  |  |  ------------------
  |  |  |  |  338|   119k|        {                                                                      \
  |  |  |  |  339|   119k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   119k|    do                                                                         \
  |  |  |  |  |  |  254|   119k|    {                                                                          \
  |  |  |  |  |  |  255|   119k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   119k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   119k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   119k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   125k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 6.48k, False: 119k]
  |  |  |  |  |  Branch (340:39): [True: 6.48k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   119k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   119k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 119k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|   119k|            {                                                                  \
  |  |  |  |  344|   119k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 119k]
  |  |  |  |  ------------------
  |  |  |  |  345|   119k|                    a0 = 0;                                                    \
  |  |  |  |  346|   119k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 3.16k, False: 115k]
  |  |  |  |  ------------------
  |  |  |  |  347|   119k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  3.16k|    do                                                                         \
  |  |  |  |  |  |  267|  3.16k|    {                                                                          \
  |  |  |  |  |  |  268|  3.16k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 3.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  3.16k|        {                                                                      \
  |  |  |  |  |  |  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|  3.16k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  3.16k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  3.16k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  3.16k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 3.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   119k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   119k|    do                                                                         \
  |  |  |  |  |  |  267|   119k|    {                                                                          \
  |  |  |  |  |  |  268|   119k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   119k|        {                                                                      \
  |  |  |  |  |  |  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|   119k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   119k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   119k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   119k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   119k|            }                                                                  \
  |  |  |  |  350|   119k|            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|   119k|        }                                                                      \
  |  |  |  |  356|   119k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 119k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  358|   119k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  359|   119k|        buf += sp->b.rowbytes;
  360|   119k|        occ -= sp->b.rowbytes;
  361|   119k|        sp->line++;
  362|   119k|        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|    536|    EOF1Da: /* premature EOF */
  366|    536|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  367|    536|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|    536|    do                                                                         \
  |  |  160|    536|    {                                                                          \
  |  |  161|    536|        sp->bit = BitsAvail;                                                   \
  |  |  162|    536|        sp->data = BitAcc;                                                     \
  |  |  163|    536|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|    536|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|    536|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|    536|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 536]
  |  |  ------------------
  ------------------
  368|    536|        return (-1);
  369|      0|    }
  370|  2.08k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  2.08k|    do                                                                         \
  |  |  160|  2.08k|    {                                                                          \
  |  |  161|  2.08k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  2.08k|        sp->data = BitAcc;                                                     \
  |  |  163|  2.08k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  2.08k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  2.08k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  2.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 2.08k]
  |  |  ------------------
  ------------------
  371|  2.08k|    return (1);
  372|  2.63k|}
tif_fax3.c:Fax3Cleanup:
 1329|    319|{
 1330|    319|    Fax3CodecState *sp = DecoderState(tif);
  ------------------
  |  |  108|    319|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    319|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1331|       |
 1332|    319|    assert(sp != 0);
  ------------------
  |  Branch (1332:5): [True: 0, False: 319]
  |  Branch (1332:5): [True: 319, False: 0]
  ------------------
 1333|       |
 1334|    319|    tif->tif_tagmethods.vgetfield = sp->b.vgetparent;
 1335|    319|    tif->tif_tagmethods.vsetfield = sp->b.vsetparent;
 1336|    319|    tif->tif_tagmethods.printdir = sp->b.printdir;
 1337|       |
 1338|    319|    if (sp->runs)
  ------------------
  |  Branch (1338:9): [True: 264, False: 55]
  ------------------
 1339|    264|        _TIFFfreeExt(tif, sp->runs);
 1340|    319|    if (sp->refline)
  ------------------
  |  Branch (1340:9): [True: 199, False: 120]
  ------------------
 1341|    199|        _TIFFfreeExt(tif, sp->refline);
 1342|       |
 1343|    319|    _TIFFfreeExt(tif, tif->tif_data);
 1344|    319|    tif->tif_data = NULL;
 1345|       |
 1346|    319|    _TIFFSetDefaultCompressionState(tif);
 1347|    319|}
tif_fax3.c:Fax3GetMaxCompressionRatio:
 1522|      6|{
 1523|      6|    (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|      6|    return 250;
 1535|      6|}
tif_fax3.c:Fax4Decode:
 1646|  12.6k|{
 1647|  12.6k|    DECLARE_STATE_2D(tif, sp, "Fax4Decode");
  ------------------
  |  |  139|  12.6k|    DECLARE_STATE(tif, sp, mod);                                               \
  |  |  ------------------
  |  |  |  |  123|  12.6k|    static const char module[] = mod;                                          \
  |  |  |  |  124|  12.6k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  12.6k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|  12.6k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  125|  12.6k|    int a0;                                   /* reference element */          \
  |  |  |  |  126|  12.6k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  |  |  127|  12.6k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  |  |  128|  12.6k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  |  |  129|  12.6k|    int RunLength;                            /* length of current run */      \
  |  |  |  |  130|  12.6k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  |  |  131|  12.6k|    unsigned char *ep;                        /* end of input data */          \
  |  |  |  |  132|  12.6k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  |  |  133|  12.6k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  |  |  134|  12.6k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  |  |  135|  12.6k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  |  |  136|  12.6k|    const TIFFFaxTabEnt *TabEnt
  |  |  ------------------
  |  |  140|  12.6k|    int b1; /* next change on prev line */                                     \
  |  |  141|  12.6k|    uint32_t                                                                   \
  |  |  142|  12.6k|        *pb /* next run in reference line */ /*                                \
  ------------------
 1648|  12.6k|    (void)s;
 1649|  12.6k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1649:9): [True: 0, False: 12.6k]
  ------------------
 1650|      0|    {
 1651|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1652|      0|        return (-1);
 1653|      0|    }
 1654|  12.6k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (1654:9): [True: 0, False: 12.6k]
  ------------------
 1655|      0|        return (-1);
 1656|  12.6k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  12.6k|    do                                                                         \
  |  |  148|  12.6k|    {                                                                          \
  |  |  149|  12.6k|        BitAcc = sp->data;                                                     \
  |  |  150|  12.6k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  12.6k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  12.6k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  12.6k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  12.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 12.6k]
  |  |  ------------------
  ------------------
 1657|  12.6k|    int start = sp->line;
 1658|   400k|    while (occ > 0)
  ------------------
  |  Branch (1658:12): [True: 399k, False: 962]
  ------------------
 1659|   399k|    {
 1660|   399k|        a0 = 0;
 1661|   399k|        RunLength = 0;
 1662|   399k|        pa = thisrun = sp->curruns;
 1663|   399k|        pb = sp->refruns;
 1664|   399k|        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|   399k|        EXPAND2D(EOFG4);
  ------------------
  |  |  463|   399k|    do                                                                         \
  |  |  464|   399k|    {                                                                          \
  |  |  465|  1.35M|        while (a0 < (int)lastx)                                                \
  |  |  ------------------
  |  |  |  Branch (465:16): [True: 976k, False: 377k]
  |  |  ------------------
  |  |  466|   976k|        {                                                                      \
  |  |  467|   976k|            if (pa >= thisrun + sp->nruns)                                     \
  |  |  ------------------
  |  |  |  Branch (467:17): [True: 271, False: 976k]
  |  |  ------------------
  |  |  468|   976k|            {                                                                  \
  |  |  469|    271|                TIFFErrorExtR(tif, module,                                     \
  |  |  470|    271|                              "Buffer overflow at line %d of %s %u", sp->line, \
  |  |  471|    271|                              isTiled(tif) ? "tile" : "strip",                 \
  |  |  ------------------
  |  |  |  |  278|    271|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    271|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 132, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|    271|                              isTiled(tif) ? tif->tif_dir.td_curtile           \
  |  |  ------------------
  |  |  |  |  278|    271|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    271|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 132, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|    271|                                           : tif->tif_dir.td_curstrip);        \
  |  |  474|    271|                return (-1);                                                   \
  |  |  475|    271|            }                                                                  \
  |  |  476|   976k|            LOOKUP8(7, TIFFFaxMainTable, eof2d);                               \
  |  |  ------------------
  |  |  |  |  247|   976k|    do                                                                         \
  |  |  |  |  248|   976k|    {                                                                          \
  |  |  |  |  249|   976k|        NeedBits8(wid, eoflab);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|   976k|    do                                                                         \
  |  |  |  |  |  |  145|   976k|    {                                                                          \
  |  |  |  |  |  |  146|   976k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:13): [True: 266k, False: 709k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   976k|        {                                                                      \
  |  |  |  |  |  |  148|   266k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   266k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 5.22k, False: 261k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  149|   266k|            {                                                                  \
  |  |  |  |  |  |  150|  5.22k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:21): [True: 54, False: 5.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  5.22k|                    goto eoflab;                                               \
  |  |  |  |  |  |  152|  5.22k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  153|  5.16k|            }                                                                  \
  |  |  |  |  |  |  154|   266k|            else                                                               \
  |  |  |  |  |  |  155|   266k|            {                                                                  \
  |  |  |  |  |  |  156|   261k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  157|   261k|                BitsAvail += 8;                                                \
  |  |  |  |  |  |  158|   261k|            }                                                                  \
  |  |  |  |  |  |  159|   266k|        }                                                                      \
  |  |  |  |  |  |  160|   976k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (160:14): [Folded, False: 975k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  250|   976k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   975k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  251|   975k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   975k|    do                                                                         \
  |  |  |  |  |  |  197|   975k|    {                                                                          \
  |  |  |  |  |  |  198|   975k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   975k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   975k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 975k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|   975k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (252:14): [Folded, False: 975k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|   976k|            switch (TabEnt->State)                                             \
  |  |  478|   975k|            {                                                                  \
  |  |  479|  12.2k|                case S_Pass:                                                   \
  |  |  ------------------
  |  |  |  |   71|  12.2k|#define S_Pass 1
  |  |  ------------------
  |  |  |  Branch (479:17): [True: 12.2k, False: 963k]
  |  |  ------------------
  |  |  480|  12.2k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  12.2k|    do                                                                         \
  |  |  |  |  441|  12.2k|    {                                                                          \
  |  |  |  |  442|  12.2k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 5.23k, False: 7.00k]
  |  |  |  |  ------------------
  |  |  |  |  443|  13.7k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 8.50k, False: 5.23k]
  |  |  |  |  |  Branch (443:32): [True: 8.50k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  8.50k|            {                                                                  \
  |  |  |  |  445|  8.50k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 8.50k]
  |  |  |  |  ------------------
  |  |  |  |  446|  8.50k|                {                                                              \
  |  |  |  |  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|  8.50k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  8.50k|                pb += 2;                                                       \
  |  |  |  |  456|  8.50k|            }                                                                  \
  |  |  |  |  457|  12.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 12.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|  12.2k|                    if (pb + 1 >= sp->refruns + sp->nruns)                     \
  |  |  ------------------
  |  |  |  Branch (481:25): [True: 367, False: 11.8k]
  |  |  ------------------
  |  |  482|  12.2k|                    {                                                          \
  |  |  483|    367|                        TIFFErrorExtR(                                         \
  |  |  484|    367|                            tif, module,                                       \
  |  |  485|    367|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  486|    367|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    367|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    367|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 136, False: 231]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|    367|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    367|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    367|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 136, False: 231]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    367|                                         : tif->tif_dir.td_curstrip);          \
  |  |  489|    367|                        return (-1);                                           \
  |  |  490|    367|                    }                                                          \
  |  |  491|  12.2k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  492|  11.8k|                    RunLength =                                                \
  |  |  493|  11.8k|                        (int)((uint32_t)RunLength + (uint32_t)(b1 - a0));      \
  |  |  494|  11.8k|                    a0 = b1;                                                   \
  |  |  495|  11.8k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  496|  11.8k|                    break;                                                     \
  |  |  497|  98.6k|                case S_Horiz:                                                  \
  |  |  ------------------
  |  |  |  |   72|  98.6k|#define S_Horiz 2
  |  |  ------------------
  |  |  |  Branch (497:17): [True: 98.6k, False: 877k]
  |  |  ------------------
  |  |  498|  98.6k|                    if ((pa - thisrun) & 1)                                    \
  |  |  ------------------
  |  |  |  Branch (498:25): [True: 10.9k, False: 87.6k]
  |  |  ------------------
  |  |  499|  98.6k|                    {                                                          \
  |  |  500|  10.9k|                        for (;;)                                               \
  |  |  501|  10.9k|                        { /* black first */                                    \
  |  |  502|  10.9k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  10.9k|    do                                                                         \
  |  |  |  |  255|  10.9k|    {                                                                          \
  |  |  |  |  256|  10.9k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  10.9k|    do                                                                         \
  |  |  |  |  |  |  165|  10.9k|    {                                                                          \
  |  |  |  |  |  |  166|  10.9k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 10.8k, False: 152]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  10.9k|        {                                                                      \
  |  |  |  |  |  |  168|  10.8k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  10.8k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 48, False: 10.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  10.8k|            {                                                                  \
  |  |  |  |  |  |  170|     48|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 0, False: 48]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     48|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|     48|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|     48|            }                                                                  \
  |  |  |  |  |  |  174|  10.8k|            else                                                               \
  |  |  |  |  |  |  175|  10.8k|            {                                                                  \
  |  |  |  |  |  |  176|  10.7k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  10.7k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 870, False: 9.89k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  10.7k|                {                                                              \
  |  |  |  |  |  |  179|    870|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|    870|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 870]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|    870|                    {                                                          \
  |  |  |  |  |  |  181|      0|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      0|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      0|                    }                                                          \
  |  |  |  |  |  |  184|    870|                    else                                                       \
  |  |  |  |  |  |  185|    870|                    {                                                          \
  |  |  |  |  |  |  186|    870|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|    870|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|    870|                    }                                                          \
  |  |  |  |  |  |  189|    870|                }                                                              \
  |  |  |  |  |  |  190|  10.7k|            }                                                                  \
  |  |  |  |  |  |  191|  10.8k|        }                                                                      \
  |  |  |  |  |  |  192|  10.9k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 10.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  10.9k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  10.9k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  10.9k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  10.9k|    do                                                                         \
  |  |  |  |  |  |  197|  10.9k|    {                                                                          \
  |  |  |  |  |  |  198|  10.9k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  10.9k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  10.9k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 10.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  10.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 10.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  10.9k|                            switch (TabEnt->State)                             \
  |  |  504|  10.9k|                            {                                                  \
  |  |  505|  10.9k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  10.9k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (505:33): [True: 10.9k, False: 30]
  |  |  ------------------
  |  |  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: 10.9k]
  |  |  ------------------
  |  |  509|      0|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|      0|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (509:33): [True: 0, False: 10.9k]
  |  |  ------------------
  |  |  510|      0|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  511|      0|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  512|      0|                                                      TabEnt->Param);          \
  |  |  513|      0|                                    break;                                     \
  |  |  514|     30|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (514:33): [True: 30, False: 10.9k]
  |  |  ------------------
  |  |  515|     30|                                    goto badBlack2d;                           \
  |  |  516|  10.9k|                            }                                                  \
  |  |  517|  10.9k|                        }                                                      \
  |  |  518|  10.9k|                    doneWhite2da:;                                             \
  |  |  519|  10.9k|                        for (;;)                                               \
  |  |  520|  36.8k|                        { /* then white */                                     \
  |  |  521|  36.8k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  36.8k|    do                                                                         \
  |  |  |  |  255|  36.8k|    {                                                                          \
  |  |  |  |  256|  36.8k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  36.8k|    do                                                                         \
  |  |  |  |  |  |  165|  36.8k|    {                                                                          \
  |  |  |  |  |  |  166|  36.8k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 24.9k, False: 11.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  36.8k|        {                                                                      \
  |  |  |  |  |  |  168|  24.9k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  24.9k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 558, False: 24.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  24.9k|            {                                                                  \
  |  |  |  |  |  |  170|    558|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 419, False: 139]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    558|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    558|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    139|            }                                                                  \
  |  |  |  |  |  |  174|  24.9k|            else                                                               \
  |  |  |  |  |  |  175|  24.9k|            {                                                                  \
  |  |  |  |  |  |  176|  24.4k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  24.4k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 1.33k, False: 23.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  24.4k|                {                                                              \
  |  |  |  |  |  |  179|  1.33k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  1.33k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 169, False: 1.16k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  1.33k|                    {                                                          \
  |  |  |  |  |  |  181|    169|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    169|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    169|                    }                                                          \
  |  |  |  |  |  |  184|  1.33k|                    else                                                       \
  |  |  |  |  |  |  185|  1.33k|                    {                                                          \
  |  |  |  |  |  |  186|  1.16k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  1.16k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  1.16k|                    }                                                          \
  |  |  |  |  |  |  189|  1.33k|                }                                                              \
  |  |  |  |  |  |  190|  24.4k|            }                                                                  \
  |  |  |  |  |  |  191|  24.9k|        }                                                                      \
  |  |  |  |  |  |  192|  36.8k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 36.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  36.8k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  36.3k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  36.3k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  36.3k|    do                                                                         \
  |  |  |  |  |  |  197|  36.3k|    {                                                                          \
  |  |  |  |  |  |  198|  36.3k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  36.3k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  36.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 36.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  36.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 36.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|  36.8k|                            switch (TabEnt->State)                             \
  |  |  523|  36.3k|                            {                                                  \
  |  |  524|  9.73k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  9.73k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (524:33): [True: 9.73k, False: 26.6k]
  |  |  ------------------
  |  |  525|  9.73k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  9.73k|    do                                                                         \
  |  |  |  |  267|  9.73k|    {                                                                          \
  |  |  |  |  268|  9.73k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 374, False: 9.35k]
  |  |  |  |  ------------------
  |  |  |  |  269|  9.73k|        {                                                                      \
  |  |  |  |  270|    374|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|    374|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    374|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    374|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 374, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|    374|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    374|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    374|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 374, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|    374|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|    374|            return (-1);                                                       \
  |  |  |  |  275|    374|        }                                                                      \
  |  |  |  |  276|  9.73k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  9.35k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  9.35k|        RunLength = 0;                                                         \
  |  |  |  |  279|  9.35k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 9.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  9.73k|                                    goto doneBlack2da;                         \
  |  |  527|  23.8k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  23.8k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (527:33): [True: 23.8k, False: 12.5k]
  |  |  ------------------
  |  |  528|  25.8k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  25.8k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (528:33): [True: 2.07k, False: 34.3k]
  |  |  ------------------
  |  |  529|  25.8k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  530|  25.8k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  531|  25.8k|                                                      TabEnt->Param);          \
  |  |  532|  25.8k|                                    break;                                     \
  |  |  533|  23.8k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (533:33): [True: 788, False: 35.6k]
  |  |  ------------------
  |  |  534|    788|                                    goto badWhite2d;                           \
  |  |  535|  36.3k|                            }                                                  \
  |  |  536|  36.3k|                        }                                                      \
  |  |  537|  10.9k|                    doneBlack2da:;                                             \
  |  |  538|  9.35k|                    }                                                          \
  |  |  539|  98.6k|                    else                                                       \
  |  |  540|  98.6k|                    {                                                          \
  |  |  541|  87.6k|                        for (;;)                                               \
  |  |  542|   131k|                        { /* white first */                                    \
  |  |  543|   131k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   131k|    do                                                                         \
  |  |  |  |  255|   131k|    {                                                                          \
  |  |  |  |  256|   131k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   131k|    do                                                                         \
  |  |  |  |  |  |  165|   131k|    {                                                                          \
  |  |  |  |  |  |  166|   131k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 128k, False: 3.46k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   131k|        {                                                                      \
  |  |  |  |  |  |  168|   128k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   128k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 684, False: 127k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   128k|            {                                                                  \
  |  |  |  |  |  |  170|    684|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 0, False: 684]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    684|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    684|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    684|            }                                                                  \
  |  |  |  |  |  |  174|   128k|            else                                                               \
  |  |  |  |  |  |  175|   128k|            {                                                                  \
  |  |  |  |  |  |  176|   127k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   127k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 69, False: 127k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   127k|                {                                                              \
  |  |  |  |  |  |  179|     69|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|     69|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 8, False: 61]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|     69|                    {                                                          \
  |  |  |  |  |  |  181|      8|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      8|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      8|                    }                                                          \
  |  |  |  |  |  |  184|     69|                    else                                                       \
  |  |  |  |  |  |  185|     69|                    {                                                          \
  |  |  |  |  |  |  186|     61|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|     61|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|     61|                    }                                                          \
  |  |  |  |  |  |  189|     69|                }                                                              \
  |  |  |  |  |  |  190|   127k|            }                                                                  \
  |  |  |  |  |  |  191|   128k|        }                                                                      \
  |  |  |  |  |  |  192|   131k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 131k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   131k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   131k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   131k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   131k|    do                                                                         \
  |  |  |  |  |  |  197|   131k|    {                                                                          \
  |  |  |  |  |  |  198|   131k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   131k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   131k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 131k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   131k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 131k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|   131k|                            switch (TabEnt->State)                             \
  |  |  545|   131k|                            {                                                  \
  |  |  546|  87.3k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  87.3k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (546:33): [True: 87.3k, False: 44.2k]
  |  |  ------------------
  |  |  547|  87.3k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  87.3k|    do                                                                         \
  |  |  |  |  267|  87.3k|    {                                                                          \
  |  |  |  |  268|  87.3k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 87.3k]
  |  |  |  |  ------------------
  |  |  |  |  269|  87.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|  87.3k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  87.3k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  87.3k|        RunLength = 0;                                                         \
  |  |  |  |  279|  87.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 87.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|  87.3k|                                    goto doneWhite2db;                         \
  |  |  549|  87.3k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  42.8k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (549:33): [True: 42.8k, False: 88.7k]
  |  |  ------------------
  |  |  550|  43.9k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  43.9k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (550:33): [True: 1.10k, False: 130k]
  |  |  ------------------
  |  |  551|  43.9k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  552|  43.9k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  553|  43.9k|                                                      TabEnt->Param);          \
  |  |  554|  43.9k|                                    break;                                     \
  |  |  555|  42.8k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (555:33): [True: 315, False: 131k]
  |  |  ------------------
  |  |  556|    315|                                    goto badWhite2d;                           \
  |  |  557|   131k|                            }                                                  \
  |  |  558|   131k|                        }                                                      \
  |  |  559|  87.6k|                    doneWhite2db:;                                             \
  |  |  560|  87.3k|                        for (;;)                                               \
  |  |  561|  87.8k|                        { /* then black */                                     \
  |  |  562|  87.8k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  87.8k|    do                                                                         \
  |  |  |  |  255|  87.8k|    {                                                                          \
  |  |  |  |  256|  87.8k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  87.8k|    do                                                                         \
  |  |  |  |  |  |  165|  87.8k|    {                                                                          \
  |  |  |  |  |  |  166|  87.8k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 35.5k, False: 52.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  87.8k|        {                                                                      \
  |  |  |  |  |  |  168|  35.5k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  35.5k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 370, False: 35.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  35.5k|            {                                                                  \
  |  |  |  |  |  |  170|    370|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 0, False: 370]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    370|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    370|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    370|            }                                                                  \
  |  |  |  |  |  |  174|  35.5k|            else                                                               \
  |  |  |  |  |  |  175|  35.5k|            {                                                                  \
  |  |  |  |  |  |  176|  35.1k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  35.1k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 941, False: 34.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  35.1k|                {                                                              \
  |  |  |  |  |  |  179|    941|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|    941|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 4, False: 937]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|    941|                    {                                                          \
  |  |  |  |  |  |  181|      4|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      4|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      4|                    }                                                          \
  |  |  |  |  |  |  184|    941|                    else                                                       \
  |  |  |  |  |  |  185|    941|                    {                                                          \
  |  |  |  |  |  |  186|    937|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|    937|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|    937|                    }                                                          \
  |  |  |  |  |  |  189|    941|                }                                                              \
  |  |  |  |  |  |  190|  35.1k|            }                                                                  \
  |  |  |  |  |  |  191|  35.5k|        }                                                                      \
  |  |  |  |  |  |  192|  87.8k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 87.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  87.8k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  87.8k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  87.8k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  87.8k|    do                                                                         \
  |  |  |  |  |  |  197|  87.8k|    {                                                                          \
  |  |  |  |  |  |  198|  87.8k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  87.8k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  87.8k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 87.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  87.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 87.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|  87.8k|                            switch (TabEnt->State)                             \
  |  |  564|  87.8k|                            {                                                  \
  |  |  565|  86.7k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  86.7k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (565:33): [True: 86.7k, False: 1.09k]
  |  |  ------------------
  |  |  566|  86.7k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  86.7k|    do                                                                         \
  |  |  |  |  267|  86.7k|    {                                                                          \
  |  |  |  |  268|  86.7k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 86.7k]
  |  |  |  |  ------------------
  |  |  |  |  269|  86.7k|        {                                                                      \
  |  |  |  |  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|  86.7k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  86.7k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  86.7k|        RunLength = 0;                                                         \
  |  |  |  |  279|  86.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 86.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  567|  86.7k|                                    goto doneBlack2db;                         \
  |  |  568|  86.7k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|    275|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (568:33): [True: 275, False: 87.5k]
  |  |  ------------------
  |  |  569|    438|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|    438|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (569:33): [True: 163, False: 87.6k]
  |  |  ------------------
  |  |  570|    438|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  571|    438|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  572|    438|                                                      TabEnt->Param);          \
  |  |  573|    438|                                    break;                                     \
  |  |  574|    652|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (574:33): [True: 652, False: 87.1k]
  |  |  ------------------
  |  |  575|    652|                                    goto badBlack2d;                           \
  |  |  576|  87.8k|                            }                                                  \
  |  |  577|  87.8k|                        }                                                      \
  |  |  578|  87.3k|                    doneBlack2db:;                                             \
  |  |  579|  86.7k|                    }                                                          \
  |  |  580|  98.6k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  96.0k|    do                                                                         \
  |  |  |  |  441|  96.0k|    {                                                                          \
  |  |  |  |  442|  96.0k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 96.0k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  443|   121k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 106k, False: 15.0k]
  |  |  |  |  |  Branch (443:32): [True: 25.4k, False: 81.0k]
  |  |  |  |  ------------------
  |  |  |  |  444|  96.0k|            {                                                                  \
  |  |  |  |  445|  25.4k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 25.4k]
  |  |  |  |  ------------------
  |  |  |  |  446|  25.4k|                {                                                              \
  |  |  |  |  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|  25.4k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  25.4k|                pb += 2;                                                       \
  |  |  |  |  456|  25.4k|            }                                                                  \
  |  |  |  |  457|  96.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 96.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|  96.0k|                    break;                                                     \
  |  |  582|   327k|                case S_V0:                                                     \
  |  |  ------------------
  |  |  |  |   73|   327k|#define S_V0 3
  |  |  ------------------
  |  |  |  Branch (582:17): [True: 327k, False: 648k]
  |  |  ------------------
  |  |  583|   327k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   327k|    do                                                                         \
  |  |  |  |  441|   327k|    {                                                                          \
  |  |  |  |  442|   327k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 143k, False: 184k]
  |  |  |  |  ------------------
  |  |  |  |  443|   327k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 60.6k, False: 143k]
  |  |  |  |  |  Branch (443:32): [True: 60.6k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   143k|            {                                                                  \
  |  |  |  |  445|  60.6k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 60.6k]
  |  |  |  |  ------------------
  |  |  |  |  446|  60.6k|                {                                                              \
  |  |  |  |  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|  60.6k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  60.6k|                pb += 2;                                                       \
  |  |  |  |  456|  60.6k|            }                                                                  \
  |  |  |  |  457|   327k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 327k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|   327k|                    SETVALUE(b1 - a0);                                         \
  |  |  ------------------
  |  |  |  |  266|   327k|    do                                                                         \
  |  |  |  |  267|   327k|    {                                                                          \
  |  |  |  |  268|   327k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 327k]
  |  |  |  |  ------------------
  |  |  |  |  269|   327k|        {                                                                      \
  |  |  |  |  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|   327k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   327k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   327k|        RunLength = 0;                                                         \
  |  |  |  |  279|   327k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 327k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|   327k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (585:25): [True: 315, False: 327k]
  |  |  ------------------
  |  |  586|   327k|                    {                                                          \
  |  |  587|    315|                        TIFFErrorExtR(                                         \
  |  |  588|    315|                            tif, module,                                       \
  |  |  589|    315|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  590|    315|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    315|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    315|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 139, False: 176]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  591|    315|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    315|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    315|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 139, False: 176]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|    315|                                         : tif->tif_dir.td_curstrip);          \
  |  |  593|    315|                        return (-1);                                           \
  |  |  594|    315|                    }                                                          \
  |  |  595|   327k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  596|   327k|                    break;                                                     \
  |  |  597|   327k|                case S_VR:                                                     \
  |  |  ------------------
  |  |  |  |   74|   165k|#define S_VR 4
  |  |  ------------------
  |  |  |  Branch (597:17): [True: 165k, False: 810k]
  |  |  ------------------
  |  |  598|   165k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   165k|    do                                                                         \
  |  |  |  |  441|   165k|    {                                                                          \
  |  |  |  |  442|   165k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 103k, False: 62.1k]
  |  |  |  |  ------------------
  |  |  |  |  443|   184k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 81.1k, False: 103k]
  |  |  |  |  |  Branch (443:32): [True: 81.1k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   103k|            {                                                                  \
  |  |  |  |  445|  81.1k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 81.1k]
  |  |  |  |  ------------------
  |  |  |  |  446|  81.1k|                {                                                              \
  |  |  |  |  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|  81.1k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  81.1k|                pb += 2;                                                       \
  |  |  |  |  456|  81.1k|            }                                                                  \
  |  |  |  |  457|   165k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 165k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|   165k|                    SETVALUE((int)((uint32_t)(b1 - a0) + TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   165k|    do                                                                         \
  |  |  |  |  267|   165k|    {                                                                          \
  |  |  |  |  268|   165k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 165k]
  |  |  |  |  ------------------
  |  |  |  |  269|   165k|        {                                                                      \
  |  |  |  |  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|   165k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   165k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   165k|        RunLength = 0;                                                         \
  |  |  |  |  279|   165k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 165k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|   165k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (600:25): [True: 346, False: 165k]
  |  |  ------------------
  |  |  601|   165k|                    {                                                          \
  |  |  602|    346|                        TIFFErrorExtR(                                         \
  |  |  603|    346|                            tif, module,                                       \
  |  |  604|    346|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  605|    346|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    346|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    346|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 130, False: 216]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  606|    346|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    346|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    346|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 130, False: 216]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  607|    346|                                         : tif->tif_dir.td_curstrip);          \
  |  |  608|    346|                        return (-1);                                           \
  |  |  609|    346|                    }                                                          \
  |  |  610|   165k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  611|   165k|                    break;                                                     \
  |  |  612|   357k|                case S_VL:                                                     \
  |  |  ------------------
  |  |  |  |   75|   357k|#define S_VL 5
  |  |  ------------------
  |  |  |  Branch (612:17): [True: 357k, False: 618k]
  |  |  ------------------
  |  |  613|   357k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   357k|    do                                                                         \
  |  |  |  |  441|   357k|    {                                                                          \
  |  |  |  |  442|   357k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 303k, False: 53.8k]
  |  |  |  |  ------------------
  |  |  |  |  443|   448k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 144k, False: 303k]
  |  |  |  |  |  Branch (443:32): [True: 144k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   303k|            {                                                                  \
  |  |  |  |  445|   144k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 144k]
  |  |  |  |  ------------------
  |  |  |  |  446|   144k|                {                                                              \
  |  |  |  |  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|   144k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   144k|                pb += 2;                                                       \
  |  |  |  |  456|   144k|            }                                                                  \
  |  |  |  |  457|   357k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 357k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  614|   357k|                    if (b1 < (int)((uint32_t)a0 + TabEnt->Param))              \
  |  |  ------------------
  |  |  |  Branch (614:25): [True: 3.98k, False: 353k]
  |  |  ------------------
  |  |  615|   357k|                    {                                                          \
  |  |  616|  3.98k|                        unexpected("VL", a0);                                  \
  |  |  ------------------
  |  |  |  |  220|  3.98k|    do                                                                         \
  |  |  |  |  221|  3.98k|    {                                                                          \
  |  |  |  |  222|  3.98k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  3.98k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  3.98k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 3.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  617|  3.98k|                        goto eol2d;                                            \
  |  |  618|  3.98k|                    }                                                          \
  |  |  619|   357k|                    SETVALUE((int)((uint32_t)(b1 - a0) - TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   353k|    do                                                                         \
  |  |  |  |  267|   353k|    {                                                                          \
  |  |  |  |  268|   353k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 353k]
  |  |  |  |  ------------------
  |  |  |  |  269|   353k|        {                                                                      \
  |  |  |  |  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|   353k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   353k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   353k|        RunLength = 0;                                                         \
  |  |  |  |  279|   353k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 353k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  620|   353k|                    b1 = b1 - (int)*--pb;                                      \
  |  |  621|   353k|                    break;                                                     \
  |  |  622|   353k|                case S_Ext:                                                    \
  |  |  ------------------
  |  |  |  |   76|  5.55k|#define S_Ext 6
  |  |  ------------------
  |  |  |  Branch (622:17): [True: 5.55k, False: 970k]
  |  |  ------------------
  |  |  623|  5.55k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  624|  5.55k|                    extension(a0);                                             \
  |  |  ------------------
  |  |  |  |  238|  5.55k|    Fax3Extension(module, tif, (uint32_t)sp->line, (uint32_t)(a0))
  |  |  ------------------
  |  |  625|  5.55k|                    goto eol2d;                                                \
  |  |  626|   353k|                case S_EOL:                                                    \
  |  |  ------------------
  |  |  |  |   82|  8.47k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (626:17): [True: 8.47k, False: 967k]
  |  |  ------------------
  |  |  627|  8.47k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  628|  8.47k|                    NeedBits8(4, eof2d);                                       \
  |  |  ------------------
  |  |  |  |  144|  8.47k|    do                                                                         \
  |  |  |  |  145|  8.47k|    {                                                                          \
  |  |  |  |  146|  8.47k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 6.91k, False: 1.56k]
  |  |  |  |  ------------------
  |  |  |  |  147|  8.47k|        {                                                                      \
  |  |  |  |  148|  6.91k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  6.91k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 2.34k, False: 4.56k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  6.91k|            {                                                                  \
  |  |  |  |  150|  2.34k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 2.08k, False: 262]
  |  |  |  |  ------------------
  |  |  |  |  151|  2.34k|                    goto eoflab;                                               \
  |  |  |  |  152|  2.34k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|    262|            }                                                                  \
  |  |  |  |  154|  6.91k|            else                                                               \
  |  |  |  |  155|  6.91k|            {                                                                  \
  |  |  |  |  156|  4.56k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  4.56k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  4.56k|            }                                                                  \
  |  |  |  |  159|  6.91k|        }                                                                      \
  |  |  |  |  160|  8.47k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 6.39k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|  8.47k|                    if (GetBits(4))                                            \
  |  |  ------------------
  |  |  |  |  194|  6.39k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 2.55k, False: 3.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  630|  6.39k|                        unexpected("EOL", a0);                                 \
  |  |  ------------------
  |  |  |  |  220|  2.55k|    do                                                                         \
  |  |  |  |  221|  2.55k|    {                                                                          \
  |  |  |  |  222|  2.55k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  2.55k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  2.55k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 2.55k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  631|  6.39k|                    ClrBits(4);                                                \
  |  |  ------------------
  |  |  |  |  196|  6.39k|    do                                                                         \
  |  |  |  |  197|  6.39k|    {                                                                          \
  |  |  |  |  198|  6.39k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  6.39k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  6.39k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 6.39k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|  6.39k|                    EOLcnt = 1;                                                \
  |  |  633|  6.39k|                    goto eol2d;                                                \
  |  |  634|  8.47k|                default:                                                       \
  |  |  ------------------
  |  |  |  Branch (634:17): [True: 0, False: 975k]
  |  |  ------------------
  |  |  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|    682|                badBlack2d:                                                    \
  |  |  639|    682|                    unexpected("BlackTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|    682|    do                                                                         \
  |  |  |  |  221|    682|    {                                                                          \
  |  |  |  |  222|    682|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|    682|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|    682|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 682]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  640|    682|                    goto eol2d;                                                \
  |  |  641|  1.10k|                badWhite2d:                                                    \
  |  |  642|  1.10k|                    unexpected("WhiteTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  1.10k|    do                                                                         \
  |  |  |  |  221|  1.10k|    {                                                                          \
  |  |  |  |  222|  1.10k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  1.10k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  1.10k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 1.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  643|  1.10k|                    goto eol2d;                                                \
  |  |  644|  2.55k|                eof2d:                                                         \
  |  |  645|  2.55k|                    prematureEOF(a0);                                          \
  |  |  ------------------
  |  |  |  |  271|  2.55k|    do                                                                         \
  |  |  |  |  272|  2.55k|    {                                                                          \
  |  |  |  |  273|  2.55k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  2.55k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  2.55k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 2.55k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  646|  2.55k|                    CLEANUP_RUNS();                                            \
  |  |  ------------------
  |  |  |  |  333|  2.55k|    do                                                                         \
  |  |  |  |  334|  2.55k|    {                                                                          \
  |  |  |  |  335|  2.55k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 428, False: 2.12k]
  |  |  |  |  ------------------
  |  |  |  |  336|  2.55k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    428|    do                                                                         \
  |  |  |  |  |  |  267|    428|    {                                                                          \
  |  |  |  |  |  |  268|    428|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 224, False: 204]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    428|        {                                                                      \
  |  |  |  |  |  |  270|    224|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    224|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    224|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    224|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 142, False: 82]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    224|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    224|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    224|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 142, False: 82]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    224|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    224|            return (-1);                                                       \
  |  |  |  |  |  |  275|    224|        }                                                                      \
  |  |  |  |  |  |  276|    428|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    204|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    204|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    204|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 204]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  2.55k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 2.33k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|  2.33k|        {                                                                      \
  |  |  |  |  339|  2.33k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  2.33k|    do                                                                         \
  |  |  |  |  |  |  254|  2.33k|    {                                                                          \
  |  |  |  |  |  |  255|  2.33k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  2.33k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  2.33k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  2.33k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 2.33k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  2.70k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 374, False: 2.33k]
  |  |  |  |  |  Branch (340:39): [True: 374, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  2.33k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  2.33k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 2.33k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|  2.33k|            {                                                                  \
  |  |  |  |  344|  2.33k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 2.33k]
  |  |  |  |  ------------------
  |  |  |  |  345|  2.33k|                    a0 = 0;                                                    \
  |  |  |  |  346|  2.33k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 1.58k, False: 750]
  |  |  |  |  ------------------
  |  |  |  |  347|  2.33k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.58k|    do                                                                         \
  |  |  |  |  |  |  267|  1.58k|    {                                                                          \
  |  |  |  |  |  |  268|  1.58k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 1.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.58k|        {                                                                      \
  |  |  |  |  |  |  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.58k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  1.58k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  1.58k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  1.58k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  2.33k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  2.33k|    do                                                                         \
  |  |  |  |  |  |  267|  2.33k|    {                                                                          \
  |  |  |  |  |  |  268|  2.33k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 369, False: 1.96k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  2.33k|        {                                                                      \
  |  |  |  |  |  |  270|    369|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    369|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    369|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    369|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 138, False: 231]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    369|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    369|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    369|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 138, False: 231]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    369|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    369|            return (-1);                                                       \
  |  |  |  |  |  |  275|    369|        }                                                                      \
  |  |  |  |  |  |  276|  2.33k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  1.96k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  1.96k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  1.96k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1.96k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  2.33k|            }                                                                  \
  |  |  |  |  350|  2.33k|            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|  2.33k|        }                                                                      \
  |  |  |  |  356|  2.33k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 1.96k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  647|  2.55k|                    goto eoflab;                                               \
  |  |  648|   975k|            }                                                                  \
  |  |  649|   975k|        }                                                                      \
  |  |  650|   399k|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (650:13): [True: 10.1k, False: 367k]
  |  |  ------------------
  |  |  651|   377k|        {                                                                      \
  |  |  652|  10.1k|            if (RunLength + a0 < lastx)                                        \
  |  |  ------------------
  |  |  |  Branch (652:17): [True: 0, False: 10.1k]
  |  |  ------------------
  |  |  653|  10.1k|            {                                                                  \
  |  |  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|  10.1k|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|  10.1k|    do                                                                         \
  |  |  |  |  267|  10.1k|    {                                                                          \
  |  |  |  |  268|  10.1k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 10.1k]
  |  |  |  |  ------------------
  |  |  |  |  269|  10.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|  10.1k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  10.1k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  10.1k|        RunLength = 0;                                                         \
  |  |  |  |  279|  10.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 10.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  661|  10.1k|        }                                                                      \
  |  |  662|   394k|    eol2d:                                                                     \
  |  |  663|   394k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   394k|    do                                                                         \
  |  |  |  |  334|   394k|    {                                                                          \
  |  |  |  |  335|   394k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 966, False: 393k]
  |  |  |  |  ------------------
  |  |  |  |  336|   394k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    966|    do                                                                         \
  |  |  |  |  |  |  267|    966|    {                                                                          \
  |  |  |  |  |  |  268|    966|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 591, False: 375]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    966|        {                                                                      \
  |  |  |  |  |  |  270|    591|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    591|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    591|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    591|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 150, False: 441]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    591|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    591|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    591|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 150, False: 441]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    591|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    591|            return (-1);                                                       \
  |  |  |  |  |  |  275|    591|        }                                                                      \
  |  |  |  |  |  |  276|    966|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    375|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    375|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    375|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 375]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   394k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 199k, False: 194k]
  |  |  |  |  ------------------
  |  |  |  |  338|   394k|        {                                                                      \
  |  |  |  |  339|   199k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   199k|    do                                                                         \
  |  |  |  |  |  |  254|   199k|    {                                                                          \
  |  |  |  |  |  |  255|   199k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   199k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   199k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   199k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 199k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   457k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 257k, False: 199k]
  |  |  |  |  |  Branch (340:39): [True: 257k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   257k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   199k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 198k, False: 876]
  |  |  |  |  ------------------
  |  |  |  |  343|   199k|            {                                                                  \
  |  |  |  |  344|   198k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 198k]
  |  |  |  |  ------------------
  |  |  |  |  345|   198k|                    a0 = 0;                                                    \
  |  |  |  |  346|   198k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 68.0k, False: 130k]
  |  |  |  |  ------------------
  |  |  |  |  347|   198k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  68.0k|    do                                                                         \
  |  |  |  |  |  |  267|  68.0k|    {                                                                          \
  |  |  |  |  |  |  268|  68.0k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 68.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  68.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|  68.0k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  68.0k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  68.0k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  68.0k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 68.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   198k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   198k|    do                                                                         \
  |  |  |  |  |  |  267|   198k|    {                                                                          \
  |  |  |  |  |  |  268|   198k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 348, False: 198k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   198k|        {                                                                      \
  |  |  |  |  |  |  270|    348|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    348|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    348|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    348|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 175, False: 173]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    348|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    348|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    348|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 175, False: 173]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    348|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    348|            return (-1);                                                       \
  |  |  |  |  |  |  275|    348|        }                                                                      \
  |  |  |  |  |  |  276|   198k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   198k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   198k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   198k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 198k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   198k|            }                                                                  \
  |  |  |  |  350|   199k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 876]
  |  |  |  |  ------------------
  |  |  |  |  351|    876|            {                                                                  \
  |  |  |  |  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|   199k|        }                                                                      \
  |  |  |  |  356|   394k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 393k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  664|   394k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (664:14): [Folded, False: 393k]
  |  |  ------------------
  ------------------
 1671|   393k|        if (EOLcnt)
  ------------------
  |  Branch (1671:13): [True: 6.21k, False: 387k]
  ------------------
 1672|  6.21k|            goto EOFG4;
 1673|   387k|        if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
  ------------------
  |  Branch (1673:13): [True: 0, False: 387k]
  ------------------
 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|   387k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1682|   387k|        SETVALUE(0); /* imaginary change for reference */
  ------------------
  |  |  266|   387k|    do                                                                         \
  |  |  267|   387k|    {                                                                          \
  |  |  268|   387k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  ------------------
  |  |  |  Branch (268:13): [True: 319, False: 387k]
  |  |  ------------------
  |  |  269|   387k|        {                                                                      \
  |  |  270|    319|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  271|    319|                          sp->line, 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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  272|    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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  273|    319|                                       : tif->tif_dir.td_curstrip);            \
  |  |  274|    319|            return (-1);                                                       \
  |  |  275|    319|        }                                                                      \
  |  |  276|   387k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  277|   387k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  278|   387k|        RunLength = 0;                                                         \
  |  |  279|   387k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (279:14): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 1683|   387k|        SWAP(uint32_t *, sp->curruns, sp->refruns);
  ------------------
  |  | 1636|   387k|    {                                                                          \
  |  | 1637|   387k|        t x;                                                                   \
  |  | 1638|   387k|        x = (a);                                                               \
  |  | 1639|   387k|        (a) = (b);                                                             \
  |  | 1640|   387k|        (b) = x;                                                               \
  |  | 1641|   387k|    }
  ------------------
 1684|   387k|        buf += sp->b.rowbytes;
 1685|   387k|        occ -= sp->b.rowbytes;
 1686|   387k|        sp->line++;
 1687|   387k|        continue;
 1688|  8.18k|    EOFG4:
 1689|  8.18k|        NeedBits16(13, BADG4);
  ------------------
  |  |  164|  8.18k|    do                                                                         \
  |  |  165|  8.18k|    {                                                                          \
  |  |  166|  8.18k|        if (BitsAvail < (n))                                                   \
  |  |  ------------------
  |  |  |  Branch (166:13): [True: 8.18k, False: 0]
  |  |  ------------------
  |  |  167|  8.18k|        {                                                                      \
  |  |  168|  8.18k|            if (EndOfData())                                                   \
  |  |  ------------------
  |  |  |  |  117|  8.18k|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 2.28k, False: 5.89k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  169|  8.18k|            {                                                                  \
  |  |  170|  2.28k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  ------------------
  |  |  |  Branch (170:21): [True: 2.23k, False: 45]
  |  |  ------------------
  |  |  171|  2.28k|                    goto eoflab;                                               \
  |  |  172|  2.28k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  173|     45|            }                                                                  \
  |  |  174|  8.18k|            else                                                               \
  |  |  175|  8.18k|            {                                                                  \
  |  |  176|  5.89k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  177|  5.89k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  ------------------
  |  |  |  Branch (177:21): [True: 811, False: 5.08k]
  |  |  ------------------
  |  |  178|  5.89k|                {                                                              \
  |  |  179|    811|                    if (EndOfData())                                           \
  |  |  ------------------
  |  |  |  |  117|    811|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 1, False: 810]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  180|    811|                    {                                                          \
  |  |  181|      1|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  182|      1|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  183|      1|                    }                                                          \
  |  |  184|    811|                    else                                                       \
  |  |  185|    811|                    {                                                          \
  |  |  186|    810|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  187|    810|                        BitsAvail += 8;                                        \
  |  |  188|    810|                    }                                                          \
  |  |  189|    811|                }                                                              \
  |  |  190|  5.89k|            }                                                                  \
  |  |  191|  8.18k|        }                                                                      \
  |  |  192|  8.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (192:14): [Folded, False: 5.94k]
  |  |  ------------------
  ------------------
 1690|  8.18k|    BADG4:
 1691|       |#ifdef FAX3_DEBUG
 1692|       |        if (GetBits(13) != 0x1001)
 1693|       |            fputs("Bad EOFB\n", stderr);
 1694|       |#endif
 1695|  8.18k|        ClrBits(13);
  ------------------
  |  |  196|  8.18k|    do                                                                         \
  |  |  197|  8.18k|    {                                                                          \
  |  |  198|  8.18k|        BitsAvail -= (n);                                                      \
  |  |  199|  8.18k|        BitAcc >>= (n);                                                        \
  |  |  200|  8.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 8.18k]
  |  |  ------------------
  ------------------
 1696|  8.18k|        if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
  ------------------
  |  Branch (1696:13): [True: 0, False: 8.18k]
  ------------------
 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|  8.18k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1705|  8.18k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  8.18k|    do                                                                         \
  |  |  160|  8.18k|    {                                                                          \
  |  |  161|  8.18k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  8.18k|        sp->data = BitAcc;                                                     \
  |  |  163|  8.18k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  8.18k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  8.18k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  8.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 8.18k]
  |  |  ------------------
  ------------------
 1706|  8.18k|        return (sp->line != start
  ------------------
  |  Branch (1706:17): [True: 4.61k, False: 3.56k]
  ------------------
 1707|  8.18k|                    ? 1
 1708|  8.18k|                    : -1); /* don't error on badly-terminated strips */
 1709|  8.18k|    }
 1710|    962|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|    962|    do                                                                         \
  |  |  160|    962|    {                                                                          \
  |  |  161|    962|        sp->bit = BitsAvail;                                                   \
  |  |  162|    962|        sp->data = BitAcc;                                                     \
  |  |  163|    962|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|    962|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|    962|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|    962|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 962]
  |  |  ------------------
  ------------------
 1711|    962|    return (1);
 1712|  12.6k|}
tif_fax3.c:Fax4GetMaxCompressionRatio:
 1752|    225|{
 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|    225|    return isTiled(tif) ? tif->tif_dir.td_tilewidth
  ------------------
  |  |  278|    225|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    225|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 223, False: 2]
  |  |  ------------------
  ------------------
 1758|    225|                        : tif->tif_dir.td_imagewidth;
 1759|    225|}
tif_fax3.c:Fax3DecodeRLE:
 1802|  9.18k|{
 1803|  9.18k|    DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
  ------------------
  |  |  123|  9.18k|    static const char module[] = mod;                                          \
  |  |  124|  9.18k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  ------------------
  |  |  |  |  108|  9.18k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  9.18k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  125|  9.18k|    int a0;                                   /* reference element */          \
  |  |  126|  9.18k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  127|  9.18k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  128|  9.18k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  129|  9.18k|    int RunLength;                            /* length of current run */      \
  |  |  130|  9.18k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  131|  9.18k|    unsigned char *ep;                        /* end of input data */          \
  |  |  132|  9.18k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  133|  9.18k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  134|  9.18k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  135|  9.18k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  136|  9.18k|    const TIFFFaxTabEnt *TabEnt
  ------------------
 1804|  9.18k|    int mode = sp->b.mode;
 1805|  9.18k|    (void)s;
 1806|  9.18k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1806:9): [True: 0, False: 9.18k]
  ------------------
 1807|      0|    {
 1808|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1809|      0|        return (-1);
 1810|      0|    }
 1811|  9.18k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (1811:9): [True: 1, False: 9.18k]
  ------------------
 1812|      1|        return (-1);
 1813|  9.18k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  9.18k|    do                                                                         \
  |  |  148|  9.18k|    {                                                                          \
  |  |  149|  9.18k|        BitAcc = sp->data;                                                     \
  |  |  150|  9.18k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  9.18k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  9.18k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  9.18k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  9.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 9.18k]
  |  |  ------------------
  ------------------
 1814|  9.18k|    thisrun = sp->curruns;
 1815|  88.1k|    while (occ > 0)
  ------------------
  |  Branch (1815:12): [True: 79.3k, False: 8.82k]
  ------------------
 1816|  79.3k|    {
 1817|  79.3k|        a0 = 0;
 1818|  79.3k|        RunLength = 0;
 1819|  79.3k|        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|  79.3k|        EXPAND1D(EOFRLE);
  ------------------
  |  |  371|  79.3k|    do                                                                         \
  |  |  372|  79.3k|    {                                                                          \
  |  |  373|  79.3k|        for (;;)                                                               \
  |  |  374|  98.6k|        {                                                                      \
  |  |  375|  98.6k|            for (;;)                                                           \
  |  |  376|   614k|            {                                                                  \
  |  |  377|   614k|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   614k|    do                                                                         \
  |  |  |  |  255|   614k|    {                                                                          \
  |  |  |  |  256|   614k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   614k|    do                                                                         \
  |  |  |  |  |  |  165|   614k|    {                                                                          \
  |  |  |  |  |  |  166|   614k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 533k, False: 80.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   614k|        {                                                                      \
  |  |  |  |  |  |  168|   533k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   533k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 670, False: 533k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   533k|            {                                                                  \
  |  |  |  |  |  |  170|    670|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 288, False: 382]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    670|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    670|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    382|            }                                                                  \
  |  |  |  |  |  |  174|   533k|            else                                                               \
  |  |  |  |  |  |  175|   533k|            {                                                                  \
  |  |  |  |  |  |  176|   533k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   533k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 30.7k, False: 502k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   533k|                {                                                              \
  |  |  |  |  |  |  179|  30.7k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  30.7k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 87, False: 30.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  30.7k|                    {                                                          \
  |  |  |  |  |  |  181|     87|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|     87|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|     87|                    }                                                          \
  |  |  |  |  |  |  184|  30.7k|                    else                                                       \
  |  |  |  |  |  |  185|  30.7k|                    {                                                          \
  |  |  |  |  |  |  186|  30.6k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  30.6k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  30.6k|                    }                                                          \
  |  |  |  |  |  |  189|  30.7k|                }                                                              \
  |  |  |  |  |  |  190|   533k|            }                                                                  \
  |  |  |  |  |  |  191|   533k|        }                                                                      \
  |  |  |  |  |  |  192|   614k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 613k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   614k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   613k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   613k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   613k|    do                                                                         \
  |  |  |  |  |  |  197|   613k|    {                                                                          \
  |  |  |  |  |  |  198|   613k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   613k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   613k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 613k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   613k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 613k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|   614k|                switch (TabEnt->State)                                         \
  |  |  379|   613k|                {                                                              \
  |  |  380|  3.35k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  3.35k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 3.35k, False: 610k]
  |  |  ------------------
  |  |  381|  3.35k|                        EOLcnt = 1;                                            \
  |  |  382|  3.35k|                        goto done1d;                                           \
  |  |  383|  36.6k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|  36.6k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 36.6k, False: 577k]
  |  |  ------------------
  |  |  384|  36.6k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|  36.6k|    do                                                                         \
  |  |  |  |  267|  36.6k|    {                                                                          \
  |  |  |  |  268|  36.6k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 36.6k]
  |  |  |  |  ------------------
  |  |  |  |  269|  36.6k|        {                                                                      \
  |  |  |  |  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|  36.6k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  36.6k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  36.6k|        RunLength = 0;                                                         \
  |  |  |  |  279|  36.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 36.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|  36.6k|                        goto doneWhite1d;                                      \
  |  |  386|   461k|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|   461k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 461k, False: 151k]
  |  |  ------------------
  |  |  387|   515k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|   515k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 53.5k, False: 560k]
  |  |  ------------------
  |  |  388|   515k|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|   515k|                        RunLength =                                            \
  |  |  390|   515k|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|   515k|                        break;                                                 \
  |  |  392|   461k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 58.4k, False: 555k]
  |  |  ------------------
  |  |  393|  58.4k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  58.4k|    do                                                                         \
  |  |  |  |  221|  58.4k|    {                                                                          \
  |  |  |  |  222|  58.4k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  58.4k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  58.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 58.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  58.4k|                        goto done1d;                                           \
  |  |  395|   613k|                }                                                              \
  |  |  396|   613k|            }                                                                  \
  |  |  397|  98.6k|        doneWhite1d:                                                           \
  |  |  398|  36.6k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 12.2k, False: 24.3k]
  |  |  ------------------
  |  |  399|  36.6k|                goto done1d;                                                   \
  |  |  400|  36.6k|            for (;;)                                                           \
  |  |  401|  24.4k|            {                                                                  \
  |  |  402|  24.4k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  24.4k|    do                                                                         \
  |  |  |  |  255|  24.4k|    {                                                                          \
  |  |  |  |  256|  24.4k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  24.4k|    do                                                                         \
  |  |  |  |  |  |  165|  24.4k|    {                                                                          \
  |  |  |  |  |  |  166|  24.4k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 22.3k, False: 2.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  24.4k|        {                                                                      \
  |  |  |  |  |  |  168|  22.3k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  22.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 210, False: 22.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  22.3k|            {                                                                  \
  |  |  |  |  |  |  170|    210|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 74, False: 136]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    210|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    210|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    136|            }                                                                  \
  |  |  |  |  |  |  174|  22.3k|            else                                                               \
  |  |  |  |  |  |  175|  22.3k|            {                                                                  \
  |  |  |  |  |  |  176|  22.0k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  22.0k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 4, False: 22.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  22.0k|                {                                                              \
  |  |  |  |  |  |  179|      4|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|      4|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 4]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|      4|                    {                                                          \
  |  |  |  |  |  |  181|      0|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      0|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      0|                    }                                                          \
  |  |  |  |  |  |  184|      4|                    else                                                       \
  |  |  |  |  |  |  185|      4|                    {                                                          \
  |  |  |  |  |  |  186|      4|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|      4|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|      4|                    }                                                          \
  |  |  |  |  |  |  189|      4|                }                                                              \
  |  |  |  |  |  |  190|  22.0k|            }                                                                  \
  |  |  |  |  |  |  191|  22.3k|        }                                                                      \
  |  |  |  |  |  |  192|  24.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 24.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  24.4k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  24.3k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  24.3k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  24.3k|    do                                                                         \
  |  |  |  |  |  |  197|  24.3k|    {                                                                          \
  |  |  |  |  |  |  198|  24.3k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  24.3k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  24.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 24.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  24.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 24.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|  24.4k|                switch (TabEnt->State)                                         \
  |  |  404|  24.3k|                {                                                              \
  |  |  405|    177|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|    177|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 177, False: 24.2k]
  |  |  ------------------
  |  |  406|    177|                        EOLcnt = 1;                                            \
  |  |  407|    177|                        goto done1d;                                           \
  |  |  408|  24.0k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|  24.0k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 24.0k, False: 314]
  |  |  ------------------
  |  |  409|  24.0k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|  24.0k|    do                                                                         \
  |  |  |  |  267|  24.0k|    {                                                                          \
  |  |  |  |  268|  24.0k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 24.0k]
  |  |  |  |  ------------------
  |  |  |  |  269|  24.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|  24.0k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  24.0k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  24.0k|        RunLength = 0;                                                         \
  |  |  |  |  279|  24.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 24.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|  24.0k|                        goto doneBlack1d;                                      \
  |  |  411|  24.0k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|     78|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 78, False: 24.3k]
  |  |  ------------------
  |  |  412|    108|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|    108|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 30, False: 24.3k]
  |  |  ------------------
  |  |  413|    108|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|    108|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|    108|                        break;                                                 \
  |  |  416|     78|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 29, False: 24.3k]
  |  |  ------------------
  |  |  417|     29|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|     29|    do                                                                         \
  |  |  |  |  221|     29|    {                                                                          \
  |  |  |  |  222|     29|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|     29|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|     29|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|     29|                        goto done1d;                                           \
  |  |  419|  24.3k|                }                                                              \
  |  |  420|  24.3k|            }                                                                  \
  |  |  421|  24.3k|        doneBlack1d:                                                           \
  |  |  422|  24.0k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 4.71k, False: 19.3k]
  |  |  ------------------
  |  |  423|  24.0k|                goto done1d;                                                   \
  |  |  424|  24.0k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 170, False: 19.1k]
  |  |  |  Branch (424:35): [True: 170, False: 0]
  |  |  ------------------
  |  |  425|  19.3k|                pa -= 2;                                                       \
  |  |  426|  19.3k|        }                                                                      \
  |  |  427|  79.3k|    eof1d:                                                                     \
  |  |  428|    362|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|    362|    do                                                                         \
  |  |  |  |  272|    362|    {                                                                          \
  |  |  |  |  273|    362|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|    362|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|    362|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 362]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|    362|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|    362|    do                                                                         \
  |  |  |  |  334|    362|    {                                                                          \
  |  |  |  |  335|    362|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 91, False: 271]
  |  |  |  |  ------------------
  |  |  |  |  336|    362|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|     91|    do                                                                         \
  |  |  |  |  |  |  267|     91|    {                                                                          \
  |  |  |  |  |  |  268|     91|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 91]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|     91|        {                                                                      \
  |  |  |  |  |  |  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|     91|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|     91|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|     91|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|     91|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 91]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|    362|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 321, False: 41]
  |  |  |  |  ------------------
  |  |  |  |  338|    362|        {                                                                      \
  |  |  |  |  339|    321|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    321|    do                                                                         \
  |  |  |  |  |  |  254|    321|    {                                                                          \
  |  |  |  |  |  |  255|    321|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    321|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    321|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    321|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 321]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|    369|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 48, False: 321]
  |  |  |  |  |  Branch (340:39): [True: 48, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    321|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    321|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 321, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    321|            {                                                                  \
  |  |  |  |  344|    321|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 321]
  |  |  |  |  ------------------
  |  |  |  |  345|    321|                    a0 = 0;                                                    \
  |  |  |  |  346|    321|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 35, False: 286]
  |  |  |  |  ------------------
  |  |  |  |  347|    321|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|     35|    do                                                                         \
  |  |  |  |  |  |  267|     35|    {                                                                          \
  |  |  |  |  |  |  268|     35|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 35]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|     35|        {                                                                      \
  |  |  |  |  |  |  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|     35|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|     35|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|     35|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|     35|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 35]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    321|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    321|    do                                                                         \
  |  |  |  |  |  |  267|    321|    {                                                                          \
  |  |  |  |  |  |  268|    321|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 321]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    321|        {                                                                      \
  |  |  |  |  |  |  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|    321|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    321|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    321|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    321|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 321]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    321|            }                                                                  \
  |  |  |  |  350|    321|            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|    321|        }                                                                      \
  |  |  |  |  356|    362|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 362]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|    362|        goto eoflab;                                                           \
  |  |  431|  78.9k|    done1d:                                                                    \
  |  |  432|  78.9k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|  78.9k|    do                                                                         \
  |  |  |  |  334|  78.9k|    {                                                                          \
  |  |  |  |  335|  78.9k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 385, False: 78.5k]
  |  |  |  |  ------------------
  |  |  |  |  336|  78.9k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    385|    do                                                                         \
  |  |  |  |  |  |  267|    385|    {                                                                          \
  |  |  |  |  |  |  268|    385|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 385]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    385|        {                                                                      \
  |  |  |  |  |  |  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|    385|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    385|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    385|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    385|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 385]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  78.9k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 74.5k, False: 4.37k]
  |  |  |  |  ------------------
  |  |  |  |  338|  78.9k|        {                                                                      \
  |  |  |  |  339|  74.5k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  74.5k|    do                                                                         \
  |  |  |  |  |  |  254|  74.5k|    {                                                                          \
  |  |  |  |  |  |  255|  74.5k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  74.5k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  74.5k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  74.5k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 74.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  87.4k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 12.8k, False: 74.5k]
  |  |  |  |  |  Branch (340:39): [True: 12.8k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  74.5k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  74.5k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 74.5k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|  74.5k|            {                                                                  \
  |  |  |  |  344|  74.5k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 74.5k]
  |  |  |  |  ------------------
  |  |  |  |  345|  74.5k|                    a0 = 0;                                                    \
  |  |  |  |  346|  74.5k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 5.00k, False: 69.5k]
  |  |  |  |  ------------------
  |  |  |  |  347|  74.5k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  5.00k|    do                                                                         \
  |  |  |  |  |  |  267|  5.00k|    {                                                                          \
  |  |  |  |  |  |  268|  5.00k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 5.00k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  5.00k|        {                                                                      \
  |  |  |  |  |  |  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.00k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  5.00k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  5.00k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  5.00k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 5.00k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  74.5k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  74.5k|    do                                                                         \
  |  |  |  |  |  |  267|  74.5k|    {                                                                          \
  |  |  |  |  |  |  268|  74.5k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 74.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  74.5k|        {                                                                      \
  |  |  |  |  |  |  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|  74.5k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  74.5k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  74.5k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  74.5k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 74.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  74.5k|            }                                                                  \
  |  |  |  |  350|  74.5k|            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|  74.5k|        }                                                                      \
  |  |  |  |  356|  78.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 78.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|  78.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 78.9k]
  |  |  ------------------
  ------------------
 1826|  78.9k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1827|       |        /*
 1828|       |         * Cleanup at the end of the row.
 1829|       |         */
 1830|  78.9k|        if (mode & FAXMODE_BYTEALIGN)
  ------------------
  |  |  701|  78.9k|#define FAXMODE_BYTEALIGN 0x0004     /* byte align row */
  ------------------
  |  Branch (1830:13): [True: 78.3k, False: 583]
  ------------------
 1831|  78.3k|        {
 1832|  78.3k|            int n = BitsAvail - (BitsAvail & ~7);
 1833|  78.3k|            ClrBits(n);
  ------------------
  |  |  196|  78.3k|    do                                                                         \
  |  |  197|  78.3k|    {                                                                          \
  |  |  198|  78.3k|        BitsAvail -= (n);                                                      \
  |  |  199|  78.3k|        BitAcc >>= (n);                                                        \
  |  |  200|  78.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 78.3k]
  |  |  ------------------
  ------------------
 1834|  78.3k|        }
 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|    542|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (1839:17): [True: 542, False: 41]
  |  Branch (1839:35): [True: 305, False: 237]
  ------------------
 1840|    305|                cp++;
 1841|    583|        }
 1842|  78.9k|        buf += sp->b.rowbytes;
 1843|  78.9k|        occ -= sp->b.rowbytes;
 1844|  78.9k|        sp->line++;
 1845|  78.9k|        continue;
 1846|    362|    EOFRLE: /* premature EOF */
 1847|    362|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1848|    362|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|    362|    do                                                                         \
  |  |  160|    362|    {                                                                          \
  |  |  161|    362|        sp->bit = BitsAvail;                                                   \
  |  |  162|    362|        sp->data = BitAcc;                                                     \
  |  |  163|    362|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|    362|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|    362|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|    362|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 362]
  |  |  ------------------
  ------------------
 1849|    362|        return (-1);
 1850|  79.3k|    }
 1851|  8.82k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  8.82k|    do                                                                         \
  |  |  160|  8.82k|    {                                                                          \
  |  |  161|  8.82k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  8.82k|        sp->data = BitAcc;                                                     \
  |  |  163|  8.82k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  8.82k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  8.82k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  8.82k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 8.82k]
  |  |  ------------------
  ------------------
 1852|  8.82k|    return (1);
 1853|  9.18k|}

TIFFRGBAImageOK:
   85|  4.64k|{
   86|  4.64k|    TIFFDirectory *td = &tif->tif_dir;
   87|  4.64k|    uint16_t photometric;
   88|  4.64k|    int colorchannels;
   89|       |
   90|  4.64k|    if (!tif->tif_decodestatus)
  ------------------
  |  Branch (90:9): [True: 2, False: 4.63k]
  ------------------
   91|      2|    {
   92|      2|        snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      2|#define EMSG_BUF_SIZE 1024
  ------------------
   93|      2|                 "Sorry, requested compression method is not configured");
   94|      2|        return (0);
   95|      2|    }
   96|  4.63k|    switch (td->td_bitspersample)
   97|  4.63k|    {
   98|    538|        case 1:
  ------------------
  |  Branch (98:9): [True: 538, False: 4.10k]
  ------------------
   99|    598|        case 2:
  ------------------
  |  Branch (99:9): [True: 60, False: 4.57k]
  ------------------
  100|    620|        case 4:
  ------------------
  |  Branch (100:9): [True: 22, False: 4.61k]
  ------------------
  101|  3.24k|        case 8:
  ------------------
  |  Branch (101:9): [True: 2.62k, False: 2.01k]
  ------------------
  102|  3.52k|        case 16:
  ------------------
  |  Branch (102:9): [True: 279, False: 4.36k]
  ------------------
  103|  3.52k|            break;
  104|  1.11k|        default:
  ------------------
  |  Branch (104:9): [True: 1.11k, False: 3.52k]
  ------------------
  105|  1.11k|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|  1.11k|#define EMSG_BUF_SIZE 1024
  ------------------
  106|  1.11k|                     "Sorry, can not handle images with %" PRIu16
  107|  1.11k|                     "-bit samples",
  108|  1.11k|                     td->td_bitspersample);
  109|  1.11k|            return (0);
  110|  4.63k|    }
  111|  3.52k|    if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|  3.52k|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (111:9): [True: 35, False: 3.49k]
  ------------------
  112|     35|    {
  113|     35|        snprintf(
  114|     35|            emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     35|#define EMSG_BUF_SIZE 1024
  ------------------
  115|     35|            "Sorry, can not handle images with IEEE floating-point samples");
  116|     35|        return (0);
  117|     35|    }
  118|  3.49k|    colorchannels = td->td_samplesperpixel - td->td_extrasamples;
  119|  3.49k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric))
  ------------------
  |  |  220|  3.49k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (119:9): [True: 1.72k, False: 1.76k]
  ------------------
  120|  1.72k|    {
  121|  1.72k|        switch (colorchannels)
  122|  1.72k|        {
  123|  1.72k|            case 1:
  ------------------
  |  Branch (123:13): [True: 1.72k, False: 8]
  ------------------
  124|  1.72k|                photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|  1.72k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  125|  1.72k|                break;
  126|      0|            case 3:
  ------------------
  |  Branch (126:13): [True: 0, False: 1.72k]
  ------------------
  127|      0|                photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  128|      0|                break;
  129|      8|            default:
  ------------------
  |  Branch (129:13): [True: 8, False: 1.72k]
  ------------------
  130|      8|                snprintf(emsg, EMSG_BUF_SIZE, "Missing needed %s tag",
  ------------------
  |  |   53|      8|#define EMSG_BUF_SIZE 1024
  ------------------
  131|      8|                         photoTag);
  132|      8|                return (0);
  133|  1.72k|        }
  134|  1.72k|    }
  135|  3.48k|    switch (photometric)
  136|  3.48k|    {
  137|     11|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|     11|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (137:9): [True: 11, False: 3.47k]
  ------------------
  138|  1.82k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.82k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (138:9): [True: 1.81k, False: 1.66k]
  ------------------
  139|  1.85k|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|  1.85k|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (139:9): [True: 29, False: 3.45k]
  ------------------
  140|  1.85k|            if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  3.71k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (140:17): [True: 1.71k, False: 147]
  ------------------
  141|  1.71k|                td->td_samplesperpixel != 1 && td->td_bitspersample < 8)
  ------------------
  |  Branch (141:17): [True: 305, False: 1.40k]
  |  Branch (141:48): [True: 11, False: 294]
  ------------------
  142|     11|            {
  143|     11|                snprintf(
  144|     11|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     11|#define EMSG_BUF_SIZE 1024
  ------------------
  145|     11|                    "Sorry, can not handle contiguous data with %s=%" PRIu16
  146|     11|                    ", "
  147|     11|                    "and %s=%" PRIu16 " and Bits/Sample=%" PRIu16 "",
  148|     11|                    photoTag, photometric, "Samples/pixel",
  149|     11|                    td->td_samplesperpixel, td->td_bitspersample);
  150|     11|                return (0);
  151|     11|            }
  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.84k|            break;
  158|  1.84k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  1.42k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (158:9): [True: 1.42k, False: 2.06k]
  ------------------
  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.42k|            break;
  166|     87|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|     87|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (166:9): [True: 87, False: 3.39k]
  ------------------
  167|     87|            if (colorchannels < 3)
  ------------------
  |  Branch (167:17): [True: 25, False: 62]
  ------------------
  168|     25|            {
  169|     25|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     25|#define EMSG_BUF_SIZE 1024
  ------------------
  170|     25|                         "Sorry, can not handle RGB image with %s=%d",
  171|     25|                         "Color channels", colorchannels);
  172|     25|                return (0);
  173|     25|            }
  174|     62|            break;
  175|     62|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     48|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (175:9): [True: 48, False: 3.43k]
  ------------------
  176|     48|        {
  177|     48|            uint16_t inkset;
  178|     48|            TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  322|     48|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  179|     48|            if (inkset != INKSET_CMYK)
  ------------------
  |  |  323|     48|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (179:17): [True: 1, False: 47]
  ------------------
  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|     47|            if (td->td_samplesperpixel < 4)
  ------------------
  |  Branch (186:17): [True: 0, False: 47]
  ------------------
  187|      0|            {
  188|      0|                snprintf(
  189|      0|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  190|      0|                    "Sorry, can not handle separated image with %s=%" PRIu16,
  191|      0|                    "Samples/pixel", td->td_samplesperpixel);
  192|      0|                return 0;
  193|      0|            }
  194|     47|            break;
  195|     47|        }
  196|     47|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     17|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (196:9): [True: 17, False: 3.46k]
  ------------------
  197|     17|            if (td->td_compression != COMPRESSION_SGILOG)
  ------------------
  |  |  210|     17|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (197:17): [True: 3, False: 14]
  ------------------
  198|      3|            {
  199|      3|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      3|#define EMSG_BUF_SIZE 1024
  ------------------
  200|      3|                         "Sorry, LogL data must have %s=%d", "Compression",
  201|      3|                         COMPRESSION_SGILOG);
  ------------------
  |  |  210|      3|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  202|      3|                return (0);
  203|      3|            }
  204|     14|            break;
  205|     17|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|     17|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (205:9): [True: 17, False: 3.46k]
  ------------------
  206|     17|            if (td->td_compression != COMPRESSION_SGILOG &&
  ------------------
  |  |  210|     34|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (206:17): [True: 11, False: 6]
  ------------------
  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|     16|            if (td->td_planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|     16|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (215:17): [True: 0, False: 16]
  ------------------
  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|     16|            if (td->td_samplesperpixel != 3 || colorchannels != 3)
  ------------------
  |  Branch (222:17): [True: 0, False: 16]
  |  Branch (222:48): [True: 12, False: 4]
  ------------------
  223|     12|            {
  224|     12|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     12|#define EMSG_BUF_SIZE 1024
  ------------------
  225|     12|                         "Sorry, can not handle image with %s=%" PRIu16
  226|     12|                         ", %s=%d",
  227|     12|                         "Samples/pixel", td->td_samplesperpixel,
  228|     12|                         "colorchannels", colorchannels);
  229|     12|                return 0;
  230|     12|            }
  231|      4|            break;
  232|     15|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|     15|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (232:9): [True: 15, False: 3.47k]
  ------------------
  233|     15|            if (td->td_samplesperpixel != 3 || colorchannels != 3 ||
  ------------------
  |  Branch (233:17): [True: 0, False: 15]
  |  Branch (233:48): [True: 1, False: 14]
  ------------------
  234|     14|                (td->td_bitspersample != 8 && td->td_bitspersample != 16))
  ------------------
  |  Branch (234:18): [True: 8, False: 6]
  |  Branch (234:47): [True: 0, False: 8]
  ------------------
  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|     14|            break;
  245|     23|        default:
  ------------------
  |  Branch (245:9): [True: 23, False: 3.46k]
  ------------------
  246|     23|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     23|#define EMSG_BUF_SIZE 1024
  ------------------
  247|     23|                     "Sorry, can not handle image with %s=%" PRIu16, photoTag,
  248|     23|                     photometric);
  249|     23|            return (0);
  250|  3.48k|    }
  251|  3.40k|    return (1);
  252|  3.48k|}
TIFFRGBAImageEnd:
  255|  3.40k|{
  256|  3.40k|    if (img->Map)
  ------------------
  |  Branch (256:9): [True: 2, False: 3.40k]
  ------------------
  257|      2|    {
  258|      2|        _TIFFfreeExt(img->tif, img->Map);
  259|      2|        img->Map = NULL;
  260|      2|    }
  261|  3.40k|    if (img->BWmap)
  ------------------
  |  Branch (261:9): [True: 1.71k, False: 1.69k]
  ------------------
  262|  1.71k|    {
  263|  1.71k|        _TIFFfreeExt(img->tif, img->BWmap);
  264|  1.71k|        img->BWmap = NULL;
  265|  1.71k|    }
  266|  3.40k|    if (img->PALmap)
  ------------------
  |  Branch (266:9): [True: 29, False: 3.37k]
  ------------------
  267|     29|    {
  268|     29|        _TIFFfreeExt(img->tif, img->PALmap);
  269|     29|        img->PALmap = NULL;
  270|     29|    }
  271|  3.40k|    if (img->ycbcr)
  ------------------
  |  Branch (271:9): [True: 1.13k, False: 2.27k]
  ------------------
  272|  1.13k|    {
  273|  1.13k|        _TIFFfreeExt(img->tif, img->ycbcr);
  274|  1.13k|        img->ycbcr = NULL;
  275|  1.13k|    }
  276|  3.40k|    if (img->cielab)
  ------------------
  |  Branch (276:9): [True: 13, False: 3.39k]
  ------------------
  277|     13|    {
  278|     13|        _TIFFfreeExt(img->tif, img->cielab);
  279|     13|        img->cielab = NULL;
  280|     13|    }
  281|  3.40k|    if (img->UaToAa)
  ------------------
  |  Branch (281:9): [True: 57, False: 3.35k]
  ------------------
  282|     57|    {
  283|     57|        _TIFFfreeExt(img->tif, img->UaToAa);
  284|     57|        img->UaToAa = NULL;
  285|     57|    }
  286|  3.40k|    if (img->Bitdepth16To8)
  ------------------
  |  Branch (286:9): [True: 80, False: 3.32k]
  ------------------
  287|     80|    {
  288|     80|        _TIFFfreeExt(img->tif, img->Bitdepth16To8);
  289|     80|        img->Bitdepth16To8 = NULL;
  290|     80|    }
  291|       |
  292|  3.40k|    if (img->redcmap)
  ------------------
  |  Branch (292:9): [True: 29, False: 3.37k]
  ------------------
  293|     29|    {
  294|     29|        _TIFFfreeExt(img->tif, img->redcmap);
  295|     29|        _TIFFfreeExt(img->tif, img->greencmap);
  296|     29|        _TIFFfreeExt(img->tif, img->bluecmap);
  297|       |        img->redcmap = img->greencmap = img->bluecmap = NULL;
  298|     29|    }
  299|  3.40k|}
TIFFRGBAImageBegin:
  313|  4.64k|{
  314|  4.64k|    uint16_t *sampleinfo;
  315|  4.64k|    uint16_t extrasamples;
  316|  4.64k|    uint16_t planarconfig;
  317|  4.64k|    uint16_t compress;
  318|  4.64k|    int colorchannels;
  319|  4.64k|    uint16_t *red_orig, *green_orig, *blue_orig;
  320|  4.64k|    uint32_t n_color;
  321|       |
  322|  4.64k|    if (!TIFFRGBAImageOK(tif, emsg))
  ------------------
  |  Branch (322:9): [True: 1.23k, False: 3.40k]
  ------------------
  323|  1.23k|        return 0;
  324|       |
  325|       |    /* Initialize to normal values */
  326|  3.40k|    img->row_offset = 0;
  327|  3.40k|    img->col_offset = 0;
  328|  3.40k|    img->redcmap = NULL;
  329|  3.40k|    img->greencmap = NULL;
  330|  3.40k|    img->bluecmap = NULL;
  331|  3.40k|    img->Map = NULL;
  332|  3.40k|    img->BWmap = NULL;
  333|  3.40k|    img->PALmap = NULL;
  334|  3.40k|    img->ycbcr = NULL;
  335|  3.40k|    img->cielab = NULL;
  336|  3.40k|    img->UaToAa = NULL;
  337|  3.40k|    img->Bitdepth16To8 = NULL;
  338|  3.40k|    img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
  ------------------
  |  |  252|  3.40k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  339|       |
  340|  3.40k|    img->tif = tif;
  341|  3.40k|    img->stoponerr = stop;
  342|  3.40k|    TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
  ------------------
  |  |  180|  3.40k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  343|  3.40k|    switch (img->bitspersample)
  344|  3.40k|    {
  345|    518|        case 1:
  ------------------
  |  Branch (345:9): [True: 518, False: 2.89k]
  ------------------
  346|    576|        case 2:
  ------------------
  |  Branch (346:9): [True: 58, False: 3.35k]
  ------------------
  347|    597|        case 4:
  ------------------
  |  Branch (347:9): [True: 21, False: 3.38k]
  ------------------
  348|  3.18k|        case 8:
  ------------------
  |  Branch (348:9): [True: 2.59k, False: 817]
  ------------------
  349|  3.40k|        case 16:
  ------------------
  |  Branch (349:9): [True: 220, False: 3.18k]
  ------------------
  350|  3.40k|            break;
  351|      0|        default:
  ------------------
  |  Branch (351:9): [True: 0, False: 3.40k]
  ------------------
  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.40k|    }
  358|  3.40k|    img->alpha = 0;
  359|  3.40k|    TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
  ------------------
  |  |  257|  3.40k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  360|  3.40k|    TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, &extrasamples,
  ------------------
  |  |  329|  3.40k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  361|  3.40k|                          &sampleinfo);
  362|  3.40k|    if (extrasamples >= 1)
  ------------------
  |  Branch (362:9): [True: 506, False: 2.90k]
  ------------------
  363|    506|    {
  364|    506|        switch (sampleinfo[0])
  365|    506|        {
  366|    332|            case EXTRASAMPLE_UNSPECIFIED: /* Workaround for some images without
  ------------------
  |  |  330|    332|#define EXTRASAMPLE_UNSPECIFIED 0          /* !unspecified data */
  ------------------
  |  Branch (366:13): [True: 332, False: 174]
  ------------------
  367|       |                                           */
  368|    332|                if (img->samplesperpixel >
  ------------------
  |  Branch (368:21): [True: 127, False: 205]
  ------------------
  369|    332|                    3) /* correct info about alpha channel */
  370|    127|                    img->alpha = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|    127|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  371|    332|                break;
  372|     89|            case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */
  ------------------
  |  |  331|     89|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (372:13): [True: 89, False: 417]
  ------------------
  373|    174|            case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */
  ------------------
  |  |  332|    174|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (373:13): [True: 85, False: 421]
  ------------------
  374|    174|                img->alpha = sampleinfo[0];
  375|    174|                break;
  376|      0|            default:
  ------------------
  |  Branch (376:13): [True: 0, False: 506]
  ------------------
  377|      0|                break;
  378|    506|        }
  379|    506|    }
  380|       |
  381|  3.40k|#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA
  382|  3.40k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
  ------------------
  |  |  220|  3.40k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (382:9): [True: 1.71k, False: 1.69k]
  ------------------
  383|  1.71k|        img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  221|  1.71k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  384|       |
  385|  3.40k|    if (extrasamples == 0 && img->samplesperpixel == 4 &&
  ------------------
  |  Branch (385:9): [True: 2.90k, False: 506]
  |  Branch (385:30): [True: 9, False: 2.89k]
  ------------------
  386|      9|        img->photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|      9|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (386:9): [True: 0, False: 9]
  ------------------
  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.40k|#endif
  392|       |
  393|  3.40k|    colorchannels = img->samplesperpixel - extrasamples;
  394|  3.40k|    TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  181|  3.40k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  395|  3.40k|    TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
  ------------------
  |  |  264|  3.40k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  396|  3.40k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
  ------------------
  |  |  220|  3.40k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (396:9): [True: 1.71k, False: 1.69k]
  ------------------
  397|  1.71k|    {
  398|  1.71k|        switch (colorchannels)
  399|  1.71k|        {
  400|  1.71k|            case 1:
  ------------------
  |  Branch (400:13): [True: 1.71k, False: 0]
  ------------------
  401|  1.71k|                if (isCCITTCompression(tif))
  ------------------
  |  Branch (401:21): [True: 266, False: 1.44k]
  ------------------
  402|    266|                    img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  221|    266|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  403|  1.44k|                else
  404|  1.44k|                    img->photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|  1.44k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  405|  1.71k|                break;
  406|      0|            case 3:
  ------------------
  |  Branch (406:13): [True: 0, False: 1.71k]
  ------------------
  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.71k]
  ------------------
  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.71k|        }
  414|  1.71k|    }
  415|  3.40k|    switch (img->photometric)
  416|  3.40k|    {
  417|     29|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     29|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (417:9): [True: 29, False: 3.37k]
  ------------------
  418|     29|            if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &red_orig, &green_orig,
  ------------------
  |  |  309|     29|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (418:17): [True: 0, False: 29]
  ------------------
  419|     29|                              &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|     29|            n_color = (uint32_t)(1U << img->bitspersample);
  428|     29|            img->redcmap = (uint16_t *)_TIFFmallocExt(
  429|     29|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  430|     29|            img->greencmap = (uint16_t *)_TIFFmallocExt(
  431|     29|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  432|     29|            img->bluecmap = (uint16_t *)_TIFFmallocExt(
  433|     29|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  434|     29|            if (!img->redcmap || !img->greencmap || !img->bluecmap)
  ------------------
  |  Branch (434:17): [True: 0, False: 29]
  |  Branch (434:34): [True: 0, False: 29]
  |  Branch (434:53): [True: 0, False: 29]
  ------------------
  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|     29|            _TIFFmemcpy(img->redcmap, red_orig, n_color * 2);
  442|     29|            _TIFFmemcpy(img->greencmap, green_orig, n_color * 2);
  443|     29|            _TIFFmemcpy(img->bluecmap, blue_orig, n_color * 2);
  444|       |
  445|       |            /* fall through... */
  446|    306|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|    306|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (446:9): [True: 277, False: 3.13k]
  ------------------
  447|  1.84k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.84k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (447:9): [True: 1.54k, False: 1.86k]
  ------------------
  448|  1.84k|            if (planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  3.69k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (448:17): [True: 1.70k, False: 147]
  ------------------
  449|  1.70k|                img->samplesperpixel != 1 && img->bitspersample < 8)
  ------------------
  |  Branch (449:17): [True: 294, False: 1.40k]
  |  Branch (449:46): [True: 0, False: 294]
  ------------------
  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.84k|            break;
  461|  1.84k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  1.42k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (461:9): [True: 1.42k, False: 1.98k]
  ------------------
  462|       |            /* It would probably be nice to have a reality check here. */
  463|  1.42k|            if (planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.42k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (463:17): [True: 704, False: 716]
  ------------------
  464|       |                /* can rely on libjpeg to convert to RGB */
  465|       |                /* XXX should restore current state on exit */
  466|    704|                switch (compress)
  467|    704|                {
  468|    277|                    case COMPRESSION_JPEG:
  ------------------
  |  |  190|    277|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
  |  Branch (468:21): [True: 277, False: 427]
  ------------------
  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|    277|                        TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE,
  ------------------
  |  |  706|    277|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  476|    277|                                     JPEGCOLORMODE_RGB);
  ------------------
  |  |  708|    277|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  477|    277|                        img->photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|    277|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  478|    277|                        break;
  479|    427|                    default:
  ------------------
  |  Branch (479:21): [True: 427, False: 277]
  ------------------
  480|    427|                        /* do nothing */;
  481|    427|                        break;
  482|    704|                }
  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.42k|            break;
  490|  1.42k|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|     62|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (490:9): [True: 62, False: 3.34k]
  ------------------
  491|     62|            if (colorchannels < 3)
  ------------------
  |  Branch (491:17): [True: 0, False: 62]
  ------------------
  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|     62|            break;
  499|     62|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     47|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (499:9): [True: 47, False: 3.36k]
  ------------------
  500|     47|        {
  501|     47|            uint16_t inkset;
  502|     47|            TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  322|     47|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  503|     47|            if (inkset != INKSET_CMYK)
  ------------------
  |  |  323|     47|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (503:17): [True: 0, False: 47]
  ------------------
  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|     47|            if (img->samplesperpixel < 4)
  ------------------
  |  Branch (511:17): [True: 0, False: 47]
  ------------------
  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|     47|        }
  520|     47|        break;
  521|     47|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     14|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (521:9): [True: 14, False: 3.39k]
  ------------------
  522|     14|            if (compress != COMPRESSION_SGILOG)
  ------------------
  |  |  210|     14|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (522:17): [True: 0, False: 14]
  ------------------
  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|     14|            TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  743|     14|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
                          TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|     14|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  530|     14|            img->photometric = PHOTOMETRIC_MINISBLACK; /* little white lie */
  ------------------
  |  |  222|     14|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  531|     14|            img->bitspersample = 8;
  532|     14|            break;
  533|      4|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|      4|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (533:9): [True: 4, False: 3.40k]
  ------------------
  534|      4|            if (compress != COMPRESSION_SGILOG &&
  ------------------
  |  |  210|      8|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (534:17): [True: 0, False: 4]
  ------------------
  535|      0|                compress != COMPRESSION_SGILOG24)
  ------------------
  |  |  211|      0|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (535:17): [True: 0, False: 0]
  ------------------
  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|      4|            if (planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|      4|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (543:17): [True: 0, False: 4]
  ------------------
  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|      4|            TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  743|      4|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
                          TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|      4|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  551|      4|            img->photometric = PHOTOMETRIC_RGB; /* little white lie */
  ------------------
  |  |  223|      4|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  552|      4|            img->bitspersample = 8;
  553|      4|            break;
  554|     14|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|     14|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (554:9): [True: 14, False: 3.39k]
  ------------------
  555|     14|            break;
  556|      0|        default:
  ------------------
  |  Branch (556:9): [True: 0, False: 3.40k]
  ------------------
  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.40k|    }
  562|  3.40k|    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
  ------------------
  |  |  178|  3.40k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  563|  3.40k|    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
  ------------------
  |  |  179|  3.40k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  564|  3.40k|    TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
  ------------------
  |  |  248|  3.40k|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  565|  3.40k|    img->isContig =
  566|  3.40k|        !(planarconfig == PLANARCONFIG_SEPARATE && img->samplesperpixel > 1);
  ------------------
  |  |  266|  6.81k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (566:11): [True: 914, False: 2.49k]
  |  Branch (566:52): [True: 882, False: 32]
  ------------------
  567|  3.40k|    if (img->isContig)
  ------------------
  |  Branch (567:9): [True: 2.52k, False: 882]
  ------------------
  568|  2.52k|    {
  569|  2.52k|        if (!PickContigCase(img))
  ------------------
  |  Branch (569:13): [True: 30, False: 2.49k]
  ------------------
  570|     30|        {
  571|     30|            snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   53|     30|#define EMSG_BUF_SIZE 1024
  ------------------
  572|     30|            goto fail_return;
  573|     30|        }
  574|  2.52k|    }
  575|    882|    else
  576|    882|    {
  577|    882|        if (!PickSeparateCase(img))
  ------------------
  |  Branch (577:13): [True: 35, False: 847]
  ------------------
  578|     35|        {
  579|     35|            snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   53|     35|#define EMSG_BUF_SIZE 1024
  ------------------
  580|     35|            goto fail_return;
  581|     35|        }
  582|    882|    }
  583|  3.34k|    return 1;
  584|       |
  585|     65|fail_return:
  586|     65|    TIFFRGBAImageEnd(img);
  587|     65|    return 0;
  588|  3.40k|}
TIFFRGBAImageGet:
  592|  3.34k|{
  593|  3.34k|    if (img->get == NULL)
  ------------------
  |  Branch (593:9): [True: 0, False: 3.34k]
  ------------------
  594|      0|    {
  595|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  596|      0|                      "No \"get\" routine setup");
  597|      0|        return (0);
  598|      0|    }
  599|  3.34k|    if (img->put.any == NULL)
  ------------------
  |  Branch (599:9): [True: 0, False: 3.34k]
  ------------------
  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.34k|    if (0 <= img->row_offset && (uint32_t)img->row_offset < img->height)
  ------------------
  |  Branch (608:9): [True: 3.34k, False: 0]
  |  Branch (608:33): [True: 3.34k, False: 0]
  ------------------
  609|  3.34k|    {
  610|  3.34k|        uint32_t hx = img->height - (uint32_t)img->row_offset;
  611|  3.34k|        if (h > hx)
  ------------------
  |  Branch (611:13): [True: 0, False: 3.34k]
  ------------------
  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.34k|    }
  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.34k|    return (*img->get)(img, raster, w, h);
  628|  3.34k|}
TIFFReadRGBAImageOriented:
  636|  4.64k|{
  637|  4.64k|    char emsg[EMSG_BUF_SIZE] = "";
  638|  4.64k|    TIFFRGBAImage img;
  639|  4.64k|    int ok;
  640|       |
  641|  4.64k|    if (TIFFRGBAImageBegin(&img, tif, stop, emsg))
  ------------------
  |  Branch (641:9): [True: 3.34k, False: 1.29k]
  ------------------
  642|  3.34k|    {
  643|  3.34k|        img.req_orientation = (uint16_t)orientation;
  644|  3.34k|        ok = TIFFRGBAImageGet(&img, raster, rwidth, rheight);
  645|  3.34k|        TIFFRGBAImageEnd(&img);
  646|  3.34k|    }
  647|  1.29k|    else
  648|  1.29k|    {
  649|  1.29k|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s", emsg);
  650|  1.29k|        ok = 0;
  651|  1.29k|    }
  652|  4.64k|    return (ok);
  653|  4.64k|}
TIFFReadRGBAImage:
  661|  4.64k|{
  662|  4.64k|    return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
  663|  4.64k|                                     ORIENTATION_BOTLEFT, stop);
  ------------------
  |  |  252|  4.64k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  664|  4.64k|}
tif_getimage.c:isCCITTCompression:
  302|  1.71k|{
  303|  1.71k|    uint16_t compress;
  304|  1.71k|    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  181|  1.71k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  305|  1.71k|    return (compress == COMPRESSION_CCITTFAX3 ||
  ------------------
  |  |  184|  3.42k|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (305:13): [True: 170, False: 1.54k]
  ------------------
  306|  1.54k|            compress == COMPRESSION_CCITTFAX4 ||
  ------------------
  |  |  186|  3.25k|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (306:13): [True: 63, False: 1.47k]
  ------------------
  307|  1.47k|            compress == COMPRESSION_CCITTRLE ||
  ------------------
  |  |  183|  3.19k|#define COMPRESSION_CCITTRLE 2        /* CCITT modified Huffman RLE */
  ------------------
  |  Branch (307:13): [True: 10, False: 1.46k]
  ------------------
  308|  1.46k|            compress == COMPRESSION_CCITTRLEW);
  ------------------
  |  |  194|  1.46k|#define COMPRESSION_CCITTRLEW 32771   /* #1 w/ word alignment */
  ------------------
  |  Branch (308:13): [True: 23, False: 1.44k]
  ------------------
  309|  1.71k|}
tif_getimage.c:PickContigCase:
 3123|  2.52k|{
 3124|  2.52k|    img->get = TIFFIsTiled(img->tif) ? gtTileContig : gtStripContig;
  ------------------
  |  Branch (3124:16): [True: 1.92k, False: 605]
  ------------------
 3125|  2.52k|    img->put.contig = NULL;
 3126|  2.52k|    switch (img->photometric)
 3127|  2.52k|    {
 3128|    333|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|    333|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3128:9): [True: 333, False: 2.19k]
  ------------------
 3129|    333|            switch (img->bitspersample)
 3130|    333|            {
 3131|    292|                case 8:
  ------------------
  |  Branch (3131:17): [True: 292, False: 41]
  ------------------
 3132|    292|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  331|    584|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3132:25): [True: 5, False: 287]
  ------------------
 3133|      5|                        img->samplesperpixel >= 4)
  ------------------
  |  Branch (3133:25): [True: 4, False: 1]
  ------------------
 3134|      4|                        img->put.contig = putRGBAAcontig8bittile;
 3135|    288|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  332|    576|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3135:30): [True: 8, False: 280]
  ------------------
 3136|      8|                             img->samplesperpixel >= 4)
  ------------------
  |  Branch (3136:30): [True: 7, False: 1]
  ------------------
 3137|      7|                    {
 3138|      7|                        if (BuildMapUaToAa(img))
  ------------------
  |  Branch (3138:29): [True: 7, False: 0]
  ------------------
 3139|      7|                            img->put.contig = putRGBUAcontig8bittile;
 3140|      7|                    }
 3141|    281|                    else if (img->samplesperpixel >= 3)
  ------------------
  |  Branch (3141:30): [True: 281, False: 0]
  ------------------
 3142|    281|                        img->put.contig = putRGBcontig8bittile;
 3143|    292|                    break;
 3144|     28|                case 16:
  ------------------
  |  Branch (3144:17): [True: 28, False: 305]
  ------------------
 3145|     28|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  331|     56|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3145:25): [True: 5, False: 23]
  ------------------
 3146|      5|                        img->samplesperpixel >= 4)
  ------------------
  |  Branch (3146:25): [True: 4, False: 1]
  ------------------
 3147|      4|                    {
 3148|      4|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3148:29): [True: 4, False: 0]
  ------------------
 3149|      4|                            img->put.contig = putRGBAAcontig16bittile;
 3150|      4|                    }
 3151|     24|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  332|     48|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3151:30): [True: 4, False: 20]
  ------------------
 3152|      4|                             img->samplesperpixel >= 4)
  ------------------
  |  Branch (3152:30): [True: 4, False: 0]
  ------------------
 3153|      4|                    {
 3154|      4|                        if (BuildMapBitdepth16To8(img) && BuildMapUaToAa(img))
  ------------------
  |  Branch (3154:29): [True: 4, False: 0]
  |  Branch (3154:59): [True: 4, False: 0]
  ------------------
 3155|      4|                            img->put.contig = putRGBUAcontig16bittile;
 3156|      4|                    }
 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|     28|                    break;
 3163|     13|                default:
  ------------------
  |  Branch (3163:17): [True: 13, False: 320]
  ------------------
 3164|     13|                    break;
 3165|    333|            }
 3166|    333|            break;
 3167|    333|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|      7|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3167:9): [True: 7, False: 2.51k]
  ------------------
 3168|      7|            if (img->samplesperpixel >= 4 && buildMap(img))
  ------------------
  |  Branch (3168:17): [True: 7, False: 0]
  |  Branch (3168:46): [True: 7, False: 0]
  ------------------
 3169|      7|            {
 3170|      7|                if (img->bitspersample == 8)
  ------------------
  |  Branch (3170:21): [True: 5, False: 2]
  ------------------
 3171|      5|                {
 3172|      5|                    if (!img->Map)
  ------------------
  |  Branch (3172:25): [True: 5, False: 0]
  ------------------
 3173|      5|                        img->put.contig = putRGBcontig8bitCMYKtile;
 3174|      0|                    else
 3175|      0|                        img->put.contig = putRGBcontig8bitCMYKMaptile;
 3176|      5|                }
 3177|      7|            }
 3178|      7|            break;
 3179|     29|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     29|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (3179:9): [True: 29, False: 2.49k]
  ------------------
 3180|     29|            if (buildMap(img))
  ------------------
  |  Branch (3180:17): [True: 29, False: 0]
  ------------------
 3181|     29|            {
 3182|     29|                switch (img->bitspersample)
 3183|     29|                {
 3184|     15|                    case 8:
  ------------------
  |  Branch (3184:21): [True: 15, False: 14]
  ------------------
 3185|     15|                        img->put.contig = put8bitcmaptile;
 3186|     15|                        break;
 3187|      1|                    case 4:
  ------------------
  |  Branch (3187:21): [True: 1, False: 28]
  ------------------
 3188|      1|                        img->put.contig = put4bitcmaptile;
 3189|      1|                        break;
 3190|     13|                    case 2:
  ------------------
  |  Branch (3190:21): [True: 13, False: 16]
  ------------------
 3191|     13|                        img->put.contig = put2bitcmaptile;
 3192|     13|                        break;
 3193|      0|                    case 1:
  ------------------
  |  Branch (3193:21): [True: 0, False: 29]
  ------------------
 3194|      0|                        img->put.contig = put1bitcmaptile;
 3195|      0|                        break;
 3196|      0|                    default:
  ------------------
  |  Branch (3196:21): [True: 0, False: 29]
  ------------------
 3197|      0|                        break;
 3198|     29|                }
 3199|     29|            }
 3200|     29|            break;
 3201|    274|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|    274|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3201:9): [True: 274, False: 2.25k]
  ------------------
 3202|  1.71k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.71k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3202:9): [True: 1.44k, False: 1.08k]
  ------------------
 3203|  1.71k|            if (buildMap(img))
  ------------------
  |  Branch (3203:17): [True: 1.71k, False: 0]
  ------------------
 3204|  1.71k|            {
 3205|  1.71k|                switch (img->bitspersample)
 3206|  1.71k|                {
 3207|    132|                    case 16:
  ------------------
  |  Branch (3207:21): [True: 132, False: 1.58k]
  ------------------
 3208|    132|                        img->put.contig = put16bitbwtile;
 3209|    132|                        break;
 3210|  1.03k|                    case 8:
  ------------------
  |  Branch (3210:21): [True: 1.03k, False: 681]
  ------------------
 3211|  1.03k|                        if (img->alpha && img->samplesperpixel == 2)
  ------------------
  |  Branch (3211:29): [True: 91, False: 944]
  |  Branch (3211:43): [True: 23, False: 68]
  ------------------
 3212|     23|                            img->put.contig = putagreytile;
 3213|  1.01k|                        else
 3214|  1.01k|                            img->put.contig = putgreytile;
 3215|  1.03k|                        break;
 3216|     20|                    case 4:
  ------------------
  |  Branch (3216:21): [True: 20, False: 1.69k]
  ------------------
 3217|     20|                        img->put.contig = put4bitbwtile;
 3218|     20|                        break;
 3219|     43|                    case 2:
  ------------------
  |  Branch (3219:21): [True: 43, False: 1.67k]
  ------------------
 3220|     43|                        img->put.contig = put2bitbwtile;
 3221|     43|                        break;
 3222|    486|                    case 1:
  ------------------
  |  Branch (3222:21): [True: 486, False: 1.23k]
  ------------------
 3223|    486|                        img->put.contig = put1bitbwtile;
 3224|    486|                        break;
 3225|      0|                    default:
  ------------------
  |  Branch (3225:21): [True: 0, False: 1.71k]
  ------------------
 3226|      0|                        break;
 3227|  1.71k|                }
 3228|  1.71k|            }
 3229|  1.71k|            break;
 3230|  1.71k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|    427|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3230:9): [True: 427, False: 2.09k]
  ------------------
 3231|    427|            if ((img->bitspersample == 8) && (img->samplesperpixel == 3))
  ------------------
  |  Branch (3231:17): [True: 426, False: 1]
  |  Branch (3231:46): [True: 426, False: 0]
  ------------------
 3232|    426|            {
 3233|    426|                if (initYCbCrConversion(img) != 0)
  ------------------
  |  Branch (3233:21): [True: 426, False: 0]
  ------------------
 3234|    426|                {
 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|    426|                    uint16_t SubsamplingHor;
 3245|    426|                    uint16_t SubsamplingVer;
 3246|    426|                    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|    426|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 3247|    426|                                          &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|    426|                    if (img->width < SubsamplingHor ||
  ------------------
  |  Branch (3251:25): [True: 5, False: 421]
  ------------------
 3252|    421|                        img->height < SubsamplingVer)
  ------------------
  |  Branch (3252:25): [True: 7, False: 414]
  ------------------
 3253|     12|                    {
 3254|     12|                        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 3255|     12|                                      "YCbCr subsampling (%u,%u) incompatible "
 3256|     12|                                      "with image size %ux%u",
 3257|     12|                                      SubsamplingHor, SubsamplingVer,
 3258|     12|                                      img->width, img->height);
 3259|     12|                        return (0);
 3260|     12|                    }
 3261|    414|                    switch ((SubsamplingHor << 4) | SubsamplingVer)
 3262|    414|                    {
 3263|     65|                        case 0x44:
  ------------------
  |  Branch (3263:25): [True: 65, False: 349]
  ------------------
 3264|     65|                            img->put.contig = putcontig8bitYCbCr44tile;
 3265|     65|                            break;
 3266|     48|                        case 0x42:
  ------------------
  |  Branch (3266:25): [True: 48, False: 366]
  ------------------
 3267|     48|                            img->put.contig = putcontig8bitYCbCr42tile;
 3268|     48|                            break;
 3269|     15|                        case 0x41:
  ------------------
  |  Branch (3269:25): [True: 15, False: 399]
  ------------------
 3270|     15|                            img->put.contig = putcontig8bitYCbCr41tile;
 3271|     15|                            break;
 3272|    179|                        case 0x22:
  ------------------
  |  Branch (3272:25): [True: 179, False: 235]
  ------------------
 3273|    179|                            img->put.contig = putcontig8bitYCbCr22tile;
 3274|    179|                            break;
 3275|      4|                        case 0x21:
  ------------------
  |  Branch (3275:25): [True: 4, False: 410]
  ------------------
 3276|      4|                            img->put.contig = putcontig8bitYCbCr21tile;
 3277|      4|                            break;
 3278|     26|                        case 0x12:
  ------------------
  |  Branch (3278:25): [True: 26, False: 388]
  ------------------
 3279|     26|                            img->put.contig = putcontig8bitYCbCr12tile;
 3280|     26|                            break;
 3281|     76|                        case 0x11:
  ------------------
  |  Branch (3281:25): [True: 76, False: 338]
  ------------------
 3282|     76|                            img->put.contig = putcontig8bitYCbCr11tile;
 3283|     76|                            break;
 3284|      1|                        default:
  ------------------
  |  Branch (3284:25): [True: 1, False: 413]
  ------------------
 3285|      1|                            break;
 3286|    414|                    }
 3287|    414|                }
 3288|    426|            }
 3289|    415|            break;
 3290|    415|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|     14|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (3290:9): [True: 14, False: 2.51k]
  ------------------
 3291|     14|            if (img->samplesperpixel == 3 && buildMap(img))
  ------------------
  |  Branch (3291:17): [True: 14, False: 0]
  |  Branch (3291:46): [True: 14, False: 0]
  ------------------
 3292|     14|            {
 3293|     14|                if (img->bitspersample == 8 || img->bitspersample == 16)
  ------------------
  |  Branch (3293:21): [True: 6, False: 8]
  |  Branch (3293:48): [True: 8, False: 0]
  ------------------
 3294|     14|                    img->put.contig = initCIELabConversion(img);
 3295|     14|                break;
 3296|     14|            }
 3297|      0|            break;
 3298|      0|        default:
  ------------------
  |  Branch (3298:9): [True: 0, False: 2.52k]
  ------------------
 3299|      0|            break;
 3300|  2.52k|    }
 3301|  2.51k|    return ((img->get != NULL) && (img->put.contig != NULL));
  ------------------
  |  Branch (3301:13): [True: 2.51k, False: 0]
  |  Branch (3301:35): [True: 2.49k, False: 18]
  ------------------
 3302|  2.52k|}
tif_getimage.c:gtTileContig:
  735|  1.91k|{
  736|  1.91k|    TIFF *tif = img->tif;
  737|  1.91k|    tileContigRoutine put = img->put.contig;
  738|  1.91k|    uint32_t col, row, y, rowstoread;
  739|  1.91k|    tmsize_t pos;
  740|  1.91k|    uint32_t tw, th;
  741|  1.91k|    unsigned char *buf = NULL;
  742|  1.91k|    int32_t fromskew, toskew;
  743|  1.91k|    uint32_t nrow;
  744|  1.91k|    int ret = 1, flip;
  745|  1.91k|    uint32_t this_tw, tocol;
  746|  1.91k|    int32_t this_toskew, leftmost_toskew;
  747|  1.91k|    int32_t leftmost_fromskew;
  748|  1.91k|    uint32_t leftmost_tw;
  749|  1.91k|    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.91k|    uint32_t wmin;
  754|       |
  755|  1.91k|    if (0 <= img->col_offset && (uint32_t)img->col_offset < img->width)
  ------------------
  |  Branch (755:9): [True: 1.91k, False: 0]
  |  Branch (755:33): [True: 1.91k, False: 0]
  ------------------
  756|  1.91k|    {
  757|  1.91k|        wmin = TIFFmin(w, img->width - (uint32_t)img->col_offset);
  ------------------
  |  |  337|  1.91k|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 1.91k]
  |  |  ------------------
  ------------------
  758|  1.91k|    }
  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.91k|    bufsize = TIFFTileSize(tif);
  768|  1.91k|    if (bufsize == 0)
  ------------------
  |  Branch (768:9): [True: 0, False: 1.91k]
  ------------------
  769|      0|    {
  770|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "No space for tile buffer");
  771|      0|        return (0);
  772|      0|    }
  773|       |
  774|  1.91k|    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  311|  1.91k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  775|  1.91k|    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  312|  1.91k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  776|       |
  777|  1.91k|    flip = setorientation(img);
  778|  1.91k|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|  1.91k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (778:9): [True: 1.90k, False: 6]
  ------------------
  779|  1.90k|    {
  780|  1.90k|        if (((int64_t)tw + w) > INT_MAX)
  ------------------
  |  Branch (780:13): [True: 0, False: 1.90k]
  ------------------
  781|      0|        {
  782|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  783|      0|                          "unsupported tile size (too wide)");
  784|      0|            return (0);
  785|      0|        }
  786|  1.90k|        y = h - 1;
  787|  1.90k|        toskew = -(int32_t)(tw + w);
  788|  1.90k|    }
  789|      6|    else
  790|      6|    {
  791|      6|        if (tw > ((int64_t)INT_MAX + w) || w > ((int64_t)INT_MAX + tw))
  ------------------
  |  Branch (791:13): [True: 0, False: 6]
  |  Branch (791:44): [True: 0, False: 6]
  ------------------
  792|      0|        {
  793|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  794|      0|                          "unsupported tile size (too wide)");
  795|      0|            return (0);
  796|      0|        }
  797|      6|        y = 0;
  798|      6|        toskew = -(int32_t)(tw - w);
  799|      6|    }
  800|       |
  801|  1.91k|    if (tw == 0 || th == 0)
  ------------------
  |  Branch (801:9): [True: 0, False: 1.91k]
  |  Branch (801:20): [True: 0, False: 1.91k]
  ------------------
  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.91k|    leftmost_fromskew = (int32_t)((uint32_t)img->col_offset % tw);
  811|  1.91k|    leftmost_tw = (uint32_t)((int32_t)tw - leftmost_fromskew);
  812|  1.91k|    int64_t skew_i64 = (int64_t)toskew + (int64_t)(int32_t)leftmost_fromskew;
  813|  1.91k|    if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
  ------------------
  |  Branch (813:9): [True: 0, False: 1.91k]
  |  Branch (813:31): [True: 0, False: 1.91k]
  ------------------
  814|      0|    {
  815|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
  816|      0|                      skew_i64);
  817|      0|        return (0);
  818|      0|    }
  819|  1.91k|    leftmost_toskew = (int32_t)skew_i64;
  820|   107k|    for (row = 0; ret != 0 && row < h; row += nrow)
  ------------------
  |  Branch (820:19): [True: 107k, False: 258]
  |  Branch (820:31): [True: 105k, False: 1.65k]
  ------------------
  821|   105k|    {
  822|   105k|        rowstoread = th - ((uint32_t)row + (uint32_t)img->row_offset) % th;
  823|   105k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (823:17): [True: 1.68k, False: 103k]
  ------------------
  824|   105k|        fromskew = leftmost_fromskew;
  825|   105k|        this_tw = leftmost_tw;
  826|   105k|        this_toskew = leftmost_toskew;
  827|   105k|        tocol = 0;
  828|   105k|        col = (uint32_t)img->col_offset;
  829|       |        /* wmin: only write imagewidth if raster is bigger. */
  830|   472k|        while (tocol < wmin)
  ------------------
  |  Branch (830:16): [True: 367k, False: 105k]
  ------------------
  831|   367k|        {
  832|   367k|            if (_TIFFReadTileAndAllocBuffer(tif, (void **)&buf, bufsize, col,
  ------------------
  |  Branch (832:17): [True: 311k, False: 55.4k]
  ------------------
  833|   367k|                                            (uint32_t)row +
  834|   367k|                                                (uint32_t)img->row_offset,
  835|   367k|                                            0, 0) == (tmsize_t)(-1) &&
  836|   311k|                (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (836:18): [True: 258, False: 311k]
  |  Branch (836:33): [True: 0, False: 311k]
  ------------------
  837|    258|            {
  838|    258|                ret = 0;
  839|    258|                break;
  840|    258|            }
  841|   366k|            pos = (((uint32_t)row + (uint32_t)img->row_offset) % th) *
  842|   366k|                      TIFFTileRowSize(tif) +
  843|   366k|                  ((tmsize_t)fromskew * img->samplesperpixel);
  844|   366k|            if (tocol + this_tw > wmin)
  ------------------
  |  Branch (844:17): [True: 90.0k, False: 276k]
  ------------------
  845|  90.0k|            {
  846|       |                /*
  847|       |                 * Rightmost tile is clipped on right side.
  848|       |                 */
  849|  90.0k|                fromskew = (int32_t)(tw - (wmin - tocol));
  850|  90.0k|                this_tw = (uint32_t)((int32_t)tw - fromskew);
  851|  90.0k|                this_toskew = (int32_t)(toskew + (int32_t)(uint32_t)fromskew);
  852|  90.0k|            }
  853|   366k|            tmsize_t roffset = (tmsize_t)y * w + tocol;
  854|   366k|            (*put)(img, raster + roffset, tocol, y, this_tw, nrow, fromskew,
  855|   366k|                   this_toskew, buf + pos);
  856|   366k|            tocol += this_tw;
  857|   366k|            col += this_tw;
  858|       |            /*
  859|       |             * After the leftmost tile, tiles are no longer clipped on left
  860|       |             * side.
  861|       |             */
  862|   366k|            fromskew = 0;
  863|   366k|            this_tw = tw;
  864|   366k|            this_toskew = toskew;
  865|   366k|        }
  866|       |
  867|   105k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|   105k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (867:25): [True: 105k, False: 231]
  ------------------
  868|   105k|                                                 : (int32_t)nrow);
  869|   105k|    }
  870|  1.91k|    _TIFFfreeExt(img->tif, buf);
  871|       |
  872|  1.91k|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|  1.91k|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (872:9): [True: 3, False: 1.90k]
  ------------------
  873|      3|    {
  874|      3|        uint32_t line;
  875|       |
  876|     91|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (876:24): [True: 88, False: 3]
  ------------------
  877|     88|        {
  878|     88|            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|     88|            uint32_t *right = left + wmin - 1;
  882|       |
  883|  27.4k|            while (left < right)
  ------------------
  |  Branch (883:20): [True: 27.3k, False: 88]
  ------------------
  884|  27.3k|            {
  885|  27.3k|                uint32_t temp = *left;
  886|  27.3k|                *left = *right;
  887|  27.3k|                *right = temp;
  888|  27.3k|                left++;
  889|  27.3k|                right--;
  890|  27.3k|            }
  891|     88|        }
  892|      3|    }
  893|       |
  894|  1.91k|    return (ret);
  895|  1.91k|}
tif_getimage.c:setorientation:
  667|  3.34k|{
  668|  3.34k|    switch (img->orientation)
  669|  3.34k|    {
  670|  3.24k|        case ORIENTATION_TOPLEFT:
  ------------------
  |  |  249|  3.24k|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (670:9): [True: 3.24k, False: 96]
  ------------------
  671|  3.25k|        case ORIENTATION_LEFTTOP:
  ------------------
  |  |  253|  3.25k|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (671:9): [True: 10, False: 3.33k]
  ------------------
  672|  3.25k|            if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|  6.51k|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (672:17): [True: 0, False: 3.25k]
  ------------------
  673|  3.25k|                img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|  3.25k|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (673:17): [True: 0, False: 3.25k]
  ------------------
  674|      0|                return FLIP_HORIZONTALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  675|  3.25k|            else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  251|  6.51k|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (675:22): [True: 0, False: 3.25k]
  ------------------
  676|  3.25k|                     img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  255|  3.25k|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (676:22): [True: 0, False: 3.25k]
  ------------------
  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.25k|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|  6.51k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (678:22): [True: 3.25k, 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.25k|                return FLIP_VERTICALLY;
  ------------------
  |  |   50|  3.25k|#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.33k]
  ------------------
  684|      3|        case ORIENTATION_RIGHTTOP:
  ------------------
  |  |  254|      3|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (684:9): [True: 0, False: 3.34k]
  ------------------
  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|     70|        case ORIENTATION_BOTRIGHT:
  ------------------
  |  |  251|     70|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (696:9): [True: 70, False: 3.27k]
  ------------------
  697|     73|        case ORIENTATION_RIGHTBOT:
  ------------------
  |  |  255|     73|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (697:9): [True: 3, False: 3.33k]
  ------------------
  698|     73|            if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  249|    146|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (698:17): [True: 0, False: 73]
  ------------------
  699|     73|                img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  253|     73|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (699:17): [True: 0, False: 73]
  ------------------
  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|     73|            else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|    146|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (701:22): [True: 0, False: 73]
  ------------------
  702|     73|                     img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|     73|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (702:22): [True: 0, False: 73]
  ------------------
  703|      0|                return FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  704|     73|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|    146|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (704:22): [True: 73, 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|     73|                return FLIP_HORIZONTALLY;
  ------------------
  |  |   51|     73|#define FLIP_HORIZONTALLY 0x02
  ------------------
  707|      0|            else
  708|      0|                return 0;
  709|      7|        case ORIENTATION_BOTLEFT:
  ------------------
  |  |  252|      7|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (709:9): [True: 7, False: 3.33k]
  ------------------
  710|     10|        case ORIENTATION_LEFTBOT:
  ------------------
  |  |  256|     10|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (710:9): [True: 3, False: 3.33k]
  ------------------
  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.34k]
  ------------------
  723|      0|            return 0;
  724|  3.34k|    }
  725|  3.34k|}
tif_getimage.c:gtStripContig:
 1150|    586|{
 1151|    586|    TIFF *tif = img->tif;
 1152|    586|    tileContigRoutine put = img->put.contig;
 1153|    586|    uint32_t row, y, nrow, nrowsub, rowstoread;
 1154|    586|    tmsize_t pos;
 1155|    586|    unsigned char *buf = NULL;
 1156|    586|    uint32_t rowsperstrip;
 1157|    586|    uint16_t subsamplinghor, subsamplingver;
 1158|    586|    uint32_t imagewidth = img->width;
 1159|    586|    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|    586|    int32_t fromskew, toskew;
 1163|    586|    int ret = 1, flip;
 1164|    586|    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|    586|    uint32_t wmin;
 1169|    586|    if (0 <= img->col_offset && (uint32_t)img->col_offset < imagewidth)
  ------------------
  |  Branch (1169:9): [True: 586, False: 0]
  |  Branch (1169:33): [True: 586, False: 0]
  ------------------
 1170|    586|    {
 1171|    586|        wmin = TIFFmin(w, imagewidth - (uint32_t)img->col_offset);
  ------------------
  |  |  337|    586|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 586]
  |  |  ------------------
  ------------------
 1172|    586|    }
 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|    586|    TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor,
  ------------------
  |  |  388|    586|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 1183|    586|                          &subsamplingver);
 1184|    586|    if (subsamplingver == 0)
  ------------------
  |  Branch (1184:9): [True: 1, False: 585]
  ------------------
 1185|      1|    {
 1186|      1|        TIFFErrorExtR(tif, TIFFFileName(tif),
 1187|      1|                      "Invalid vertical YCbCr subsampling");
 1188|      1|        return (0);
 1189|      1|    }
 1190|       |
 1191|    585|    maxstripsize = TIFFStripSize(tif);
 1192|       |
 1193|    585|    flip = setorientation(img);
 1194|    585|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|    585|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1194:9): [True: 578, False: 7]
  ------------------
 1195|    578|    {
 1196|    578|        if (w > INT_MAX / 2)
  ------------------
  |  Branch (1196:13): [True: 0, False: 578]
  ------------------
 1197|      0|        {
 1198|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "Width overflow");
 1199|      0|            return (0);
 1200|      0|        }
 1201|    578|        y = h - 1;
 1202|       |        /* Skew back to the raster row before the currently written row
 1203|       |         * -> one raster width plus copied image pixels. */
 1204|    578|        toskew = -(int32_t)(w + wmin);
 1205|    578|    }
 1206|      7|    else
 1207|      7|    {
 1208|      7|        y = 0;
 1209|       |        /* Skew forward to the end of the raster width of the row currently
 1210|       |         * copied. */
 1211|      7|        toskew = (int32_t)(w - wmin);
 1212|      7|    }
 1213|       |
 1214|    585|    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
  ------------------
  |  |  258|    585|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 1215|    585|    if (rowsperstrip == 0)
  ------------------
  |  Branch (1215:9): [True: 0, False: 585]
  ------------------
 1216|      0|    {
 1217|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
 1218|      0|        return (0);
 1219|      0|    }
 1220|       |
 1221|    585|    scanline = TIFFScanlineSize(tif);
 1222|    585|    fromskew = (int32_t)(w < imagewidth ? imagewidth - w : 0);
  ------------------
  |  Branch (1222:26): [True: 0, False: 585]
  ------------------
 1223|  99.2k|    for (row = 0; row < h; row += nrow)
  ------------------
  |  Branch (1223:19): [True: 98.7k, False: 494]
  ------------------
 1224|  98.7k|    {
 1225|  98.7k|        uint32_t temp;
 1226|  98.7k|        rowstoread = rowsperstrip -
 1227|  98.7k|                     (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip;
 1228|  98.7k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (1228:17): [True: 485, False: 98.2k]
  ------------------
 1229|  98.7k|        nrowsub = nrow;
 1230|  98.7k|        if ((nrowsub % subsamplingver) != 0)
  ------------------
  |  Branch (1230:13): [True: 13.6k, False: 85.0k]
  ------------------
 1231|  13.6k|            nrowsub += subsamplingver - nrowsub % subsamplingver;
 1232|  98.7k|        temp =
 1233|  98.7k|            (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip + nrowsub;
 1234|  98.7k|        if (scanline > 0 && temp > (size_t)(TIFF_TMSIZE_T_MAX / scanline))
  ------------------
  |  |   68|  98.7k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (1234:13): [True: 98.7k, False: 0]
  |  Branch (1234:29): [True: 0, False: 98.7k]
  ------------------
 1235|      0|        {
 1236|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1237|      0|                          "Integer overflow in gtStripContig");
 1238|      0|            return 0;
 1239|      0|        }
 1240|  98.7k|        if (_TIFFReadEncodedStripAndAllocBuffer(
  ------------------
  |  Branch (1240:13): [True: 62.7k, False: 35.9k]
  ------------------
 1241|  98.7k|                tif,
 1242|  98.7k|                TIFFComputeStrip(tif,
 1243|  98.7k|                                 (uint32_t)((int32_t)row + img->row_offset), 0),
 1244|  98.7k|                (void **)(&buf), maxstripsize,
 1245|  98.7k|                (tmsize_t)((size_t)temp * (size_t)scanline)) ==
 1246|  98.7k|                (tmsize_t)(-1) &&
 1247|  62.7k|            (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1247:14): [True: 91, False: 62.6k]
  |  Branch (1247:29): [True: 0, False: 62.6k]
  ------------------
 1248|     91|        {
 1249|     91|            ret = 0;
 1250|     91|            break;
 1251|     91|        }
 1252|       |
 1253|  98.6k|        pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) %
 1254|  98.6k|                         rowsperstrip) *
 1255|  98.6k|                  scanline +
 1256|  98.6k|              ((tmsize_t)img->col_offset * img->samplesperpixel);
 1257|  98.6k|        tmsize_t roffset = (tmsize_t)y * w;
 1258|  98.6k|        (*put)(img, raster + roffset, 0, y, wmin, nrow, fromskew, toskew,
 1259|  98.6k|               buf + pos);
 1260|  98.6k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|  98.6k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1260:25): [True: 94.8k, False: 3.78k]
  ------------------
 1261|  98.6k|                                                 : (int32_t)nrow);
 1262|  98.6k|    }
 1263|       |
 1264|    585|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|    585|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1264:9): [True: 8, False: 577]
  ------------------
 1265|      8|    {
 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|      8|        uint32_t line;
 1271|       |
 1272|   281k|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (1272:24): [True: 281k, False: 8]
  ------------------
 1273|   281k|        {
 1274|   281k|            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|   281k|            uint32_t *right = left + wmin - 1;
 1278|       |
 1279|  7.60M|            while (left < right)
  ------------------
  |  Branch (1279:20): [True: 7.32M, False: 281k]
  ------------------
 1280|  7.32M|            {
 1281|  7.32M|                uint32_t temp = *left;
 1282|  7.32M|                *left = *right;
 1283|  7.32M|                *right = temp;
 1284|  7.32M|                left++;
 1285|  7.32M|                right--;
 1286|  7.32M|            }
 1287|   281k|        }
 1288|      8|    }
 1289|       |
 1290|    585|    _TIFFfreeExt(img->tif, buf);
 1291|    585|    return (ret);
 1292|    585|}
tif_getimage.c:putRGBAAcontig8bittile:
 1862|     11|{
 1863|     11|    int samplesperpixel = img->samplesperpixel;
 1864|       |
 1865|     11|    (void)x;
 1866|     11|    (void)y;
 1867|     11|    const tmsize_t fromskewLocal =
 1868|     11|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1869|    101|    for (; h > 0; --h)
  ------------------
  |  Branch (1869:12): [True: 90, False: 11]
  ------------------
 1870|     90|    {
 1871|     90|        UNROLL8(w, NOP, *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]);
  ------------------
  |  | 1554|     90|    {                                                                          \
  |  | 1555|     90|        uint32_t _x;                                                           \
  |  | 1556|     90|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 0, False: 90]
  |  |  ------------------
  |  | 1557|     90|        {                                                                      \
  |  | 1558|      0|            op1;                                                               \
  |  | 1559|      0|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|      0|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|      0|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|      0|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|      0|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|      0|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|      0|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|      0|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|      0|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|      0|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|      0|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|      0|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|      0|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|      0|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|      0|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|      0|        }                                                                      \
  |  | 1561|     90|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 90, False: 0]
  |  |  ------------------
  |  | 1562|     90|        {                                                                      \
  |  | 1563|     90|            op1;                                                               \
  |  | 1564|     90|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|     90|    switch (x)                                                                 \
  |  |  |  | 1519|     90|    {                                                                          \
  |  |  |  | 1520|      0|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  |  | 1521|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|      0|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  |  | 1523|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|      0|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  |  | 1525|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|      3|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 3, False: 87]
  |  |  |  |  ------------------
  |  |  |  | 1527|      3|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|      3|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  |  | 1529|      3|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|     90|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 87, False: 3]
  |  |  |  |  ------------------
  |  |  |  | 1531|     90|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|     90|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  |  | 1533|     90|            op;                                                                \
  |  |  |  | 1534|     90|            break;                                                             \
  |  |  |  | 1535|     90|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 90]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|     90|    }
  |  |  ------------------
  |  | 1565|     90|        }                                                                      \
  |  | 1566|     90|    }
  ------------------
 1872|     90|                pp += samplesperpixel);
 1873|     90|        cp += toskew;
 1874|     90|        pp += fromskewLocal;
 1875|     90|    }
 1876|     11|}
tif_getimage.c:BuildMapUaToAa:
 3390|     57|{
 3391|     57|    static const char module[] = "BuildMapUaToAa";
 3392|     57|    uint8_t *m;
 3393|     57|    uint16_t na, nv;
 3394|     57|    assert(img->UaToAa == NULL);
  ------------------
  |  Branch (3394:5): [True: 0, False: 57]
  |  Branch (3394:5): [True: 57, False: 0]
  ------------------
 3395|     57|    img->UaToAa = (uint8_t *)_TIFFmallocExt(img->tif, 65536);
 3396|     57|    if (img->UaToAa == NULL)
  ------------------
  |  Branch (3396:9): [True: 0, False: 57]
  ------------------
 3397|      0|    {
 3398|      0|        TIFFErrorExtR(img->tif, module, "Out of memory");
 3399|      0|        return (0);
 3400|      0|    }
 3401|     57|    m = img->UaToAa;
 3402|  14.6k|    for (na = 0; na < 256; na++)
  ------------------
  |  Branch (3402:18): [True: 14.5k, False: 57]
  ------------------
 3403|  14.5k|    {
 3404|  3.75M|        for (nv = 0; nv < 256; nv++)
  ------------------
  |  Branch (3404:22): [True: 3.73M, False: 14.5k]
  ------------------
 3405|  3.73M|            *m++ = (uint8_t)((nv * na + 127) / 255);
 3406|  14.5k|    }
 3407|     57|    return (1);
 3408|     57|}
tif_getimage.c:putRGBUAcontig8bittile:
 1883|  14.9k|{
 1884|  14.9k|    int samplesperpixel = img->samplesperpixel;
 1885|  14.9k|    (void)y;
 1886|  14.9k|    const tmsize_t fromskewLocal =
 1887|  14.9k|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1888|  14.7M|    for (; h > 0; --h)
  ------------------
  |  Branch (1888:12): [True: 14.7M, False: 14.9k]
  ------------------
 1889|  14.7M|    {
 1890|  14.7M|        uint32_t r, g, b, a;
 1891|  14.7M|        uint8_t *m;
 1892|   125M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1892:21): [True: 110M, False: 14.7M]
  ------------------
 1893|   110M|        {
 1894|   110M|            a = pp[3];
 1895|   110M|            m = img->UaToAa + ((size_t)a << 8);
 1896|   110M|            r = m[pp[0]];
 1897|   110M|            g = m[pp[1]];
 1898|   110M|            b = m[pp[2]];
 1899|   110M|            *cp++ = PACK4(r, g, b, a);
  ------------------
  |  | 1614|   110M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|   110M|     ((uint32_t)(a) << 24))
  ------------------
 1900|   110M|            pp += samplesperpixel;
 1901|   110M|        }
 1902|  14.7M|        cp += toskew;
 1903|  14.7M|        pp += fromskewLocal;
 1904|  14.7M|    }
 1905|  14.9k|}
tif_getimage.c:putRGBcontig8bittile:
 1841|  53.6k|{
 1842|  53.6k|    int samplesperpixel = img->samplesperpixel;
 1843|       |
 1844|  53.6k|    (void)x;
 1845|  53.6k|    (void)y;
 1846|  53.6k|    const tmsize_t fromskewLocal =
 1847|  53.6k|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1848|  3.70M|    for (; h > 0; --h)
  ------------------
  |  Branch (1848:12): [True: 3.65M, False: 53.6k]
  ------------------
 1849|  3.65M|    {
 1850|  3.65M|        UNROLL8(w, NOP, *cp++ = PACK(pp[0], pp[1], pp[2]);
  ------------------
  |  | 1554|  3.65M|    {                                                                          \
  |  | 1555|  3.65M|        uint32_t _x;                                                           \
  |  | 1556|  54.3M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 50.6M, False: 3.65M]
  |  |  ------------------
  |  | 1557|  50.6M|        {                                                                      \
  |  | 1558|  50.6M|            op1;                                                               \
  |  | 1559|  50.6M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|  50.6M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  50.6M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  50.6M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  50.6M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  50.6M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  50.6M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  50.6M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|  50.6M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  50.6M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  50.6M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  50.6M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  50.6M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  50.6M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  50.6M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|  50.6M|        }                                                                      \
  |  | 1561|  3.65M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 3.51M, False: 136k]
  |  |  ------------------
  |  | 1562|  3.65M|        {                                                                      \
  |  | 1563|  3.51M|            op1;                                                               \
  |  | 1564|  3.51M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|  3.51M|    switch (x)                                                                 \
  |  |  |  | 1519|  3.51M|    {                                                                          \
  |  |  |  | 1520|   595k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 595k, False: 2.91M]
  |  |  |  |  ------------------
  |  |  |  | 1521|   595k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|   711k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 115k, False: 3.39M]
  |  |  |  |  ------------------
  |  |  |  | 1523|   711k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|   780k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 69.2k, False: 3.44M]
  |  |  |  |  ------------------
  |  |  |  | 1525|   780k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|   924k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 143k, False: 3.37M]
  |  |  |  |  ------------------
  |  |  |  | 1527|   924k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|  1.09M|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 173k, False: 3.34M]
  |  |  |  |  ------------------
  |  |  |  | 1529|  1.09M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|  3.19M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 2.09M, False: 1.41M]
  |  |  |  |  ------------------
  |  |  |  | 1531|  3.19M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|  3.51M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 318k, False: 3.19M]
  |  |  |  |  ------------------
  |  |  |  | 1533|  3.51M|            op;                                                                \
  |  |  |  | 1534|  3.51M|            break;                                                             \
  |  |  |  | 1535|  3.19M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 3.51M]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|  3.51M|    }
  |  |  ------------------
  |  | 1565|  3.51M|        }                                                                      \
  |  | 1566|  3.65M|    }
  ------------------
 1851|  3.65M|                pp += samplesperpixel);
 1852|  3.65M|        cp += toskew;
 1853|  3.65M|        pp += fromskewLocal;
 1854|  3.65M|    }
 1855|  53.6k|}
tif_getimage.c:BuildMapBitdepth16To8:
 3411|     80|{
 3412|     80|    static const char module[] = "BuildMapBitdepth16To8";
 3413|     80|    uint8_t *m;
 3414|     80|    uint32_t n;
 3415|     80|    assert(img->Bitdepth16To8 == NULL);
  ------------------
  |  Branch (3415:5): [True: 0, False: 80]
  |  Branch (3415:5): [True: 80, False: 0]
  ------------------
 3416|     80|    img->Bitdepth16To8 = (uint8_t *)_TIFFmallocExt(img->tif, 65536);
 3417|     80|    if (img->Bitdepth16To8 == NULL)
  ------------------
  |  Branch (3417:9): [True: 0, False: 80]
  ------------------
 3418|      0|    {
 3419|      0|        TIFFErrorExtR(img->tif, module, "Out of memory");
 3420|      0|        return (0);
 3421|      0|    }
 3422|     80|    m = img->Bitdepth16To8;
 3423|  5.24M|    for (n = 0; n < 65536; n++)
  ------------------
  |  Branch (3423:17): [True: 5.24M, False: 80]
  ------------------
 3424|  5.24M|        *m++ = (uint8_t)((n + 128) / 257);
 3425|     80|    return (1);
 3426|     80|}
tif_getimage.c:putRGBAAcontig16bittile:
 1935|    336|{
 1936|    336|    int samplesperpixel = img->samplesperpixel;
 1937|    336|    uint16_t *wp = (uint16_t *)pp;
 1938|    336|    (void)y;
 1939|    336|    const tmsize_t fromskewLocal =
 1940|    336|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1941|  53.1k|    for (; h > 0; --h)
  ------------------
  |  Branch (1941:12): [True: 52.7k, False: 336]
  ------------------
 1942|  52.7k|    {
 1943|   394k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1943:21): [True: 342k, False: 52.7k]
  ------------------
 1944|   342k|        {
 1945|   342k|            *cp++ = PACK4(img->Bitdepth16To8[wp[0]], img->Bitdepth16To8[wp[1]],
  ------------------
  |  | 1614|   342k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|   342k|     ((uint32_t)(a) << 24))
  ------------------
 1946|   342k|                          img->Bitdepth16To8[wp[2]], img->Bitdepth16To8[wp[3]]);
 1947|   342k|            wp += samplesperpixel;
 1948|   342k|        }
 1949|  52.7k|        cp += toskew;
 1950|  52.7k|        wp += fromskewLocal;
 1951|  52.7k|    }
 1952|    336|}
tif_getimage.c:putRGBUAcontig16bittile:
 1959|     27|{
 1960|     27|    int samplesperpixel = img->samplesperpixel;
 1961|     27|    uint16_t *wp = (uint16_t *)pp;
 1962|     27|    (void)y;
 1963|     27|    const tmsize_t fromskewLocal =
 1964|     27|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1965|   188k|    for (; h > 0; --h)
  ------------------
  |  Branch (1965:12): [True: 188k, False: 27]
  ------------------
 1966|   188k|    {
 1967|   188k|        uint32_t r, g, b, a;
 1968|   188k|        uint8_t *m;
 1969|   589k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1969:21): [True: 401k, False: 188k]
  ------------------
 1970|   401k|        {
 1971|   401k|            a = img->Bitdepth16To8[wp[3]];
 1972|   401k|            m = img->UaToAa + ((size_t)a << 8);
 1973|   401k|            r = m[img->Bitdepth16To8[wp[0]]];
 1974|   401k|            g = m[img->Bitdepth16To8[wp[1]]];
 1975|   401k|            b = m[img->Bitdepth16To8[wp[2]]];
 1976|   401k|            *cp++ = PACK4(r, g, b, a);
  ------------------
  |  | 1614|   401k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|   401k|     ((uint32_t)(a) << 24))
  ------------------
 1977|   401k|            wp += samplesperpixel;
 1978|   401k|        }
 1979|   188k|        cp += toskew;
 1980|   188k|        wp += fromskewLocal;
 1981|   188k|    }
 1982|     27|}
tif_getimage.c:putRGBcontig16bittile:
 1911|    687|{
 1912|    687|    int samplesperpixel = img->samplesperpixel;
 1913|    687|    uint16_t *wp = (uint16_t *)pp;
 1914|    687|    (void)y;
 1915|    687|    const tmsize_t fromskewLocal =
 1916|    687|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1917|  41.8k|    for (; h > 0; --h)
  ------------------
  |  Branch (1917:12): [True: 41.1k, False: 687]
  ------------------
 1918|  41.1k|    {
 1919|   111M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1919:21): [True: 111M, False: 41.1k]
  ------------------
 1920|   111M|        {
 1921|   111M|            *cp++ = PACK(img->Bitdepth16To8[wp[0]], img->Bitdepth16To8[wp[1]],
  ------------------
  |  | 1612|   111M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|   111M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 1922|   111M|                         img->Bitdepth16To8[wp[2]]);
 1923|   111M|            wp += samplesperpixel;
 1924|   111M|        }
 1925|  41.1k|        cp += toskew;
 1926|  41.1k|        wp += fromskewLocal;
 1927|  41.1k|    }
 1928|    687|}
tif_getimage.c:buildMap:
 3082|  1.76k|{
 3083|  1.76k|    switch (img->photometric)
 3084|  1.76k|    {
 3085|      0|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3085:9): [True: 0, False: 1.76k]
  ------------------
 3086|      0|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|      0|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3086:9): [True: 0, False: 1.76k]
  ------------------
 3087|      7|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|      7|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3087:9): [True: 7, False: 1.75k]
  ------------------
 3088|      7|            if (img->bitspersample == 8)
  ------------------
  |  Branch (3088:17): [True: 5, False: 2]
  ------------------
 3089|      5|                break;
 3090|       |            /* fall through... */
 3091|  1.44k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.44k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3091:9): [True: 1.44k, False: 324]
  ------------------
 3092|  1.71k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  1.71k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3092:9): [True: 274, False: 1.49k]
  ------------------
 3093|  1.71k|            if (!setupMap(img))
  ------------------
  |  Branch (3093:17): [True: 0, False: 1.71k]
  ------------------
 3094|      0|                return (0);
 3095|  1.71k|            break;
 3096|  1.71k|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     29|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (3096:9): [True: 29, False: 1.73k]
  ------------------
 3097|       |            /*
 3098|       |             * Convert 16-bit colormap to 8-bit (unless it looks
 3099|       |             * like an old-style 8-bit colormap).
 3100|       |             */
 3101|     29|            if (checkcmap(img) == 16)
  ------------------
  |  Branch (3101:17): [True: 15, False: 14]
  ------------------
 3102|     15|                cvtcmap(img);
 3103|     14|            else
 3104|     14|                TIFFWarningExtR(img->tif, TIFFFileName(img->tif),
 3105|     14|                                "Assuming 8-bit colormap");
 3106|       |            /*
 3107|       |             * Use mapping table and colormap to construct
 3108|       |             * unpacking tables for samples < 8 bits.
 3109|       |             */
 3110|     29|            if (img->bitspersample <= 8 && !makecmap(img))
  ------------------
  |  Branch (3110:17): [True: 29, False: 0]
  |  Branch (3110:44): [True: 0, False: 29]
  ------------------
 3111|      0|                return (0);
 3112|     29|            break;
 3113|     29|        default:
  ------------------
  |  Branch (3113:9): [True: 14, False: 1.75k]
  ------------------
 3114|     14|            break;
 3115|  1.76k|    }
 3116|  1.76k|    return (1);
 3117|  1.76k|}
tif_getimage.c:setupMap:
 2935|  1.71k|{
 2936|  1.71k|    int32_t x, range;
 2937|       |
 2938|  1.71k|    range = (int32_t)((1U << img->bitspersample) - 1U);
 2939|       |
 2940|       |    /* treat 16 bit the same as eight bit */
 2941|  1.71k|    if (img->bitspersample == 16)
  ------------------
  |  Branch (2941:9): [True: 132, False: 1.58k]
  ------------------
 2942|    132|        range = 255;
 2943|       |
 2944|  1.71k|    img->Map = (TIFFRGBValue *)_TIFFmallocExt(
 2945|  1.71k|        img->tif, (tmsize_t)((size_t)(range + 1) * sizeof(TIFFRGBValue)));
 2946|  1.71k|    if (img->Map == NULL)
  ------------------
  |  Branch (2946:9): [True: 0, False: 1.71k]
  ------------------
 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.71k|    if (img->photometric == PHOTOMETRIC_MINISWHITE)
  ------------------
  |  |  221|  1.71k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (2952:9): [True: 274, False: 1.44k]
  ------------------
 2953|    274|    {
 2954|  2.85k|        for (x = 0; x <= range; x++)
  ------------------
  |  Branch (2954:21): [True: 2.58k, False: 274]
  ------------------
 2955|  2.58k|            img->Map[x] = (TIFFRGBValue)(((range - x) * 255) / range);
 2956|    274|    }
 2957|  1.44k|    else
 2958|  1.44k|    {
 2959|   299k|        for (x = 0; x <= range; x++)
  ------------------
  |  Branch (2959:21): [True: 297k, False: 1.44k]
  ------------------
 2960|   297k|            img->Map[x] = (TIFFRGBValue)((x * 255) / range);
 2961|  1.44k|    }
 2962|  1.71k|    if (img->bitspersample <= 16 &&
  ------------------
  |  Branch (2962:9): [True: 1.71k, False: 0]
  ------------------
 2963|  1.71k|        (img->photometric == PHOTOMETRIC_MINISBLACK ||
  ------------------
  |  |  222|  3.43k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (2963:10): [True: 1.44k, False: 276]
  ------------------
 2964|    276|         img->photometric == PHOTOMETRIC_MINISWHITE))
  ------------------
  |  |  221|    276|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (2964:10): [True: 274, False: 2]
  ------------------
 2965|  1.71k|    {
 2966|       |        /*
 2967|       |         * Use photometric mapping table to construct
 2968|       |         * unpacking tables for samples <= 8 bits.
 2969|       |         */
 2970|  1.71k|        if (!makebwmap(img))
  ------------------
  |  Branch (2970:13): [True: 0, False: 1.71k]
  ------------------
 2971|      0|            return (0);
 2972|       |        /* no longer need Map, free it */
 2973|  1.71k|        _TIFFfreeExt(img->tif, img->Map);
 2974|  1.71k|        img->Map = NULL;
 2975|  1.71k|    }
 2976|  1.71k|    return (1);
 2977|  1.71k|}
tif_getimage.c:makebwmap:
 2867|  1.71k|{
 2868|  1.71k|    TIFFRGBValue *Map = img->Map;
 2869|  1.71k|    int bitspersample = img->bitspersample;
 2870|  1.71k|    int nsamples = 8 / bitspersample;
 2871|  1.71k|    int i;
 2872|  1.71k|    uint32_t *p;
 2873|       |
 2874|  1.71k|    if (nsamples == 0)
  ------------------
  |  Branch (2874:9): [True: 132, False: 1.58k]
  ------------------
 2875|    132|        nsamples = 1;
 2876|       |
 2877|  1.71k|    img->BWmap = (uint32_t **)_TIFFmallocExt(
 2878|  1.71k|        img->tif,
 2879|  1.71k|        (tmsize_t)((size_t)256 * sizeof(uint32_t *) +
 2880|  1.71k|                   ((size_t)256 * (size_t)nsamples * sizeof(uint32_t))));
 2881|  1.71k|    if (img->BWmap == NULL)
  ------------------
  |  Branch (2881:9): [True: 0, False: 1.71k]
  ------------------
 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.71k|    p = (uint32_t *)(img->BWmap + 256);
 2888|   441k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (2888:17): [True: 439k, False: 1.71k]
  ------------------
 2889|   439k|    {
 2890|   439k|        TIFFRGBValue c;
 2891|   439k|        img->BWmap[i] = p;
 2892|   439k|        switch (bitspersample)
 2893|   439k|        {
 2894|      0|#define GREY(x)                                                                \
 2895|      0|    c = Map[x];                                                                \
 2896|      0|    *p++ = PACK(c, c, c);
 2897|   124k|            case 1:
  ------------------
  |  Branch (2897:13): [True: 124k, False: 314k]
  ------------------
 2898|   124k|                GREY(i >> 7);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2899|   124k|                GREY((i >> 6) & 1);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2900|   124k|                GREY((i >> 5) & 1);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2901|   124k|                GREY((i >> 4) & 1);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2902|   124k|                GREY((i >> 3) & 1);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2903|   124k|                GREY((i >> 2) & 1);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2904|   124k|                GREY((i >> 1) & 1);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2905|   124k|                GREY(i & 1);
  ------------------
  |  | 2895|   124k|    c = Map[x];                                                                \
  |  | 2896|   124k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   124k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   124k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2906|   124k|                break;
 2907|  11.0k|            case 2:
  ------------------
  |  Branch (2907:13): [True: 11.0k, False: 428k]
  ------------------
 2908|  11.0k|                GREY(i >> 6);
  ------------------
  |  | 2895|  11.0k|    c = Map[x];                                                                \
  |  | 2896|  11.0k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.0k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.0k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2909|  11.0k|                GREY((i >> 4) & 3);
  ------------------
  |  | 2895|  11.0k|    c = Map[x];                                                                \
  |  | 2896|  11.0k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.0k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.0k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2910|  11.0k|                GREY((i >> 2) & 3);
  ------------------
  |  | 2895|  11.0k|    c = Map[x];                                                                \
  |  | 2896|  11.0k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.0k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.0k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2911|  11.0k|                GREY(i & 3);
  ------------------
  |  | 2895|  11.0k|    c = Map[x];                                                                \
  |  | 2896|  11.0k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.0k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.0k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2912|  11.0k|                break;
 2913|  5.12k|            case 4:
  ------------------
  |  Branch (2913:13): [True: 5.12k, False: 434k]
  ------------------
 2914|  5.12k|                GREY(i >> 4);
  ------------------
  |  | 2895|  5.12k|    c = Map[x];                                                                \
  |  | 2896|  5.12k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  5.12k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  5.12k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2915|  5.12k|                GREY(i & 0xf);
  ------------------
  |  | 2895|  5.12k|    c = Map[x];                                                                \
  |  | 2896|  5.12k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  5.12k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  5.12k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2916|  5.12k|                break;
 2917|   264k|            case 8:
  ------------------
  |  Branch (2917:13): [True: 264k, False: 174k]
  ------------------
 2918|   298k|            case 16:
  ------------------
  |  Branch (2918:13): [True: 33.7k, False: 405k]
  ------------------
 2919|   298k|                GREY(i);
  ------------------
  |  | 2895|   298k|    c = Map[x];                                                                \
  |  | 2896|   298k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   298k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   298k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2920|   298k|                break;
 2921|      0|            default:
  ------------------
  |  Branch (2921:13): [True: 0, False: 439k]
  ------------------
 2922|      0|                break;
 2923|   439k|        }
 2924|   439k|#undef GREY
 2925|   439k|    }
 2926|  1.71k|    return (1);
 2927|  1.71k|}
tif_getimage.c:checkcmap:
 2980|     29|{
 2981|     29|    uint16_t *r = img->redcmap;
 2982|     29|    uint16_t *g = img->greencmap;
 2983|     29|    uint16_t *b = img->bluecmap;
 2984|     29|    long n = 1L << img->bitspersample;
 2985|       |
 2986|  3.41k|    while (n-- > 0)
  ------------------
  |  Branch (2986:12): [True: 3.40k, False: 14]
  ------------------
 2987|  3.40k|        if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
  ------------------
  |  Branch (2987:13): [True: 13, False: 3.38k]
  |  Branch (2987:28): [True: 1, False: 3.38k]
  |  Branch (2987:43): [True: 1, False: 3.38k]
  ------------------
 2988|     15|            return (16);
 2989|     14|    return (8);
 2990|     29|}
tif_getimage.c:cvtcmap:
 2993|     15|{
 2994|     15|    uint16_t *r = img->redcmap;
 2995|     15|    uint16_t *g = img->greencmap;
 2996|     15|    uint16_t *b = img->bluecmap;
 2997|     15|    long i;
 2998|       |
 2999|    591|    for (i = (1L << img->bitspersample) - 1; i >= 0; i--)
  ------------------
  |  Branch (2999:46): [True: 576, False: 15]
  ------------------
 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|     15|}
tif_getimage.c:makecmap:
 3017|     29|{
 3018|     29|    int bitspersample = img->bitspersample;
 3019|     29|    int nsamples = 8 / bitspersample;
 3020|     29|    uint16_t *r = img->redcmap;
 3021|     29|    uint16_t *g = img->greencmap;
 3022|     29|    uint16_t *b = img->bluecmap;
 3023|     29|    uint32_t *p;
 3024|     29|    int i;
 3025|       |
 3026|     29|    img->PALmap = (uint32_t **)_TIFFmallocExt(
 3027|     29|        img->tif,
 3028|     29|        (tmsize_t)((size_t)256 * sizeof(uint32_t *) +
 3029|     29|                   ((size_t)256 * (size_t)nsamples * sizeof(uint32_t))));
 3030|     29|    if (img->PALmap == NULL)
  ------------------
  |  Branch (3030:9): [True: 0, False: 29]
  ------------------
 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|     29|    p = (uint32_t *)(img->PALmap + 256);
 3037|  7.45k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (3037:17): [True: 7.42k, False: 29]
  ------------------
 3038|  7.42k|    {
 3039|  7.42k|        TIFFRGBValue c;
 3040|  7.42k|        img->PALmap[i] = p;
 3041|  7.42k|#define CMAP(x)                                                                \
 3042|  7.42k|    c = (TIFFRGBValue)x;                                                       \
 3043|  7.42k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
 3044|  7.42k|        switch (bitspersample)
 3045|  7.42k|        {
 3046|      0|            case 1:
  ------------------
  |  Branch (3046:13): [True: 0, False: 7.42k]
  ------------------
 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|  3.32k|            case 2:
  ------------------
  |  Branch (3056:13): [True: 3.32k, False: 4.09k]
  ------------------
 3057|  3.32k|                CMAP(i >> 6);
  ------------------
  |  | 3042|  3.32k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  3.32k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  3.32k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.32k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3058|  3.32k|                CMAP((i >> 4) & 3);
  ------------------
  |  | 3042|  3.32k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  3.32k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  3.32k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.32k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3059|  3.32k|                CMAP((i >> 2) & 3);
  ------------------
  |  | 3042|  3.32k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  3.32k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  3.32k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.32k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3060|  3.32k|                CMAP(i & 3);
  ------------------
  |  | 3042|  3.32k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  3.32k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  3.32k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.32k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3061|  3.32k|                break;
 3062|    256|            case 4:
  ------------------
  |  Branch (3062:13): [True: 256, False: 7.16k]
  ------------------
 3063|    256|                CMAP(i >> 4);
  ------------------
  |  | 3042|    256|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|    256|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|    256|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|    256|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3064|    256|                CMAP(i & 0xf);
  ------------------
  |  | 3042|    256|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|    256|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|    256|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|    256|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3065|    256|                break;
 3066|  3.84k|            case 8:
  ------------------
  |  Branch (3066:13): [True: 3.84k, False: 3.58k]
  ------------------
 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: 7.42k]
  ------------------
 3070|      0|                break;
 3071|  7.42k|        }
 3072|  7.42k|#undef CMAP
 3073|  7.42k|    }
 3074|     29|    return (1);
 3075|     29|}
tif_getimage.c:putRGBcontig8bitCMYKtile:
 1990|    586|{
 1991|    586|    int samplesperpixel = img->samplesperpixel;
 1992|    586|    uint16_t r, g, b, k;
 1993|       |
 1994|    586|    (void)x;
 1995|    586|    (void)y;
 1996|    586|    const tmsize_t fromskewLocal =
 1997|    586|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1998|   256k|    for (; h > 0; --h)
  ------------------
  |  Branch (1998:12): [True: 256k, False: 586]
  ------------------
 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: 0, 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|    586|}
tif_getimage.c:put8bitcmaptile:
 1626|  2.40k|{
 1627|  2.40k|    uint32_t **PALmap = img->PALmap;
 1628|  2.40k|    int samplesperpixel = img->samplesperpixel;
 1629|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1630|  2.40k|    const tmsize_t fromskewLocal =
 1631|  2.40k|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1632|       |
 1633|  2.40k|    (void)y;
 1634|  7.47k|    for (; h > 0; --h)
  ------------------
  |  Branch (1634:12): [True: 5.07k, False: 2.40k]
  ------------------
 1635|  5.07k|    {
 1636|  15.9M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1636:21): [True: 15.9M, False: 5.07k]
  ------------------
 1637|  15.9M|        {
 1638|  15.9M|            *cp++ = PALmap[*pp][0];
 1639|  15.9M|            pp += samplesperpixel;
 1640|  15.9M|        }
 1641|  5.07k|        cp += toskew;
 1642|  5.07k|        pp += fromskewLocal;
 1643|  5.07k|    }
 1644|  2.40k|}
tif_getimage.c:put4bitcmaptile:
 1650|  3.20k|{
 1651|  3.20k|    uint32_t **PALmap = img->PALmap;
 1652|       |
 1653|  3.20k|    (void)x;
 1654|  3.20k|    (void)y;
 1655|  3.20k|    fromskew /= 2;
 1656|  28.8k|    for (; h > 0; --h)
  ------------------
  |  Branch (1656:12): [True: 25.6k, False: 3.20k]
  ------------------
 1657|  25.6k|    {
 1658|  25.6k|        uint32_t *bw;
 1659|  25.6k|        UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1582|  25.6k|    {                                                                          \
  |  | 1583|  25.6k|        uint32_t _x;                                                           \
  |  | 1584|  4.73M|        for (_x = w; _x >= 2; _x -= 2)                                         \
  |  |  ------------------
  |  |  |  Branch (1584:22): [True: 4.71M, False: 25.6k]
  |  |  ------------------
  |  | 1585|  4.71M|        {                                                                      \
  |  | 1586|  4.71M|            op1;                                                               \
  |  | 1587|  4.71M|            REPEAT2(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1515|  4.71M|    op;                                                                        \
  |  |  |  | 1516|  4.71M|    op
  |  |  ------------------
  |  | 1588|  4.71M|        }                                                                      \
  |  | 1589|  25.6k|        if (_x)                                                                \
  |  |  ------------------
  |  |  |  Branch (1589:13): [True: 0, False: 25.6k]
  |  |  ------------------
  |  | 1590|  25.6k|        {                                                                      \
  |  | 1591|      0|            op1;                                                               \
  |  | 1592|      0|            op2;                                                               \
  |  | 1593|      0|        }                                                                      \
  |  | 1594|  25.6k|    }
  ------------------
 1660|  25.6k|        cp += toskew;
 1661|  25.6k|        pp += fromskew;
 1662|  25.6k|    }
 1663|  3.20k|}
tif_getimage.c:put2bitcmaptile:
 1669|      5|{
 1670|      5|    uint32_t **PALmap = img->PALmap;
 1671|       |
 1672|      5|    (void)x;
 1673|      5|    (void)y;
 1674|      5|    fromskew /= 4;
 1675|    165|    for (; h > 0; --h)
  ------------------
  |  Branch (1675:12): [True: 160, False: 5]
  ------------------
 1676|    160|    {
 1677|    160|        uint32_t *bw;
 1678|    160|        UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1568|    160|    {                                                                          \
  |  | 1569|    160|        uint32_t _x;                                                           \
  |  | 1570|  13.7k|        for (_x = w; _x >= 4; _x -= 4)                                         \
  |  |  ------------------
  |  |  |  Branch (1570:22): [True: 13.5k, False: 160]
  |  |  ------------------
  |  | 1571|  13.5k|        {                                                                      \
  |  | 1572|  13.5k|            op1;                                                               \
  |  | 1573|  13.5k|            REPEAT4(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1512|  13.5k|    REPEAT2(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|  13.5k|    op;                                                                        \
  |  |  |  |  |  | 1516|  13.5k|    op
  |  |  |  |  ------------------
  |  |  |  | 1513|  13.5k|    REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|  13.5k|    op;                                                                        \
  |  |  |  |  |  | 1516|  13.5k|    op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1574|  13.5k|        }                                                                      \
  |  | 1575|    160|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1575:13): [True: 0, False: 160]
  |  |  ------------------
  |  | 1576|    160|        {                                                                      \
  |  | 1577|      0|            op1;                                                               \
  |  | 1578|      0|            CASE4(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1539|      0|    switch (x)                                                                 \
  |  |  |  | 1540|      0|    {                                                                          \
  |  |  |  | 1541|      0|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1541:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1542|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1543|      0|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1543:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1544|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1545|      0|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1545:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1546|      0|            op;                                                                \
  |  |  |  | 1547|      0|            break;                                                             \
  |  |  |  | 1548|      0|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1548:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1549|      0|            break;                                                             \
  |  |  |  | 1550|      0|    }
  |  |  ------------------
  |  | 1579|      0|        }                                                                      \
  |  | 1580|    160|    }
  ------------------
 1679|    160|        cp += toskew;
 1680|    160|        pp += fromskew;
 1681|    160|    }
 1682|      5|}
tif_getimage.c:put16bitbwtile:
 1755|  7.84k|{
 1756|  7.84k|    int samplesperpixel = img->samplesperpixel;
 1757|  7.84k|    uint32_t **BWmap = img->BWmap;
 1758|       |    /* Convert pixel skew to byte skew (16-bit samples) */
 1759|  7.84k|    const tmsize_t fromskewLocal =
 1760|  7.84k|        (tmsize_t)fromskew * (tmsize_t)(2 * samplesperpixel);
 1761|       |
 1762|  7.84k|    (void)y;
 1763|   155k|    for (; h > 0; --h)
  ------------------
  |  Branch (1763:12): [True: 147k, False: 7.84k]
  ------------------
 1764|   147k|    {
 1765|   147k|        uint16_t *wp = (uint16_t *)pp;
 1766|       |
 1767|   128M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1767:21): [True: 128M, False: 147k]
  ------------------
 1768|   128M|        {
 1769|       |            /* use high order byte of 16bit value */
 1770|       |
 1771|   128M|            *cp++ = BWmap[*wp >> 8][0];
 1772|   128M|            pp += 2 * samplesperpixel;
 1773|   128M|            wp += samplesperpixel;
 1774|   128M|        }
 1775|   147k|        cp += toskew;
 1776|   147k|        pp += fromskewLocal;
 1777|   147k|    }
 1778|  7.84k|}
tif_getimage.c:putagreytile:
 1731|  1.94k|{
 1732|  1.94k|    int samplesperpixel = img->samplesperpixel;
 1733|  1.94k|    uint32_t **BWmap = img->BWmap;
 1734|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1735|  1.94k|    const tmsize_t fromskewLocal =
 1736|  1.94k|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1737|       |
 1738|  1.94k|    (void)y;
 1739|  1.38M|    for (; h > 0; --h)
  ------------------
  |  Branch (1739:12): [True: 1.37M, False: 1.94k]
  ------------------
 1740|  1.37M|    {
 1741|  99.1M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1741:21): [True: 97.7M, False: 1.37M]
  ------------------
 1742|  97.7M|        {
 1743|  97.7M|            *cp++ = BWmap[*pp][0] & ((uint32_t)*(pp + 1) << 24 | ~A1);
  ------------------
  |  | 1610|  97.7M|#define A1 (((uint32_t)0xffL) << 24)
  ------------------
 1744|  97.7M|            pp += samplesperpixel;
 1745|  97.7M|        }
 1746|  1.37M|        cp += toskew;
 1747|  1.37M|        pp += fromskewLocal;
 1748|  1.37M|    }
 1749|  1.94k|}
tif_getimage.c:putgreytile:
 1707|   147k|{
 1708|   147k|    int samplesperpixel = img->samplesperpixel;
 1709|   147k|    uint32_t **BWmap = img->BWmap;
 1710|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1711|   147k|    const tmsize_t fromskewLocal =
 1712|   147k|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1713|       |
 1714|   147k|    (void)y;
 1715|  27.6M|    for (; h > 0; --h)
  ------------------
  |  Branch (1715:12): [True: 27.5M, False: 147k]
  ------------------
 1716|  27.5M|    {
 1717|  1.25G|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1717:21): [True: 1.22G, False: 27.5M]
  ------------------
 1718|  1.22G|        {
 1719|  1.22G|            *cp++ = BWmap[*pp][0];
 1720|  1.22G|            pp += samplesperpixel;
 1721|  1.22G|        }
 1722|  27.5M|        cp += toskew;
 1723|  27.5M|        pp += fromskewLocal;
 1724|  27.5M|    }
 1725|   147k|}
tif_getimage.c:put4bitbwtile:
 1822|  1.45k|{
 1823|  1.45k|    uint32_t **BWmap = img->BWmap;
 1824|       |
 1825|  1.45k|    (void)x;
 1826|  1.45k|    (void)y;
 1827|  1.45k|    fromskew /= 2;
 1828|  56.3k|    for (; h > 0; --h)
  ------------------
  |  Branch (1828:12): [True: 54.8k, False: 1.45k]
  ------------------
 1829|  54.8k|    {
 1830|  54.8k|        uint32_t *bw;
 1831|  54.8k|        UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1582|  54.8k|    {                                                                          \
  |  | 1583|  54.8k|        uint32_t _x;                                                           \
  |  | 1584|   235M|        for (_x = w; _x >= 2; _x -= 2)                                         \
  |  |  ------------------
  |  |  |  Branch (1584:22): [True: 235M, False: 54.8k]
  |  |  ------------------
  |  | 1585|   235M|        {                                                                      \
  |  | 1586|   235M|            op1;                                                               \
  |  | 1587|   235M|            REPEAT2(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1515|   235M|    op;                                                                        \
  |  |  |  | 1516|   235M|    op
  |  |  ------------------
  |  | 1588|   235M|        }                                                                      \
  |  | 1589|  54.8k|        if (_x)                                                                \
  |  |  ------------------
  |  |  |  Branch (1589:13): [True: 50.7k, False: 4.13k]
  |  |  ------------------
  |  | 1590|  54.8k|        {                                                                      \
  |  | 1591|  50.7k|            op1;                                                               \
  |  | 1592|  50.7k|            op2;                                                               \
  |  | 1593|  50.7k|        }                                                                      \
  |  | 1594|  54.8k|    }
  ------------------
 1832|  54.8k|        cp += toskew;
 1833|  54.8k|        pp += fromskew;
 1834|  54.8k|    }
 1835|  1.45k|}
tif_getimage.c:put2bitbwtile:
 1803|  1.70k|{
 1804|  1.70k|    uint32_t **BWmap = img->BWmap;
 1805|       |
 1806|  1.70k|    (void)x;
 1807|  1.70k|    (void)y;
 1808|  1.70k|    fromskew /= 4;
 1809|   328k|    for (; h > 0; --h)
  ------------------
  |  Branch (1809:12): [True: 327k, False: 1.70k]
  ------------------
 1810|   327k|    {
 1811|   327k|        uint32_t *bw;
 1812|   327k|        UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1568|   327k|    {                                                                          \
  |  | 1569|   327k|        uint32_t _x;                                                           \
  |  | 1570|  2.47M|        for (_x = w; _x >= 4; _x -= 4)                                         \
  |  |  ------------------
  |  |  |  Branch (1570:22): [True: 2.15M, False: 327k]
  |  |  ------------------
  |  | 1571|  2.15M|        {                                                                      \
  |  | 1572|  2.15M|            op1;                                                               \
  |  | 1573|  2.15M|            REPEAT4(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1512|  2.15M|    REPEAT2(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|  2.15M|    op;                                                                        \
  |  |  |  |  |  | 1516|  2.15M|    op
  |  |  |  |  ------------------
  |  |  |  | 1513|  2.15M|    REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|  2.15M|    op;                                                                        \
  |  |  |  |  |  | 1516|  2.15M|    op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1574|  2.15M|        }                                                                      \
  |  | 1575|   327k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1575:13): [True: 326k, False: 555]
  |  |  ------------------
  |  | 1576|   327k|        {                                                                      \
  |  | 1577|   326k|            op1;                                                               \
  |  | 1578|   326k|            CASE4(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1539|   326k|    switch (x)                                                                 \
  |  |  |  | 1540|   326k|    {                                                                          \
  |  |  |  | 1541|  49.1k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1541:9): [True: 49.1k, False: 277k]
  |  |  |  |  ------------------
  |  |  |  | 1542|  49.1k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1543|   211k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1543:9): [True: 162k, False: 163k]
  |  |  |  |  ------------------
  |  |  |  | 1544|   211k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1545|   326k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1545:9): [True: 114k, False: 211k]
  |  |  |  |  ------------------
  |  |  |  | 1546|   326k|            op;                                                                \
  |  |  |  | 1547|   326k|            break;                                                             \
  |  |  |  | 1548|   211k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1548:9): [True: 0, False: 326k]
  |  |  |  |  ------------------
  |  |  |  | 1549|      0|            break;                                                             \
  |  |  |  | 1550|   326k|    }
  |  |  ------------------
  |  | 1579|   326k|        }                                                                      \
  |  | 1580|   327k|    }
  ------------------
 1813|   327k|        cp += toskew;
 1814|   327k|        pp += fromskew;
 1815|   327k|    }
 1816|  1.70k|}
tif_getimage.c:put1bitbwtile:
 1784|  84.7k|{
 1785|  84.7k|    uint32_t **BWmap = img->BWmap;
 1786|       |
 1787|  84.7k|    (void)x;
 1788|  84.7k|    (void)y;
 1789|  84.7k|    fromskew /= 8;
 1790|  11.4M|    for (; h > 0; --h)
  ------------------
  |  Branch (1790:12): [True: 11.3M, False: 84.7k]
  ------------------
 1791|  11.3M|    {
 1792|  11.3M|        uint32_t *bw;
 1793|  11.3M|        UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1554|  11.3M|    {                                                                          \
  |  | 1555|  11.3M|        uint32_t _x;                                                           \
  |  | 1556|   182M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 171M, False: 11.3M]
  |  |  ------------------
  |  | 1557|   171M|        {                                                                      \
  |  | 1558|   171M|            op1;                                                               \
  |  | 1559|   171M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|   171M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   171M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   171M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   171M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   171M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   171M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   171M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|   171M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   171M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   171M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   171M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   171M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   171M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   171M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|   171M|        }                                                                      \
  |  | 1561|  11.3M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 11.2M, False: 44.5k]
  |  |  ------------------
  |  | 1562|  11.3M|        {                                                                      \
  |  | 1563|  11.2M|            op1;                                                               \
  |  | 1564|  11.2M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|  11.2M|    switch (x)                                                                 \
  |  |  |  | 1519|  11.2M|    {                                                                          \
  |  |  |  | 1520|  76.4k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 76.4k, False: 11.2M]
  |  |  |  |  ------------------
  |  |  |  | 1521|  76.4k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|  3.06M|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 2.99M, False: 8.30M]
  |  |  |  |  ------------------
  |  |  |  | 1523|  3.06M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|  3.32M|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 262k, False: 11.0M]
  |  |  |  |  ------------------
  |  |  |  | 1525|  3.32M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|  9.94M|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 6.61M, False: 4.68M]
  |  |  |  |  ------------------
  |  |  |  | 1527|  9.94M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|  10.7M|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 761k, False: 10.5M]
  |  |  |  |  ------------------
  |  |  |  | 1529|  10.7M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|  10.7M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 37.7k, False: 11.2M]
  |  |  |  |  ------------------
  |  |  |  | 1531|  10.7M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|  11.2M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 553k, False: 10.7M]
  |  |  |  |  ------------------
  |  |  |  | 1533|  11.2M|            op;                                                                \
  |  |  |  | 1534|  11.2M|            break;                                                             \
  |  |  |  | 1535|  10.7M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 11.2M]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|  11.2M|    }
  |  |  ------------------
  |  | 1565|  11.2M|        }                                                                      \
  |  | 1566|  11.3M|    }
  ------------------
 1794|  11.3M|        cp += toskew;
 1795|  11.3M|        pp += fromskew;
 1796|  11.3M|    }
 1797|  84.7k|}
tif_getimage.c:initYCbCrConversion:
 2764|  1.13k|{
 2765|  1.13k|    static const char module[] = "initYCbCrConversion";
 2766|       |
 2767|  1.13k|    float *luma, *refBlackWhite;
 2768|       |
 2769|  1.13k|    if (img->ycbcr == NULL)
  ------------------
  |  Branch (2769:9): [True: 1.13k, False: 0]
  ------------------
 2770|  1.13k|    {
 2771|  1.13k|        img->ycbcr = (TIFFYCbCrToRGB *)_TIFFmallocExt(
 2772|  1.13k|            img->tif, TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long)) +
  ------------------
  |  |  322|  1.13k|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  312|  1.13k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (312:6): [True: 1.13k, Folded]
  |  |  |  |  ------------------
  |  |  |  |  313|  1.13k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  314|  1.13k|         : 0U)
  |  |  ------------------
  ------------------
 2773|  1.13k|                          4 * 256 * sizeof(TIFFRGBValue) +
 2774|  1.13k|                          2 * 256 * sizeof(int) + 3 * 256 * sizeof(int32_t));
 2775|  1.13k|        if (img->ycbcr == NULL)
  ------------------
  |  Branch (2775:13): [True: 0, False: 1.13k]
  ------------------
 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.13k|    }
 2782|       |
 2783|  1.13k|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
  ------------------
  |  |  387|  1.13k|#define TIFFTAG_YCBCRCOEFFICIENTS 529      /* !RGB -> YCbCr transform */
  ------------------
 2784|  1.13k|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,
  ------------------
  |  |  392|  1.13k|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
 2785|  1.13k|                          &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.13k|    if (isnan(luma[0]) || isnan(luma[1]) || TIFF_FLOAT_EQ(luma[1], 0.0f) ||
  ------------------
  |  |  342|  2.27k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (342:29): [True: 1, False: 1.13k]
  |  |  ------------------
  ------------------
  |  Branch (2789:9): [True: 0, False: 1.13k]
  |  Branch (2789:27): [True: 0, False: 1.13k]
  ------------------
 2790|  1.13k|        isnan(luma[2]))
  ------------------
  |  Branch (2790:9): [True: 0, False: 1.13k]
  ------------------
 2791|      1|    {
 2792|      1|        TIFFErrorExtR(img->tif, module,
 2793|      1|                      "Invalid values for YCbCrCoefficients tag");
 2794|      1|        return (0);
 2795|      1|    }
 2796|       |
 2797|  1.13k|    if (!isInRefBlackWhiteRange(refBlackWhite[0]) ||
  ------------------
  |  Branch (2797:9): [True: 0, False: 1.13k]
  ------------------
 2798|  1.13k|        !isInRefBlackWhiteRange(refBlackWhite[1]) ||
  ------------------
  |  Branch (2798:9): [True: 0, False: 1.13k]
  ------------------
 2799|  1.13k|        !isInRefBlackWhiteRange(refBlackWhite[2]) ||
  ------------------
  |  Branch (2799:9): [True: 0, False: 1.13k]
  ------------------
 2800|  1.13k|        !isInRefBlackWhiteRange(refBlackWhite[3]) ||
  ------------------
  |  Branch (2800:9): [True: 0, False: 1.13k]
  ------------------
 2801|  1.13k|        !isInRefBlackWhiteRange(refBlackWhite[4]) ||
  ------------------
  |  Branch (2801:9): [True: 0, False: 1.13k]
  ------------------
 2802|  1.13k|        !isInRefBlackWhiteRange(refBlackWhite[5]))
  ------------------
  |  Branch (2802:9): [True: 0, False: 1.13k]
  ------------------
 2803|      0|    {
 2804|      0|        TIFFErrorExtR(img->tif, module,
 2805|      0|                      "Invalid values for ReferenceBlackWhite tag");
 2806|      0|        return (0);
 2807|      0|    }
 2808|       |
 2809|  1.13k|    if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)
  ------------------
  |  Branch (2809:9): [True: 0, False: 1.13k]
  ------------------
 2810|      0|        return (0);
 2811|  1.13k|    return (1);
 2812|  1.13k|}
tif_getimage.c:isInRefBlackWhiteRange:
 2759|  6.80k|{
 2760|  6.80k|    return f > (float)(-0x7FFFFFFF + 128) && f < (float)0x7FFFFFFF;
  ------------------
  |  Branch (2760:12): [True: 6.80k, False: 0]
  |  Branch (2760:46): [True: 6.80k, False: 0]
  ------------------
 2761|  6.80k|}
tif_getimage.c:putcontig8bitYCbCr44tile:
 2262|  5.08k|{
 2263|  5.08k|    uint32_t *cp1 = cp + w + toskew;
 2264|  5.08k|    uint32_t *cp2 = cp1 + w + toskew;
 2265|  5.08k|    uint32_t *cp3 = cp2 + w + toskew;
 2266|  5.08k|    const tmsize_t incr = 3 * (tmsize_t)w + 4 * (tmsize_t)toskew;
 2267|       |
 2268|  5.08k|    (void)y;
 2269|       |    /* adjust fromskew */
 2270|  5.08k|    const tmsize_t fromskewLocal =
 2271|  5.08k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 4 + 2);
 2272|  5.08k|    if ((h & 3) == 0 && (w & 3) == 0)
  ------------------
  |  Branch (2272:9): [True: 2.14k, False: 2.94k]
  |  Branch (2272:25): [True: 1.67k, False: 476]
  ------------------
 2273|  1.67k|    {
 2274|  15.8k|        for (; h >= 4; h -= 4)
  ------------------
  |  Branch (2274:16): [True: 14.1k, False: 1.67k]
  ------------------
 2275|  14.1k|        {
 2276|  14.1k|            x = w >> 2;
 2277|  14.1k|            do
 2278|   184k|            {
 2279|   184k|                int32_t Cb = pp[16];
 2280|   184k|                int32_t Cr = pp[17];
 2281|       |
 2282|   184k|                YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2283|   184k|                YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2284|   184k|                YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2285|   184k|                YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2286|   184k|                YCbCrtoRGB(cp1[0], pp[4]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2287|   184k|                YCbCrtoRGB(cp1[1], pp[5]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2288|   184k|                YCbCrtoRGB(cp1[2], pp[6]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2289|   184k|                YCbCrtoRGB(cp1[3], pp[7]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2290|   184k|                YCbCrtoRGB(cp2[0], pp[8]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2291|   184k|                YCbCrtoRGB(cp2[1], pp[9]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2292|   184k|                YCbCrtoRGB(cp2[2], pp[10]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2293|   184k|                YCbCrtoRGB(cp2[3], pp[11]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2294|   184k|                YCbCrtoRGB(cp3[0], pp[12]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2295|   184k|                YCbCrtoRGB(cp3[1], pp[13]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2296|   184k|                YCbCrtoRGB(cp3[2], pp[14]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2297|   184k|                YCbCrtoRGB(cp3[3], pp[15]);
  ------------------
  |  | 2252|   184k|    {                                                                          \
  |  | 2253|   184k|        uint32_t r, g, b;                                                      \
  |  | 2254|   184k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   184k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   184k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   184k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   184k|    }
  ------------------
 2298|       |
 2299|   184k|                cp += 4;
 2300|   184k|                cp1 += 4;
 2301|   184k|                cp2 += 4;
 2302|   184k|                cp3 += 4;
 2303|   184k|                pp += 18;
 2304|   184k|            } while (--x);
  ------------------
  |  Branch (2304:22): [True: 170k, 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.67k|    }
 2312|  3.41k|    else
 2313|  3.41k|    {
 2314|  29.8k|        while (h > 0)
  ------------------
  |  Branch (2314:16): [True: 29.8k, False: 0]
  ------------------
 2315|  29.8k|        {
 2316|  1.88M|            for (x = w; x > 0;)
  ------------------
  |  Branch (2316:25): [True: 1.85M, False: 29.8k]
  ------------------
 2317|  1.85M|            {
 2318|  1.85M|                int32_t Cb = pp[16];
 2319|  1.85M|                int32_t Cr = pp[17];
 2320|  1.85M|                switch (x)
 2321|  1.85M|                {
 2322|  1.83M|                    default:
  ------------------
  |  Branch (2322:21): [True: 1.83M, False: 26.5k]
  ------------------
 2323|  1.83M|                        switch (h)
 2324|  1.83M|                        {
 2325|  1.47M|                            default:
  ------------------
  |  Branch (2325:29): [True: 1.47M, False: 351k]
  ------------------
 2326|  1.47M|                                YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.47M|    {                                                                          \
  |  | 2253|  1.47M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.47M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.47M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.47M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.47M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.47M|    }
  ------------------
 2327|  1.54M|                            case 3:
  ------------------
  |  Branch (2327:29): [True: 61.9k, False: 1.76M]
  ------------------
 2328|  1.54M|                                YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.54M|    {                                                                          \
  |  | 2253|  1.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.54M|    }
  ------------------
 2329|  1.81M|                            case 2:
  ------------------
  |  Branch (2329:29): [True: 269k, False: 1.56M]
  ------------------
 2330|  1.81M|                                YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.81M|    {                                                                          \
  |  | 2253|  1.81M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.81M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.81M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.81M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.81M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.81M|    }
  ------------------
 2331|  1.83M|                            case 1:
  ------------------
  |  Branch (2331:29): [True: 20.7k, False: 1.81M]
  ------------------
 2332|  1.83M|                                YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.83M|    {                                                                          \
  |  | 2253|  1.83M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.83M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.83M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.83M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.83M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.83M|    }
  ------------------
 2333|  1.83M|                        } /* FALLTHROUGH */
 2334|  1.83M|                    case 3:
  ------------------
  |  Branch (2334:21): [True: 4.92k, False: 1.85M]
  ------------------
 2335|  1.83M|                        switch (h)
 2336|  1.83M|                        {
 2337|  1.48M|                            default:
  ------------------
  |  Branch (2337:29): [True: 1.48M, False: 352k]
  ------------------
 2338|  1.48M|                                YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.48M|    {                                                                          \
  |  | 2253|  1.48M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.48M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.48M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.48M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.48M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.48M|    }
  ------------------
 2339|  1.54M|                            case 3:
  ------------------
  |  Branch (2339:29): [True: 62.6k, False: 1.77M]
  ------------------
 2340|  1.54M|                                YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.54M|    {                                                                          \
  |  | 2253|  1.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.54M|    }
  ------------------
 2341|  1.81M|                            case 2:
  ------------------
  |  Branch (2341:29): [True: 269k, False: 1.56M]
  ------------------
 2342|  1.81M|                                YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.81M|    {                                                                          \
  |  | 2253|  1.81M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.81M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.81M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.81M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.81M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.81M|    }
  ------------------
 2343|  1.83M|                            case 1:
  ------------------
  |  Branch (2343:29): [True: 20.7k, False: 1.81M]
  ------------------
 2344|  1.83M|                                YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.83M|    {                                                                          \
  |  | 2253|  1.83M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.83M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.83M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.83M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.83M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.83M|    }
  ------------------
 2345|  1.83M|                        } /* FALLTHROUGH */
 2346|  1.83M|                    case 2:
  ------------------
  |  Branch (2346:21): [True: 900, False: 1.85M]
  ------------------
 2347|  1.83M|                        switch (h)
 2348|  1.83M|                        {
 2349|  1.48M|                            default:
  ------------------
  |  Branch (2349:29): [True: 1.48M, False: 352k]
  ------------------
 2350|  1.48M|                                YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.48M|    {                                                                          \
  |  | 2253|  1.48M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.48M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.48M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.48M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.48M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.48M|    }
  ------------------
 2351|  1.54M|                            case 3:
  ------------------
  |  Branch (2351:29): [True: 62.6k, False: 1.77M]
  ------------------
 2352|  1.54M|                                YCbCrtoRGB(cp2[1], pp[9]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.54M|    {                                                                          \
  |  | 2253|  1.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.54M|    }
  ------------------
 2353|  1.81M|                            case 2:
  ------------------
  |  Branch (2353:29): [True: 269k, False: 1.56M]
  ------------------
 2354|  1.81M|                                YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.81M|    {                                                                          \
  |  | 2253|  1.81M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.81M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.81M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.81M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.81M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.81M|    }
  ------------------
 2355|  1.83M|                            case 1:
  ------------------
  |  Branch (2355:29): [True: 20.8k, False: 1.81M]
  ------------------
 2356|  1.83M|                                YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.83M|    {                                                                          \
  |  | 2253|  1.83M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.83M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.83M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.83M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.83M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.83M|    }
  ------------------
 2357|  1.83M|                        } /* FALLTHROUGH */
 2358|  1.85M|                    case 1:
  ------------------
  |  Branch (2358:21): [True: 20.7k, False: 1.83M]
  ------------------
 2359|  1.85M|                        switch (h)
 2360|  1.85M|                        {
 2361|  1.50M|                            default:
  ------------------
  |  Branch (2361:29): [True: 1.50M, False: 354k]
  ------------------
 2362|  1.50M|                                YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.50M|    {                                                                          \
  |  | 2253|  1.50M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.50M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.50M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.50M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.50M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.50M|    }
  ------------------
 2363|  1.56M|                            case 3:
  ------------------
  |  Branch (2363:29): [True: 64.0k, False: 1.79M]
  ------------------
 2364|  1.56M|                                YCbCrtoRGB(cp2[0], pp[8]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.56M|    {                                                                          \
  |  | 2253|  1.56M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.56M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.56M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.56M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.56M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.56M|    }
  ------------------
 2365|  1.83M|                            case 2:
  ------------------
  |  Branch (2365:29): [True: 269k, False: 1.58M]
  ------------------
 2366|  1.83M|                                YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.83M|    {                                                                          \
  |  | 2253|  1.83M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.83M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.83M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.83M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.83M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.83M|    }
  ------------------
 2367|  1.85M|                            case 1:
  ------------------
  |  Branch (2367:29): [True: 21.4k, False: 1.83M]
  ------------------
 2368|  1.85M|                                YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.85M|    {                                                                          \
  |  | 2253|  1.85M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.85M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.85M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.85M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.85M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.85M|    }
  ------------------
 2369|  1.85M|                        } /* FALLTHROUGH */
 2370|  1.85M|                }
 2371|  1.85M|                if (x < 4)
  ------------------
  |  Branch (2371:21): [True: 26.5k, False: 1.83M]
  ------------------
 2372|  26.5k|                {
 2373|  26.5k|                    cp += x;
 2374|  26.5k|                    cp1 += x;
 2375|  26.5k|                    cp2 += x;
 2376|  26.5k|                    cp3 += x;
 2377|  26.5k|                    x = 0;
 2378|  26.5k|                }
 2379|  1.83M|                else
 2380|  1.83M|                {
 2381|  1.83M|                    cp += 4;
 2382|  1.83M|                    cp1 += 4;
 2383|  1.83M|                    cp2 += 4;
 2384|  1.83M|                    cp3 += 4;
 2385|  1.83M|                    x -= 4;
 2386|  1.83M|                }
 2387|  1.85M|                pp += 18;
 2388|  1.85M|            }
 2389|  29.8k|            if (h <= 4)
  ------------------
  |  Branch (2389:17): [True: 3.41k, False: 26.4k]
  ------------------
 2390|  3.41k|                break;
 2391|  26.4k|            h -= 4;
 2392|  26.4k|            cp += incr;
 2393|  26.4k|            cp1 += incr;
 2394|  26.4k|            cp2 += incr;
 2395|  26.4k|            cp3 += incr;
 2396|  26.4k|            pp += fromskewLocal;
 2397|  26.4k|        }
 2398|  3.41k|    }
 2399|  5.08k|}
tif_getimage.c:putcontig8bitYCbCr42tile:
 2405|  36.6k|{
 2406|  36.6k|    uint32_t *cp1 = cp + w + toskew;
 2407|  36.6k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2408|       |
 2409|  36.6k|    (void)y;
 2410|  36.6k|    const tmsize_t fromskewLocal =
 2411|  36.6k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 2 + 2);
 2412|  36.6k|    if ((w & 3) == 0 && (h & 1) == 0)
  ------------------
  |  Branch (2412:9): [True: 5.17k, False: 31.5k]
  |  Branch (2412:25): [True: 4.36k, False: 803]
  ------------------
 2413|  4.36k|    {
 2414|   139k|        for (; h >= 2; h -= 2)
  ------------------
  |  Branch (2414:16): [True: 135k, False: 4.36k]
  ------------------
 2415|   135k|        {
 2416|   135k|            x = w >> 2;
 2417|   135k|            do
 2418|  3.54M|            {
 2419|  3.54M|                int32_t Cb = pp[8];
 2420|  3.54M|                int32_t Cr = pp[9];
 2421|       |
 2422|  3.54M|                YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2423|  3.54M|                YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2424|  3.54M|                YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2425|  3.54M|                YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2426|  3.54M|                YCbCrtoRGB(cp1[0], pp[4]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2427|  3.54M|                YCbCrtoRGB(cp1[1], pp[5]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2428|  3.54M|                YCbCrtoRGB(cp1[2], pp[6]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2429|  3.54M|                YCbCrtoRGB(cp1[3], pp[7]);
  ------------------
  |  | 2252|  3.54M|    {                                                                          \
  |  | 2253|  3.54M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.54M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.54M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.54M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.54M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.54M|    }
  ------------------
 2430|       |
 2431|  3.54M|                cp += 4;
 2432|  3.54M|                cp1 += 4;
 2433|  3.54M|                pp += 10;
 2434|  3.54M|            } while (--x);
  ------------------
  |  Branch (2434:22): [True: 3.40M, False: 135k]
  ------------------
 2435|   135k|            cp += incr;
 2436|   135k|            cp1 += incr;
 2437|   135k|            pp += fromskewLocal;
 2438|   135k|        }
 2439|  4.36k|    }
 2440|  32.3k|    else
 2441|  32.3k|    {
 2442|  99.8k|        while (h > 0)
  ------------------
  |  Branch (2442:16): [True: 99.8k, False: 0]
  ------------------
 2443|  99.8k|        {
 2444|  3.74M|            for (x = w; x > 0;)
  ------------------
  |  Branch (2444:25): [True: 3.64M, False: 99.8k]
  ------------------
 2445|  3.64M|            {
 2446|  3.64M|                int32_t Cb = pp[8];
 2447|  3.64M|                int32_t Cr = pp[9];
 2448|  3.64M|                switch (x)
 2449|  3.64M|                {
 2450|  3.55M|                    default:
  ------------------
  |  Branch (2450:21): [True: 3.55M, False: 85.6k]
  ------------------
 2451|  3.55M|                        switch (h)
 2452|  3.55M|                        {
 2453|  3.48M|                            default:
  ------------------
  |  Branch (2453:29): [True: 3.48M, False: 70.4k]
  ------------------
 2454|  3.48M|                                YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.48M|    {                                                                          \
  |  | 2253|  3.48M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.48M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.48M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.48M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.48M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.48M|    }
  ------------------
 2455|  3.55M|                            case 1:
  ------------------
  |  Branch (2455:29): [True: 70.4k, False: 3.48M]
  ------------------
 2456|  3.55M|                                YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.55M|    {                                                                          \
  |  | 2253|  3.55M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.55M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.55M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.55M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.55M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.55M|    }
  ------------------
 2457|  3.55M|                        } /* FALLTHROUGH */
 2458|  3.59M|                    case 3:
  ------------------
  |  Branch (2458:21): [True: 42.1k, False: 3.60M]
  ------------------
 2459|  3.59M|                        switch (h)
 2460|  3.59M|                        {
 2461|  3.52M|                            default:
  ------------------
  |  Branch (2461:29): [True: 3.52M, False: 70.4k]
  ------------------
 2462|  3.52M|                                YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.52M|    {                                                                          \
  |  | 2253|  3.52M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.52M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.52M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.52M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.52M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.52M|    }
  ------------------
 2463|  3.59M|                            case 1:
  ------------------
  |  Branch (2463:29): [True: 70.4k, False: 3.52M]
  ------------------
 2464|  3.59M|                                YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.59M|    {                                                                          \
  |  | 2253|  3.59M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.59M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.59M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.59M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.59M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.59M|    }
  ------------------
 2465|  3.59M|                        } /* FALLTHROUGH */
 2466|  3.62M|                    case 2:
  ------------------
  |  Branch (2466:21): [True: 29.1k, False: 3.61M]
  ------------------
 2467|  3.62M|                        switch (h)
 2468|  3.62M|                        {
 2469|  3.55M|                            default:
  ------------------
  |  Branch (2469:29): [True: 3.55M, False: 70.4k]
  ------------------
 2470|  3.55M|                                YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.55M|    {                                                                          \
  |  | 2253|  3.55M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.55M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.55M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.55M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.55M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.55M|    }
  ------------------
 2471|  3.62M|                            case 1:
  ------------------
  |  Branch (2471:29): [True: 70.4k, False: 3.55M]
  ------------------
 2472|  3.62M|                                YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.62M|    {                                                                          \
  |  | 2253|  3.62M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.62M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.62M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.62M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.62M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.62M|    }
  ------------------
 2473|  3.62M|                        } /* FALLTHROUGH */
 2474|  3.64M|                    case 1:
  ------------------
  |  Branch (2474:21): [True: 14.3k, False: 3.62M]
  ------------------
 2475|  3.64M|                        switch (h)
 2476|  3.64M|                        {
 2477|  3.57M|                            default:
  ------------------
  |  Branch (2477:29): [True: 3.57M, False: 71.1k]
  ------------------
 2478|  3.57M|                                YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.57M|    {                                                                          \
  |  | 2253|  3.57M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.57M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.57M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.57M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.57M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.57M|    }
  ------------------
 2479|  3.64M|                            case 1:
  ------------------
  |  Branch (2479:29): [True: 71.1k, False: 3.57M]
  ------------------
 2480|  3.64M|                                YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  3.64M|    {                                                                          \
  |  | 2253|  3.64M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.64M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.64M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.64M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.64M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.64M|    }
  ------------------
 2481|  3.64M|                        } /* FALLTHROUGH */
 2482|  3.64M|                }
 2483|  3.64M|                if (x < 4)
  ------------------
  |  Branch (2483:21): [True: 85.6k, False: 3.55M]
  ------------------
 2484|  85.6k|                {
 2485|  85.6k|                    cp += x;
 2486|  85.6k|                    cp1 += x;
 2487|  85.6k|                    x = 0;
 2488|  85.6k|                }
 2489|  3.55M|                else
 2490|  3.55M|                {
 2491|  3.55M|                    cp += 4;
 2492|  3.55M|                    cp1 += 4;
 2493|  3.55M|                    x -= 4;
 2494|  3.55M|                }
 2495|  3.64M|                pp += 10;
 2496|  3.64M|            }
 2497|  99.8k|            if (h <= 2)
  ------------------
  |  Branch (2497:17): [True: 32.3k, False: 67.5k]
  ------------------
 2498|  32.3k|                break;
 2499|  67.5k|            h -= 2;
 2500|  67.5k|            cp += incr;
 2501|  67.5k|            cp1 += incr;
 2502|  67.5k|            pp += fromskewLocal;
 2503|  67.5k|        }
 2504|  32.3k|    }
 2505|  36.6k|}
tif_getimage.c:putcontig8bitYCbCr41tile:
 2511|  53.9k|{
 2512|  53.9k|    (void)y;
 2513|  53.9k|    const tmsize_t fromskewLocal =
 2514|  53.9k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 1 + 2);
 2515|  53.9k|    do
 2516|  1.69M|    {
 2517|  1.69M|        x = w >> 2;
 2518|  3.35M|        while (x > 0)
  ------------------
  |  Branch (2518:16): [True: 1.65M, False: 1.69M]
  ------------------
 2519|  1.65M|        {
 2520|  1.65M|            int32_t Cb = pp[4];
 2521|  1.65M|            int32_t Cr = pp[5];
 2522|       |
 2523|  1.65M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  1.65M|    {                                                                          \
  |  | 2253|  1.65M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.65M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.65M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.65M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.65M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.65M|    }
  ------------------
 2524|  1.65M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  1.65M|    {                                                                          \
  |  | 2253|  1.65M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.65M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.65M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.65M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.65M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.65M|    }
  ------------------
 2525|  1.65M|            YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2252|  1.65M|    {                                                                          \
  |  | 2253|  1.65M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.65M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.65M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.65M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.65M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.65M|    }
  ------------------
 2526|  1.65M|            YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2252|  1.65M|    {                                                                          \
  |  | 2253|  1.65M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.65M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.65M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.65M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.65M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.65M|    }
  ------------------
 2527|       |
 2528|  1.65M|            cp += 4;
 2529|  1.65M|            pp += 6;
 2530|  1.65M|            x--;
 2531|  1.65M|        }
 2532|       |
 2533|  1.69M|        if ((w & 3) != 0)
  ------------------
  |  Branch (2533:13): [True: 66.0k, False: 1.63M]
  ------------------
 2534|  66.0k|        {
 2535|  66.0k|            int32_t Cb = pp[4];
 2536|  66.0k|            int32_t Cr = pp[5];
 2537|       |
 2538|  66.0k|            switch ((w & 3))
 2539|  66.0k|            {
 2540|     98|                case 3:
  ------------------
  |  Branch (2540:17): [True: 98, False: 65.9k]
  ------------------
 2541|     98|                    YCbCrtoRGB(cp[2], pp[2]); /*-fallthrough*/
  ------------------
  |  | 2252|     98|    {                                                                          \
  |  | 2253|     98|        uint32_t r, g, b;                                                      \
  |  | 2254|     98|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|     98|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|     98|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|     98|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|     98|    }
  ------------------
 2542|    745|                case 2:
  ------------------
  |  Branch (2542:17): [True: 647, False: 65.3k]
  ------------------
 2543|    745|                    YCbCrtoRGB(cp[1], pp[1]); /*-fallthrough*/
  ------------------
  |  | 2252|    745|    {                                                                          \
  |  | 2253|    745|        uint32_t r, g, b;                                                      \
  |  | 2254|    745|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|    745|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|    745|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|    745|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|    745|    }
  ------------------
 2544|  66.0k|                case 1:
  ------------------
  |  Branch (2544:17): [True: 65.2k, False: 745]
  ------------------
 2545|  66.0k|                    YCbCrtoRGB(cp[0], pp[0]); /*-fallthrough*/
  ------------------
  |  | 2252|  66.0k|    {                                                                          \
  |  | 2253|  66.0k|        uint32_t r, g, b;                                                      \
  |  | 2254|  66.0k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  66.0k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  66.0k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  66.0k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  66.0k|    }
  ------------------
 2546|  66.0k|                case 0:
  ------------------
  |  Branch (2546:17): [True: 0, False: 66.0k]
  ------------------
 2547|  66.0k|                    break;
 2548|      0|                default:
  ------------------
  |  Branch (2548:17): [True: 0, False: 66.0k]
  ------------------
 2549|      0|                    break;
 2550|  66.0k|            }
 2551|       |
 2552|  66.0k|            cp += (w & 3);
 2553|  66.0k|            pp += 6;
 2554|  66.0k|        }
 2555|       |
 2556|  1.69M|        cp += toskew;
 2557|  1.69M|        pp += fromskewLocal;
 2558|  1.69M|    } while (--h);
  ------------------
  |  Branch (2558:14): [True: 1.64M, False: 53.9k]
  ------------------
 2559|  53.9k|}
tif_getimage.c:putcontig8bitYCbCr22tile:
 2565|  3.51k|{
 2566|  3.51k|    uint32_t *cp2;
 2567|  3.51k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2568|  3.51k|    (void)y;
 2569|  3.51k|    const tmsize_t fromskewLocal =
 2570|  3.51k|        (tmsize_t)(fromskew / 2) * (tmsize_t)(2 * 2 + 2);
 2571|  3.51k|    cp2 = cp + w + toskew;
 2572|   111k|    while (h >= 2)
  ------------------
  |  Branch (2572:12): [True: 108k, False: 3.51k]
  ------------------
 2573|   108k|    {
 2574|   108k|        x = w;
 2575|  6.40M|        while (x >= 2)
  ------------------
  |  Branch (2575:16): [True: 6.29M, False: 108k]
  ------------------
 2576|  6.29M|        {
 2577|  6.29M|            uint32_t Cb = pp[4];
 2578|  6.29M|            uint32_t Cr = pp[5];
 2579|  6.29M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  6.29M|    {                                                                          \
  |  | 2253|  6.29M|        uint32_t r, g, b;                                                      \
  |  | 2254|  6.29M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  6.29M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  6.29M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  6.29M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  6.29M|    }
  ------------------
 2580|  6.29M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  6.29M|    {                                                                          \
  |  | 2253|  6.29M|        uint32_t r, g, b;                                                      \
  |  | 2254|  6.29M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  6.29M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  6.29M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  6.29M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  6.29M|    }
  ------------------
 2581|  6.29M|            YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 2252|  6.29M|    {                                                                          \
  |  | 2253|  6.29M|        uint32_t r, g, b;                                                      \
  |  | 2254|  6.29M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  6.29M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  6.29M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  6.29M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  6.29M|    }
  ------------------
 2582|  6.29M|            YCbCrtoRGB(cp2[1], pp[3]);
  ------------------
  |  | 2252|  6.29M|    {                                                                          \
  |  | 2253|  6.29M|        uint32_t r, g, b;                                                      \
  |  | 2254|  6.29M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  6.29M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  6.29M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  6.29M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  6.29M|    }
  ------------------
 2583|  6.29M|            cp += 2;
 2584|  6.29M|            cp2 += 2;
 2585|  6.29M|            pp += 6;
 2586|  6.29M|            x -= 2;
 2587|  6.29M|        }
 2588|   108k|        if (x == 1)
  ------------------
  |  Branch (2588:13): [True: 54.9k, False: 53.2k]
  ------------------
 2589|  54.9k|        {
 2590|  54.9k|            uint32_t Cb = pp[4];
 2591|  54.9k|            uint32_t Cr = pp[5];
 2592|  54.9k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  54.9k|    {                                                                          \
  |  | 2253|  54.9k|        uint32_t r, g, b;                                                      \
  |  | 2254|  54.9k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  54.9k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  54.9k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  54.9k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  54.9k|    }
  ------------------
 2593|  54.9k|            YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 2252|  54.9k|    {                                                                          \
  |  | 2253|  54.9k|        uint32_t r, g, b;                                                      \
  |  | 2254|  54.9k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  54.9k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  54.9k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  54.9k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  54.9k|    }
  ------------------
 2594|  54.9k|            cp++;
 2595|  54.9k|            cp2++;
 2596|  54.9k|            pp += 6;
 2597|  54.9k|        }
 2598|   108k|        cp += incr;
 2599|   108k|        cp2 += incr;
 2600|   108k|        pp += fromskewLocal;
 2601|   108k|        h -= 2;
 2602|   108k|    }
 2603|  3.51k|    if (h == 1)
  ------------------
  |  Branch (2603:9): [True: 2.37k, False: 1.14k]
  ------------------
 2604|  2.37k|    {
 2605|  2.37k|        x = w;
 2606|  3.41M|        while (x >= 2)
  ------------------
  |  Branch (2606:16): [True: 3.41M, False: 2.37k]
  ------------------
 2607|  3.41M|        {
 2608|  3.41M|            uint32_t Cb = pp[4];
 2609|  3.41M|            uint32_t Cr = pp[5];
 2610|  3.41M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  3.41M|    {                                                                          \
  |  | 2253|  3.41M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.41M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.41M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.41M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.41M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.41M|    }
  ------------------
 2611|  3.41M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  3.41M|    {                                                                          \
  |  | 2253|  3.41M|        uint32_t r, g, b;                                                      \
  |  | 2254|  3.41M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  3.41M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  3.41M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.41M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  3.41M|    }
  ------------------
 2612|  3.41M|            cp += 2;
 2613|  3.41M|            cp2 += 2;
 2614|  3.41M|            pp += 6;
 2615|  3.41M|            x -= 2;
 2616|  3.41M|        }
 2617|  2.37k|        if (x == 1)
  ------------------
  |  Branch (2617:13): [True: 2.24k, False: 122]
  ------------------
 2618|  2.24k|        {
 2619|  2.24k|            uint32_t Cb = pp[4];
 2620|  2.24k|            uint32_t Cr = pp[5];
 2621|  2.24k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  2.24k|    {                                                                          \
  |  | 2253|  2.24k|        uint32_t r, g, b;                                                      \
  |  | 2254|  2.24k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  2.24k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  2.24k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  2.24k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  2.24k|    }
  ------------------
 2622|  2.24k|        }
 2623|  2.37k|    }
 2624|  3.51k|}
tif_getimage.c:putcontig8bitYCbCr21tile:
 2630|  5.23k|{
 2631|  5.23k|    (void)y;
 2632|  5.23k|    const tmsize_t fromskewLocal =
 2633|  5.23k|        (tmsize_t)(fromskew / 2) * (tmsize_t)(2 * 1 + 2);
 2634|  5.23k|    do
 2635|  5.23k|    {
 2636|  5.23k|        x = w >> 1;
 2637|   100k|        while (x > 0)
  ------------------
  |  Branch (2637:16): [True: 95.5k, False: 5.23k]
  ------------------
 2638|  95.5k|        {
 2639|  95.5k|            int32_t Cb = pp[2];
 2640|  95.5k|            int32_t Cr = pp[3];
 2641|       |
 2642|  95.5k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  95.5k|    {                                                                          \
  |  | 2253|  95.5k|        uint32_t r, g, b;                                                      \
  |  | 2254|  95.5k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  95.5k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  95.5k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  95.5k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  95.5k|    }
  ------------------
 2643|  95.5k|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  95.5k|    {                                                                          \
  |  | 2253|  95.5k|        uint32_t r, g, b;                                                      \
  |  | 2254|  95.5k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  95.5k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  95.5k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  95.5k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  95.5k|    }
  ------------------
 2644|       |
 2645|  95.5k|            cp += 2;
 2646|  95.5k|            pp += 4;
 2647|  95.5k|            x--;
 2648|  95.5k|        }
 2649|       |
 2650|  5.23k|        if ((w & 1) != 0)
  ------------------
  |  Branch (2650:13): [True: 5.23k, False: 1]
  ------------------
 2651|  5.23k|        {
 2652|  5.23k|            int32_t Cb = pp[2];
 2653|  5.23k|            int32_t Cr = pp[3];
 2654|       |
 2655|  5.23k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  5.23k|    {                                                                          \
  |  | 2253|  5.23k|        uint32_t r, g, b;                                                      \
  |  | 2254|  5.23k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  5.23k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  5.23k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  5.23k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  5.23k|    }
  ------------------
 2656|       |
 2657|  5.23k|            cp += 1;
 2658|  5.23k|            pp += 4;
 2659|  5.23k|        }
 2660|       |
 2661|  5.23k|        cp += toskew;
 2662|  5.23k|        pp += fromskewLocal;
 2663|  5.23k|    } while (--h);
  ------------------
  |  Branch (2663:14): [True: 0, False: 5.23k]
  ------------------
 2664|  5.23k|}
tif_getimage.c:putcontig8bitYCbCr12tile:
 2670|    812|{
 2671|    812|    uint32_t *cp2;
 2672|    812|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2673|    812|    (void)y;
 2674|    812|    const tmsize_t fromskewLocal =
 2675|    812|        (tmsize_t)(fromskew / 1) * (tmsize_t)(1 * 2 + 2);
 2676|    812|    cp2 = cp + w + toskew;
 2677|  46.9k|    while (h >= 2)
  ------------------
  |  Branch (2677:12): [True: 46.0k, False: 812]
  ------------------
 2678|  46.0k|    {
 2679|  46.0k|        x = w;
 2680|  46.0k|        do
 2681|   236k|        {
 2682|   236k|            uint32_t Cb = pp[2];
 2683|   236k|            uint32_t Cr = pp[3];
 2684|   236k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|   236k|    {                                                                          \
  |  | 2253|   236k|        uint32_t r, g, b;                                                      \
  |  | 2254|   236k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   236k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   236k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   236k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   236k|    }
  ------------------
 2685|   236k|            YCbCrtoRGB(cp2[0], pp[1]);
  ------------------
  |  | 2252|   236k|    {                                                                          \
  |  | 2253|   236k|        uint32_t r, g, b;                                                      \
  |  | 2254|   236k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   236k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   236k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   236k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   236k|    }
  ------------------
 2686|   236k|            cp++;
 2687|   236k|            cp2++;
 2688|   236k|            pp += 4;
 2689|   236k|        } while (--x);
  ------------------
  |  Branch (2689:18): [True: 190k, False: 46.0k]
  ------------------
 2690|  46.0k|        cp += incr;
 2691|  46.0k|        cp2 += incr;
 2692|  46.0k|        pp += fromskewLocal;
 2693|  46.0k|        h -= 2;
 2694|  46.0k|    }
 2695|    812|    if (h == 1)
  ------------------
  |  Branch (2695:9): [True: 508, False: 304]
  ------------------
 2696|    508|    {
 2697|    508|        x = w;
 2698|    508|        do
 2699|  10.6k|        {
 2700|  10.6k|            uint32_t Cb = pp[2];
 2701|  10.6k|            uint32_t Cr = pp[3];
 2702|  10.6k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  10.6k|    {                                                                          \
  |  | 2253|  10.6k|        uint32_t r, g, b;                                                      \
  |  | 2254|  10.6k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  10.6k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  10.6k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  10.6k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  10.6k|    }
  ------------------
 2703|  10.6k|            cp++;
 2704|  10.6k|            pp += 4;
 2705|  10.6k|        } while (--x);
  ------------------
  |  Branch (2705:18): [True: 10.1k, False: 508]
  ------------------
 2706|    508|    }
 2707|    812|}
tif_getimage.c:putcontig8bitYCbCr11tile:
 2713|  1.63k|{
 2714|  1.63k|    (void)y;
 2715|  1.63k|    const tmsize_t fromskewLocal =
 2716|  1.63k|        (tmsize_t)(fromskew / 1) * (tmsize_t)(1 * 1 + 2);
 2717|  1.63k|    do
 2718|  19.0k|    {
 2719|  19.0k|        x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */
 2720|  19.0k|        do
 2721|  1.94M|        {
 2722|  1.94M|            int32_t Cb = pp[1];
 2723|  1.94M|            int32_t Cr = pp[2];
 2724|       |
 2725|  1.94M|            YCbCrtoRGB(*cp++, pp[0]);
  ------------------
  |  | 2252|  1.94M|    {                                                                          \
  |  | 2253|  1.94M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.94M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.94M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.94M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.94M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.94M|    }
  ------------------
 2726|       |
 2727|  1.94M|            pp += 3;
 2728|  1.94M|        } while (--x);
  ------------------
  |  Branch (2728:18): [True: 1.92M, False: 19.0k]
  ------------------
 2729|  19.0k|        cp += toskew;
 2730|  19.0k|        pp += fromskewLocal;
 2731|  19.0k|    } while (--h);
  ------------------
  |  Branch (2731:14): [True: 17.4k, False: 1.63k]
  ------------------
 2732|  1.63k|}
tif_getimage.c:initCIELabConversion:
 2815|     14|{
 2816|     14|    static const char module[] = "initCIELabConversion";
 2817|       |
 2818|     14|    float *whitePoint;
 2819|     14|    float refWhite[3];
 2820|       |
 2821|     14|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
  ------------------
  |  |  307|     14|#define TIFFTAG_WHITEPOINT 318             /* image white point */
  ------------------
 2822|     14|    if (TIFF_FLOAT_EQ(whitePoint[1], 0.0f))
  ------------------
  |  |  342|     14|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (342:29): [True: 1, False: 13]
  |  |  ------------------
  ------------------
 2823|      1|    {
 2824|      1|        TIFFErrorExtR(img->tif, module, "Invalid value for WhitePoint tag.");
 2825|      1|        return NULL;
 2826|      1|    }
 2827|       |
 2828|     13|    if (!img->cielab)
  ------------------
  |  Branch (2828:9): [True: 13, False: 0]
  ------------------
 2829|     13|    {
 2830|     13|        img->cielab = (TIFFCIELabToRGB *)_TIFFmallocExt(
 2831|     13|            img->tif, sizeof(TIFFCIELabToRGB));
 2832|     13|        if (!img->cielab)
  ------------------
  |  Branch (2832:13): [True: 0, False: 13]
  ------------------
 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|     13|    }
 2839|       |
 2840|     13|    refWhite[1] = 100.0f;
 2841|     13|    refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
 2842|     13|    refWhite[2] =
 2843|     13|        (1.0f - whitePoint[0] - whitePoint[1]) / whitePoint[1] * refWhite[1];
 2844|     13|    if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0)
  ------------------
  |  Branch (2844:9): [True: 0, False: 13]
  ------------------
 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|     13|    if (img->bitspersample == 8)
  ------------------
  |  Branch (2852:9): [True: 5, False: 8]
  ------------------
 2853|      5|        return putcontig8bitCIELab8;
 2854|      8|    else if (img->bitspersample == 16)
  ------------------
  |  Branch (2854:14): [True: 8, False: 0]
  ------------------
 2855|      8|        return putcontig8bitCIELab16;
 2856|      0|    return NULL;
 2857|     13|}
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|    470|{
 2227|    470|    float X, Y, Z;
 2228|    470|    uint32_t r, g, b;
 2229|    470|    uint16_t *wp = (uint16_t *)pp;
 2230|    470|    (void)y;
 2231|    470|    const tmsize_t fromskewLocal = (tmsize_t)fromskew * (tmsize_t)3;
 2232|  3.01k|    for (; h > 0; --h)
  ------------------
  |  Branch (2232:12): [True: 2.54k, False: 470]
  ------------------
 2233|  2.54k|    {
 2234|   247k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2234:21): [True: 244k, False: 2.54k]
  ------------------
 2235|   244k|        {
 2236|   244k|            TIFFCIELab16ToXYZ(img->cielab, (uint16_t)wp[0], (int16_t)wp[1],
 2237|   244k|                              (int16_t)wp[2], &X, &Y, &Z);
 2238|   244k|            TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
 2239|   244k|            *cp++ = PACK(r, g, b);
  ------------------
  |  | 1612|   244k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|   244k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2240|   244k|            wp += 3;
 2241|   244k|        }
 2242|  2.54k|        cp += toskew;
 2243|  2.54k|        wp += fromskewLocal;
 2244|  2.54k|    }
 2245|    470|}
tif_getimage.c:PickSeparateCase:
 3311|    882|{
 3312|    882|    img->get = TIFFIsTiled(img->tif) ? gtTileSeparate : gtStripSeparate;
  ------------------
  |  Branch (3312:16): [True: 685, False: 197]
  ------------------
 3313|    882|    img->put.separate = NULL;
 3314|    882|    switch (img->photometric)
 3315|    882|    {
 3316|      3|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      3|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3316:9): [True: 3, False: 879]
  ------------------
 3317|    116|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|    116|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3317:9): [True: 113, False: 769]
  ------------------
 3318|       |            /* greyscale images processed pretty much as RGB by gtTileSeparate
 3319|       |             */
 3320|    126|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|    126|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3320:9): [True: 10, False: 872]
  ------------------
 3321|    126|            switch (img->bitspersample)
 3322|    126|            {
 3323|     73|                case 8:
  ------------------
  |  Branch (3323:17): [True: 73, False: 53]
  ------------------
 3324|     73|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  331|     73|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3324:25): [True: 36, False: 37]
  ------------------
 3325|     36|                        img->put.separate = putRGBAAseparate8bittile;
 3326|     37|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|     37|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3326:30): [True: 26, False: 11]
  ------------------
 3327|     26|                    {
 3328|     26|                        if (BuildMapUaToAa(img))
  ------------------
  |  Branch (3328:29): [True: 26, False: 0]
  ------------------
 3329|     26|                            img->put.separate = putRGBUAseparate8bittile;
 3330|     26|                    }
 3331|     11|                    else
 3332|     11|                        img->put.separate = putRGBseparate8bittile;
 3333|     73|                    break;
 3334|     52|                case 16:
  ------------------
  |  Branch (3334:17): [True: 52, False: 74]
  ------------------
 3335|     52|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  331|     52|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3335:25): [True: 17, False: 35]
  ------------------
 3336|     17|                    {
 3337|     17|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3337:29): [True: 17, False: 0]
  ------------------
 3338|     17|                            img->put.separate = putRGBAAseparate16bittile;
 3339|     17|                    }
 3340|     35|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|     35|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3340:30): [True: 20, False: 15]
  ------------------
 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|     15|                    else
 3346|     15|                    {
 3347|     15|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3347:29): [True: 15, False: 0]
  ------------------
 3348|     15|                            img->put.separate = putRGBseparate16bittile;
 3349|     15|                    }
 3350|     52|                    break;
 3351|      1|                default:
  ------------------
  |  Branch (3351:17): [True: 1, False: 125]
  ------------------
 3352|      1|                    break;
 3353|    126|            }
 3354|    126|            break;
 3355|    126|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     40|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3355:9): [True: 40, False: 842]
  ------------------
 3356|     40|            if (img->bitspersample == 8 && img->samplesperpixel == 4)
  ------------------
  |  Branch (3356:17): [True: 40, False: 0]
  |  Branch (3356:44): [True: 39, False: 1]
  ------------------
 3357|     39|            {
 3358|       |                /* Not alpha, but seems like the only way to get 4th band */
 3359|     39|                img->alpha = 1;
 3360|     39|                img->put.separate = putCMYKseparate8bittile;
 3361|     39|            }
 3362|     40|            break;
 3363|    716|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|    716|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3363:9): [True: 716, False: 166]
  ------------------
 3364|    716|            if ((img->bitspersample == 8) && (img->samplesperpixel == 3))
  ------------------
  |  Branch (3364:17): [True: 716, False: 0]
  |  Branch (3364:46): [True: 709, False: 7]
  ------------------
 3365|    709|            {
 3366|    709|                if (initYCbCrConversion(img) != 0)
  ------------------
  |  Branch (3366:21): [True: 708, False: 1]
  ------------------
 3367|    708|                {
 3368|    708|                    uint16_t hs, vs;
 3369|    708|                    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|    708|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 3370|    708|                                          &hs, &vs);
 3371|    708|                    switch ((hs << 4) | vs)
 3372|    708|                    {
 3373|    683|                        case 0x11:
  ------------------
  |  Branch (3373:25): [True: 683, False: 25]
  ------------------
 3374|    683|                            img->put.separate = putseparate8bitYCbCr11tile;
 3375|    683|                            break;
 3376|       |                            /* TODO: add other cases here */
 3377|     25|                        default:
  ------------------
  |  Branch (3377:25): [True: 25, False: 683]
  ------------------
 3378|     25|                            break;
 3379|    708|                    }
 3380|    708|                }
 3381|    709|            }
 3382|    716|            break;
 3383|    716|        default:
  ------------------
  |  Branch (3383:9): [True: 0, False: 882]
  ------------------
 3384|      0|            break;
 3385|    882|    }
 3386|    882|    return ((img->get != NULL) && (img->put.separate != NULL));
  ------------------
  |  Branch (3386:13): [True: 882, False: 0]
  |  Branch (3386:35): [True: 847, False: 35]
  ------------------
 3387|    882|}
tif_getimage.c:gtTileSeparate:
  905|    670|{
  906|    670|    TIFF *tif = img->tif;
  907|    670|    tileSeparateRoutine put = img->put.separate;
  908|    670|    uint32_t col, row, y, rowstoread;
  909|    670|    tmsize_t pos;
  910|    670|    uint32_t tw, th;
  911|    670|    unsigned char *buf = NULL;
  912|    670|    unsigned char *p0 = NULL;
  913|    670|    unsigned char *p1 = NULL;
  914|    670|    unsigned char *p2 = NULL;
  915|    670|    unsigned char *pa = NULL;
  916|    670|    tmsize_t tilesize;
  917|    670|    tmsize_t bufsize;
  918|    670|    int32_t fromskew, toskew;
  919|    670|    int alpha = img->alpha;
  920|    670|    uint32_t nrow;
  921|    670|    int ret = 1, flip;
  922|    670|    uint16_t colorchannels;
  923|    670|    uint32_t this_tw, tocol;
  924|    670|    int32_t this_toskew, leftmost_toskew;
  925|    670|    int32_t leftmost_fromskew;
  926|    670|    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|    670|    uint32_t wmin;
  931|    670|    if (0 <= img->col_offset && (uint32_t)img->col_offset < img->width)
  ------------------
  |  Branch (931:9): [True: 670, False: 0]
  |  Branch (931:33): [True: 670, False: 0]
  ------------------
  932|    670|    {
  933|    670|        wmin = TIFFmin(w, img->width - (uint32_t)img->col_offset);
  ------------------
  |  |  337|    670|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 670]
  |  |  ------------------
  ------------------
  934|    670|    }
  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|    670|    tilesize = TIFFTileSize(tif);
  945|    670|    bufsize =
  946|    670|        _TIFFMultiplySSize(tif, alpha ? 4 : 3, tilesize, "gtTileSeparate");
  ------------------
  |  Branch (946:33): [True: 69, False: 601]
  ------------------
  947|    670|    if (bufsize == 0)
  ------------------
  |  Branch (947:9): [True: 0, False: 670]
  ------------------
  948|      0|    {
  949|      0|        return (0);
  950|      0|    }
  951|       |
  952|    670|    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  311|    670|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  953|    670|    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  312|    670|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  954|       |
  955|    670|    flip = setorientation(img);
  956|    670|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|    670|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (956:9): [True: 644, False: 26]
  ------------------
  957|    644|    {
  958|    644|        if (((int64_t)tw + w) > INT_MAX)
  ------------------
  |  Branch (958:13): [True: 0, False: 644]
  ------------------
  959|      0|        {
  960|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  961|      0|                          "unsupported tile size (too wide)");
  962|      0|            return (0);
  963|      0|        }
  964|    644|        y = h - 1;
  965|    644|        toskew = -(int32_t)(tw + w);
  966|    644|    }
  967|     26|    else
  968|     26|    {
  969|     26|        if (tw > ((int64_t)INT_MAX + w) || w > ((int64_t)INT_MAX + tw))
  ------------------
  |  Branch (969:13): [True: 0, False: 26]
  |  Branch (969:44): [True: 0, False: 26]
  ------------------
  970|      0|        {
  971|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  972|      0|                          "unsupported tile size (too wide)");
  973|      0|            return (0);
  974|      0|        }
  975|     26|        y = 0;
  976|     26|        toskew = -(int32_t)(tw - w);
  977|     26|    }
  978|       |
  979|    670|    switch (img->photometric)
  980|    670|    {
  981|      0|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      0|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (981:9): [True: 0, False: 670]
  ------------------
  982|     56|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|     56|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (982:9): [True: 56, False: 614]
  ------------------
  983|     56|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     56|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (983:9): [True: 0, False: 670]
  ------------------
  984|     56|            colorchannels = 1;
  985|     56|            break;
  986|       |
  987|    614|        default:
  ------------------
  |  Branch (987:9): [True: 614, False: 56]
  ------------------
  988|    614|            colorchannels = 3;
  989|    614|            break;
  990|    670|    }
  991|       |
  992|    670|    if (tw == 0 || th == 0)
  ------------------
  |  Branch (992:9): [True: 0, False: 670]
  |  Branch (992:20): [True: 0, False: 670]
  ------------------
  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|    670|    leftmost_fromskew = (int32_t)((uint32_t)img->col_offset % tw);
 1002|    670|    leftmost_tw = (uint32_t)((int32_t)tw - leftmost_fromskew);
 1003|    670|    int64_t skew_i64 = (int64_t)toskew + (int64_t)(int32_t)leftmost_fromskew;
 1004|    670|    if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
  ------------------
  |  Branch (1004:9): [True: 0, False: 670]
  |  Branch (1004:31): [True: 0, False: 670]
  ------------------
 1005|      0|    {
 1006|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
 1007|      0|                      skew_i64);
 1008|      0|        return (0);
 1009|      0|    }
 1010|    670|    leftmost_toskew = (int32_t)skew_i64;
 1011|   145k|    for (row = 0; ret != 0 && row < h; row += nrow)
  ------------------
  |  Branch (1011:19): [True: 145k, False: 76]
  |  Branch (1011:31): [True: 144k, False: 594]
  ------------------
 1012|   144k|    {
 1013|   144k|        rowstoread = th - ((uint32_t)row + (uint32_t)img->row_offset) % th;
 1014|   144k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (1014:17): [True: 615, False: 144k]
  ------------------
 1015|   144k|        fromskew = leftmost_fromskew;
 1016|   144k|        this_tw = leftmost_tw;
 1017|   144k|        this_toskew = leftmost_toskew;
 1018|   144k|        tocol = 0;
 1019|   144k|        col = (uint32_t)img->col_offset;
 1020|       |        /* wmin: only write imagewidth if raster is bigger. */
 1021|   591k|        while (tocol < wmin)
  ------------------
  |  Branch (1021:16): [True: 446k, False: 144k]
  ------------------
 1022|   446k|        {
 1023|   446k|            if (buf == NULL)
  ------------------
  |  Branch (1023:17): [True: 670, False: 445k]
  ------------------
 1024|    670|            {
 1025|    670|                if (_TIFFReadTileAndAllocBuffer(
  ------------------
  |  Branch (1025:21): [True: 114, False: 556]
  ------------------
 1026|    670|                        tif, (void **)&buf, bufsize, col,
 1027|    670|                        (uint32_t)((int32_t)row + img->row_offset), 0,
 1028|    670|                        0) == (tmsize_t)(-1) &&
 1029|    114|                    (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1029:22): [True: 76, False: 38]
  |  Branch (1029:37): [True: 0, False: 38]
  ------------------
 1030|     76|                {
 1031|     76|                    ret = 0;
 1032|     76|                    break;
 1033|     76|                }
 1034|    594|                p0 = buf;
 1035|    594|                if (colorchannels == 1)
  ------------------
  |  Branch (1035:21): [True: 47, False: 547]
  ------------------
 1036|     47|                {
 1037|     47|                    p2 = p1 = p0;
 1038|     47|                    pa = (alpha ? (p0 + 3 * tilesize) : NULL);
  ------------------
  |  Branch (1038:27): [True: 37, False: 10]
  ------------------
 1039|     47|                }
 1040|    547|                else
 1041|    547|                {
 1042|    547|                    p1 = p0 + tilesize;
 1043|    547|                    p2 = p1 + tilesize;
 1044|    547|                    pa = (alpha ? (p2 + tilesize) : NULL);
  ------------------
  |  Branch (1044:27): [True: 23, False: 524]
  ------------------
 1045|    547|                }
 1046|    594|            }
 1047|   445k|            else if (TIFFReadTile(tif, p0, col,
  ------------------
  |  Branch (1047:22): [True: 246k, False: 199k]
  ------------------
 1048|   445k|                                  (uint32_t)((int32_t)row + img->row_offset), 0,
 1049|   445k|                                  0) == (tmsize_t)(-1) &&
 1050|   246k|                     img->stoponerr)
  ------------------
  |  Branch (1050:22): [True: 0, False: 246k]
  ------------------
 1051|      0|            {
 1052|      0|                ret = 0;
 1053|      0|                break;
 1054|      0|            }
 1055|   446k|            if (colorchannels > 1 &&
  ------------------
  |  Branch (1055:17): [True: 345k, False: 100k]
  ------------------
 1056|   345k|                TIFFReadTile(tif, p1, col,
  ------------------
  |  Branch (1056:17): [True: 329k, False: 16.6k]
  ------------------
 1057|   345k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1058|   345k|                             (uint16_t)1) == (tmsize_t)(-1) &&
 1059|   329k|                img->stoponerr)
  ------------------
  |  Branch (1059:17): [True: 0, False: 329k]
  ------------------
 1060|      0|            {
 1061|      0|                ret = 0;
 1062|      0|                break;
 1063|      0|            }
 1064|   446k|            if (colorchannels > 1 &&
  ------------------
  |  Branch (1064:17): [True: 345k, False: 100k]
  ------------------
 1065|   345k|                TIFFReadTile(tif, p2, col,
  ------------------
  |  Branch (1065:17): [True: 345k, False: 542]
  ------------------
 1066|   345k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1067|   345k|                             (uint16_t)2) == (tmsize_t)(-1) &&
 1068|   345k|                img->stoponerr)
  ------------------
  |  Branch (1068:17): [True: 0, False: 345k]
  ------------------
 1069|      0|            {
 1070|      0|                ret = 0;
 1071|      0|                break;
 1072|      0|            }
 1073|   446k|            if (alpha &&
  ------------------
  |  Branch (1073:17): [True: 242k, False: 203k]
  ------------------
 1074|   242k|                TIFFReadTile(tif, pa, col,
  ------------------
  |  Branch (1074:17): [True: 242k, False: 400]
  ------------------
 1075|   242k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1076|   242k|                             (uint16_t)colorchannels) == (tmsize_t)(-1) &&
 1077|   242k|                img->stoponerr)
  ------------------
  |  Branch (1077:17): [True: 0, False: 242k]
  ------------------
 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|   446k|            pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) % th) *
 1086|   446k|                      TIFFTileRowSize(tif) +
 1087|   446k|                  (tmsize_t)fromskew;
 1088|   446k|            if (tocol + this_tw > wmin)
  ------------------
  |  Branch (1088:17): [True: 144k, False: 301k]
  ------------------
 1089|   144k|            {
 1090|       |                /*
 1091|       |                 * Rightmost tile is clipped on right side.
 1092|       |                 */
 1093|   144k|                fromskew = (int32_t)(tw - (wmin - tocol));
 1094|   144k|                this_tw = (uint32_t)((int32_t)tw - fromskew);
 1095|   144k|                this_toskew = (int32_t)(toskew + (int32_t)(uint32_t)fromskew);
 1096|   144k|            }
 1097|   446k|            tmsize_t roffset = (tmsize_t)y * w + tocol;
 1098|   446k|            (*put)(img, raster + roffset, tocol, y, this_tw, nrow, fromskew,
 1099|   446k|                   this_toskew, p0 + pos, p1 + pos, p2 + pos,
 1100|   446k|                   (alpha ? (pa + pos) : NULL));
  ------------------
  |  Branch (1100:21): [True: 242k, False: 203k]
  ------------------
 1101|   446k|            tocol += this_tw;
 1102|   446k|            col += this_tw;
 1103|       |            /*
 1104|       |             * After the leftmost tile, tiles are no longer clipped on left
 1105|       |             * side.
 1106|       |             */
 1107|   446k|            fromskew = 0;
 1108|   446k|            this_tw = tw;
 1109|   446k|            this_toskew = toskew;
 1110|   446k|        }
 1111|       |
 1112|   144k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|   144k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1112:25): [True: 78.6k, False: 66.3k]
  ------------------
 1113|   144k|                                                 : (int32_t)nrow);
 1114|   144k|    }
 1115|       |
 1116|    670|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|    670|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1116:9): [True: 24, False: 646]
  ------------------
 1117|     24|    {
 1118|     24|        uint32_t line;
 1119|       |
 1120|  99.8k|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (1120:24): [True: 99.8k, False: 24]
  ------------------
 1121|  99.8k|        {
 1122|  99.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|  99.8k|            uint32_t *right = left + wmin - 1;
 1126|       |
 1127|  15.3M|            while (left < right)
  ------------------
  |  Branch (1127:20): [True: 15.2M, False: 99.8k]
  ------------------
 1128|  15.2M|            {
 1129|  15.2M|                uint32_t temp = *left;
 1130|  15.2M|                *left = *right;
 1131|  15.2M|                *right = temp;
 1132|  15.2M|                left++;
 1133|  15.2M|                right--;
 1134|  15.2M|            }
 1135|  99.8k|        }
 1136|     24|    }
 1137|       |
 1138|    670|    _TIFFfreeExt(img->tif, buf);
 1139|    670|    return (ret);
 1140|    670|}
tif_getimage.c:gtStripSeparate:
 1302|    177|{
 1303|    177|    TIFF *tif = img->tif;
 1304|    177|    tileSeparateRoutine put = img->put.separate;
 1305|    177|    unsigned char *buf = NULL;
 1306|    177|    unsigned char *p0 = NULL, *p1 = NULL, *p2 = NULL, *pa = NULL;
 1307|    177|    uint32_t row, y, nrow, rowstoread;
 1308|    177|    tmsize_t pos;
 1309|    177|    tmsize_t scanline;
 1310|    177|    uint32_t rowsperstrip, offset_row;
 1311|    177|    uint32_t imagewidth = img->width;
 1312|    177|    tmsize_t stripsize;
 1313|    177|    tmsize_t bufsize;
 1314|    177|    int32_t fromskew, toskew;
 1315|    177|    int alpha = img->alpha;
 1316|    177|    int ret = 1, flip;
 1317|    177|    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|    177|    uint32_t wmin;
 1322|    177|    if (0 <= img->col_offset && (uint32_t)img->col_offset < imagewidth)
  ------------------
  |  Branch (1322:9): [True: 177, False: 0]
  |  Branch (1322:33): [True: 177, False: 0]
  ------------------
 1323|    177|    {
 1324|    177|        wmin = TIFFmin(w, imagewidth - (uint32_t)img->col_offset);
  ------------------
  |  |  337|    177|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 177]
  |  |  ------------------
  ------------------
 1325|    177|    }
 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|    177|    stripsize = TIFFStripSize(tif);
 1336|    177|    bufsize =
 1337|    177|        _TIFFMultiplySSize(tif, alpha ? 4 : 3, stripsize, "gtStripSeparate");
  ------------------
  |  Branch (1337:33): [True: 87, False: 90]
  ------------------
 1338|    177|    if (bufsize == 0)
  ------------------
  |  Branch (1338:9): [True: 0, False: 177]
  ------------------
 1339|      0|    {
 1340|      0|        return (0);
 1341|      0|    }
 1342|       |
 1343|    177|    flip = setorientation(img);
 1344|    177|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|    177|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1344:9): [True: 133, False: 44]
  ------------------
 1345|    133|    {
 1346|    133|        if (w > INT_MAX / 2)
  ------------------
  |  Branch (1346:13): [True: 0, False: 133]
  ------------------
 1347|      0|        {
 1348|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "Width overflow");
 1349|      0|            return (0);
 1350|      0|        }
 1351|    133|        y = h - 1;
 1352|       |        /* Skew back to the raster row before the currently written row
 1353|       |         * -> one raster width plus one image width. */
 1354|    133|        toskew = -(int32_t)(w + wmin);
 1355|    133|    }
 1356|     44|    else
 1357|     44|    {
 1358|     44|        y = 0;
 1359|       |        /* Skew forward to the end of the raster width of the row currently
 1360|       |         * written. */
 1361|     44|        toskew = (int32_t)(w - wmin);
 1362|     44|    }
 1363|       |
 1364|    177|    switch (img->photometric)
 1365|    177|    {
 1366|      2|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      2|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (1366:9): [True: 2, False: 175]
  ------------------
 1367|     59|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|     59|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (1367:9): [True: 57, False: 120]
  ------------------
 1368|     59|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     59|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (1368:9): [True: 0, False: 177]
  ------------------
 1369|     59|            colorchannels = 1;
 1370|     59|            break;
 1371|       |
 1372|    118|        default:
  ------------------
  |  Branch (1372:9): [True: 118, False: 59]
  ------------------
 1373|    118|            colorchannels = 3;
 1374|    118|            break;
 1375|    177|    }
 1376|       |
 1377|    177|    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
  ------------------
  |  |  258|    177|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 1378|    177|    if (rowsperstrip == 0)
  ------------------
  |  Branch (1378:9): [True: 0, False: 177]
  ------------------
 1379|      0|    {
 1380|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
 1381|      0|        return (0);
 1382|      0|    }
 1383|       |
 1384|    177|    scanline = TIFFScanlineSize(tif);
 1385|    177|    fromskew = (int32_t)(w < imagewidth ? imagewidth - w : 0);
  ------------------
  |  Branch (1385:26): [True: 0, False: 177]
  ------------------
 1386|   102k|    for (row = 0; row < h; row += nrow)
  ------------------
  |  Branch (1386:19): [True: 102k, False: 149]
  ------------------
 1387|   102k|    {
 1388|   102k|        uint32_t temp;
 1389|   102k|        rowstoread =
 1390|   102k|            rowsperstrip -
 1391|   102k|            ((uint32_t)((int32_t)row + img->row_offset) % rowsperstrip);
 1392|   102k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (1392:17): [True: 162, False: 102k]
  ------------------
 1393|   102k|        offset_row = (uint32_t)((int32_t)row + img->row_offset);
 1394|   102k|        temp = (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip + nrow;
 1395|   102k|        if (scanline > 0 && temp > (size_t)(TIFF_TMSIZE_T_MAX / scanline))
  ------------------
  |  |   68|   102k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (1395:13): [True: 102k, False: 0]
  |  Branch (1395:29): [True: 0, False: 102k]
  ------------------
 1396|      0|        {
 1397|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1398|      0|                          "Integer overflow in gtStripSeparate");
 1399|      0|            return 0;
 1400|      0|        }
 1401|   102k|        if (buf == NULL)
  ------------------
  |  Branch (1401:13): [True: 177, False: 102k]
  ------------------
 1402|    177|        {
 1403|    177|            if (_TIFFReadEncodedStripAndAllocBuffer(
  ------------------
  |  Branch (1403:17): [True: 101, False: 76]
  ------------------
 1404|    177|                    tif, TIFFComputeStrip(tif, offset_row, 0), (void **)&buf,
 1405|    177|                    bufsize, temp * scanline) == (tmsize_t)(-1) &&
 1406|    101|                (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1406:18): [True: 28, False: 73]
  |  Branch (1406:33): [True: 0, False: 73]
  ------------------
 1407|     28|            {
 1408|     28|                ret = 0;
 1409|     28|                break;
 1410|     28|            }
 1411|    149|            p0 = buf;
 1412|    149|            if (colorchannels == 1)
  ------------------
  |  Branch (1412:17): [True: 54, False: 95]
  ------------------
 1413|     54|            {
 1414|     54|                p2 = p1 = p0;
 1415|     54|                pa = (alpha ? (p0 + 3 * stripsize) : NULL);
  ------------------
  |  Branch (1415:23): [True: 46, False: 8]
  ------------------
 1416|     54|            }
 1417|     95|            else
 1418|     95|            {
 1419|     95|                p1 = p0 + stripsize;
 1420|     95|                p2 = p1 + stripsize;
 1421|     95|                pa = (alpha ? (p2 + stripsize) : NULL);
  ------------------
  |  Branch (1421:23): [True: 36, False: 59]
  ------------------
 1422|     95|            }
 1423|    149|        }
 1424|   102k|        else if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
  ------------------
  |  Branch (1424:18): [True: 67.2k, False: 35.2k]
  ------------------
 1425|   102k|                                      p0, temp * scanline) == (tmsize_t)(-1) &&
 1426|  67.2k|                 img->stoponerr)
  ------------------
  |  Branch (1426:18): [True: 0, False: 67.2k]
  ------------------
 1427|      0|        {
 1428|      0|            ret = 0;
 1429|      0|            break;
 1430|      0|        }
 1431|   102k|        if (colorchannels > 1 &&
  ------------------
  |  Branch (1431:13): [True: 3.89k, False: 98.7k]
  ------------------
 1432|  3.89k|            TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1), p1,
  ------------------
  |  Branch (1432:13): [True: 743, False: 3.15k]
  ------------------
 1433|  3.89k|                                 temp * scanline) == (tmsize_t)(-1) &&
 1434|    743|            img->stoponerr)
  ------------------
  |  Branch (1434:13): [True: 0, False: 743]
  ------------------
 1435|      0|        {
 1436|      0|            ret = 0;
 1437|      0|            break;
 1438|      0|        }
 1439|   102k|        if (colorchannels > 1 &&
  ------------------
  |  Branch (1439:13): [True: 3.89k, False: 98.7k]
  ------------------
 1440|  3.89k|            TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2), p2,
  ------------------
  |  Branch (1440:13): [True: 758, False: 3.13k]
  ------------------
 1441|  3.89k|                                 temp * scanline) == (tmsize_t)(-1) &&
 1442|    758|            img->stoponerr)
  ------------------
  |  Branch (1442:13): [True: 0, False: 758]
  ------------------
 1443|      0|        {
 1444|      0|            ret = 0;
 1445|      0|            break;
 1446|      0|        }
 1447|   102k|        if (alpha)
  ------------------
  |  Branch (1447:13): [True: 102k, False: 291]
  ------------------
 1448|   102k|        {
 1449|   102k|            if (TIFFReadEncodedStrip(
  ------------------
  |  Branch (1449:17): [True: 67.0k, False: 35.2k]
  ------------------
 1450|   102k|                    tif, TIFFComputeStrip(tif, offset_row, colorchannels), pa,
 1451|   102k|                    temp * scanline) == (tmsize_t)(-1) &&
 1452|  67.0k|                img->stoponerr)
  ------------------
  |  Branch (1452:17): [True: 0, False: 67.0k]
  ------------------
 1453|      0|            {
 1454|      0|                ret = 0;
 1455|      0|                break;
 1456|      0|            }
 1457|   102k|        }
 1458|       |
 1459|       |        /* For SEPARATE the pos-offset is per sample and should not be
 1460|       |         * multiplied by img->samplesperpixel. */
 1461|   102k|        pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) %
 1462|   102k|                         rowsperstrip) *
 1463|   102k|                  scanline +
 1464|   102k|              (tmsize_t)img->col_offset;
 1465|   102k|        tmsize_t roffset = (tmsize_t)y * w;
 1466|   102k|        (*put)(img, raster + roffset, 0, y, wmin, nrow, fromskew, toskew,
 1467|   102k|               p0 + pos, p1 + pos, p2 + pos, (alpha ? (pa + pos) : NULL));
  ------------------
  |  Branch (1467:47): [True: 102k, False: 291]
  ------------------
 1468|   102k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|   102k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1468:25): [True: 3.99k, False: 98.6k]
  ------------------
 1469|   102k|                                                 : (int32_t)nrow);
 1470|   102k|    }
 1471|       |
 1472|    177|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|    177|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1472:9): [True: 41, False: 136]
  ------------------
 1473|     41|    {
 1474|     41|        uint32_t line;
 1475|       |
 1476|  67.5M|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (1476:24): [True: 67.5M, False: 41]
  ------------------
 1477|  67.5M|        {
 1478|  67.5M|            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.5M|            uint32_t *right = left + wmin - 1;
 1482|       |
 1483|   164M|            while (left < right)
  ------------------
  |  Branch (1483:20): [True: 96.8M, False: 67.5M]
  ------------------
 1484|  96.8M|            {
 1485|  96.8M|                uint32_t temp = *left;
 1486|  96.8M|                *left = *right;
 1487|  96.8M|                *right = temp;
 1488|  96.8M|                left++;
 1489|  96.8M|                right--;
 1490|  96.8M|            }
 1491|  67.5M|        }
 1492|     41|    }
 1493|       |
 1494|    177|    _TIFFfreeExt(img->tif, buf);
 1495|    177|    return (ret);
 1496|    177|}
tif_getimage.c:putRGBAAseparate8bittile:
 2067|  7.55k|{
 2068|  7.55k|    (void)img;
 2069|  7.55k|    (void)x;
 2070|  7.55k|    (void)y;
 2071|  28.2k|    for (; h > 0; --h)
  ------------------
  |  Branch (2071:12): [True: 20.7k, False: 7.55k]
  ------------------
 2072|  20.7k|    {
 2073|  20.7k|        UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++));
  ------------------
  |  | 1554|  20.7k|    {                                                                          \
  |  | 1555|  20.7k|        uint32_t _x;                                                           \
  |  | 1556|  7.48M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 7.46M, False: 20.7k]
  |  |  ------------------
  |  | 1557|  7.46M|        {                                                                      \
  |  | 1558|  7.46M|            op1;                                                               \
  |  | 1559|  7.46M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|  7.46M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  7.46M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  7.46M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  7.46M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  7.46M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  7.46M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  7.46M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|  7.46M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  7.46M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  7.46M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  7.46M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  7.46M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  7.46M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  7.46M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|  7.46M|        }                                                                      \
  |  | 1561|  20.7k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 20.6k, False: 69]
  |  |  ------------------
  |  | 1562|  20.7k|        {                                                                      \
  |  | 1563|  20.6k|            op1;                                                               \
  |  | 1564|  20.6k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|  20.6k|    switch (x)                                                                 \
  |  |  |  | 1519|  20.6k|    {                                                                          \
  |  |  |  | 1520|  2.12k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 2.12k, False: 18.5k]
  |  |  |  |  ------------------
  |  |  |  | 1521|  2.12k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|  2.46k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 334, False: 20.2k]
  |  |  |  |  ------------------
  |  |  |  | 1523|  2.46k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|  9.35k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 6.89k, False: 13.7k]
  |  |  |  |  ------------------
  |  |  |  | 1525|  9.35k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|  9.37k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 16, False: 20.6k]
  |  |  |  |  ------------------
  |  |  |  | 1527|  9.37k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|  10.3k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 1.02k, False: 19.6k]
  |  |  |  |  ------------------
  |  |  |  | 1529|  10.3k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|  10.4k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 64, False: 20.5k]
  |  |  |  |  ------------------
  |  |  |  | 1531|  10.4k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|  20.6k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 10.1k, False: 10.4k]
  |  |  |  |  ------------------
  |  |  |  | 1533|  20.6k|            op;                                                                \
  |  |  |  | 1534|  20.6k|            break;                                                             \
  |  |  |  | 1535|  10.4k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 20.6k]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|  20.6k|    }
  |  |  ------------------
  |  | 1565|  20.6k|        }                                                                      \
  |  | 1566|  20.7k|    }
  ------------------
 2074|  20.7k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1603|  20.7k|    {                                                                          \
  |  | 1604|  20.7k|        r += skew;                                                             \
  |  | 1605|  20.7k|        g += skew;                                                             \
  |  | 1606|  20.7k|        b += skew;                                                             \
  |  | 1607|  20.7k|        a += skew;                                                             \
  |  | 1608|  20.7k|    }
  ------------------
 2075|  20.7k|        cp += toskew;
 2076|  20.7k|    }
 2077|  7.55k|}
tif_getimage.c:putRGBUAseparate8bittile:
 2106|    452|{
 2107|    452|    (void)img;
 2108|    452|    (void)y;
 2109|   201k|    for (; h > 0; --h)
  ------------------
  |  Branch (2109:12): [True: 200k, False: 452]
  ------------------
 2110|   200k|    {
 2111|   200k|        uint32_t rv, gv, bv, av;
 2112|   200k|        uint8_t *m;
 2113|  31.5M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2113:21): [True: 31.3M, False: 200k]
  ------------------
 2114|  31.3M|        {
 2115|  31.3M|            av = *a++;
 2116|  31.3M|            m = img->UaToAa + ((size_t)av << 8);
 2117|  31.3M|            rv = m[*r++];
 2118|  31.3M|            gv = m[*g++];
 2119|  31.3M|            bv = m[*b++];
 2120|  31.3M|            *cp++ = PACK4(rv, gv, bv, av);
  ------------------
  |  | 1614|  31.3M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|  31.3M|     ((uint32_t)(a) << 24))
  ------------------
 2121|  31.3M|        }
 2122|   200k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1603|   200k|    {                                                                          \
  |  | 1604|   200k|        r += skew;                                                             \
  |  | 1605|   200k|        g += skew;                                                             \
  |  | 1606|   200k|        b += skew;                                                             \
  |  | 1607|   200k|        a += skew;                                                             \
  |  | 1608|   200k|    }
  ------------------
 2123|   200k|        cp += toskew;
 2124|   200k|    }
 2125|    452|}
tif_getimage.c:putRGBseparate8bittile:
 2050|    318|{
 2051|    318|    (void)img;
 2052|    318|    (void)x;
 2053|    318|    (void)y;
 2054|    318|    (void)a;
 2055|   293k|    for (; h > 0; --h)
  ------------------
  |  Branch (2055:12): [True: 292k, False: 318]
  ------------------
 2056|   292k|    {
 2057|   292k|        UNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++));
  ------------------
  |  | 1554|   292k|    {                                                                          \
  |  | 1555|   292k|        uint32_t _x;                                                           \
  |  | 1556|  13.5M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 13.2M, False: 292k]
  |  |  ------------------
  |  | 1557|  13.2M|        {                                                                      \
  |  | 1558|  13.2M|            op1;                                                               \
  |  | 1559|  13.2M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|  13.2M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  13.2M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.2M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.2M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  13.2M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.2M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.2M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|  13.2M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  13.2M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.2M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.2M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  13.2M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.2M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.2M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|  13.2M|        }                                                                      \
  |  | 1561|   292k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 292k, False: 10]
  |  |  ------------------
  |  | 1562|   292k|        {                                                                      \
  |  | 1563|   292k|            op1;                                                               \
  |  | 1564|   292k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|   292k|    switch (x)                                                                 \
  |  |  |  | 1519|   292k|    {                                                                          \
  |  |  |  | 1520|    761|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 761, False: 291k]
  |  |  |  |  ------------------
  |  |  |  | 1521|    761|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|    761|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 0, False: 292k]
  |  |  |  |  ------------------
  |  |  |  | 1523|    761|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|  57.8k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 57.0k, False: 235k]
  |  |  |  |  ------------------
  |  |  |  | 1525|  57.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|  57.8k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 0, False: 292k]
  |  |  |  |  ------------------
  |  |  |  | 1527|  57.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|   116k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 58.5k, False: 234k]
  |  |  |  |  ------------------
  |  |  |  | 1529|   116k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|   116k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 3, False: 292k]
  |  |  |  |  ------------------
  |  |  |  | 1531|   116k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|   292k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 176k, False: 116k]
  |  |  |  |  ------------------
  |  |  |  | 1533|   292k|            op;                                                                \
  |  |  |  | 1534|   292k|            break;                                                             \
  |  |  |  | 1535|   116k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 292k]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|   292k|    }
  |  |  ------------------
  |  | 1565|   292k|        }                                                                      \
  |  | 1566|   292k|    }
  ------------------
 2058|   292k|        SKEW(r, g, b, fromskew);
  ------------------
  |  | 1597|   292k|    {                                                                          \
  |  | 1598|   292k|        r += skew;                                                             \
  |  | 1599|   292k|        g += skew;                                                             \
  |  | 1600|   292k|        b += skew;                                                             \
  |  | 1601|   292k|    }
  ------------------
 2059|   292k|        cp += toskew;
 2060|   292k|    }
 2061|    318|}
tif_getimage.c:putRGBAAseparate16bittile:
 2152|   124k|{
 2153|   124k|    uint16_t *wr = (uint16_t *)r;
 2154|   124k|    uint16_t *wg = (uint16_t *)g;
 2155|   124k|    uint16_t *wb = (uint16_t *)b;
 2156|   124k|    uint16_t *wa = (uint16_t *)a;
 2157|   124k|    (void)img;
 2158|   124k|    (void)y;
 2159|   580k|    for (; h > 0; --h)
  ------------------
  |  Branch (2159:12): [True: 456k, False: 124k]
  ------------------
 2160|   456k|    {
 2161|  60.5M|        for (x = 0; x < w; x++)
  ------------------
  |  Branch (2161:21): [True: 60.1M, False: 456k]
  ------------------
 2162|  60.1M|            *cp++ = PACK4(img->Bitdepth16To8[*wr++], img->Bitdepth16To8[*wg++],
  ------------------
  |  | 1614|  60.1M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|  60.1M|     ((uint32_t)(a) << 24))
  ------------------
 2163|   456k|                          img->Bitdepth16To8[*wb++], img->Bitdepth16To8[*wa++]);
 2164|   456k|        SKEW4(wr, wg, wb, wa, fromskew);
  ------------------
  |  | 1603|   456k|    {                                                                          \
  |  | 1604|   456k|        r += skew;                                                             \
  |  | 1605|   456k|        g += skew;                                                             \
  |  | 1606|   456k|        b += skew;                                                             \
  |  | 1607|   456k|        a += skew;                                                             \
  |  | 1608|   456k|    }
  ------------------
 2165|   456k|        cp += toskew;
 2166|   456k|    }
 2167|   124k|}
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.3M|    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|   237M|        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|    337|{
 2132|    337|    uint16_t *wr = (uint16_t *)r;
 2133|    337|    uint16_t *wg = (uint16_t *)g;
 2134|    337|    uint16_t *wb = (uint16_t *)b;
 2135|    337|    (void)img;
 2136|    337|    (void)y;
 2137|    337|    (void)a;
 2138|   773k|    for (; h > 0; --h)
  ------------------
  |  Branch (2138:12): [True: 773k, False: 337]
  ------------------
 2139|   773k|    {
 2140|  87.9M|        for (x = 0; x < w; x++)
  ------------------
  |  Branch (2140:21): [True: 87.1M, False: 773k]
  ------------------
 2141|  87.1M|            *cp++ = PACK(img->Bitdepth16To8[*wr++], img->Bitdepth16To8[*wg++],
  ------------------
  |  | 1612|  87.1M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|  87.1M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2142|   773k|                         img->Bitdepth16To8[*wb++]);
 2143|   773k|        SKEW(wr, wg, wb, fromskew);
  ------------------
  |  | 1597|   773k|    {                                                                          \
  |  | 1598|   773k|        r += skew;                                                             \
  |  | 1599|   773k|        g += skew;                                                             \
  |  | 1600|   773k|        b += skew;                                                             \
  |  | 1601|   773k|    }
  ------------------
 2144|   773k|        cp += toskew;
 2145|   773k|    }
 2146|    337|}
tif_getimage.c:putCMYKseparate8bittile:
 2083|   143k|{
 2084|   143k|    (void)img;
 2085|   143k|    (void)y;
 2086|   426k|    for (; h > 0; --h)
  ------------------
  |  Branch (2086:12): [True: 283k, False: 143k]
  ------------------
 2087|   283k|    {
 2088|   283k|        unsigned int rv, gv, bv, kv;
 2089|  41.8M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2089:21): [True: 41.5M, False: 283k]
  ------------------
 2090|  41.5M|        {
 2091|  41.5M|            kv = 255U - *a++;
 2092|  41.5M|            rv = (kv * (255U - *r++)) / 255U;
 2093|  41.5M|            gv = (kv * (255U - *g++)) / 255U;
 2094|  41.5M|            bv = (kv * (255U - *b++)) / 255U;
 2095|  41.5M|            *cp++ = PACK4(rv, gv, bv, 255);
  ------------------
  |  | 1614|  41.5M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|  41.5M|     ((uint32_t)(a) << 24))
  ------------------
 2096|  41.5M|        }
 2097|   283k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1603|   283k|    {                                                                          \
  |  | 1604|   283k|        r += skew;                                                             \
  |  | 1605|   283k|        g += skew;                                                             \
  |  | 1606|   283k|        b += skew;                                                             \
  |  | 1607|   283k|        a += skew;                                                             \
  |  | 1608|   283k|    }
  ------------------
 2098|   283k|        cp += toskew;
 2099|   283k|    }
 2100|   143k|}
tif_getimage.c:putseparate8bitYCbCr11tile:
 2738|   206k|{
 2739|   206k|    (void)y;
 2740|   206k|    (void)a;
 2741|       |    /* TODO: naming of input vars is still off, change obfuscating declaration
 2742|       |     * inside define, or resolve obfuscation */
 2743|   554k|    for (; h > 0; --h)
  ------------------
  |  Branch (2743:12): [True: 347k, False: 206k]
  ------------------
 2744|   347k|    {
 2745|   347k|        x = w;
 2746|   347k|        do
 2747|   109M|        {
 2748|   109M|            uint32_t dr, dg, db;
 2749|   109M|            TIFFYCbCrtoRGB(img->ycbcr, *r++, *g++, *b++, &dr, &dg, &db);
 2750|   109M|            *cp++ = PACK(dr, dg, db);
  ------------------
  |  | 1612|   109M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|   109M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2751|   109M|        } while (--x);
  ------------------
  |  Branch (2751:18): [True: 109M, False: 347k]
  ------------------
 2752|   347k|        SKEW(r, g, b, fromskew);
  ------------------
  |  | 1597|   347k|    {                                                                          \
  |  | 1598|   347k|        r += skew;                                                             \
  |  | 1599|   347k|        g += skew;                                                             \
  |  | 1600|   347k|        b += skew;                                                             \
  |  | 1601|   347k|    }
  ------------------
 2753|   347k|        cp += toskew;
 2754|   347k|    }
 2755|   206k|}

TIFFHashSetNew:
  141|  12.4k|{
  142|  12.4k|    TIFFHashSet *set = (TIFFHashSet *)malloc(sizeof(TIFFHashSet));
  143|  12.4k|    if (set == NULL)
  ------------------
  |  Branch (143:9): [True: 0, False: 12.4k]
  ------------------
  144|      0|        return NULL;
  145|  12.4k|    set->fnHashFunc = fnHashFunc ? fnHashFunc : TIFFHashSetHashPointer;
  ------------------
  |  Branch (145:23): [True: 12.4k, False: 0]
  ------------------
  146|  12.4k|    set->fnEqualFunc = fnEqualFunc ? fnEqualFunc : TIFFHashSetEqualPointer;
  ------------------
  |  Branch (146:24): [True: 12.4k, False: 0]
  ------------------
  147|  12.4k|    set->fnFreeEltFunc = fnFreeEltFunc;
  148|  12.4k|    set->nSize = 0;
  149|  12.4k|    set->tabList = (TIFFList **)(calloc(53, sizeof(TIFFList *)));
  150|  12.4k|    if (set->tabList == NULL)
  ------------------
  |  Branch (150:9): [True: 0, False: 12.4k]
  ------------------
  151|      0|    {
  152|      0|        free(set);
  153|      0|        return NULL;
  154|      0|    }
  155|  12.4k|    set->nIndiceAllocatedSize = 0;
  156|  12.4k|    set->nAllocatedSize = 53;
  157|  12.4k|    set->psRecyclingList = NULL;
  158|  12.4k|    set->nRecyclingListSize = 0;
  159|  12.4k|    set->bRehash = false;
  160|       |#ifdef HASH_DEBUG
  161|       |    set->nCollisions = 0;
  162|       |#endif
  163|  12.4k|    return set;
  164|  12.4k|}
TIFFHashSetSize:
  181|  6.24k|{
  182|  6.24k|    assert(set != NULL);
  ------------------
  |  Branch (182:5): [True: 0, False: 6.24k]
  |  Branch (182:5): [True: 6.24k, False: 0]
  ------------------
  183|  6.24k|    return set->nSize;
  184|  6.24k|}
TIFFHashSetDestroy:
  286|  12.4k|{
  287|  12.4k|    if (set)
  ------------------
  |  Branch (287:9): [True: 12.4k, False: 0]
  ------------------
  288|  12.4k|    {
  289|       |        TIFFHashSetClearInternal(set, true);
  290|  12.4k|        free(set->tabList);
  291|  12.4k|        TIFFListDestroy(set->psRecyclingList);
  292|  12.4k|        free(set);
  293|  12.4k|    }
  294|  12.4k|}
TIFFHashSetInsert:
  442|  12.4k|{
  443|  12.4k|    assert(set != NULL);
  ------------------
  |  Branch (443:5): [True: 0, False: 12.4k]
  |  Branch (443:5): [True: 12.4k, False: 0]
  ------------------
  444|  12.4k|    void **pElt = TIFFHashSetFindPtr(set, elt);
  445|  12.4k|    if (pElt)
  ------------------
  |  Branch (445:9): [True: 0, False: 12.4k]
  ------------------
  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|  12.4k|    if (set->nSize >= 2 * set->nAllocatedSize / 3 ||
  ------------------
  |  Branch (454:9): [True: 0, False: 12.4k]
  ------------------
  455|  12.4k|        (set->bRehash && set->nIndiceAllocatedSize > 0 &&
  ------------------
  |  Branch (455:10): [True: 0, False: 12.4k]
  |  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|  12.4k|    const unsigned long nHashVal =
  469|  12.4k|        set->fnHashFunc(elt) % (unsigned long)set->nAllocatedSize;
  470|       |#ifdef HASH_DEBUG
  471|       |    if (set->tabList[nHashVal])
  472|       |        set->nCollisions++;
  473|       |#endif
  474|       |
  475|  12.4k|    TIFFList *new_elt = TIFFHashSetGetNewListElt(set);
  476|  12.4k|    if (new_elt == NULL)
  ------------------
  |  Branch (476:9): [True: 0, False: 12.4k]
  ------------------
  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|  12.4k|    new_elt->pData = elt;
  483|  12.4k|    new_elt->psNext = set->tabList[nHashVal];
  484|  12.4k|    set->tabList[nHashVal] = new_elt;
  485|  12.4k|    set->nSize++;
  486|       |
  487|       |    return true;
  488|  12.4k|}
TIFFHashSetLookup:
  505|  12.4k|{
  506|  12.4k|    assert(set != NULL);
  ------------------
  |  Branch (506:5): [True: 0, False: 12.4k]
  |  Branch (506:5): [True: 12.4k, False: 0]
  ------------------
  507|  12.4k|    void **pElt = TIFFHashSetFindPtr(set, elt);
  508|  12.4k|    if (pElt)
  ------------------
  |  Branch (508:9): [True: 0, False: 12.4k]
  ------------------
  509|      0|        return *pElt;
  510|       |
  511|  12.4k|    return NULL;
  512|  12.4k|}
tif_hash_set.c:TIFFHashSetClearInternal:
  227|  12.4k|{
  228|  12.4k|    assert(set != NULL);
  ------------------
  |  Branch (228:5): [True: 0, False: 12.4k]
  |  Branch (228:5): [True: 12.4k, False: 0]
  ------------------
  229|   674k|    for (int i = 0; i < set->nAllocatedSize; i++)
  ------------------
  |  Branch (229:21): [True: 662k, False: 12.4k]
  ------------------
  230|   662k|    {
  231|   662k|        TIFFList *cur = set->tabList[i];
  232|   674k|        while (cur)
  ------------------
  |  Branch (232:16): [True: 12.4k, False: 662k]
  ------------------
  233|  12.4k|        {
  234|  12.4k|            if (set->fnFreeEltFunc)
  ------------------
  |  Branch (234:17): [True: 6.24k, False: 6.24k]
  ------------------
  235|  6.24k|                set->fnFreeEltFunc(cur->pData);
  236|  12.4k|            TIFFList *psNext = cur->psNext;
  237|  12.4k|            if (bFinalize)
  ------------------
  |  Branch (237:17): [True: 12.4k, False: 0]
  ------------------
  238|  12.4k|                free(cur);
  239|      0|            else
  240|      0|                TIFFHashSetReturnListElt(set, cur);
  241|  12.4k|            cur = psNext;
  242|  12.4k|        }
  243|   662k|        set->tabList[i] = NULL;
  244|   662k|    }
  245|       |    set->bRehash = false;
  246|  12.4k|}
tif_hash_set.c:TIFFListDestroy:
  261|  12.4k|{
  262|  12.4k|    TIFFList *psCurrent = psList;
  263|       |
  264|  12.4k|    while (psCurrent)
  ------------------
  |  Branch (264:12): [True: 0, False: 12.4k]
  ------------------
  265|      0|    {
  266|      0|        TIFFList *const psNext = psCurrent->psNext;
  267|      0|        free(psCurrent);
  268|      0|        psCurrent = psNext;
  269|      0|    }
  270|  12.4k|}
tif_hash_set.c:TIFFHashSetFindPtr:
  410|  24.9k|{
  411|  24.9k|    const unsigned long nHashVal =
  412|  24.9k|        set->fnHashFunc(elt) % (unsigned long)set->nAllocatedSize;
  413|  24.9k|    TIFFList *cur = set->tabList[nHashVal];
  414|  24.9k|    while (cur)
  ------------------
  |  Branch (414:12): [True: 0, False: 24.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|  24.9k|    return NULL;
  421|  24.9k|}
tif_hash_set.c:TIFFHashSetGetNewListElt:
  191|  12.4k|{
  192|  12.4k|    if (set->psRecyclingList)
  ------------------
  |  Branch (192:9): [True: 0, False: 12.4k]
  ------------------
  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|  12.4k|    return (TIFFList *)malloc(sizeof(TIFFList));
  202|  12.4k|}

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: 0, False: 3]
  ------------------
   48|      0|    {
   49|      0|        TIFFErrorExtR(tif, "JBIG",
   50|      0|                      "Multistrip images not supported in decoder");
   51|      0|        return 0;
   52|      0|    }
   53|       |
   54|      3|    return 1;
   55|      3|}

TIFFInitJPEG:
 3013|  3.17k|{
 3014|  3.17k|    JPEGState *sp;
 3015|       |
 3016|  3.17k|    (void)scheme;
 3017|  3.17k|    assert(scheme == COMPRESSION_JPEG);
  ------------------
  |  Branch (3017:5): [True: 0, False: 3.17k]
  |  Branch (3017:5): [True: 3.17k, False: 0]
  ------------------
 3018|       |
 3019|       |    /*
 3020|       |     * Merge codec-specific tag information.
 3021|       |     */
 3022|  3.17k|    if (!_TIFFMergeFields(tif, jpegFields, TIFFArrayCount(jpegFields)))
  ------------------
  |  |  339|  3.17k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (3022:9): [True: 0, False: 3.17k]
  ------------------
 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|  3.17k|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(JPEGState));
 3033|       |
 3034|  3.17k|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (3034:9): [True: 0, False: 3.17k]
  ------------------
 3035|      0|    {
 3036|      0|        TIFFErrorExtR(tif, "TIFFInitJPEG", "No space for JPEG state block");
 3037|      0|        return 0;
 3038|      0|    }
 3039|  3.17k|    _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
 3040|       |
 3041|  3.17k|    sp = JState(tif);
  ------------------
  |  |  208|  3.17k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 3042|       |    /*
 3043|       |     * Override parent get/set field methods.
 3044|       |     */
 3045|  3.17k|    sp->otherSettings.vgetparent = tif->tif_tagmethods.vgetfield;
 3046|  3.17k|    sp->otherSettings.vsetparent = tif->tif_tagmethods.vsetfield;
 3047|  3.17k|    sp->otherSettings.printdir = tif->tif_tagmethods.printdir;
 3048|       |
 3049|  3.17k|    sp->otherSettings.defsparent = tif->tif_defstripsize;
 3050|  3.17k|    sp->otherSettings.deftparent = tif->tif_deftilesize;
 3051|       |
 3052|  3.17k|    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|  3.17k|    if (tif->tif_diroff == 0)
  ------------------
  |  Branch (3060:9): [True: 0, False: 3.17k]
  ------------------
 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|  3.17k|    return 1;
 3087|  3.17k|}
tif_jpeg.c:TIFFjpeg_create_decompress:
  318|  1.17k|{
  319|       |    /* initialize JPEG error handling */
  320|  1.17k|    sp->cinfo.d.err = jpeg_std_error(&sp->err);
  321|  1.17k|    sp->err.error_exit = TIFFjpeg_error_exit;
  322|  1.17k|    sp->err.output_message = TIFFjpeg_output_message;
  323|       |
  324|       |    /* set client_data to avoid UMR warning from tools like Purify */
  325|  1.17k|    sp->cinfo.d.client_data = NULL;
  326|       |
  327|       |    return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|  1.17k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.17k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.17k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (327:12): [True: 0, False: 1.17k]
  ------------------
  328|  1.17k|}
tif_jpeg.c:TIFFjpeg_error_exit:
  244|   105k|{
  245|   105k|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  246|   105k|    char buffer[JMSG_LENGTH_MAX];
  247|       |
  248|   105k|    (*cinfo->err->format_message)(cinfo, buffer);
  249|   105k|    TIFFErrorExtR(sp->tif, "JPEGLib", "%s",
  250|   105k|                  buffer);       /* display the error message */
  251|   105k|    jpeg_abort(cinfo);           /* clean up libjpeg state */
  252|   105k|    LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|   105k|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  253|   105k|}
tif_jpeg.c:TIFFjpeg_output_message:
  261|  67.3k|{
  262|  67.3k|    char buffer[JMSG_LENGTH_MAX];
  263|       |
  264|  67.3k|    (*cinfo->err->format_message)(cinfo, buffer);
  265|  67.3k|    TIFFWarningExtR(((JPEGState *)cinfo)->tif, "JPEGLib", "%s", buffer);
  266|  67.3k|}
tif_jpeg.c:TIFFjpeg_data_src:
  744|  1.33k|{
  745|  1.33k|    sp->cinfo.d.src = &sp->src;
  746|  1.33k|    sp->src.init_source = std_init_source;
  747|  1.33k|    sp->src.fill_input_buffer = std_fill_input_buffer;
  748|  1.33k|    sp->src.skip_input_data = std_skip_input_data;
  749|  1.33k|    sp->src.resync_to_restart = jpeg_resync_to_restart;
  750|  1.33k|    sp->src.term_source = std_term_source;
  751|  1.33k|    sp->src.bytes_in_buffer = 0; /* for safety */
  752|       |    sp->src.next_input_byte = NULL;
  753|  1.33k|}
tif_jpeg.c:std_init_source:
  674|   133k|{
  675|   133k|    JPEGState *sp = (JPEGState *)cinfo;
  676|   133k|    TIFF *tif = sp->tif;
  677|       |
  678|   133k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
  679|   133k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
  680|   133k|}
tif_jpeg.c:std_fill_input_buffer:
  683|   193k|{
  684|   193k|    JPEGState *sp = (JPEGState *)cinfo;
  685|   193k|    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|   193k|    WARNMS(cinfo, JWRN_JPEG_EOF);
  712|       |    /* insert a fake EOI marker */
  713|   193k|    sp->src.next_input_byte = dummy_EOI;
  714|   193k|    sp->src.bytes_in_buffer = 2;
  715|   193k|    return (TRUE);
  ------------------
  |  |   71|   193k|#define TRUE 1
  ------------------
  716|   193k|}
tif_jpeg.c:std_skip_input_data:
  719|  10.3k|{
  720|  10.3k|    JPEGState *sp = (JPEGState *)cinfo;
  721|       |
  722|  10.3k|    if (num_bytes > 0)
  ------------------
  |  Branch (722:9): [True: 10.3k, False: 0]
  ------------------
  723|  10.3k|    {
  724|  10.3k|        if ((size_t)num_bytes > sp->src.bytes_in_buffer)
  ------------------
  |  Branch (724:13): [True: 6.01k, False: 4.31k]
  ------------------
  725|  6.01k|        {
  726|       |            /* oops, buffer overrun */
  727|  6.01k|            (void)std_fill_input_buffer(cinfo);
  728|  6.01k|        }
  729|  4.31k|        else
  730|  4.31k|        {
  731|  4.31k|            sp->src.next_input_byte += (size_t)num_bytes;
  732|  4.31k|            sp->src.bytes_in_buffer -= (size_t)num_bytes;
  733|  4.31k|        }
  734|  10.3k|    }
  735|  10.3k|}
tif_jpeg.c:std_term_source:
  738|  24.1k|{
  739|       |    /* No work necessary here */
  740|  24.1k|    (void)cinfo;
  741|  24.1k|}
tif_jpeg.c:TIFFjpeg_read_header:
  396|   133k|{
  397|       |    return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
  ------------------
  |  |  301|   133k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|   133k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (397:12): [True: 89.3k, False: 44.3k]
  ------------------
  398|   133k|}
tif_jpeg.c:TIFFjpeg_destroy:
  525|  1.17k|{
  526|       |    return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
  ------------------
  |  |  302|  1.17k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.17k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.17k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (526:12): [True: 0, False: 1.17k]
  ------------------
  527|  1.17k|}
tif_jpeg.c:TIFFjpeg_has_multiple_scans:
  401|  40.6k|{
  402|       |    return CALLJPEG(sp, 0, jpeg_has_multiple_scans(&sp->cinfo.d));
  ------------------
  |  |  301|  40.6k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  40.6k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (402:12): [True: 0, False: 40.6k]
  ------------------
  403|  40.6k|}
tif_jpeg.c:TIFFInitJPEGCommon:
 2969|  3.17k|{
 2970|  3.17k|    JPEGState *sp;
 2971|       |
 2972|  3.17k|    sp = JState(tif);
  ------------------
  |  |  208|  3.17k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2973|  3.17k|    sp->tif = tif; /* back link */
 2974|       |
 2975|       |    /* Default values for codec-specific fields */
 2976|  3.17k|    sp->otherSettings.jpegtables = NULL;
 2977|  3.17k|    sp->otherSettings.jpegtables_length = 0;
 2978|  3.17k|    sp->otherSettings.jpegquality = 75; /* Default IJG quality */
 2979|  3.17k|    sp->otherSettings.jpegcolormode = JPEGCOLORMODE_RAW;
  ------------------
  |  |  707|  3.17k|#define JPEGCOLORMODE_RAW 0x0000     /* no conversion (default) */
  ------------------
 2980|  3.17k|    sp->otherSettings.jpegtablesmode =
 2981|  3.17k|        JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  710|  3.17k|#define JPEGTABLESMODE_QUANT 0x0001  /* include quantization tbls */
  ------------------
                      JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  711|  3.17k|#define JPEGTABLESMODE_HUFF 0x0002   /* include Huffman tbls */
  ------------------
 2982|  3.17k|    sp->otherSettings.ycbcrsampling_fetched = 0;
 2983|       |
 2984|  3.17k|    tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
 2985|  3.17k|    tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
 2986|  3.17k|    tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
 2987|       |
 2988|       |    /*
 2989|       |     * Install codec methods.
 2990|       |     */
 2991|  3.17k|    tif->tif_fixuptags = JPEGFixupTags;
 2992|  3.17k|    tif->tif_setupdecode = JPEGSetupDecode;
 2993|  3.17k|    tif->tif_predecode = JPEGPreDecode;
 2994|  3.17k|    tif->tif_decoderow = JPEGDecode;
 2995|  3.17k|    tif->tif_decodestrip = JPEGDecode;
 2996|  3.17k|    tif->tif_decodetile = JPEGDecode;
 2997|  3.17k|    tif->tif_setupencode = JPEGSetupEncode;
 2998|  3.17k|    tif->tif_preencode = JPEGPreEncode;
 2999|  3.17k|    tif->tif_postencode = JPEGPostEncode;
 3000|  3.17k|    tif->tif_encoderow = JPEGEncode;
 3001|  3.17k|    tif->tif_encodestrip = JPEGEncode;
 3002|  3.17k|    tif->tif_encodetile = JPEGEncode;
 3003|  3.17k|    tif->tif_getmaxcompressionratio = JPEGGetMaxCompressionRatio;
 3004|  3.17k|    tif->tif_cleanup = JPEGCleanup;
 3005|       |
 3006|  3.17k|    tif->tif_defstripsize = JPEGDefaultStripSize;
 3007|  3.17k|    tif->tif_deftilesize = JPEGDefaultTileSize;
 3008|  3.17k|    tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
  ------------------
  |  |  127|  3.17k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 3009|  3.17k|    sp->cinfo_initialized = FALSE;
  ------------------
  |  |   72|  3.17k|#define FALSE 0
  ------------------
 3010|  3.17k|}
tif_jpeg.c:JPEGVGetField:
 2796|  17.7k|{
 2797|  17.7k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  17.7k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2798|       |
 2799|  17.7k|    assert(sp != NULL);
  ------------------
  |  Branch (2799:5): [True: 0, False: 17.7k]
  |  Branch (2799:5): [True: 17.7k, False: 0]
  ------------------
 2800|       |
 2801|  17.7k|    switch (tag)
 2802|  17.7k|    {
 2803|      0|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|      0|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (2803:9): [True: 0, False: 17.7k]
  ------------------
 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: 17.7k]
  ------------------
 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: 17.7k]
  ------------------
 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: 17.7k]
  ------------------
 2814|      0|            *va_arg(ap, int *) = sp->otherSettings.jpegtablesmode;
 2815|      0|            break;
 2816|  17.7k|        default:
  ------------------
  |  Branch (2816:9): [True: 17.7k, False: 0]
  ------------------
 2817|  17.7k|            return (*sp->otherSettings.vgetparent)(tif, tag, ap);
 2818|  17.7k|    }
 2819|      0|    return (1);
 2820|  17.7k|}
tif_jpeg.c:JPEGVSetField:
 2736|  20.0k|{
 2737|  20.0k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  20.0k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2738|  20.0k|    const TIFFField *fip;
 2739|  20.0k|    uint32_t v32;
 2740|       |
 2741|  20.0k|    assert(sp != NULL);
  ------------------
  |  Branch (2741:5): [True: 0, False: 20.0k]
  |  Branch (2741:5): [True: 20.0k, False: 0]
  ------------------
 2742|       |
 2743|  20.0k|    switch (tag)
 2744|  20.0k|    {
 2745|    896|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|    896|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (2745:9): [True: 896, False: 19.1k]
  ------------------
 2746|    896|            v32 = (uint32_t)va_arg(ap, uint32_t);
 2747|    896|            if (v32 == 0)
  ------------------
  |  Branch (2747:17): [True: 14, False: 882]
  ------------------
 2748|     14|            {
 2749|       |                /* XXX */
 2750|     14|                return (0);
 2751|     14|            }
 2752|    882|            _TIFFsetByteArrayExt(tif, &sp->otherSettings.jpegtables,
 2753|    882|                                 va_arg(ap, void *), v32);
 2754|    882|            sp->otherSettings.jpegtables_length = v32;
 2755|    882|            TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
  ------------------
  |  |  249|    882|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    882|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    882|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 2756|    882|            break;
 2757|      0|        case TIFFTAG_JPEGQUALITY:
  ------------------
  |  |  704|      0|#define TIFFTAG_JPEGQUALITY 65537    /* Compression quality level */
  ------------------
  |  Branch (2757:9): [True: 0, False: 20.0k]
  ------------------
 2758|      0|            sp->otherSettings.jpegquality = (int)va_arg(ap, int);
 2759|      0|            return (1); /* pseudo tag */
 2760|    277|        case TIFFTAG_JPEGCOLORMODE:
  ------------------
  |  |  706|    277|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  |  Branch (2760:9): [True: 277, False: 19.7k]
  ------------------
 2761|    277|            sp->otherSettings.jpegcolormode = (int)va_arg(ap, int);
 2762|    277|            JPEGResetUpsampled(tif);
 2763|    277|            return (1); /* pseudo tag */
 2764|  1.58k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  1.58k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (2764:9): [True: 1.58k, False: 18.4k]
  ------------------
 2765|  1.58k|        {
 2766|  1.58k|            int ret_value = (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2767|  1.58k|            JPEGResetUpsampled(tif);
 2768|  1.58k|            return ret_value;
 2769|    896|        }
 2770|      0|        case TIFFTAG_JPEGTABLESMODE:
  ------------------
  |  |  709|      0|#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
  ------------------
  |  Branch (2770:9): [True: 0, False: 20.0k]
  ------------------
 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: 20.0k]
  ------------------
 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|  17.2k|        default:
  ------------------
  |  Branch (2778:9): [True: 17.2k, False: 2.76k]
  ------------------
 2779|  17.2k|            return (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2780|  20.0k|    }
 2781|       |
 2782|    882|    if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
  ------------------
  |  Branch (2782:9): [True: 882, False: 0]
  ------------------
 2783|    882|    {
 2784|    882|        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|    882|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    882|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    882|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 2785|    882|    }
 2786|      0|    else
 2787|      0|    {
 2788|      0|        return (0);
 2789|      0|    }
 2790|       |
 2791|    882|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|    882|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 2792|    882|    return (1);
 2793|    882|}
tif_jpeg.c:JPEGResetUpsampled:
 2697|  1.86k|{
 2698|  1.86k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.86k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2699|  1.86k|    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.86k|    tif->tif_flags &= ~TIFF_UPSAMPLED;
  ------------------
  |  |  133|  1.86k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  ------------------
 2707|  1.86k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.86k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (2707:9): [True: 1.70k, False: 160]
  ------------------
 2708|  1.70k|    {
 2709|  1.70k|        if (td->td_photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  3.40k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (2709:13): [True: 1.64k, False: 61]
  ------------------
 2710|  1.64k|            sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|  1.64k|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (2710:13): [True: 277, False: 1.36k]
  ------------------
 2711|    277|        {
 2712|    277|            tif->tif_flags |= TIFF_UPSAMPLED;
  ------------------
  |  |  133|    277|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  ------------------
 2713|    277|        }
 2714|  1.42k|        else
 2715|  1.42k|        {
 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.42k|        }
 2722|  1.70k|    }
 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.86k|    if (tif->tif_dir.td_tilesize > 0)
  ------------------
  |  Branch (2728:9): [True: 257, False: 1.60k]
  ------------------
 2729|    257|        tif->tif_dir.td_tilesize =
 2730|    257|            isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
  ------------------
  |  |  278|    257|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    257|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 257, False: 0]
  |  |  ------------------
  ------------------
 2731|  1.86k|    if (tif->tif_dir.td_scanlinesize > 0)
  ------------------
  |  Branch (2731:9): [True: 277, False: 1.58k]
  ------------------
 2732|    277|        tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 2733|  1.86k|}
tif_jpeg.c:JPEGFixupTags:
  849|  3.14k|{
  850|  3.14k|#ifdef CHECK_JPEG_YCBCR_SUBSAMPLING
  851|  3.14k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  3.14k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
  852|  3.14k|    if ((tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|  3.14k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (852:9): [True: 1.36k, False: 1.78k]
  ------------------
  853|  1.36k|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|  1.36k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (853:9): [True: 1.36k, False: 1]
  ------------------
  854|  1.36k|        (tif->tif_dir.td_samplesperpixel == 3) &&
  ------------------
  |  Branch (854:9): [True: 1.36k, False: 0]
  ------------------
  855|  1.36k|        !sp->otherSettings.ycbcrsampling_fetched)
  ------------------
  |  Branch (855:9): [True: 1.36k, False: 0]
  ------------------
  856|  1.36k|        JPEGFixupTagsSubsampling(tif);
  857|  3.14k|#endif
  858|       |
  859|  3.14k|    return (1);
  860|  3.14k|}
tif_jpeg.c:JPEGFixupTagsSubsampling:
  865|  1.36k|{
  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.36k|    static const char module[] = "JPEGFixupTagsSubsampling";
  887|  1.36k|    struct JPEGFixupTagsSubsamplingData m;
  888|  1.36k|    uint64_t fileoffset = TIFFGetStrileOffset(tif, 0);
  889|       |
  890|  1.36k|    if (fileoffset == 0)
  ------------------
  |  Branch (890:9): [True: 2, False: 1.35k]
  ------------------
  891|      2|    {
  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|      2|        return;
  896|      2|    }
  897|       |
  898|  1.35k|    m.tif = tif;
  899|  1.35k|    m.buffersize = 2048;
  900|  1.35k|    m.buffer = _TIFFmallocExt(tif, m.buffersize);
  901|  1.35k|    if (m.buffer == NULL)
  ------------------
  |  Branch (901:9): [True: 0, False: 1.35k]
  ------------------
  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.35k|    m.buffercurrentbyte = NULL;
  909|  1.35k|    m.bufferbytesleft = 0;
  910|  1.35k|    m.fileoffset = fileoffset;
  911|  1.35k|    m.filepositioned = 0;
  912|  1.35k|    m.filebytesleft = TIFFGetStrileByteCount(tif, 0);
  913|  1.35k|    if (!JPEGFixupTagsSubsamplingSec(&m))
  ------------------
  |  Branch (913:9): [True: 1.11k, False: 240]
  ------------------
  914|  1.11k|        TIFFWarningExtR(
  915|  1.11k|            tif, module,
  916|  1.11k|            "Unable to auto-correct subsampling values, likely corrupt JPEG "
  917|  1.11k|            "compressed data in first strip/tile; auto-correcting skipped");
  918|  1.35k|    _TIFFfreeExt(tif, m.buffer);
  919|  1.35k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSec:
  923|  1.35k|{
  924|  1.35k|    static const char module[] = "JPEGFixupTagsSubsamplingSec";
  925|  1.35k|    uint8_t m;
  926|   258k|    while (1)
  ------------------
  |  Branch (926:12): [True: 258k, Folded]
  ------------------
  927|   258k|    {
  928|  3.17M|        while (1)
  ------------------
  |  Branch (928:16): [True: 3.17M, Folded]
  ------------------
  929|  3.17M|        {
  930|  3.17M|            if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (930:17): [True: 107, False: 3.17M]
  ------------------
  931|    107|                return (0);
  932|  3.17M|            if (m == 255)
  ------------------
  |  Branch (932:17): [True: 258k, False: 2.91M]
  ------------------
  933|   258k|                break;
  934|  3.17M|        }
  935|   443k|        while (1)
  ------------------
  |  Branch (935:16): [True: 443k, Folded]
  ------------------
  936|   443k|        {
  937|   443k|            if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (937:17): [True: 109, False: 443k]
  ------------------
  938|    109|                return (0);
  939|   443k|            if (m != 255)
  ------------------
  |  Branch (939:17): [True: 258k, False: 185k]
  ------------------
  940|   258k|                break;
  941|   443k|        }
  942|   258k|        switch (m)
  943|   258k|        {
  944|  3.14k|            case JPEG_MARKER_SOI:
  ------------------
  |  |  816|  3.14k|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (944:13): [True: 3.14k, False: 255k]
  ------------------
  945|       |                /* this type of marker has no data and should be skipped */
  946|  3.14k|                break;
  947|  5.65k|            case JPEG_MARKER_COM:
  ------------------
  |  |  821|  5.65k|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (947:13): [True: 5.65k, False: 252k]
  ------------------
  948|  8.69k|            case JPEG_MARKER_APP0:
  ------------------
  |  |  820|  8.69k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (948:13): [True: 3.03k, False: 255k]
  ------------------
  949|  16.0k|            case JPEG_MARKER_APP0 + 1:
  ------------------
  |  |  820|  16.0k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (949:13): [True: 7.32k, False: 250k]
  ------------------
  950|  17.1k|            case JPEG_MARKER_APP0 + 2:
  ------------------
  |  |  820|  17.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (950:13): [True: 1.16k, False: 257k]
  ------------------
  951|  18.3k|            case JPEG_MARKER_APP0 + 3:
  ------------------
  |  |  820|  18.3k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (951:13): [True: 1.19k, False: 257k]
  ------------------
  952|  50.1k|            case JPEG_MARKER_APP0 + 4:
  ------------------
  |  |  820|  50.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (952:13): [True: 31.7k, False: 226k]
  ------------------
  953|  50.4k|            case JPEG_MARKER_APP0 + 5:
  ------------------
  |  |  820|  50.4k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (953:13): [True: 303, False: 257k]
  ------------------
  954|  51.4k|            case JPEG_MARKER_APP0 + 6:
  ------------------
  |  |  820|  51.4k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (954:13): [True: 1.05k, False: 257k]
  ------------------
  955|  51.7k|            case JPEG_MARKER_APP0 + 7:
  ------------------
  |  |  820|  51.7k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (955:13): [True: 295, False: 257k]
  ------------------
  956|  53.4k|            case JPEG_MARKER_APP0 + 8:
  ------------------
  |  |  820|  53.4k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (956:13): [True: 1.69k, False: 256k]
  ------------------
  957|  53.7k|            case JPEG_MARKER_APP0 + 9:
  ------------------
  |  |  820|  53.7k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (957:13): [True: 298, False: 257k]
  ------------------
  958|  55.3k|            case JPEG_MARKER_APP0 + 10:
  ------------------
  |  |  820|  55.3k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (958:13): [True: 1.60k, False: 256k]
  ------------------
  959|  59.0k|            case JPEG_MARKER_APP0 + 11:
  ------------------
  |  |  820|  59.0k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (959:13): [True: 3.64k, False: 254k]
  ------------------
  960|  60.5k|            case JPEG_MARKER_APP0 + 12:
  ------------------
  |  |  820|  60.5k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (960:13): [True: 1.47k, False: 256k]
  ------------------
  961|  92.1k|            case JPEG_MARKER_APP0 + 13:
  ------------------
  |  |  820|  92.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (961:13): [True: 31.6k, False: 226k]
  ------------------
  962|  94.5k|            case JPEG_MARKER_APP0 + 14:
  ------------------
  |  |  820|  94.5k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (962:13): [True: 2.40k, False: 255k]
  ------------------
  963|   101k|            case JPEG_MARKER_APP0 + 15:
  ------------------
  |  |  820|   101k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (963:13): [True: 6.92k, False: 251k]
  ------------------
  964|   102k|            case JPEG_MARKER_DQT:
  ------------------
  |  |  818|   102k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (964:13): [True: 675, False: 257k]
  ------------------
  965|   102k|            case JPEG_MARKER_SOS:
  ------------------
  |  |  817|   102k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (965:13): [True: 598, False: 257k]
  ------------------
  966|   253k|            case JPEG_MARKER_DHT:
  ------------------
  |  |  815|   253k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (966:13): [True: 151k, False: 107k]
  ------------------
  967|   254k|            case JPEG_MARKER_DRI:
  ------------------
  |  |  819|   254k|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (967:13): [True: 314, False: 257k]
  ------------------
  968|       |                /* this type of marker has data, but it has no use to us and
  969|       |                 * should be skipped */
  970|   254k|                {
  971|   254k|                    uint16_t n;
  972|   254k|                    if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (972:25): [True: 280, False: 253k]
  ------------------
  973|    280|                        return (0);
  974|   253k|                    if (n < 2)
  ------------------
  |  Branch (974:25): [True: 0, False: 253k]
  ------------------
  975|      0|                        return (0);
  976|   253k|                    n = (uint16_t)(n - 2);
  977|   253k|                    if (n > 0)
  ------------------
  |  Branch (977:25): [True: 241k, False: 12.7k]
  ------------------
  978|   241k|                        JPEGFixupTagsSubsamplingSkip(data, n);
  979|   253k|                }
  980|      0|                break;
  981|     26|            case JPEG_MARKER_SOF0:  /* Baseline sequential Huffman */
  ------------------
  |  |  810|     26|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (981:13): [True: 26, False: 258k]
  ------------------
  982|     50|            case JPEG_MARKER_SOF1:  /* Extended sequential Huffman */
  ------------------
  |  |  811|     50|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (982:13): [True: 24, False: 258k]
  ------------------
  983|    131|            case JPEG_MARKER_SOF2:  /* Progressive Huffman: normally not allowed
  ------------------
  |  |  812|    131|#define JPEG_MARKER_SOF2 0xC2
  ------------------
  |  Branch (983:13): [True: 81, False: 258k]
  ------------------
  984|       |                                       by  TechNote, but that doesn't hurt
  985|       |                                       supporting it */
  986|    620|            case JPEG_MARKER_SOF9:  /* Extended sequential arithmetic */
  ------------------
  |  |  813|    620|#define JPEG_MARKER_SOF9 0xC9
  ------------------
  |  Branch (986:13): [True: 489, False: 257k]
  ------------------
  987|    807|            case JPEG_MARKER_SOF10: /* Progressive arithmetic: normally not
  ------------------
  |  |  814|    807|#define JPEG_MARKER_SOF10 0xCA
  ------------------
  |  Branch (987:13): [True: 187, False: 258k]
  ------------------
  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|    807|                {
  993|    807|                    uint16_t n;
  994|    807|                    uint16_t o;
  995|    807|                    uint8_t p;
  996|    807|                    uint8_t ph, pv;
  997|    807|                    if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (997:25): [True: 133, False: 674]
  ------------------
  998|    133|                        return (0);
  999|    674|                    if (n != 8 + data->tif->tif_dir.td_samplesperpixel * 3)
  ------------------
  |  Branch (999:25): [True: 8, False: 666]
  ------------------
 1000|      8|                        return (0);
 1001|    666|                    JPEGFixupTagsSubsamplingSkip(data, 7);
 1002|    666|                    if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (1002:25): [True: 191, False: 475]
  ------------------
 1003|    191|                        return (0);
 1004|    475|                    ph = (p >> 4);
 1005|    475|                    pv = (p & 15);
 1006|    475|                    JPEGFixupTagsSubsamplingSkip(data, 1);
 1007|  1.04k|                    for (o = 1; o < data->tif->tif_dir.td_samplesperpixel; o++)
  ------------------
  |  Branch (1007:33): [True: 807, False: 236]
  ------------------
 1008|    807|                    {
 1009|    807|                        JPEGFixupTagsSubsamplingSkip(data, 1);
 1010|    807|                        if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (1010:29): [True: 235, False: 572]
  ------------------
 1011|    235|                            return (0);
 1012|    572|                        if (p != 0x11)
  ------------------
  |  Branch (1012:29): [True: 4, False: 568]
  ------------------
 1013|      4|                        {
 1014|      4|                            TIFFWarningExtR(data->tif, module,
 1015|      4|                                            "Subsampling values inside JPEG "
 1016|      4|                                            "compressed data "
 1017|      4|                                            "have no TIFF equivalent, "
 1018|      4|                                            "auto-correction of TIFF "
 1019|      4|                                            "subsampling values failed");
 1020|      4|                            return (1);
 1021|      4|                        }
 1022|    568|                        JPEGFixupTagsSubsamplingSkip(data, 1);
 1023|    568|                    }
 1024|    236|                    if (((ph != 1) && (ph != 2) && (ph != 4)) ||
  ------------------
  |  Branch (1024:26): [True: 217, False: 19]
  |  Branch (1024:39): [True: 43, False: 174]
  |  Branch (1024:52): [True: 0, False: 43]
  ------------------
 1025|    236|                        ((pv != 1) && (pv != 2) && (pv != 4)))
  ------------------
  |  Branch (1025:26): [True: 138, False: 98]
  |  Branch (1025:39): [True: 16, False: 122]
  |  Branch (1025:52): [True: 0, False: 16]
  ------------------
 1026|      0|                    {
 1027|      0|                        TIFFWarningExtR(data->tif, module,
 1028|      0|                                        "Subsampling values inside JPEG "
 1029|      0|                                        "compressed data have no TIFF "
 1030|      0|                                        "equivalent, auto-correction of TIFF "
 1031|      0|                                        "subsampling values failed");
 1032|      0|                        return (1);
 1033|      0|                    }
 1034|    236|                    if ((ph != data->tif->tif_dir.td_ycbcrsubsampling[0]) ||
  ------------------
  |  Branch (1034:25): [True: 62, False: 174]
  ------------------
 1035|    174|                        (pv != data->tif->tif_dir.td_ycbcrsubsampling[1]))
  ------------------
  |  Branch (1035:25): [True: 89, False: 85]
  ------------------
 1036|    151|                    {
 1037|    151|                        TIFFWarningExtR(
 1038|    151|                            data->tif, module,
 1039|    151|                            "Auto-corrected former TIFF subsampling values "
 1040|    151|                            "[%" PRIu16 ",%" PRIu16
 1041|    151|                            "] to match subsampling values inside JPEG "
 1042|    151|                            "compressed data [%" PRIu8 ",%" PRIu8 "]",
 1043|    151|                            data->tif->tif_dir.td_ycbcrsubsampling[0],
 1044|    151|                            data->tif->tif_dir.td_ycbcrsubsampling[1], ph, pv);
 1045|    151|                        data->tif->tif_dir.td_ycbcrsubsampling[0] = ph;
 1046|    151|                        data->tif->tif_dir.td_ycbcrsubsampling[1] = pv;
 1047|    151|                    }
 1048|    236|                }
 1049|      0|                return (1);
 1050|     55|            default:
  ------------------
  |  Branch (1050:13): [True: 55, False: 258k]
  ------------------
 1051|     55|                return (0);
 1052|   258k|        }
 1053|   258k|    }
 1054|  1.35k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadByte:
 1059|  4.12M|{
 1060|  4.12M|    if (data->bufferbytesleft == 0)
  ------------------
  |  Branch (1060:9): [True: 4.63k, False: 4.12M]
  ------------------
 1061|  4.63k|    {
 1062|  4.63k|        uint32_t m;
 1063|  4.63k|        if (data->filebytesleft == 0)
  ------------------
  |  Branch (1063:13): [True: 48, False: 4.58k]
  ------------------
 1064|     48|            return (0);
 1065|  4.58k|        if (!data->filepositioned)
  ------------------
  |  Branch (1065:13): [True: 2.07k, False: 2.50k]
  ------------------
 1066|  2.07k|        {
 1067|  2.07k|            if (TIFFSeekFile(data->tif, data->fileoffset, SEEK_SET) ==
  ------------------
  |  |  287|  2.07k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
  |  Branch (1067:17): [True: 117, False: 1.95k]
  ------------------
 1068|  2.07k|                (toff_t)-1)
 1069|    117|            {
 1070|    117|                return 0;
 1071|    117|            }
 1072|  1.95k|            data->filepositioned = 1;
 1073|  1.95k|        }
 1074|  4.46k|        m = data->buffersize;
 1075|  4.46k|        if ((uint64_t)m > data->filebytesleft)
  ------------------
  |  Branch (1075:13): [True: 346, False: 4.11k]
  ------------------
 1076|    346|            m = (uint32_t)data->filebytesleft;
 1077|  4.46k|        assert(m < 0x80000000UL);
  ------------------
  |  Branch (1077:9): [True: 0, False: 4.46k]
  |  Branch (1077:9): [True: 4.46k, False: 0]
  ------------------
 1078|  4.46k|        if (TIFFReadFile(data->tif, data->buffer, (tmsize_t)m) != (tmsize_t)m)
  ------------------
  |  |  283|  4.46k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  |  Branch (1078:13): [True: 890, False: 3.57k]
  ------------------
 1079|    890|            return (0);
 1080|  3.57k|        data->buffercurrentbyte = (uint8_t *)data->buffer;
 1081|  3.57k|        data->bufferbytesleft = m;
 1082|  3.57k|        data->fileoffset += m;
 1083|  3.57k|        data->filebytesleft -= m;
 1084|  3.57k|    }
 1085|  4.12M|    *result = *data->buffercurrentbyte;
 1086|  4.12M|    data->buffercurrentbyte++;
 1087|  4.12M|    data->bufferbytesleft--;
 1088|  4.12M|    return (1);
 1089|  4.12M|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadWord:
 1094|   255k|{
 1095|   255k|    uint8_t ma;
 1096|   255k|    uint8_t mb;
 1097|   255k|    if (!JPEGFixupTagsSubsamplingReadByte(data, &ma))
  ------------------
  |  Branch (1097:9): [True: 160, False: 254k]
  ------------------
 1098|    160|        return (0);
 1099|   254k|    if (!JPEGFixupTagsSubsamplingReadByte(data, &mb))
  ------------------
  |  Branch (1099:9): [True: 253, False: 254k]
  ------------------
 1100|    253|        return (0);
 1101|   254k|    *result = (uint16_t)((ma << 8) | mb);
 1102|   254k|    return (1);
 1103|   254k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSkip:
 1108|   243k|{
 1109|   243k|    if ((uint32_t)skiplength <= data->bufferbytesleft)
  ------------------
  |  Branch (1109:9): [True: 242k, False: 874]
  ------------------
 1110|   242k|    {
 1111|   242k|        data->buffercurrentbyte += skiplength;
 1112|   242k|        data->bufferbytesleft -= skiplength;
 1113|   242k|    }
 1114|    874|    else
 1115|    874|    {
 1116|    874|        uint16_t m;
 1117|    874|        m = (uint16_t)(skiplength - data->bufferbytesleft);
 1118|    874|        if (m <= data->filebytesleft)
  ------------------
  |  Branch (1118:13): [True: 848, False: 26]
  ------------------
 1119|    848|        {
 1120|    848|            data->bufferbytesleft = 0;
 1121|    848|            data->fileoffset += m;
 1122|    848|            data->filebytesleft -= m;
 1123|    848|            data->filepositioned = 0;
 1124|    848|        }
 1125|     26|        else
 1126|     26|        {
 1127|     26|            data->bufferbytesleft = 0;
 1128|     26|            data->filebytesleft = 0;
 1129|     26|        }
 1130|    874|    }
 1131|   243k|}
tif_jpeg.c:JPEGSetupDecode:
 1136|  2.05k|{
 1137|  2.05k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  2.05k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1138|  2.05k|    TIFFDirectory *td = &tif->tif_dir;
 1139|       |
 1140|  2.05k|#if defined(JPEG_DUAL_MODE_8_12) && !defined(FROM_TIF_JPEG_12)
 1141|  2.05k|    if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (1141:9): [True: 879, False: 1.17k]
  ------------------
 1142|    879|    {
 1143|       |        /* We pass a pointer to a copy of otherSettings, since */
 1144|       |        /* TIFFReInitJPEG_12() will clear sp */
 1145|    879|        JPEGOtherSettings savedOtherSettings = sp->otherSettings;
 1146|    879|        return TIFFReInitJPEG_12(tif, &savedOtherSettings, COMPRESSION_JPEG, 0);
  ------------------
  |  |  190|    879|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
 1147|    879|    }
 1148|  1.17k|#endif
 1149|       |
 1150|  1.17k|    JPEGInitializeLibJPEG(tif, TRUE);
  ------------------
  |  |   71|  1.17k|#define TRUE 1
  ------------------
 1151|       |
 1152|  1.17k|    assert(sp != NULL);
  ------------------
  |  Branch (1152:5): [True: 0, False: 1.17k]
  |  Branch (1152:5): [True: 1.17k, False: 0]
  ------------------
 1153|  1.17k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1153:5): [True: 0, False: 1.17k]
  |  Branch (1153:5): [True: 1.17k, False: 0]
  ------------------
 1154|       |
 1155|       |    /* Read JPEGTables if it is present */
 1156|  1.17k|    if (TIFFFieldSet(tif, FIELD_JPEGTABLES))
  ------------------
  |  |  248|  1.17k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.17k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.17k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 160, False: 1.01k]
  |  |  ------------------
  ------------------
 1157|    160|    {
 1158|    160|        TIFFjpeg_tables_src(sp);
 1159|    160|        if (TIFFjpeg_read_header(sp, FALSE) != JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  |   72|    160|#define FALSE 0
  ------------------
  |  Branch (1159:13): [True: 5, False: 155]
  ------------------
 1160|      5|        {
 1161|      5|            TIFFErrorExtR(tif, "JPEGSetupDecode", "Bogus JPEGTables field");
 1162|      5|            return (0);
 1163|      5|        }
 1164|    160|    }
 1165|       |
 1166|       |    /* Grab parameters that are same for all strips/tiles */
 1167|  1.17k|    sp->photometric = td->td_photometric;
 1168|  1.17k|    switch (sp->photometric)
 1169|  1.17k|    {
 1170|    274|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|    274|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1170:9): [True: 274, False: 896]
  ------------------
 1171|    274|            sp->h_sampling = td->td_ycbcrsubsampling[0];
 1172|    274|            sp->v_sampling = td->td_ycbcrsubsampling[1];
 1173|    274|            break;
 1174|    896|        default:
  ------------------
  |  Branch (1174:9): [True: 896, False: 274]
  ------------------
 1175|       |            /* TIFF 6.0 forbids subsampling of all other color spaces */
 1176|    896|            sp->h_sampling = 1;
 1177|    896|            sp->v_sampling = 1;
 1178|    896|            break;
 1179|  1.17k|    }
 1180|       |
 1181|       |    /* Set up for reading normal data */
 1182|  1.17k|    TIFFjpeg_data_src(sp);
 1183|  1.17k|    tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
 1184|  1.17k|    return (1);
 1185|  1.17k|}
tif_jpeg.c:JPEGInitializeLibJPEG:
 2883|  1.17k|{
 2884|  1.17k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.17k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2885|       |
 2886|  1.17k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2886:9): [True: 2, False: 1.17k]
  ------------------
 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.17k|    if (decompress)
  ------------------
  |  Branch (2901:9): [True: 1.17k, False: 0]
  ------------------
 2902|  1.17k|    {
 2903|  1.17k|        if (!TIFFjpeg_create_decompress(sp))
  ------------------
  |  Branch (2903:13): [True: 0, False: 1.17k]
  ------------------
 2904|      0|            return (0);
 2905|  1.17k|    }
 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.17k|    sp->cinfo_initialized = TRUE;
  ------------------
  |  |   71|  1.17k|#define TRUE 1
  ------------------
 2936|       |
 2937|  1.17k|    return 1;
 2938|  1.17k|}
tif_jpeg.c:TIFFjpeg_tables_src:
  769|    160|{
  770|    160|    TIFFjpeg_data_src(sp);
  771|    160|    sp->src.init_source = tables_init_source;
  772|    160|}
tif_jpeg.c:tables_init_source:
  761|    159|{
  762|    159|    JPEGState *sp = (JPEGState *)cinfo;
  763|       |
  764|    159|    sp->src.next_input_byte = (const JOCTET *)sp->otherSettings.jpegtables;
  765|    159|    sp->src.bytes_in_buffer = (size_t)sp->otherSettings.jpegtables_length;
  766|    159|}
tif_jpeg.c:JPEGPreDecode:
 1268|   133k|{
 1269|   133k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|   133k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1270|   133k|    TIFFDirectory *td = &tif->tif_dir;
 1271|   133k|    static const char module[] = "JPEGPreDecode";
 1272|   133k|    int downsampled_output;
 1273|   133k|    int ci;
 1274|       |
 1275|   133k|    assert(sp != NULL);
  ------------------
  |  Branch (1275:5): [True: 0, False: 133k]
  |  Branch (1275:5): [True: 133k, False: 0]
  ------------------
 1276|       |
 1277|   133k|    if (sp->cinfo.comm.is_decompressor == 0)
  ------------------
  |  Branch (1277:9): [True: 0, False: 133k]
  ------------------
 1278|      0|    {
 1279|      0|        tif->tif_setupdecode(tif);
 1280|      0|    }
 1281|       |
 1282|   133k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1282:5): [True: 0, False: 133k]
  |  Branch (1282:5): [True: 133k, False: 0]
  ------------------
 1283|       |    /*
 1284|       |     * Reset decoder state from any previous strip/tile,
 1285|       |     * in case application didn't read the whole strip.
 1286|       |     */
 1287|   133k|    if (!TIFFjpeg_abort(sp))
  ------------------
  |  Branch (1287:9): [True: 0, False: 133k]
  ------------------
 1288|      0|        return (0);
 1289|       |    /*
 1290|       |     * Read the header for this strip/tile.
 1291|       |     */
 1292|       |
 1293|   133k|    if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
  ------------------
  |  |   71|   133k|#define TRUE 1
  ------------------
  |  Branch (1293:9): [True: 89.3k, False: 44.1k]
  ------------------
 1294|  89.3k|        return (0);
 1295|       |
 1296|  44.1k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1297|  44.1k|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1298|       |
 1299|  44.1k|    if (!JPEGComputeStrileWidthHeightBytesPerLine(tif, s))
  ------------------
  |  Branch (1299:9): [True: 0, False: 44.1k]
  ------------------
 1300|      0|        return 0;
 1301|       |
 1302|  44.1k|    if (sp->cinfo.d.image_width < sp->strile_width ||
  ------------------
  |  Branch (1302:9): [True: 41.5k, False: 2.59k]
  ------------------
 1303|  2.59k|        sp->cinfo.d.image_height < sp->strile_height)
  ------------------
  |  Branch (1303:9): [True: 1.26k, False: 1.33k]
  ------------------
 1304|  42.8k|    {
 1305|  42.8k|        TIFFWarningExtR(tif, module,
 1306|  42.8k|                        "Improper JPEG strip/tile size, "
 1307|  42.8k|                        "expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1308|  42.8k|                        sp->strile_width, sp->strile_height,
 1309|  42.8k|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1310|  42.8k|    }
 1311|  44.1k|    if (sp->cinfo.d.image_width == sp->strile_width &&
  ------------------
  |  Branch (1311:9): [True: 1.92k, False: 42.2k]
  ------------------
 1312|  1.92k|        sp->cinfo.d.image_height > sp->strile_height &&
  ------------------
  |  Branch (1312:9): [True: 1.06k, False: 862]
  ------------------
 1313|  1.06k|        tif->tif_dir.td_row + sp->strile_height == td->td_imagelength &&
  ------------------
  |  Branch (1313:9): [True: 19, False: 1.04k]
  ------------------
 1314|     19|        !isTiled(tif))
  ------------------
  |  |  278|     19|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     19|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1314:9): [True: 18, False: 1]
  ------------------
 1315|     18|    {
 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|     18|        TIFFWarningExtR(tif, module,
 1321|     18|                        "JPEG strip size exceeds expected dimensions,"
 1322|     18|                        " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1323|     18|                        sp->strile_width, sp->strile_height,
 1324|     18|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1325|     18|    }
 1326|  44.1k|    else if (sp->cinfo.d.image_width > sp->strile_width ||
  ------------------
  |  Branch (1326:14): [True: 662, False: 43.4k]
  ------------------
 1327|  43.4k|             sp->cinfo.d.image_height > sp->strile_height)
  ------------------
  |  Branch (1327:14): [True: 1.21k, False: 42.2k]
  ------------------
 1328|  1.87k|    {
 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|  1.87k|        TIFFErrorExtR(tif, module,
 1336|  1.87k|                      "JPEG strip/tile size exceeds expected dimensions,"
 1337|  1.87k|                      " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1338|  1.87k|                      sp->strile_width, sp->strile_height,
 1339|  1.87k|                      sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1340|  1.87k|        return (0);
 1341|  1.87k|    }
 1342|  42.2k|    if (sp->cinfo.d.num_components !=
  ------------------
  |  Branch (1342:9): [True: 1.24k, False: 41.0k]
  ------------------
 1343|  42.2k|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|  42.2k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1343:10): [True: 40.8k, False: 1.45k]
  ------------------
 1344|  42.2k|                                                    : 1))
 1345|  1.24k|    {
 1346|  1.24k|        TIFFErrorExtR(tif, module, "Improper JPEG component count");
 1347|  1.24k|        return (0);
 1348|  1.24k|    }
 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|  41.0k|    if (td->td_bitspersample != BITS_IN_JSAMPLE ||
  ------------------
  |  |  108|  82.1k|#define BITS_IN_JSAMPLE 8
  ------------------
  |  Branch (1358:9): [True: 0, False: 41.0k]
  ------------------
 1359|  41.0k|        sp->cinfo.d.data_precision != td->td_bitspersample)
  ------------------
  |  Branch (1359:9): [True: 401, False: 40.6k]
  ------------------
 1360|    401|    {
 1361|    401|        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1362|    401|        return (0);
 1363|    401|    }
 1364|  40.6k|#endif
 1365|       |
 1366|  40.6k|    if (sp->cinfo.d.progressive_mode &&
  ------------------
  |  Branch (1366:9): [True: 20.7k, False: 19.9k]
  ------------------
 1367|  20.7k|        !sp->otherSettings.has_warned_about_progressive_mode)
  ------------------
  |  Branch (1367:9): [True: 513, False: 20.2k]
  ------------------
 1368|    513|    {
 1369|    513|        TIFFWarningExtR(tif, module,
 1370|    513|                        "The JPEG strip/tile is encoded with progressive mode, "
 1371|    513|                        "which is normally not legal for JPEG-in-TIFF.\n"
 1372|    513|                        "libtiff should be able to decode it, but it might "
 1373|    513|                        "cause compatibility issues with other readers");
 1374|    513|        sp->otherSettings.has_warned_about_progressive_mode = TRUE;
  ------------------
  |  |   71|    513|#define TRUE 1
  ------------------
 1375|    513|    }
 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|  40.6k|    if (TIFFjpeg_has_multiple_scans(sp))
  ------------------
  |  Branch (1380:9): [True: 23.1k, False: 17.5k]
  ------------------
 1381|  23.1k|    {
 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|  23.1k|        toff_t nRequiredMemory = 1024 * 1024;
 1389|       |
 1390|  74.3k|        for (ci = 0; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1390:22): [True: 51.2k, False: 23.1k]
  ------------------
 1391|  51.2k|        {
 1392|  51.2k|            const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
 1393|  51.2k|            if (compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0)
  ------------------
  |  Branch (1393:17): [True: 51.2k, False: 0]
  |  Branch (1393:47): [True: 51.2k, False: 0]
  ------------------
 1394|  51.2k|            {
 1395|  51.2k|                nRequiredMemory +=
 1396|  51.2k|                    (toff_t)((JDIMENSION)(((int)compptr->width_in_blocks +
 1397|  51.2k|                                           compptr->h_samp_factor - 1) /
 1398|  51.2k|                                          compptr->h_samp_factor)) *
 1399|  51.2k|                    (JDIMENSION)(((int)compptr->height_in_blocks +
 1400|  51.2k|                                  compptr->v_samp_factor - 1) /
 1401|  51.2k|                                 compptr->v_samp_factor) *
 1402|  51.2k|                    sizeof(JBLOCK);
 1403|  51.2k|            }
 1404|  51.2k|        }
 1405|       |
 1406|  23.1k|        if (sp->cinfo.d.mem->max_memory_to_use > 0 &&
  ------------------
  |  Branch (1406:13): [True: 0, False: 23.1k]
  ------------------
 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|  23.1k|    }
 1425|       |
 1426|  40.6k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  40.6k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1426:9): [True: 39.1k, False: 1.45k]
  ------------------
 1427|  39.1k|    {
 1428|       |        /* Component 0 should have expected sampling factors */
 1429|  39.1k|        if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
  ------------------
  |  Branch (1429:13): [True: 222, False: 38.9k]
  ------------------
 1430|  38.9k|            sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling)
  ------------------
  |  Branch (1430:13): [True: 232, False: 38.7k]
  ------------------
 1431|    454|        {
 1432|    454|            TIFFErrorExtR(tif, module,
 1433|    454|                          "Improper JPEG sampling factors %d,%d\n"
 1434|    454|                          "Apparently should be %" PRIu16 ",%" PRIu16 ".",
 1435|    454|                          sp->cinfo.d.comp_info[0].h_samp_factor,
 1436|    454|                          sp->cinfo.d.comp_info[0].v_samp_factor,
 1437|    454|                          sp->h_sampling, sp->v_sampling);
 1438|    454|            return (0);
 1439|    454|        }
 1440|       |        /* Rest should have sampling factors 1,1 */
 1441|  68.0k|        for (ci = 1; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1441:22): [True: 29.3k, False: 38.7k]
  ------------------
 1442|  29.3k|        {
 1443|  29.3k|            if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
  ------------------
  |  Branch (1443:17): [True: 9, False: 29.3k]
  ------------------
 1444|  29.3k|                sp->cinfo.d.comp_info[ci].v_samp_factor != 1)
  ------------------
  |  Branch (1444:17): [True: 9, False: 29.3k]
  ------------------
 1445|     18|            {
 1446|     18|                TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1447|     18|                return (0);
 1448|     18|            }
 1449|  29.3k|        }
 1450|  38.7k|    }
 1451|  1.45k|    else
 1452|  1.45k|    {
 1453|       |        /* PC 2's single component should have sampling factors 1,1 */
 1454|  1.45k|        if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
  ------------------
  |  Branch (1454:13): [True: 2, False: 1.45k]
  ------------------
 1455|  1.45k|            sp->cinfo.d.comp_info[0].v_samp_factor != 1)
  ------------------
  |  Branch (1455:13): [True: 2, False: 1.45k]
  ------------------
 1456|      4|        {
 1457|      4|            TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1458|      4|            return (0);
 1459|      4|        }
 1460|  1.45k|    }
 1461|  40.1k|    downsampled_output = FALSE;
  ------------------
  |  |   72|  40.1k|#define FALSE 0
  ------------------
 1462|  40.1k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  80.3k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1462:9): [True: 38.7k, False: 1.45k]
  ------------------
 1463|  38.7k|        sp->photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  78.8k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1463:9): [True: 14.3k, False: 24.3k]
  ------------------
 1464|  14.3k|        sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|  14.3k|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (1464:9): [True: 14.3k, False: 2]
  ------------------
 1465|  14.3k|    {
 1466|       |        /* Convert YCbCr to RGB */
 1467|  14.3k|        sp->cinfo.d.jpeg_color_space = JCS_YCbCr;
 1468|  14.3k|        sp->cinfo.d.out_color_space = JCS_RGB;
 1469|  14.3k|    }
 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.6k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1475:13): [True: 24.3k, False: 1.45k]
  ------------------
 1476|  24.3k|            (sp->h_sampling != 1 || sp->v_sampling != 1))
  ------------------
  |  Branch (1476:14): [True: 1, False: 24.3k]
  |  Branch (1476:37): [True: 1, False: 24.3k]
  ------------------
 1477|      2|            downsampled_output = TRUE;
  ------------------
  |  |   71|      2|#define TRUE 1
  ------------------
 1478|       |        /* XXX what about up-sampling? */
 1479|  25.8k|    }
 1480|  40.1k|    if (downsampled_output)
  ------------------
  |  Branch (1480:9): [True: 2, False: 40.1k]
  ------------------
 1481|      2|    {
 1482|       |        /* Need to use raw-data interface to libjpeg */
 1483|      2|        sp->cinfo.d.raw_data_out = TRUE;
  ------------------
  |  |   71|      2|#define TRUE 1
  ------------------
 1484|       |#if JPEG_LIB_VERSION >= 70
 1485|       |        sp->cinfo.d.do_fancy_upsampling = FALSE;
 1486|       |#endif /* JPEG_LIB_VERSION >= 70 */
 1487|      2|        tif->tif_decoderow = DecodeRowError;
 1488|      2|        tif->tif_decodestrip = JPEGDecodeRaw;
 1489|      2|        tif->tif_decodetile = JPEGDecodeRaw;
 1490|      2|    }
 1491|  40.1k|    else
 1492|  40.1k|    {
 1493|       |        /* Use normal interface to libjpeg */
 1494|  40.1k|        sp->cinfo.d.raw_data_out = FALSE;
  ------------------
  |  |   72|  40.1k|#define FALSE 0
  ------------------
 1495|  40.1k|        tif->tif_decoderow = JPEGDecode;
 1496|  40.1k|        tif->tif_decodestrip = JPEGDecode;
 1497|  40.1k|        tif->tif_decodetile = JPEGDecode;
 1498|  40.1k|    }
 1499|       |    /* Start JPEG decompressor */
 1500|  40.1k|    if (!TIFFjpeg_start_decompress(sp))
  ------------------
  |  Branch (1500:9): [True: 9.63k, False: 30.5k]
  ------------------
 1501|  9.63k|        return (0);
 1502|       |    /* Allocate downsampled-data buffers if needed */
 1503|  30.5k|    if (downsampled_output)
  ------------------
  |  Branch (1503:9): [True: 2, False: 30.5k]
  ------------------
 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|  30.5k|    return (1);
 1511|  30.5k|}
tif_jpeg.c:TIFFjpeg_abort:
  520|   133k|{
  521|       |    return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
  ------------------
  |  |  302|   133k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|   133k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|   133k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (521:12): [True: 0, False: 133k]
  ------------------
  522|   133k|}
tif_jpeg.c:JPEGComputeStrileWidthHeightBytesPerLine:
 1224|  44.1k|{
 1225|  44.1k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  44.1k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1226|  44.1k|    TIFFDirectory *td = &tif->tif_dir;
 1227|       |
 1228|       |    /*
 1229|       |     * Check image parameters and set decompression parameters.
 1230|       |     */
 1231|  44.1k|    if (isTiled(tif))
  ------------------
  |  |  278|  44.1k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  44.1k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 43.9k, False: 228]
  |  |  ------------------
  ------------------
 1232|  43.9k|    {
 1233|  43.9k|        sp->strile_width = td->td_tilewidth;
 1234|  43.9k|        sp->strile_height = td->td_tilelength;
 1235|  43.9k|        sp->bytesperline = TIFFTileRowSize(tif);
 1236|  43.9k|    }
 1237|    228|    else
 1238|    228|    {
 1239|    228|        sp->strile_width = td->td_imagewidth;
 1240|    228|        sp->strile_height = td->td_imagelength - tif->tif_dir.td_row;
 1241|    228|        if (sp->strile_height > td->td_rowsperstrip)
  ------------------
  |  Branch (1241:13): [True: 196, False: 32]
  ------------------
 1242|    196|            sp->strile_height = td->td_rowsperstrip;
 1243|    228|        sp->bytesperline = TIFFScanlineSize(tif);
 1244|    228|    }
 1245|  44.1k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0)
  ------------------
  |  |  266|  88.3k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (1245:9): [True: 1.45k, False: 42.7k]
  |  Branch (1245:57): [True: 422, False: 1.03k]
  ------------------
 1246|    422|    {
 1247|       |        /*
 1248|       |         * For PC 2, scale down the expected strip/tile size
 1249|       |         * to match a downsampled component
 1250|       |         */
 1251|    422|        if (sp->h_sampling == 0 || sp->v_sampling == 0)
  ------------------
  |  Branch (1251:13): [True: 0, False: 422]
  |  Branch (1251:36): [True: 0, False: 422]
  ------------------
 1252|      0|        {
 1253|      0|            TIFFErrorExtR(tif, "JPEGComputeStrileWidthHeightBytesPerLine",
 1254|      0|                          "JPEG horizontal or vertical sampling is zero");
 1255|      0|            return (0);
 1256|      0|        }
 1257|    422|        sp->strile_width = TIFFhowmany_32(sp->strile_width, sp->h_sampling);
  ------------------
  |  |  312|    422|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 422, False: 0]
  |  |  ------------------
  |  |  313|    422|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|    422|         : 0U)
  ------------------
 1258|    422|        sp->strile_height = TIFFhowmany_32(sp->strile_height, sp->v_sampling);
  ------------------
  |  |  312|    422|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 422, False: 0]
  |  |  ------------------
  |  |  313|    422|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|    422|         : 0U)
  ------------------
 1259|    422|    }
 1260|       |
 1261|  44.1k|    return 1;
 1262|  44.1k|}
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|  30.5k|{
  516|       |    return CALLJPEG(sp, -1, (int)jpeg_finish_decompress(&sp->cinfo.d));
  ------------------
  |  |  301|  30.5k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  30.5k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (516:12): [True: 6.37k, False: 24.1k]
  ------------------
  517|  30.5k|}
tif_jpeg.c:TIFFjpeg_start_decompress:
  406|  40.1k|{
  407|  40.1k|    const char *sz_max_allowed_scan_number;
  408|       |    /* progress monitor */
  409|  40.1k|    sp->cinfo.d.progress = &sp->progress;
  410|  40.1k|    sp->progress.progress_monitor = TIFFjpeg_progress_monitor;
  411|  40.1k|    sp->otherSettings.max_allowed_scan_number = 100;
  412|  40.1k|    sz_max_allowed_scan_number = getenv("LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER");
  413|  40.1k|    if (sz_max_allowed_scan_number)
  ------------------
  |  Branch (413:9): [True: 0, False: 40.1k]
  ------------------
  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|  40.1k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  40.1k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  40.1k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (417:12): [True: 9.63k, False: 30.5k]
  ------------------
  418|  40.1k|}
tif_jpeg.c:TIFFjpeg_progress_monitor:
  274|  4.27M|{
  275|  4.27M|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  276|  4.27M|    if (cinfo->is_decompressor)
  ------------------
  |  Branch (276:9): [True: 4.27M, False: 0]
  ------------------
  277|  4.27M|    {
  278|  4.27M|        const int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
  279|  4.27M|        if (scan_no >= sp->otherSettings.max_allowed_scan_number)
  ------------------
  |  Branch (279:13): [True: 2, False: 4.27M]
  ------------------
  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|  4.27M|    }
  293|  4.27M|}
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|  31.2k|{
 1520|  31.2k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  31.2k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1521|  31.2k|    tmsize_t nrows;
 1522|  31.2k|    (void)s;
 1523|       |
 1524|       |    /*
 1525|       |    ** Update available information, buffer may have been refilled
 1526|       |    ** between decode requests
 1527|       |    */
 1528|  31.2k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawcp;
 1529|  31.2k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
 1530|       |
 1531|  31.2k|    if (sp->bytesperline == 0)
  ------------------
  |  Branch (1531:9): [True: 0, False: 31.2k]
  ------------------
 1532|      0|    {
 1533|      0|        memset(buf, 0, (size_t)cc);
 1534|      0|        return 0;
 1535|      0|    }
 1536|       |
 1537|  31.2k|    nrows = cc / sp->bytesperline;
 1538|  31.2k|    if (cc % sp->bytesperline)
  ------------------
  |  Branch (1538:9): [True: 0, False: 31.2k]
  ------------------
 1539|      0|        TIFFWarningExtR(tif, tif->tif_name, "fractional scanline not read");
 1540|       |
 1541|  31.2k|    if (nrows > (tmsize_t)sp->cinfo.d.image_height)
  ------------------
  |  Branch (1541:9): [True: 30.4k, False: 839]
  ------------------
 1542|  30.4k|    {
 1543|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1544|       |         * strile height. */
 1545|  30.4k|        memset(buf, 0, (size_t)cc);
 1546|  30.4k|        nrows = sp->cinfo.d.image_height;
 1547|  30.4k|    }
 1548|    839|    else if (sp->strile_width > sp->cinfo.d.image_width)
  ------------------
  |  Branch (1548:14): [True: 709, False: 130]
  ------------------
 1549|    709|    {
 1550|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1551|       |         * strile width. */
 1552|    709|        memset(buf, 0, (size_t)cc);
 1553|    709|    }
 1554|       |
 1555|       |    /* data is expected to be read in multiples of a scanline */
 1556|  31.2k|    if (nrows)
  ------------------
  |  Branch (1556:9): [True: 31.2k, False: 0]
  ------------------
 1557|  31.2k|    {
 1558|  31.2k|        do
 1559|  3.68M|        {
 1560|       |            /*
 1561|       |             * In the libjpeg6b-9a 8bit case.  We read directly into
 1562|       |             * the TIFF buffer.
 1563|       |             */
 1564|  3.68M|            JSAMPROW bufptr = (JSAMPROW)buf;
 1565|       |
 1566|  3.68M|            if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)
  ------------------
  |  Branch (1566:17): [True: 30, False: 3.68M]
  ------------------
 1567|     30|            {
 1568|     30|                memset(buf, 0, (size_t)cc);
 1569|     30|                return (0);
 1570|     30|            }
 1571|       |
 1572|  3.68M|            ++tif->tif_dir.td_row;
 1573|  3.68M|            buf += sp->bytesperline;
 1574|  3.68M|            cc -= sp->bytesperline;
 1575|  3.68M|        } while (--nrows > 0);
  ------------------
  |  Branch (1575:18): [True: 3.65M, False: 31.2k]
  ------------------
 1576|  31.2k|    }
 1577|       |
 1578|       |    /* Update information on consumed data */
 1579|  31.2k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1580|  31.2k|    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|  31.2k|    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height ||
  ------------------
  |  Branch (1583:12): [True: 752, False: 30.5k]
  ------------------
 1584|  30.5k|           TIFFjpeg_finish_decompress(sp);
  ------------------
  |  Branch (1584:12): [True: 30.5k, False: 0]
  ------------------
 1585|  31.2k|}
tif_jpeg.c:TIFFjpeg_read_scanlines:
  422|  3.68M|{
  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.68M|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  3.68M|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (428:12): [True: 30, False: 3.68M]
  ------------------
  429|  3.68M|                    (int)jpeg_read_scanlines(&sp->cinfo.d, scanlines,
  430|  3.68M|                                             (JDIMENSION)max_lines));
  431|  3.68M|#endif
  432|  3.68M|}
tif_jpeg.c:JPEGGetMaxCompressionRatio:
 2941|      7|{
 2942|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
 2943|       |     * the maximum compression rate. */
 2944|       |
 2945|      7|    const JPEGState *sp = JState(tif);
  ------------------
  |  |  208|      7|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2946|      7|    if ((tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|      7|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (2946:9): [True: 3, False: 4]
  ------------------
 2947|      3|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|      3|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (2947:9): [True: 3, False: 0]
  ------------------
 2948|      3|        (tif->tif_dir.td_samplesperpixel == 3))
  ------------------
  |  Branch (2948:9): [True: 3, False: 0]
  ------------------
 2949|      3|    {
 2950|      3|        if (sp->h_sampling == 2 && sp->v_sampling == 2)
  ------------------
  |  Branch (2950:13): [True: 0, False: 3]
  |  Branch (2950:36): [True: 0, False: 0]
  ------------------
 2951|      0|        {
 2952|      0|            if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (2952:17): [True: 0, False: 0]
  ------------------
 2953|      0|                return 768;
 2954|      0|            else
 2955|      0|                return 512;
 2956|      0|        }
 2957|       |
 2958|      3|        return 0; /* unknown */
 2959|      3|    }
 2960|       |
 2961|      4|    if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (2961:9): [True: 1, False: 3]
  ------------------
 2962|      1|        return 384;
 2963|      3|    else
 2964|      3|        return 256;
 2965|      4|}
tif_jpeg.c:JPEGCleanup:
 2678|  2.29k|{
 2679|  2.29k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  2.29k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2680|       |
 2681|  2.29k|    assert(sp != 0);
  ------------------
  |  Branch (2681:5): [True: 0, False: 2.29k]
  |  Branch (2681:5): [True: 2.29k, False: 0]
  ------------------
 2682|       |
 2683|  2.29k|    tif->tif_tagmethods.vgetfield = sp->otherSettings.vgetparent;
 2684|  2.29k|    tif->tif_tagmethods.vsetfield = sp->otherSettings.vsetparent;
 2685|  2.29k|    tif->tif_tagmethods.printdir = sp->otherSettings.printdir;
 2686|  2.29k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2686:9): [True: 1.17k, False: 1.12k]
  ------------------
 2687|  1.17k|        TIFFjpeg_destroy(sp);         /* release libjpeg resources */
 2688|  2.29k|    if (sp->otherSettings.jpegtables) /* tag value */
  ------------------
  |  Branch (2688:9): [True: 163, False: 2.13k]
  ------------------
 2689|    163|        _TIFFfreeExt(tif, sp->otherSettings.jpegtables);
 2690|  2.29k|    _TIFFfreeExt(tif, tif->tif_data); /* release local state */
 2691|  2.29k|    tif->tif_data = NULL;
 2692|       |
 2693|  2.29k|    _TIFFSetDefaultCompressionState(tif);
 2694|  2.29k|}
tif_jpeg_12.c:TIFFjpeg_create_decompress:
  318|    879|{
  319|       |    /* initialize JPEG error handling */
  320|    879|    sp->cinfo.d.err = jpeg_std_error(&sp->err);
  321|    879|    sp->err.error_exit = TIFFjpeg_error_exit;
  322|    879|    sp->err.output_message = TIFFjpeg_output_message;
  323|       |
  324|       |    /* set client_data to avoid UMR warning from tools like Purify */
  325|    879|    sp->cinfo.d.client_data = NULL;
  326|       |
  327|       |    return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|    879|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    879|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    879|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (327:12): [True: 0, False: 879]
  ------------------
  328|    879|}
tif_jpeg_12.c:TIFFjpeg_error_exit:
  244|    431|{
  245|    431|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  246|    431|    char buffer[JMSG_LENGTH_MAX];
  247|       |
  248|    431|    (*cinfo->err->format_message)(cinfo, buffer);
  249|    431|    TIFFErrorExtR(sp->tif, "JPEGLib", "%s",
  250|    431|                  buffer);       /* display the error message */
  251|    431|    jpeg_abort(cinfo);           /* clean up libjpeg state */
  252|    431|    LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|    431|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  253|    431|}
tif_jpeg_12.c:TIFFjpeg_output_message:
  261|  1.51k|{
  262|  1.51k|    char buffer[JMSG_LENGTH_MAX];
  263|       |
  264|  1.51k|    (*cinfo->err->format_message)(cinfo, buffer);
  265|  1.51k|    TIFFWarningExtR(((JPEGState *)cinfo)->tif, "JPEGLib", "%s", buffer);
  266|  1.51k|}
tif_jpeg_12.c:TIFFjpeg_data_src:
  744|  1.59k|{
  745|  1.59k|    sp->cinfo.d.src = &sp->src;
  746|  1.59k|    sp->src.init_source = std_init_source;
  747|  1.59k|    sp->src.fill_input_buffer = std_fill_input_buffer;
  748|  1.59k|    sp->src.skip_input_data = std_skip_input_data;
  749|  1.59k|    sp->src.resync_to_restart = jpeg_resync_to_restart;
  750|  1.59k|    sp->src.term_source = std_term_source;
  751|  1.59k|    sp->src.bytes_in_buffer = 0; /* for safety */
  752|       |    sp->src.next_input_byte = NULL;
  753|  1.59k|}
tif_jpeg_12.c:std_init_source:
  674|    936|{
  675|    936|    JPEGState *sp = (JPEGState *)cinfo;
  676|    936|    TIFF *tif = sp->tif;
  677|       |
  678|    936|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
  679|    936|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
  680|    936|}
tif_jpeg_12.c:std_fill_input_buffer:
  683|  1.81k|{
  684|  1.81k|    JPEGState *sp = (JPEGState *)cinfo;
  685|  1.81k|    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.81k|    WARNMS(cinfo, JWRN_JPEG_EOF);
  712|       |    /* insert a fake EOI marker */
  713|  1.81k|    sp->src.next_input_byte = dummy_EOI;
  714|  1.81k|    sp->src.bytes_in_buffer = 2;
  715|  1.81k|    return (TRUE);
  ------------------
  |  |   71|  1.81k|#define TRUE 1
  ------------------
  716|  1.81k|}
tif_jpeg_12.c:std_skip_input_data:
  719|    651|{
  720|    651|    JPEGState *sp = (JPEGState *)cinfo;
  721|       |
  722|    651|    if (num_bytes > 0)
  ------------------
  |  Branch (722:9): [True: 651, False: 0]
  ------------------
  723|    651|    {
  724|    651|        if ((size_t)num_bytes > sp->src.bytes_in_buffer)
  ------------------
  |  Branch (724:13): [True: 239, False: 412]
  ------------------
  725|    239|        {
  726|       |            /* oops, buffer overrun */
  727|    239|            (void)std_fill_input_buffer(cinfo);
  728|    239|        }
  729|    412|        else
  730|    412|        {
  731|    412|            sp->src.next_input_byte += (size_t)num_bytes;
  732|    412|            sp->src.bytes_in_buffer -= (size_t)num_bytes;
  733|    412|        }
  734|    651|    }
  735|    651|}
tif_jpeg_12.c:std_term_source:
  738|    242|{
  739|       |    /* No work necessary here */
  740|    242|    (void)cinfo;
  741|    242|}
tif_jpeg_12.c:TIFFjpeg_read_header:
  396|  1.65k|{
  397|       |    return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
  ------------------
  |  |  301|  1.65k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  1.65k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (397:12): [True: 34, False: 1.62k]
  ------------------
  398|  1.65k|}
tif_jpeg_12.c:TIFFjpeg_destroy:
  525|    879|{
  526|       |    return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
  ------------------
  |  |  302|    879|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    879|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    879|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (526:12): [True: 0, False: 879]
  ------------------
  527|    879|}
tif_jpeg_12.c:TIFFjpeg_has_multiple_scans:
  401|    896|{
  402|       |    return CALLJPEG(sp, 0, jpeg_has_multiple_scans(&sp->cinfo.d));
  ------------------
  |  |  301|    896|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|    896|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (402:12): [True: 0, False: 896]
  ------------------
  403|    896|}
tif_jpeg_12.c:TIFFInitJPEGCommon:
 2969|    879|{
 2970|    879|    JPEGState *sp;
 2971|       |
 2972|    879|    sp = JState(tif);
  ------------------
  |  |  208|    879|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2973|    879|    sp->tif = tif; /* back link */
 2974|       |
 2975|       |    /* Default values for codec-specific fields */
 2976|    879|    sp->otherSettings.jpegtables = NULL;
 2977|    879|    sp->otherSettings.jpegtables_length = 0;
 2978|    879|    sp->otherSettings.jpegquality = 75; /* Default IJG quality */
 2979|    879|    sp->otherSettings.jpegcolormode = JPEGCOLORMODE_RAW;
  ------------------
  |  |  707|    879|#define JPEGCOLORMODE_RAW 0x0000     /* no conversion (default) */
  ------------------
 2980|    879|    sp->otherSettings.jpegtablesmode =
 2981|    879|        JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  710|    879|#define JPEGTABLESMODE_QUANT 0x0001  /* include quantization tbls */
  ------------------
                      JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  711|    879|#define JPEGTABLESMODE_HUFF 0x0002   /* include Huffman tbls */
  ------------------
 2982|    879|    sp->otherSettings.ycbcrsampling_fetched = 0;
 2983|       |
 2984|    879|    tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
 2985|    879|    tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
 2986|    879|    tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
 2987|       |
 2988|       |    /*
 2989|       |     * Install codec methods.
 2990|       |     */
 2991|    879|    tif->tif_fixuptags = JPEGFixupTags;
 2992|    879|    tif->tif_setupdecode = JPEGSetupDecode;
 2993|    879|    tif->tif_predecode = JPEGPreDecode;
 2994|    879|    tif->tif_decoderow = JPEGDecode;
 2995|    879|    tif->tif_decodestrip = JPEGDecode;
 2996|    879|    tif->tif_decodetile = JPEGDecode;
 2997|    879|    tif->tif_setupencode = JPEGSetupEncode;
 2998|    879|    tif->tif_preencode = JPEGPreEncode;
 2999|    879|    tif->tif_postencode = JPEGPostEncode;
 3000|    879|    tif->tif_encoderow = JPEGEncode;
 3001|    879|    tif->tif_encodestrip = JPEGEncode;
 3002|    879|    tif->tif_encodetile = JPEGEncode;
 3003|    879|    tif->tif_getmaxcompressionratio = JPEGGetMaxCompressionRatio;
 3004|    879|    tif->tif_cleanup = JPEGCleanup;
 3005|       |
 3006|    879|    tif->tif_defstripsize = JPEGDefaultStripSize;
 3007|    879|    tif->tif_deftilesize = JPEGDefaultTileSize;
 3008|    879|    tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
  ------------------
  |  |  127|    879|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 3009|    879|    sp->cinfo_initialized = FALSE;
  ------------------
  |  |   72|    879|#define FALSE 0
  ------------------
 3010|    879|}
tif_jpeg_12.c:JPEGPreDecode:
 1268|    936|{
 1269|    936|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    936|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1270|    936|    TIFFDirectory *td = &tif->tif_dir;
 1271|    936|    static const char module[] = "JPEGPreDecode";
 1272|    936|    int downsampled_output;
 1273|    936|    int ci;
 1274|       |
 1275|    936|    assert(sp != NULL);
  ------------------
  |  Branch (1275:5): [True: 0, False: 936]
  |  Branch (1275:5): [True: 936, False: 0]
  ------------------
 1276|       |
 1277|    936|    if (sp->cinfo.comm.is_decompressor == 0)
  ------------------
  |  Branch (1277:9): [True: 0, False: 936]
  ------------------
 1278|      0|    {
 1279|      0|        tif->tif_setupdecode(tif);
 1280|      0|    }
 1281|       |
 1282|    936|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1282:5): [True: 0, False: 936]
  |  Branch (1282:5): [True: 936, False: 0]
  ------------------
 1283|       |    /*
 1284|       |     * Reset decoder state from any previous strip/tile,
 1285|       |     * in case application didn't read the whole strip.
 1286|       |     */
 1287|    936|    if (!TIFFjpeg_abort(sp))
  ------------------
  |  Branch (1287:9): [True: 0, False: 936]
  ------------------
 1288|      0|        return (0);
 1289|       |    /*
 1290|       |     * Read the header for this strip/tile.
 1291|       |     */
 1292|       |
 1293|    936|    if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
  ------------------
  |  |   71|    936|#define TRUE 1
  ------------------
  |  Branch (1293:9): [True: 30, False: 906]
  ------------------
 1294|     30|        return (0);
 1295|       |
 1296|    906|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1297|    906|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1298|       |
 1299|    906|    if (!JPEGComputeStrileWidthHeightBytesPerLine(tif, s))
  ------------------
  |  Branch (1299:9): [True: 0, False: 906]
  ------------------
 1300|      0|        return 0;
 1301|       |
 1302|    906|    if (sp->cinfo.d.image_width < sp->strile_width ||
  ------------------
  |  Branch (1302:9): [True: 351, False: 555]
  ------------------
 1303|    555|        sp->cinfo.d.image_height < sp->strile_height)
  ------------------
  |  Branch (1303:9): [True: 12, False: 543]
  ------------------
 1304|    363|    {
 1305|    363|        TIFFWarningExtR(tif, module,
 1306|    363|                        "Improper JPEG strip/tile size, "
 1307|    363|                        "expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1308|    363|                        sp->strile_width, sp->strile_height,
 1309|    363|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1310|    363|    }
 1311|    906|    if (sp->cinfo.d.image_width == sp->strile_width &&
  ------------------
  |  Branch (1311:9): [True: 550, False: 356]
  ------------------
 1312|    550|        sp->cinfo.d.image_height > sp->strile_height &&
  ------------------
  |  Branch (1312:9): [True: 461, False: 89]
  ------------------
 1313|    461|        tif->tif_dir.td_row + sp->strile_height == td->td_imagelength &&
  ------------------
  |  Branch (1313:9): [True: 460, False: 1]
  ------------------
 1314|    460|        !isTiled(tif))
  ------------------
  |  |  278|    460|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    460|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1314:9): [True: 460, False: 0]
  ------------------
 1315|    460|    {
 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|    460|        TIFFWarningExtR(tif, module,
 1321|    460|                        "JPEG strip size exceeds expected dimensions,"
 1322|    460|                        " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1323|    460|                        sp->strile_width, sp->strile_height,
 1324|    460|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1325|    460|    }
 1326|    446|    else if (sp->cinfo.d.image_width > sp->strile_width ||
  ------------------
  |  Branch (1326:14): [True: 5, False: 441]
  ------------------
 1327|    441|             sp->cinfo.d.image_height > sp->strile_height)
  ------------------
  |  Branch (1327:14): [True: 3, False: 438]
  ------------------
 1328|      8|    {
 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|      8|        TIFFErrorExtR(tif, module,
 1336|      8|                      "JPEG strip/tile size exceeds expected dimensions,"
 1337|      8|                      " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1338|      8|                      sp->strile_width, sp->strile_height,
 1339|      8|                      sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1340|      8|        return (0);
 1341|      8|    }
 1342|    898|    if (sp->cinfo.d.num_components !=
  ------------------
  |  Branch (1342:9): [True: 1, False: 897]
  ------------------
 1343|    898|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    898|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1343:10): [True: 554, False: 344]
  ------------------
 1344|    898|                                                    : 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|    897|    if (td->td_bitspersample != BITS_IN_JSAMPLE ||
  ------------------
  |  |  102|  1.79k|#define BITS_IN_JSAMPLE 12
  ------------------
  |  Branch (1358:9): [True: 0, False: 897]
  ------------------
 1359|    897|        sp->cinfo.d.data_precision != td->td_bitspersample)
  ------------------
  |  Branch (1359:9): [True: 1, False: 896]
  ------------------
 1360|      1|    {
 1361|      1|        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1362|      1|        return (0);
 1363|      1|    }
 1364|    896|#endif
 1365|       |
 1366|    896|    if (sp->cinfo.d.progressive_mode &&
  ------------------
  |  Branch (1366:9): [True: 533, False: 363]
  ------------------
 1367|    533|        !sp->otherSettings.has_warned_about_progressive_mode)
  ------------------
  |  Branch (1367:9): [True: 492, False: 41]
  ------------------
 1368|    492|    {
 1369|    492|        TIFFWarningExtR(tif, module,
 1370|    492|                        "The JPEG strip/tile is encoded with progressive mode, "
 1371|    492|                        "which is normally not legal for JPEG-in-TIFF.\n"
 1372|    492|                        "libtiff should be able to decode it, but it might "
 1373|    492|                        "cause compatibility issues with other readers");
 1374|    492|        sp->otherSettings.has_warned_about_progressive_mode = TRUE;
  ------------------
  |  |   71|    492|#define TRUE 1
  ------------------
 1375|    492|    }
 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|    896|    if (TIFFjpeg_has_multiple_scans(sp))
  ------------------
  |  Branch (1380:9): [True: 533, False: 363]
  ------------------
 1381|    533|    {
 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|    533|        toff_t nRequiredMemory = 1024 * 1024;
 1389|       |
 1390|  1.06k|        for (ci = 0; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1390:22): [True: 533, False: 533]
  ------------------
 1391|    533|        {
 1392|    533|            const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
 1393|    533|            if (compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0)
  ------------------
  |  Branch (1393:17): [True: 533, False: 0]
  |  Branch (1393:47): [True: 533, False: 0]
  ------------------
 1394|    533|            {
 1395|    533|                nRequiredMemory +=
 1396|    533|                    (toff_t)((JDIMENSION)(((int)compptr->width_in_blocks +
 1397|    533|                                           compptr->h_samp_factor - 1) /
 1398|    533|                                          compptr->h_samp_factor)) *
 1399|    533|                    (JDIMENSION)(((int)compptr->height_in_blocks +
 1400|    533|                                  compptr->v_samp_factor - 1) /
 1401|    533|                                 compptr->v_samp_factor) *
 1402|    533|                    sizeof(JBLOCK);
 1403|    533|            }
 1404|    533|        }
 1405|       |
 1406|    533|        if (sp->cinfo.d.mem->max_memory_to_use > 0 &&
  ------------------
  |  Branch (1406:13): [True: 0, False: 533]
  ------------------
 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|    533|    }
 1425|       |
 1426|    896|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|    896|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1426:9): [True: 552, False: 344]
  ------------------
 1427|    552|    {
 1428|       |        /* Component 0 should have expected sampling factors */
 1429|    552|        if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
  ------------------
  |  Branch (1429:13): [True: 1, False: 551]
  ------------------
 1430|    551|            sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling)
  ------------------
  |  Branch (1430:13): [True: 1, False: 550]
  ------------------
 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|    550|        for (ci = 1; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1441:22): [True: 0, False: 550]
  ------------------
 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|    550|    }
 1451|    344|    else
 1452|    344|    {
 1453|       |        /* PC 2's single component should have sampling factors 1,1 */
 1454|    344|        if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
  ------------------
  |  Branch (1454:13): [True: 1, False: 343]
  ------------------
 1455|    343|            sp->cinfo.d.comp_info[0].v_samp_factor != 1)
  ------------------
  |  Branch (1455:13): [True: 1, False: 342]
  ------------------
 1456|      2|        {
 1457|      2|            TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1458|      2|            return (0);
 1459|      2|        }
 1460|    344|    }
 1461|    892|    downsampled_output = FALSE;
  ------------------
  |  |   72|    892|#define FALSE 0
  ------------------
 1462|    892|    if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  1.78k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1462:9): [True: 550, False: 342]
  ------------------
 1463|    550|        sp->photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  1.44k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1463:9): [True: 0, False: 550]
  ------------------
 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|    892|    else
 1471|    892|    {
 1472|       |        /* Suppress colorspace handling */
 1473|    892|        sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;
 1474|    892|        sp->cinfo.d.out_color_space = JCS_UNKNOWN;
 1475|    892|        if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  1.78k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1475:13): [True: 550, False: 342]
  ------------------
 1476|    550|            (sp->h_sampling != 1 || sp->v_sampling != 1))
  ------------------
  |  Branch (1476:14): [True: 0, False: 550]
  |  Branch (1476:37): [True: 0, False: 550]
  ------------------
 1477|      0|            downsampled_output = TRUE;
  ------------------
  |  |   71|      0|#define TRUE 1
  ------------------
 1478|       |        /* XXX what about up-sampling? */
 1479|    892|    }
 1480|    892|    if (downsampled_output)
  ------------------
  |  Branch (1480:9): [True: 0, False: 892]
  ------------------
 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|    892|    else
 1492|    892|    {
 1493|       |        /* Use normal interface to libjpeg */
 1494|    892|        sp->cinfo.d.raw_data_out = FALSE;
  ------------------
  |  |   72|    892|#define FALSE 0
  ------------------
 1495|    892|        tif->tif_decoderow = JPEGDecode;
 1496|    892|        tif->tif_decodestrip = JPEGDecode;
 1497|    892|        tif->tif_decodetile = JPEGDecode;
 1498|    892|    }
 1499|       |    /* Start JPEG decompressor */
 1500|    892|    if (!TIFFjpeg_start_decompress(sp))
  ------------------
  |  Branch (1500:9): [True: 19, False: 873]
  ------------------
 1501|     19|        return (0);
 1502|       |    /* Allocate downsampled-data buffers if needed */
 1503|    873|    if (downsampled_output)
  ------------------
  |  Branch (1503:9): [True: 0, False: 873]
  ------------------
 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|    873|    return (1);
 1511|    873|}
tif_jpeg_12.c:TIFFjpeg_abort:
  520|    936|{
  521|       |    return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
  ------------------
  |  |  302|    936|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    936|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    936|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (521:12): [True: 0, False: 936]
  ------------------
  522|    936|}
tif_jpeg_12.c:JPEGComputeStrileWidthHeightBytesPerLine:
 1224|    906|{
 1225|    906|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    906|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1226|    906|    TIFFDirectory *td = &tif->tif_dir;
 1227|       |
 1228|       |    /*
 1229|       |     * Check image parameters and set decompression parameters.
 1230|       |     */
 1231|    906|    if (isTiled(tif))
  ------------------
  |  |  278|    906|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    906|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 0, False: 906]
  |  |  ------------------
  ------------------
 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|    906|    else
 1238|    906|    {
 1239|    906|        sp->strile_width = td->td_imagewidth;
 1240|    906|        sp->strile_height = td->td_imagelength - tif->tif_dir.td_row;
 1241|    906|        if (sp->strile_height > td->td_rowsperstrip)
  ------------------
  |  Branch (1241:13): [True: 195, False: 711]
  ------------------
 1242|    195|            sp->strile_height = td->td_rowsperstrip;
 1243|    906|        sp->bytesperline = TIFFScanlineSize(tif);
 1244|    906|    }
 1245|    906|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0)
  ------------------
  |  |  266|  1.81k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (1245:9): [True: 344, False: 562]
  |  Branch (1245:57): [True: 0, False: 344]
  ------------------
 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|    906|    return 1;
 1262|    906|}
tif_jpeg_12.c:JPEGWritePacked12Sample:
  499|  74.2k|{
  500|  74.2k|    uint16_t v = (uint16_t)sample & 0x0fff;
  501|  74.2k|    uint8_t *p = buf + (sample_index / 2) * 3;
  502|  74.2k|    if ((sample_index & 1) != 0)
  ------------------
  |  Branch (502:9): [True: 0, False: 74.2k]
  ------------------
  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|  74.2k|    else
  508|  74.2k|    {
  509|  74.2k|        p[0] = (uint8_t)(v >> 4);
  510|  74.2k|        p[1] = (uint8_t)((v & 0x0f) << 4);
  511|  74.2k|    }
  512|  74.2k|}
tif_jpeg_12.c:TIFFjpeg_finish_decompress:
  515|    418|{
  516|       |    return CALLJPEG(sp, -1, (int)jpeg_finish_decompress(&sp->cinfo.d));
  ------------------
  |  |  301|    418|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|    418|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (516:12): [True: 176, False: 242]
  ------------------
  517|    418|}
tif_jpeg_12.c:TIFFjpeg_start_decompress:
  406|    892|{
  407|    892|    const char *sz_max_allowed_scan_number;
  408|       |    /* progress monitor */
  409|    892|    sp->cinfo.d.progress = &sp->progress;
  410|    892|    sp->progress.progress_monitor = TIFFjpeg_progress_monitor;
  411|    892|    sp->otherSettings.max_allowed_scan_number = 100;
  412|    892|    sz_max_allowed_scan_number = getenv("LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER");
  413|    892|    if (sz_max_allowed_scan_number)
  ------------------
  |  Branch (413:9): [True: 0, False: 892]
  ------------------
  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|    892|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    892|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    892|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (417:12): [True: 19, False: 873]
  ------------------
  418|    892|}
tif_jpeg_12.c:TIFFjpeg_progress_monitor:
  274|  2.69M|{
  275|  2.69M|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  276|  2.69M|    if (cinfo->is_decompressor)
  ------------------
  |  Branch (276:9): [True: 2.69M, False: 0]
  ------------------
  277|  2.69M|    {
  278|  2.69M|        const int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
  279|  2.69M|        if (scan_no >= sp->otherSettings.max_allowed_scan_number)
  ------------------
  |  Branch (279:13): [True: 0, False: 2.69M]
  ------------------
  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.69M|    }
  293|  2.69M|}
tif_jpeg_12.c:JPEGDecode:
 1591|  1.90M|{
 1592|  1.90M|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.90M|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1593|  1.90M|    tmsize_t nrows;
 1594|  1.90M|    (void)s;
 1595|       |
 1596|       |    /*
 1597|       |    ** Update available information, buffer may have been refilled
 1598|       |    ** between decode requests
 1599|       |    */
 1600|  1.90M|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawcp;
 1601|  1.90M|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
 1602|       |
 1603|  1.90M|    if (sp->bytesperline == 0)
  ------------------
  |  Branch (1603:9): [True: 0, False: 1.90M]
  ------------------
 1604|      0|    {
 1605|      0|        memset(buf, 0, (size_t)cc);
 1606|      0|        return 0;
 1607|      0|    }
 1608|       |
 1609|  1.90M|    nrows = cc / sp->bytesperline;
 1610|  1.90M|    if (cc % sp->bytesperline)
  ------------------
  |  Branch (1610:9): [True: 0, False: 1.90M]
  ------------------
 1611|      0|        TIFFWarningExtR(tif, tif->tif_name, "fractional scanline not read");
 1612|       |
 1613|  1.90M|    if (nrows > (tmsize_t)sp->cinfo.d.image_height)
  ------------------
  |  Branch (1613:9): [True: 0, False: 1.90M]
  ------------------
 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.90M|    else if (sp->strile_width > sp->cinfo.d.image_width)
  ------------------
  |  Branch (1620:14): [True: 90.0k, False: 1.81M]
  ------------------
 1621|  90.0k|    {
 1622|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1623|       |         * strile width. */
 1624|  90.0k|        memset(buf, 0, (size_t)cc);
 1625|  90.0k|    }
 1626|       |
 1627|       |    /* data is expected to be read in multiples of a scanline */
 1628|  1.90M|    if (nrows)
  ------------------
  |  Branch (1628:9): [True: 1.90M, False: 0]
  ------------------
 1629|  1.90M|    {
 1630|  1.90M|        TIFF_JSAMPROW line_work_buf = NULL;
  ------------------
  |  |  106|  1.90M|#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.90M|        if (sp->cinfo.d.data_precision == 12)
  ------------------
  |  Branch (1636:13): [True: 1.90M, False: 0]
  ------------------
 1637|  1.90M|        {
 1638|  1.90M|            line_work_buf = (TIFF_JSAMPROW)_TIFFmallocExt(
 1639|  1.90M|                tif, (tmsize_t)((size_t)sizeof(short) *
 1640|  1.90M|                                (size_t)sp->cinfo.d.output_width *
 1641|  1.90M|                                (size_t)sp->cinfo.d.num_components));
 1642|  1.90M|        }
 1643|       |
 1644|  1.90M|        do
 1645|  1.90M|        {
 1646|  1.90M|            if (line_work_buf != NULL)
  ------------------
  |  Branch (1646:17): [True: 1.90M, False: 0]
  ------------------
 1647|  1.90M|            {
 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.90M|                if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1)
  ------------------
  |  Branch (1654:21): [True: 202, False: 1.90M]
  ------------------
 1655|    202|                {
 1656|    202|                    memset(buf, 0, (size_t)cc);
 1657|    202|                    _TIFFfreeExt(tif, line_work_buf);
 1658|    202|                    return (0);
 1659|    202|                }
 1660|       |
 1661|  1.90M|                if (sp->cinfo.d.data_precision == 12)
  ------------------
  |  Branch (1661:21): [True: 1.90M, False: 0]
  ------------------
 1662|  1.90M|                {
 1663|  1.90M|                    tmsize_t value_count =
 1664|  1.90M|                        (tmsize_t)((JDIMENSION)sp->cinfo.d.output_width *
 1665|  1.90M|                                   (JDIMENSION)sp->cinfo.d.num_components);
 1666|  1.90M|                    tmsize_t iPair;
 1667|       |
 1668|   115M|                    for (iPair = 0; iPair < value_count / 2; iPair++)
  ------------------
  |  Branch (1668:37): [True: 113M, False: 1.90M]
  ------------------
 1669|   113M|                    {
 1670|   113M|                        unsigned char *out_ptr =
 1671|   113M|                            ((unsigned char *)buf) + iPair * 3;
 1672|   113M|                        TIFF_JSAMPLE *in_ptr = line_work_buf + iPair * 2;
  ------------------
  |  |  103|   113M|#define TIFF_JSAMPLE J12SAMPLE
  ------------------
 1673|       |
 1674|   113M|                        out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
 1675|   113M|                        out_ptr[1] =
 1676|   113M|                            (unsigned char)(((in_ptr[0] & 0xf) << 4) |
 1677|   113M|                                            ((in_ptr[1] & 0xf00) >> 8));
 1678|   113M|                        out_ptr[2] = (unsigned char)(((in_ptr[1] & 0xff) >> 0));
 1679|   113M|                    }
 1680|  1.90M|                    if ((value_count & 1) != 0)
  ------------------
  |  Branch (1680:25): [True: 74.2k, False: 1.83M]
  ------------------
 1681|  74.2k|                        JPEGWritePacked12Sample((uint8_t *)buf, value_count - 1,
 1682|  74.2k|                                                line_work_buf[value_count - 1]);
 1683|  1.90M|                }
 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.90M|            }
 1698|       |
 1699|  1.90M|            ++tif->tif_dir.td_row;
 1700|  1.90M|            buf += sp->bytesperline;
 1701|  1.90M|            cc -= sp->bytesperline;
 1702|  1.90M|        } while (--nrows > 0);
  ------------------
  |  Branch (1702:18): [True: 0, False: 1.90M]
  ------------------
 1703|       |
 1704|  1.90M|        if (line_work_buf != NULL)
  ------------------
  |  Branch (1704:13): [True: 1.90M, False: 0]
  ------------------
 1705|  1.90M|            _TIFFfreeExt(tif, line_work_buf);
 1706|  1.90M|    }
 1707|       |
 1708|       |    /* Update information on consumed data */
 1709|  1.90M|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1710|  1.90M|    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.90M|    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height ||
  ------------------
  |  Branch (1713:12): [True: 1.90M, False: 418]
  ------------------
 1714|    418|           TIFFjpeg_finish_decompress(sp);
  ------------------
  |  Branch (1714:12): [True: 418, False: 0]
  ------------------
 1715|  1.90M|}
tif_jpeg_12.c:TIFFjpeg_read_scanlines:
  422|  1.90M|{
  423|  1.90M|#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12) && BITS_IN_JSAMPLE == 12
  424|  1.90M|    return CALLJPEG(sp, -1,
  ------------------
  |  |  301|  1.90M|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  1.90M|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (424:12): [True: 202, False: 1.90M]
  ------------------
  425|  1.90M|                    (int)jpeg12_read_scanlines(&sp->cinfo.d, scanlines,
  426|  1.90M|                                               (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.90M|}
tif_jpeg_12.c:JPEGCleanup:
 2678|    879|{
 2679|    879|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    879|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2680|       |
 2681|    879|    assert(sp != 0);
  ------------------
  |  Branch (2681:5): [True: 0, False: 879]
  |  Branch (2681:5): [True: 879, False: 0]
  ------------------
 2682|       |
 2683|    879|    tif->tif_tagmethods.vgetfield = sp->otherSettings.vgetparent;
 2684|    879|    tif->tif_tagmethods.vsetfield = sp->otherSettings.vsetparent;
 2685|    879|    tif->tif_tagmethods.printdir = sp->otherSettings.printdir;
 2686|    879|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2686:9): [True: 879, False: 0]
  ------------------
 2687|    879|        TIFFjpeg_destroy(sp);         /* release libjpeg resources */
 2688|    879|    if (sp->otherSettings.jpegtables) /* tag value */
  ------------------
  |  Branch (2688:9): [True: 719, False: 160]
  ------------------
 2689|    719|        _TIFFfreeExt(tif, sp->otherSettings.jpegtables);
 2690|    879|    _TIFFfreeExt(tif, tif->tif_data); /* release local state */
 2691|    879|    tif->tif_data = NULL;
 2692|       |
 2693|    879|    _TIFFSetDefaultCompressionState(tif);
 2694|    879|}
tif_jpeg_12.c:JPEGInitializeLibJPEG:
 2883|    879|{
 2884|    879|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    879|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2885|       |
 2886|    879|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2886:9): [True: 0, False: 879]
  ------------------
 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|    879|    if (decompress)
  ------------------
  |  Branch (2901:9): [True: 879, False: 0]
  ------------------
 2902|    879|    {
 2903|    879|        if (!TIFFjpeg_create_decompress(sp))
  ------------------
  |  Branch (2903:13): [True: 0, False: 879]
  ------------------
 2904|      0|            return (0);
 2905|    879|    }
 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|    879|    sp->cinfo_initialized = TRUE;
  ------------------
  |  |   71|    879|#define TRUE 1
  ------------------
 2936|       |
 2937|    879|    return 1;
 2938|    879|}
tif_jpeg_12.c:JPEGSetupDecode:
 1136|    879|{
 1137|    879|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    879|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1138|    879|    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|    879|    JPEGInitializeLibJPEG(tif, TRUE);
  ------------------
  |  |   71|    879|#define TRUE 1
  ------------------
 1151|       |
 1152|    879|    assert(sp != NULL);
  ------------------
  |  Branch (1152:5): [True: 0, False: 879]
  |  Branch (1152:5): [True: 879, False: 0]
  ------------------
 1153|    879|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1153:5): [True: 0, False: 879]
  |  Branch (1153:5): [True: 879, False: 0]
  ------------------
 1154|       |
 1155|       |    /* Read JPEGTables if it is present */
 1156|    879|    if (TIFFFieldSet(tif, FIELD_JPEGTABLES))
  ------------------
  |  |  248|    879|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|    879|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|    879|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 719, False: 160]
  |  |  ------------------
  ------------------
 1157|    719|    {
 1158|    719|        TIFFjpeg_tables_src(sp);
 1159|    719|        if (TIFFjpeg_read_header(sp, FALSE) != JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  |   72|    719|#define FALSE 0
  ------------------
  |  Branch (1159:13): [True: 4, False: 715]
  ------------------
 1160|      4|        {
 1161|      4|            TIFFErrorExtR(tif, "JPEGSetupDecode", "Bogus JPEGTables field");
 1162|      4|            return (0);
 1163|      4|        }
 1164|    719|    }
 1165|       |
 1166|       |    /* Grab parameters that are same for all strips/tiles */
 1167|    875|    sp->photometric = td->td_photometric;
 1168|    875|    switch (sp->photometric)
 1169|    875|    {
 1170|      1|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|      1|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1170:9): [True: 1, False: 874]
  ------------------
 1171|      1|            sp->h_sampling = td->td_ycbcrsubsampling[0];
 1172|      1|            sp->v_sampling = td->td_ycbcrsubsampling[1];
 1173|      1|            break;
 1174|    874|        default:
  ------------------
  |  Branch (1174:9): [True: 874, False: 1]
  ------------------
 1175|       |            /* TIFF 6.0 forbids subsampling of all other color spaces */
 1176|    874|            sp->h_sampling = 1;
 1177|    874|            sp->v_sampling = 1;
 1178|    874|            break;
 1179|    875|    }
 1180|       |
 1181|       |    /* Set up for reading normal data */
 1182|    875|    TIFFjpeg_data_src(sp);
 1183|    875|    tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
 1184|    875|    return (1);
 1185|    875|}
tif_jpeg_12.c:TIFFjpeg_tables_src:
  769|    719|{
  770|    719|    TIFFjpeg_data_src(sp);
  771|    719|    sp->src.init_source = tables_init_source;
  772|    719|}
tif_jpeg_12.c:tables_init_source:
  761|    719|{
  762|    719|    JPEGState *sp = (JPEGState *)cinfo;
  763|       |
  764|    719|    sp->src.next_input_byte = (const JOCTET *)sp->otherSettings.jpegtables;
  765|    719|    sp->src.bytes_in_buffer = (size_t)sp->otherSettings.jpegtables_length;
  766|    719|}

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

LogL16toY:
  790|  3.30M|{
  791|  3.30M|    int Le = p16 & 0x7fff;
  792|  3.30M|    double Y;
  793|       |
  794|  3.30M|    if (!Le)
  ------------------
  |  Branch (794:9): [True: 105k, False: 3.19M]
  ------------------
  795|   105k|        return (0.);
  796|  3.19M|    Y = exp(M_LN2 / 256. * (Le + .5) - M_LN2 * 64.);
  797|  3.19M|    return (!(p16 & 0x8000) ? Y : -Y);
  ------------------
  |  Branch (797:13): [True: 1.04M, False: 2.15M]
  ------------------
  798|  3.30M|}
XYZtoRGB24:
  945|     12|{
  946|     12|    double r, g, b;
  947|       |    /* assume CCIR-709 primaries */
  948|     12|    r = 2.690 * (double)xyz[0] + -1.276 * (double)xyz[1] +
  949|     12|        -0.414 * (double)xyz[2];
  950|     12|    g = -1.022 * (double)xyz[0] + 1.978 * (double)xyz[1] +
  951|     12|        0.044 * (double)xyz[2];
  952|     12|    b = 0.061 * (double)xyz[0] + -0.224 * (double)xyz[1] +
  953|     12|        1.163 * (double)xyz[2];
  954|       |    /* assume 2.0 gamma for speed */
  955|       |    /* could use integer sqrt approx., but this is probably faster */
  956|     12|    rgb[0] = (uint8_t)((r <= 0.) ? 0 : (r >= 1.) ? 255 : (int)(256. * sqrt(r)));
  ------------------
  |  Branch (956:24): [True: 10, False: 2]
  |  Branch (956:40): [True: 0, False: 2]
  ------------------
  957|     12|    rgb[1] = (uint8_t)((g <= 0.) ? 0 : (g >= 1.) ? 255 : (int)(256. * sqrt(g)));
  ------------------
  |  Branch (957:24): [True: 7, False: 5]
  |  Branch (957:40): [True: 2, False: 3]
  ------------------
  958|     12|    rgb[2] = (uint8_t)((b <= 0.) ? 0 : (b >= 1.) ? 255 : (int)(256. * sqrt(b)));
  ------------------
  |  Branch (958:24): [True: 5, False: 7]
  |  Branch (958:40): [True: 2, False: 5]
  ------------------
  959|     12|}
LogL10toY:
  965|    394|{
  966|    394|    if (p10 == 0)
  ------------------
  |  Branch (966:9): [True: 105, False: 289]
  ------------------
  967|    105|        return (0.);
  968|    289|    return (exp(M_LN2 / 64. * (p10 + .5) - M_LN2 * 12.));
  969|    394|}
uv_decode:
 1080|  1.87k|{
 1081|  1.87k|    unsigned int upper, lower;
 1082|  1.87k|    int ui;
 1083|  1.87k|    unsigned int vi;
 1084|       |
 1085|  1.87k|    if (c < 0 || c >= UV_NDIVS)
  ------------------
  |  |    3|  1.87k|#define UV_NDIVS 16289
  ------------------
  |  Branch (1085:9): [True: 0, False: 1.87k]
  |  Branch (1085:18): [True: 341, False: 1.53k]
  ------------------
 1086|    341|        return (-1);
 1087|  1.53k|    lower = 0; /* binary search */
 1088|  1.53k|    upper = UV_NVS;
  ------------------
  |  |    5|  1.53k|#define UV_NVS 163
  ------------------
 1089|  12.3k|    while (upper - lower > 1)
  ------------------
  |  Branch (1089:12): [True: 10.9k, False: 1.35k]
  ------------------
 1090|  10.9k|    {
 1091|  10.9k|        vi = (lower + upper) >> 1;
 1092|  10.9k|        ui = c - uv_row[vi].ncum;
 1093|  10.9k|        if (ui > 0)
  ------------------
  |  Branch (1093:13): [True: 3.84k, False: 7.12k]
  ------------------
 1094|  3.84k|            lower = vi;
 1095|  7.12k|        else if (ui < 0)
  ------------------
  |  Branch (1095:18): [True: 6.94k, False: 183]
  ------------------
 1096|  6.94k|            upper = vi;
 1097|    183|        else
 1098|    183|        {
 1099|    183|            lower = vi;
 1100|    183|            break;
 1101|    183|        }
 1102|  10.9k|    }
 1103|  1.53k|    vi = lower;
 1104|  1.53k|    ui = c - uv_row[vi].ncum;
 1105|  1.53k|    *up = (double)uv_row[vi].ustart + ((double)ui + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    2|  1.53k|#define UV_SQSIZ (float)0.003500
  ------------------
 1106|  1.53k|    *vp = (double)UV_VSTART + ((double)vi + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    4|  1.53k|#define UV_VSTART (float)0.016940
  ------------------
                  *vp = (double)UV_VSTART + ((double)vi + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    2|  1.53k|#define UV_SQSIZ (float)0.003500
  ------------------
 1107|  1.53k|    return (0);
 1108|  1.87k|}
LogLuv24toXYZ:
 1114|    394|{
 1115|    394|    int Ce;
 1116|    394|    double L, u, v, s, x, y;
 1117|       |    /* decode luminance */
 1118|    394|    L = LogL10toY(p >> 14 & 0x3ff);
 1119|    394|    if (L <= 0.)
  ------------------
  |  Branch (1119:9): [True: 105, False: 289]
  ------------------
 1120|    105|    {
 1121|    105|        XYZ[0] = XYZ[1] = XYZ[2] = 0.;
 1122|    105|        return;
 1123|    105|    }
 1124|       |    /* decode color */
 1125|    289|    Ce = p & 0x3fff;
 1126|    289|    if (uv_decode(&u, &v, Ce) < 0)
  ------------------
  |  Branch (1126:9): [True: 29, False: 260]
  ------------------
 1127|     29|    {
 1128|     29|        u = U_NEU;
  ------------------
  |  |  613|     29|#define U_NEU 0.210526316
  ------------------
 1129|     29|        v = V_NEU;
  ------------------
  |  |  614|     29|#define V_NEU 0.473684211
  ------------------
 1130|     29|    }
 1131|    289|    s = 1. / (6. * u - 16. * v + 12.);
 1132|    289|    x = 9. * u * s;
 1133|    289|    y = 4. * v * s;
 1134|       |    /* convert to XYZ */
 1135|    289|    XYZ[0] = (float)(x / y * L);
 1136|    289|    XYZ[1] = (float)L;
 1137|    289|    XYZ[2] = (float)((1. - x - y) / y * L);
 1138|    289|}
LogLuv32toXYZ:
 1274|  1.20k|{
 1275|  1.20k|    double L, u, v, s, x, y;
 1276|       |    /* decode luminance */
 1277|  1.20k|    L = LogL16toY((int)p >> 16);
 1278|  1.20k|    if (L <= 0.)
  ------------------
  |  Branch (1278:9): [True: 806, False: 403]
  ------------------
 1279|    806|    {
 1280|    806|        XYZ[0] = XYZ[1] = XYZ[2] = 0.;
 1281|    806|        return;
 1282|    806|    }
 1283|       |    /* decode color */
 1284|    403|    u = 1. / UVSCALE * ((p >> 8 & 0xff) + .5);
  ------------------
  |  |  615|    403|#define UVSCALE 410.
  ------------------
 1285|    403|    v = 1. / UVSCALE * ((p & 0xff) + .5);
  ------------------
  |  |  615|    403|#define UVSCALE 410.
  ------------------
 1286|    403|    s = 1. / (6. * u - 16. * v + 12.);
 1287|    403|    x = 9. * u * s;
 1288|    403|    y = 4. * v * s;
 1289|       |    /* convert to XYZ */
 1290|    403|    XYZ[0] = (float)(x / y * L);
 1291|    403|    XYZ[1] = (float)L;
 1292|    403|    XYZ[2] = (float)((1. - x - y) / y * L);
 1293|    403|}
TIFFInitSGILog:
 1917|     65|{
 1918|     65|    static const char module[] = "TIFFInitSGILog";
 1919|     65|    LogLuvState *sp;
 1920|       |
 1921|     65|    assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG);
  ------------------
  |  Branch (1921:5): [True: 65, False: 0]
  |  Branch (1921:5): [True: 0, False: 0]
  |  Branch (1921:5): [True: 24, False: 41]
  |  Branch (1921:5): [True: 41, False: 0]
  ------------------
 1922|       |
 1923|       |    /*
 1924|       |     * Merge codec-specific tag information.
 1925|       |     */
 1926|     65|    if (!_TIFFMergeFields(tif, LogLuvFields, TIFFArrayCount(LogLuvFields)))
  ------------------
  |  |  339|     65|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1926:9): [True: 0, False: 65]
  ------------------
 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|     65|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LogLuvState));
 1936|     65|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1936:9): [True: 0, False: 65]
  ------------------
 1937|      0|        goto bad;
 1938|     65|    sp = (LogLuvState *)tif->tif_data;
 1939|     65|    _TIFFmemset((void *)sp, 0, sizeof(*sp));
 1940|     65|    sp->user_datafmt = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|     65|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1941|     65|    sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ? SGILOGENCODE_RANDITHER
  ------------------
  |  |  211|     65|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
                  sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ? SGILOGENCODE_RANDITHER
  ------------------
  |  |  750|     24|#define SGILOGENCODE_RANDITHER 1       /* randomly dither encd values */
  ------------------
  |  Branch (1941:23): [True: 24, False: 41]
  ------------------
 1942|     65|                                                       : SGILOGENCODE_NODITHER;
  ------------------
  |  |  749|    106|#define SGILOGENCODE_NODITHER 0        /* do not dither encoded values*/
  ------------------
 1943|     65|    sp->tfunc = _logLuvNop;
 1944|       |
 1945|       |    /*
 1946|       |     * Install codec methods.
 1947|       |     * NB: tif_decoderow & tif_encoderow are filled
 1948|       |     *     in at setup time.
 1949|       |     */
 1950|     65|    tif->tif_fixuptags = LogLuvFixupTags;
 1951|     65|    tif->tif_setupdecode = LogLuvSetupDecode;
 1952|     65|    tif->tif_decodestrip = LogLuvDecodeStrip;
 1953|     65|    tif->tif_decodetile = LogLuvDecodeTile;
 1954|     65|    tif->tif_setupencode = LogLuvSetupEncode;
 1955|     65|    tif->tif_encodestrip = LogLuvEncodeStrip;
 1956|     65|    tif->tif_encodetile = LogLuvEncodeTile;
 1957|     65|    tif->tif_close = LogLuvClose;
 1958|     65|    tif->tif_cleanup = LogLuvCleanup;
 1959|       |
 1960|       |    /*
 1961|       |     * Override parent get/set field methods.
 1962|       |     */
 1963|     65|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1964|     65|    tif->tif_tagmethods.vgetfield = LogLuvVGetField; /* hook for codec tags */
 1965|     65|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1966|     65|    tif->tif_tagmethods.vsetfield = LogLuvVSetField; /* hook for codec tags */
 1967|       |
 1968|     65|    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|     65|}
tif_luv.c:LogLuvFixupTags:
 1630|     52|{
 1631|     52|    (void)tif;
 1632|     52|    return (1);
 1633|     52|}
tif_luv.c:LogLuvSetupDecode:
 1636|     50|{
 1637|     50|    static const char module[] = "LogLuvSetupDecode";
 1638|     50|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|     50|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1639|     50|    TIFFDirectory *td = &tif->tif_dir;
 1640|       |
 1641|     50|    tif->tif_postdecode = _TIFFNoPostDecode;
 1642|     50|    switch (td->td_photometric)
 1643|     50|    {
 1644|     24|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|     24|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (1644:9): [True: 24, False: 26]
  ------------------
 1645|     24|            if (!LogLuvInitState(tif))
  ------------------
  |  Branch (1645:17): [True: 0, False: 24]
  ------------------
 1646|      0|                break;
 1647|     24|            if (td->td_compression == COMPRESSION_SGILOG24)
  ------------------
  |  |  211|     24|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (1647:17): [True: 14, False: 10]
  ------------------
 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|     10|                    case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|     10|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1655:21): [True: 10, False: 4]
  ------------------
 1656|     10|                        sp->tfunc = Luv24toLuv48;
 1657|     10|                        break;
 1658|      0|                    case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|      0|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1658:21): [True: 0, False: 14]
  ------------------
 1659|      0|                        sp->tfunc = Luv24toRGB;
 1660|      0|                        break;
 1661|      2|                    default:
  ------------------
  |  Branch (1661:21): [True: 2, False: 12]
  ------------------
 1662|      2|                        break;
 1663|     14|                }
 1664|     14|            }
 1665|     10|            else
 1666|     10|            {
 1667|     10|                tif->tif_decoderow = LogLuvDecode32;
 1668|     10|                switch (sp->user_datafmt)
 1669|     10|                {
 1670|      3|                    case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      3|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1670:21): [True: 3, False: 7]
  ------------------
 1671|      3|                        sp->tfunc = Luv32toXYZ;
 1672|      3|                        break;
 1673|      2|                    case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|      2|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1673:21): [True: 2, False: 8]
  ------------------
 1674|      2|                        sp->tfunc = Luv32toLuv48;
 1675|      2|                        break;
 1676|      3|                    case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|      3|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1676:21): [True: 3, False: 7]
  ------------------
 1677|      3|                        sp->tfunc = Luv32toRGB;
 1678|      3|                        break;
 1679|      2|                    default:
  ------------------
  |  Branch (1679:21): [True: 2, False: 8]
  ------------------
 1680|      2|                        break;
 1681|     10|                }
 1682|     10|            }
 1683|     24|            return (1);
 1684|     26|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     26|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (1684:9): [True: 26, False: 24]
  ------------------
 1685|     26|            if (!LogL16InitState(tif))
  ------------------
  |  Branch (1685:17): [True: 2, False: 24]
  ------------------
 1686|      2|                break;
 1687|     24|            tif->tif_decoderow = LogL16Decode;
 1688|     24|            switch (sp->user_datafmt)
 1689|     24|            {
 1690|     11|                case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|     11|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1690:17): [True: 11, False: 13]
  ------------------
 1691|     11|                    sp->tfunc = L16toY;
 1692|     11|                    break;
 1693|     12|                case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|     12|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1693:17): [True: 12, False: 12]
  ------------------
 1694|     12|                    sp->tfunc = L16toGry;
 1695|     12|                    break;
 1696|      1|                default:
  ------------------
  |  Branch (1696:17): [True: 1, False: 23]
  ------------------
 1697|      1|                    break;
 1698|     24|            }
 1699|     24|            return (1);
 1700|      0|        default:
  ------------------
  |  Branch (1700:9): [True: 0, False: 50]
  ------------------
 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|     50|    }
 1707|      2|    return (0);
 1708|     50|}
tif_luv.c:LogLuvInitState:
 1576|     24|{
 1577|     24|    static const char module[] = "LogLuvInitState";
 1578|     24|    TIFFDirectory *td = &tif->tif_dir;
 1579|     24|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|     24|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1580|       |
 1581|     24|    assert(sp != NULL);
  ------------------
  |  Branch (1581:5): [True: 0, False: 24]
  |  Branch (1581:5): [True: 24, False: 0]
  ------------------
 1582|     24|    assert(td->td_photometric == PHOTOMETRIC_LOGLUV);
  ------------------
  |  Branch (1582:5): [True: 0, False: 24]
  |  Branch (1582:5): [True: 24, False: 0]
  ------------------
 1583|       |
 1584|       |    /* for some reason, we can't do this in TIFFInitLogLuv */
 1585|     24|    if (td->td_planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|     24|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1585:9): [True: 0, False: 24]
  ------------------
 1586|      0|    {
 1587|      0|        TIFFErrorExtR(tif, module,
 1588|      0|                      "SGILog compression cannot handle non-contiguous data");
 1589|      0|        return (0);
 1590|      0|    }
 1591|     24|    if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  178|     24|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1591:9): [True: 21, False: 3]
  ------------------
 1592|     21|        sp->user_datafmt = LogLuvGuessDataFmt(td);
 1593|     24|    switch (sp->user_datafmt)
 1594|     24|    {
 1595|      5|        case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      5|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1595:9): [True: 5, False: 19]
  ------------------
 1596|      5|            sp->pixel_size = 3 * sizeof(float);
 1597|      5|            break;
 1598|     12|        case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|     12|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1598:9): [True: 12, False: 12]
  ------------------
 1599|     12|            sp->pixel_size = 3 * sizeof(int16_t);
 1600|     12|            break;
 1601|      4|        case SGILOGDATAFMT_RAW:
  ------------------
  |  |  746|      4|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1601:9): [True: 4, False: 20]
  ------------------
 1602|      4|            sp->pixel_size = sizeof(uint32_t);
 1603|      4|            break;
 1604|      3|        case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|      3|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1604:9): [True: 3, False: 21]
  ------------------
 1605|      3|            sp->pixel_size = 3 * sizeof(uint8_t);
 1606|      3|            break;
 1607|      0|        default:
  ------------------
  |  Branch (1607:9): [True: 0, False: 24]
  ------------------
 1608|      0|            TIFFErrorExtR(
 1609|      0|                tif, module,
 1610|      0|                "No support for converting user data format to LogLuv");
 1611|      0|            return (0);
 1612|     24|    }
 1613|     24|    if (isTiled(tif))
  ------------------
  |  |  278|     24|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     24|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 2, False: 22]
  |  |  ------------------
  ------------------
 1614|      2|        sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
 1615|     22|    else if (td->td_rowsperstrip < td->td_imagelength)
  ------------------
  |  Branch (1615:14): [True: 0, False: 22]
  ------------------
 1616|      0|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
 1617|     22|    else
 1618|     22|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
 1619|     24|    if (multiply_ms(sp->tbuflen, sizeof(uint32_t)) == 0 ||
  ------------------
  |  Branch (1619:9): [True: 0, False: 24]
  ------------------
 1620|     24|        (sp->tbuf = (uint8_t *)_TIFFmallocExt(
  ------------------
  |  Branch (1620:9): [True: 0, False: 24]
  ------------------
 1621|     24|             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|     24|    return (1);
 1627|     24|}
tif_luv.c:LogLuvGuessDataFmt:
 1523|     21|{
 1524|     21|    int guess;
 1525|       |
 1526|       |    /*
 1527|       |     * If the user didn't tell us their datafmt,
 1528|       |     * take our best guess from the bitspersample.
 1529|       |     */
 1530|     21|#define PACK(a, b) (((a) << 3) | (b))
 1531|     21|    switch (PACK(td->td_bitspersample, td->td_sampleformat))
  ------------------
  |  | 1530|     21|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
 1532|     21|    {
 1533|      5|        case PACK(32, SAMPLEFORMAT_IEEEFP):
  ------------------
  |  | 1530|      5|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1533:9): [True: 5, False: 16]
  ------------------
 1534|      5|            guess = SGILOGDATAFMT_FLOAT;
  ------------------
  |  |  744|      5|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
 1535|      5|            break;
 1536|      2|        case PACK(32, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1530|      2|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1536:9): [True: 2, False: 19]
  ------------------
 1537|      4|        case PACK(32, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1530|      4|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1537:9): [True: 2, False: 19]
  ------------------
 1538|      4|        case PACK(32, SAMPLEFORMAT_INT):
  ------------------
  |  | 1530|      4|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1538:9): [True: 0, False: 21]
  ------------------
 1539|      4|            guess = SGILOGDATAFMT_RAW;
  ------------------
  |  |  746|      4|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
 1540|      4|            break;
 1541|      0|        case PACK(16, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1541:9): [True: 0, False: 21]
  ------------------
 1542|      0|        case PACK(16, SAMPLEFORMAT_INT):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1542:9): [True: 0, False: 21]
  ------------------
 1543|     12|        case PACK(16, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1530|     12|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1543:9): [True: 12, False: 9]
  ------------------
 1544|     12|            guess = SGILOGDATAFMT_16BIT;
  ------------------
  |  |  745|     12|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
 1545|     12|            break;
 1546|      0|        case PACK(8, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1546:9): [True: 0, False: 21]
  ------------------
 1547|      0|        case PACK(8, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1547:9): [True: 0, False: 21]
  ------------------
 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: 21]
  ------------------
 1551|      0|            guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1552|      0|            break;
 1553|     21|#undef PACK
 1554|     21|    }
 1555|       |    /*
 1556|       |     * Double-check samples per pixel.
 1557|       |     */
 1558|     21|    switch (td->td_samplesperpixel)
 1559|     21|    {
 1560|      4|        case 1:
  ------------------
  |  Branch (1560:9): [True: 4, False: 17]
  ------------------
 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|     17|        case 3:
  ------------------
  |  Branch (1564:9): [True: 17, False: 4]
  ------------------
 1565|     17|            if (guess == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|     17|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1565:17): [True: 0, False: 17]
  ------------------
 1566|      0|                guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1567|     17|            break;
 1568|      0|        default:
  ------------------
  |  Branch (1568:9): [True: 0, False: 21]
  ------------------
 1569|      0|            guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1570|      0|            break;
 1571|     21|    }
 1572|     21|    return (guess);
 1573|     21|}
tif_luv.c:multiply_ms:
 1466|     96|{
 1467|     96|    return _TIFFMultiplySSize(NULL, m1, m2, NULL);
 1468|     96|}
tif_luv.c:LogLuvDecode24:
  265|  1.32k|{
  266|  1.32k|    static const char module[] = "LogLuvDecode24";
  267|  1.32k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|  1.32k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  268|  1.32k|    tmsize_t cc;
  269|  1.32k|    tmsize_t i;
  270|  1.32k|    tmsize_t npixels;
  271|  1.32k|    unsigned char *bp;
  272|  1.32k|    uint32_t *tp;
  273|       |
  274|  1.32k|    (void)s;
  275|  1.32k|    assert(s == 0);
  ------------------
  |  Branch (275:5): [True: 0, False: 1.32k]
  |  Branch (275:5): [True: 1.32k, False: 0]
  ------------------
  276|  1.32k|    assert(sp != NULL);
  ------------------
  |  Branch (276:5): [True: 0, False: 1.32k]
  |  Branch (276:5): [True: 1.32k, False: 0]
  ------------------
  277|       |
  278|  1.32k|    npixels = occ / sp->pixel_size;
  279|       |
  280|  1.32k|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (280:9): [True: 0, False: 1.32k]
  ------------------
  281|      0|    {
  282|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  283|      0|        return (0);
  284|      0|    }
  285|  1.32k|    tp = (uint32_t *)sp->tbuf;
  286|       |    /* copy to array of uint32_t */
  287|  1.32k|    bp = (unsigned char *)tif->tif_rawcp;
  288|  1.32k|    cc = tif->tif_rawcc;
  289|  3.67k|    for (i = 0; i < npixels && cc >= 3; i++)
  ------------------
  |  Branch (289:17): [True: 2.35k, False: 1.31k]
  |  Branch (289:32): [True: 2.34k, False: 9]
  ------------------
  290|  2.34k|    {
  291|  2.34k|        tp[i] = (uint32_t)bp[0] << 16 | (uint32_t)bp[1] << 8 | bp[2];
  292|  2.34k|        bp += 3;
  293|  2.34k|        cc -= 3;
  294|  2.34k|    }
  295|  1.32k|    tif->tif_rawcp = (uint8_t *)bp;
  296|  1.32k|    tif->tif_rawcc = cc;
  297|  1.32k|    if (i != npixels)
  ------------------
  |  Branch (297:9): [True: 9, False: 1.31k]
  ------------------
  298|      9|    {
  299|      9|        TIFFErrorExtR(tif, module,
  300|      9|                      "Not enough data at row %" PRIu32
  301|      9|                      " (short %" TIFF_SSIZE_FORMAT " pixels)",
  302|      9|                      tif->tif_dir.td_row, npixels - i);
  303|      9|        return (0);
  304|      9|    }
  305|  1.31k|    if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|  1.31k|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (305:9): [True: 186, False: 1.12k]
  ------------------
  306|    186|        LuvRawToRaw(sp, op, npixels);
  307|  1.12k|    else
  308|  1.12k|        (*sp->tfunc)(sp, op, npixels);
  309|  1.31k|    return (1);
  310|  1.32k|}
tif_luv.c:LuvRawToRaw:
  883|    365|{
  884|    365|    uint32_t *luv = (uint32_t *)sp->tbuf;
  885|       |
  886|    877|    while (n-- > 0)
  ------------------
  |  Branch (886:12): [True: 512, False: 365]
  ------------------
  887|    512|    {
  888|    512|        LogLuvStore32NativeUnaligned(op, *luv++);
  889|    512|        op += sizeof(uint32_t);
  890|    512|    }
  891|    365|}
tif_luv.c:LogLuvStore32NativeUnaligned:
  856|    512|{
  857|    512|    memcpy(cp, &v, sizeof(v));
  858|    512|}
tif_luv.c:Luv24toXYZ:
 1169|    134|{
 1170|    134|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1171|       |
 1172|    528|    while (n-- > 0)
  ------------------
  |  Branch (1172:12): [True: 394, False: 134]
  ------------------
 1173|    394|    {
 1174|    394|        float xyz[3];
 1175|    394|        LogLuv24toXYZ(*luv, xyz);
 1176|    394|        LogLuvStoreFloatNativeUnaligned(op, xyz[0]);
 1177|    394|        LogLuvStoreFloatNativeUnaligned(op + sizeof(float), xyz[1]);
 1178|    394|        LogLuvStoreFloatNativeUnaligned(op + 2 * sizeof(float), xyz[2]);
 1179|    394|        op += 3 * sizeof(float);
 1180|    394|        luv++;
 1181|    394|    }
 1182|    134|}
tif_luv.c:LogLuvStoreFloatNativeUnaligned:
  832|  40.1k|{
  833|  40.1k|    memcpy(cp, &v, sizeof(v));
  834|  40.1k|}
tif_luv.c:Luv24toLuv48:
 1185|    993|{
 1186|    993|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1187|       |
 1188|  2.58k|    while (n-- > 0)
  ------------------
  |  Branch (1188:12): [True: 1.58k, False: 993]
  ------------------
 1189|  1.58k|    {
 1190|  1.58k|        double u, v;
 1191|  1.58k|        int16_t luv0;
 1192|  1.58k|        int16_t luv1;
 1193|  1.58k|        int16_t luv2;
 1194|       |
 1195|  1.58k|        luv0 = (int16_t)((*luv >> 12 & 0xffd) + 13314);
 1196|  1.58k|        if (uv_decode(&u, &v, *luv & 0x3fff) < 0)
  ------------------
  |  Branch (1196:13): [True: 312, False: 1.27k]
  ------------------
 1197|    312|        {
 1198|    312|            u = U_NEU;
  ------------------
  |  |  613|    312|#define U_NEU 0.210526316
  ------------------
 1199|    312|            v = V_NEU;
  ------------------
  |  |  614|    312|#define V_NEU 0.473684211
  ------------------
 1200|    312|        }
 1201|  1.58k|        luv1 = (int16_t)(u * (1 << 15));
 1202|  1.58k|        luv2 = (int16_t)(v * (1 << 15));
 1203|  1.58k|        LogLuvStore16NativeUnaligned(op, luv0);
 1204|  1.58k|        LogLuvStore16NativeUnaligned(op + sizeof(int16_t), luv1);
 1205|  1.58k|        LogLuvStore16NativeUnaligned(op + 2 * sizeof(int16_t), luv2);
 1206|  1.58k|        op += 3 * sizeof(int16_t);
 1207|  1.58k|        luv++;
 1208|  1.58k|    }
 1209|    993|}
tif_luv.c:LogLuvStore16NativeUnaligned:
  844|  6.22k|{
  845|  6.22k|    memcpy(cp, &v, sizeof(v));
  846|  6.22k|}
tif_luv.c:LogLuvDecode32:
  316|    514|{
  317|    514|    static const char module[] = "LogLuvDecode32";
  318|    514|    LogLuvState *sp;
  319|    514|    int shft;
  320|    514|    tmsize_t i;
  321|    514|    tmsize_t npixels;
  322|    514|    unsigned char *bp;
  323|    514|    uint32_t *tp;
  324|    514|    uint32_t b;
  325|    514|    tmsize_t cc;
  326|    514|    int rc;
  327|       |
  328|    514|    (void)s;
  329|    514|    assert(s == 0);
  ------------------
  |  Branch (329:5): [True: 0, False: 514]
  |  Branch (329:5): [True: 514, False: 0]
  ------------------
  330|    514|    sp = DecoderState(tif);
  ------------------
  |  |  175|    514|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  331|    514|    assert(sp != NULL);
  ------------------
  |  Branch (331:5): [True: 0, False: 514]
  |  Branch (331:5): [True: 514, False: 0]
  ------------------
  332|       |
  333|    514|    npixels = occ / sp->pixel_size;
  334|       |
  335|    514|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (335:9): [True: 0, False: 514]
  ------------------
  336|      0|    {
  337|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  338|      0|        return (0);
  339|      0|    }
  340|    514|    tp = (uint32_t *)sp->tbuf;
  341|    514|    _TIFFmemset((void *)tp, 0, (tmsize_t)((size_t)npixels * sizeof(tp[0])));
  342|       |
  343|    514|    bp = (unsigned char *)tif->tif_rawcp;
  344|    514|    cc = tif->tif_rawcc;
  345|       |    /* get each byte string */
  346|  2.54k|    for (shft = 24; shft >= 0; shft -= 8)
  ------------------
  |  Branch (346:21): [True: 2.03k, False: 507]
  ------------------
  347|  2.03k|    {
  348|  4.86k|        for (i = 0; i < npixels && cc > 0;)
  ------------------
  |  Branch (348:21): [True: 2.83k, False: 2.02k]
  |  Branch (348:36): [True: 2.83k, False: 6]
  ------------------
  349|  2.83k|        {
  350|  2.83k|            if (*bp >= 128)
  ------------------
  |  Branch (350:17): [True: 1.06k, False: 1.76k]
  ------------------
  351|  1.06k|            { /* run */
  352|  1.06k|                if (cc < 2)
  ------------------
  |  Branch (352:21): [True: 1, False: 1.06k]
  ------------------
  353|      1|                    break;
  354|  1.06k|                rc = *bp++ + (2 - 128);
  355|  1.06k|                b = (uint32_t)*bp++ << shft;
  356|  1.06k|                cc -= 2;
  357|  5.98k|                while (rc-- && i < npixels)
  ------------------
  |  Branch (357:24): [True: 5.95k, False: 30]
  |  Branch (357:32): [True: 4.92k, False: 1.03k]
  ------------------
  358|  4.92k|                    tp[i++] |= b;
  359|  1.06k|            }
  360|  1.76k|            else
  361|  1.76k|            {               /* non-run */
  362|  1.76k|                rc = *bp++; /* nul is noop */
  363|  3.82k|                while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (363:24): [True: 3.81k, False: 5]
  |  Branch (363:32): [True: 2.84k, False: 974]
  |  Branch (363:40): [True: 2.05k, False: 788]
  ------------------
  364|  2.05k|                    tp[i++] |= (uint32_t)*bp++ << shft;
  365|  1.76k|            }
  366|  2.83k|        }
  367|  2.03k|        if (i != npixels)
  ------------------
  |  Branch (367:13): [True: 7, False: 2.02k]
  ------------------
  368|      7|        {
  369|      7|            TIFFErrorExtR(tif, module,
  370|      7|                          "Not enough data at row %" PRIu32
  371|      7|                          " (short %" TIFF_SSIZE_FORMAT " pixels)",
  372|      7|                          tif->tif_dir.td_row, npixels - i);
  373|      7|            tif->tif_rawcp = (uint8_t *)bp;
  374|      7|            tif->tif_rawcc = cc;
  375|      7|            return (0);
  376|      7|        }
  377|  2.03k|    }
  378|    507|    if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|    507|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (378:9): [True: 179, False: 328]
  ------------------
  379|    179|        LuvRawToRaw(sp, op, npixels);
  380|    328|    else
  381|    328|        (*sp->tfunc)(sp, op, npixels);
  382|    507|    tif->tif_rawcp = (uint8_t *)bp;
  383|    507|    tif->tif_rawcc = cc;
  384|    507|    return (1);
  385|    514|}
tif_luv.c:Luv32toXYZ:
 1333|    147|{
 1334|    147|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1335|       |
 1336|  1.34k|    while (n-- > 0)
  ------------------
  |  Branch (1336:12): [True: 1.19k, False: 147]
  ------------------
 1337|  1.19k|    {
 1338|  1.19k|        float xyz[3];
 1339|  1.19k|        LogLuv32toXYZ(*luv++, xyz);
 1340|  1.19k|        LogLuvStoreFloatNativeUnaligned(op, xyz[0]);
 1341|  1.19k|        LogLuvStoreFloatNativeUnaligned(op + sizeof(float), xyz[1]);
 1342|  1.19k|        LogLuvStoreFloatNativeUnaligned(op + 2 * sizeof(float), xyz[2]);
 1343|  1.19k|        op += 3 * sizeof(float);
 1344|  1.19k|    }
 1345|    147|}
tif_luv.c:Luv32toLuv48:
 1348|    169|{
 1349|    169|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1350|       |
 1351|    507|    while (n-- > 0)
  ------------------
  |  Branch (1351:12): [True: 338, False: 169]
  ------------------
 1352|    338|    {
 1353|    338|        double u, v;
 1354|    338|        int16_t luv0 = (int16_t)(*luv >> 16);
 1355|    338|        int16_t luv1;
 1356|    338|        int16_t luv2;
 1357|       |
 1358|    338|        u = 1. / UVSCALE * ((*luv >> 8 & 0xff) + .5);
  ------------------
  |  |  615|    338|#define UVSCALE 410.
  ------------------
 1359|    338|        v = 1. / UVSCALE * ((*luv & 0xff) + .5);
  ------------------
  |  |  615|    338|#define UVSCALE 410.
  ------------------
 1360|    338|        luv1 = (int16_t)(u * (1 << 15));
 1361|    338|        luv2 = (int16_t)(v * (1 << 15));
 1362|    338|        LogLuvStore16NativeUnaligned(op, luv0);
 1363|    338|        LogLuvStore16NativeUnaligned(op + sizeof(int16_t), luv1);
 1364|    338|        LogLuvStore16NativeUnaligned(op + 2 * sizeof(int16_t), luv2);
 1365|    338|        op += 3 * sizeof(int16_t);
 1366|    338|        luv++;
 1367|    338|    }
 1368|    169|}
tif_luv.c:Luv32toRGB:
 1371|     12|{
 1372|     12|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1373|     12|    uint8_t *rgb = (uint8_t *)op;
 1374|       |
 1375|     24|    while (n-- > 0)
  ------------------
  |  Branch (1375:12): [True: 12, False: 12]
  ------------------
 1376|     12|    {
 1377|     12|        float xyz[3];
 1378|       |
 1379|     12|        LogLuv32toXYZ(*luv++, xyz);
 1380|     12|        XYZtoRGB24(xyz, rgb);
 1381|     12|        rgb += 3;
 1382|     12|    }
 1383|     12|}
tif_luv.c:LogL16InitState:
 1471|     26|{
 1472|     26|    static const char module[] = "LogL16InitState";
 1473|     26|    TIFFDirectory *td = &tif->tif_dir;
 1474|     26|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|     26|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1475|       |
 1476|     26|    assert(sp != NULL);
  ------------------
  |  Branch (1476:5): [True: 0, False: 26]
  |  Branch (1476:5): [True: 26, False: 0]
  ------------------
 1477|     26|    assert(td->td_photometric == PHOTOMETRIC_LOGL);
  ------------------
  |  Branch (1477:5): [True: 0, False: 26]
  |  Branch (1477:5): [True: 26, False: 0]
  ------------------
 1478|       |
 1479|     26|    if (td->td_samplesperpixel != 1)
  ------------------
  |  Branch (1479:9): [True: 2, False: 24]
  ------------------
 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|     24|    if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  178|     24|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1488:9): [True: 12, False: 12]
  ------------------
 1489|     12|        sp->user_datafmt = LogL16GuessDataFmt(td);
 1490|     24|    switch (sp->user_datafmt)
 1491|     24|    {
 1492|     11|        case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|     11|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1492:9): [True: 11, False: 13]
  ------------------
 1493|     11|            sp->pixel_size = sizeof(float);
 1494|     11|            break;
 1495|      1|        case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|      1|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1495:9): [True: 1, False: 23]
  ------------------
 1496|      1|            sp->pixel_size = sizeof(int16_t);
 1497|      1|            break;
 1498|     12|        case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|     12|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1498:9): [True: 12, False: 12]
  ------------------
 1499|     12|            sp->pixel_size = sizeof(uint8_t);
 1500|     12|            break;
 1501|      0|        default:
  ------------------
  |  Branch (1501:9): [True: 0, False: 24]
  ------------------
 1502|      0|            TIFFErrorExtR(tif, module,
 1503|      0|                          "No support for converting user data format to LogL");
 1504|      0|            return (0);
 1505|     24|    }
 1506|     24|    if (isTiled(tif))
  ------------------
  |  |  278|     24|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     24|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 7, False: 17]
  |  |  ------------------
  ------------------
 1507|      7|        sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
 1508|     17|    else if (td->td_rowsperstrip < td->td_imagelength)
  ------------------
  |  Branch (1508:14): [True: 3, False: 14]
  ------------------
 1509|      3|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
 1510|     14|    else
 1511|     14|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
 1512|     24|    if (multiply_ms(sp->tbuflen, sizeof(int16_t)) == 0 ||
  ------------------
  |  Branch (1512:9): [True: 0, False: 24]
  ------------------
 1513|     24|        (sp->tbuf = (uint8_t *)_TIFFmallocExt(
  ------------------
  |  Branch (1513:9): [True: 0, False: 24]
  ------------------
 1514|     24|             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|     24|    return (1);
 1520|     24|}
tif_luv.c:LogL16GuessDataFmt:
 1444|     12|{
 1445|     12|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
 1446|     12|    switch (
 1447|     12|        PACK(td->td_samplesperpixel, td->td_bitspersample, td->td_sampleformat))
  ------------------
  |  | 1445|     12|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
 1448|     12|    {
 1449|     11|        case PACK(1, 32, SAMPLEFORMAT_IEEEFP):
  ------------------
  |  | 1445|     11|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1449:9): [True: 11, False: 1]
  ------------------
 1450|     11|            return (SGILOGDATAFMT_FLOAT);
  ------------------
  |  |  744|     11|#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: 12]
  ------------------
 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: 12]
  ------------------
 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: 11]
  ------------------
 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: 12]
  ------------------
 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: 12]
  ------------------
 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: 12]
  ------------------
 1459|      0|            break;
 1460|     12|    }
 1461|      0|#undef PACK
 1462|      0|    return (SGILOGDATAFMT_UNKNOWN);
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1463|     12|}
tif_luv.c:LogL16Decode:
  191|  56.2k|{
  192|  56.2k|    static const char module[] = "LogL16Decode";
  193|  56.2k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|  56.2k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  194|  56.2k|    int shft;
  195|  56.2k|    tmsize_t i;
  196|  56.2k|    tmsize_t npixels;
  197|  56.2k|    unsigned char *bp;
  198|  56.2k|    int16_t *tp;
  199|  56.2k|    int16_t b;
  200|  56.2k|    tmsize_t cc;
  201|  56.2k|    int rc;
  202|       |
  203|  56.2k|    (void)s;
  204|  56.2k|    assert(s == 0);
  ------------------
  |  Branch (204:5): [True: 0, False: 56.2k]
  |  Branch (204:5): [True: 56.2k, False: 0]
  ------------------
  205|  56.2k|    assert(sp != NULL);
  ------------------
  |  Branch (205:5): [True: 0, False: 56.2k]
  |  Branch (205:5): [True: 56.2k, False: 0]
  ------------------
  206|       |
  207|  56.2k|    npixels = occ / sp->pixel_size;
  208|       |
  209|  56.2k|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (209:9): [True: 0, False: 56.2k]
  ------------------
  210|      0|    {
  211|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  212|      0|        return (0);
  213|      0|    }
  214|  56.2k|    tp = (int16_t *)sp->tbuf;
  215|  56.2k|    _TIFFmemset((void *)tp, 0, (tmsize_t)((size_t)npixels * sizeof(tp[0])));
  216|       |
  217|  56.2k|    bp = (unsigned char *)tif->tif_rawcp;
  218|  56.2k|    cc = tif->tif_rawcc;
  219|       |    /* get each byte string */
  220|   167k|    for (shft = 8; shft >= 0; shft -= 8)
  ------------------
  |  Branch (220:20): [True: 112k, False: 55.6k]
  ------------------
  221|   112k|    {
  222|   631k|        for (i = 0; i < npixels && cc > 0;)
  ------------------
  |  Branch (222:21): [True: 519k, False: 111k]
  |  Branch (222:36): [True: 519k, False: 387]
  ------------------
  223|   519k|        {
  224|   519k|            if (*bp >= 128)
  ------------------
  |  Branch (224:17): [True: 99.7k, False: 419k]
  ------------------
  225|  99.7k|            { /* run */
  226|  99.7k|                if (cc < 2)
  ------------------
  |  Branch (226:21): [True: 173, False: 99.5k]
  ------------------
  227|    173|                    break;
  228|  99.5k|                rc = *bp++ + (2 - 128);
  229|  99.5k|                b = (int16_t)(*bp++ << shft);
  230|  99.5k|                cc -= 2;
  231|  4.79M|                while (rc-- && i < npixels)
  ------------------
  |  Branch (231:24): [True: 4.77M, False: 21.2k]
  |  Branch (231:32): [True: 4.69M, False: 78.2k]
  ------------------
  232|  4.69M|                    tp[i++] |= b;
  233|  99.5k|            }
  234|   419k|            else
  235|   419k|            {               /* non-run */
  236|   419k|                rc = *bp++; /* nul is noop */
  237|  2.37M|                while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (237:24): [True: 2.37M, False: 337]
  |  Branch (237:32): [True: 1.99M, False: 387k]
  |  Branch (237:40): [True: 1.95M, False: 32.1k]
  ------------------
  238|  1.95M|                    tp[i++] |= (int16_t)(*bp++ << shft);
  239|   419k|            }
  240|   519k|        }
  241|   112k|        if (i != npixels)
  ------------------
  |  Branch (241:13): [True: 560, False: 111k]
  ------------------
  242|    560|        {
  243|    560|            TIFFErrorExtR(tif, module,
  244|    560|                          "Not enough data at row %" PRIu32
  245|    560|                          " (short %" TIFF_SSIZE_FORMAT " pixels)",
  246|    560|                          tif->tif_dir.td_row, npixels - i);
  247|    560|            tif->tif_rawcp = (uint8_t *)bp;
  248|    560|            tif->tif_rawcc = cc;
  249|    560|            return (0);
  250|    560|        }
  251|   112k|    }
  252|  55.6k|    if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
  ------------------
  |  |  745|  55.6k|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (252:9): [True: 151, False: 55.5k]
  ------------------
  253|    151|        L16toL16(sp, op, npixels);
  254|  55.5k|    else
  255|  55.5k|        (*sp->tfunc)(sp, op, npixels);
  256|  55.6k|    tif->tif_rawcp = (uint8_t *)bp;
  257|  55.6k|    tif->tif_rawcc = cc;
  258|  55.6k|    return (1);
  259|  56.2k|}
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|  1.10k|{
  906|  1.10k|    int16_t *l16 = (int16_t *)sp->tbuf;
  907|       |
  908|  36.4k|    while (n-- > 0)
  ------------------
  |  Branch (908:12): [True: 35.3k, False: 1.10k]
  ------------------
  909|  35.3k|    {
  910|  35.3k|        LogLuvStoreFloatNativeUnaligned(op, (float)LogL16toY(*l16++));
  911|  35.3k|        op += sizeof(float);
  912|  35.3k|    }
  913|  1.10k|}
tif_luv.c:L16toGry:
  916|  54.4k|{
  917|  54.4k|    int16_t *l16 = (int16_t *)sp->tbuf;
  918|  54.4k|    uint8_t *gp = (uint8_t *)op;
  919|       |
  920|  3.32M|    while (n-- > 0)
  ------------------
  |  Branch (920:12): [True: 3.26M, False: 54.4k]
  ------------------
  921|  3.26M|    {
  922|  3.26M|        double Y = LogL16toY(*l16++);
  923|  3.26M|        *gp++ = (uint8_t)((Y <= 0.)   ? 0
  ------------------
  |  Branch (923:27): [True: 2.22M, False: 1.04M]
  ------------------
  924|  3.26M|                          : (Y >= 1.) ? 255
  ------------------
  |  Branch (924:29): [True: 375k, False: 668k]
  ------------------
  925|  1.04M|                                      : (int)(256. * sqrt(Y)));
  926|  3.26M|    }
  927|  54.4k|}
tif_luv.c:LogLuvDecodeStrip:
  393|    703|{
  394|    703|    tmsize_t rowlen = TIFFScanlineSize(tif);
  395|       |
  396|    703|    if (rowlen == 0)
  ------------------
  |  Branch (396:9): [True: 0, False: 703]
  ------------------
  397|      0|        return 0;
  398|       |
  399|    703|    assert(cc % rowlen == 0);
  ------------------
  |  Branch (399:5): [True: 0, False: 703]
  |  Branch (399:5): [True: 703, False: 0]
  ------------------
  400|  4.11k|    while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
  ------------------
  |  Branch (400:12): [True: 3.95k, False: 160]
  |  Branch (400:18): [True: 3.41k, False: 543]
  ------------------
  401|  3.41k|    {
  402|  3.41k|        bp += rowlen;
  403|  3.41k|        cc -= rowlen;
  404|  3.41k|    }
  405|    703|    return (cc == 0);
  406|    703|}
tif_luv.c:LogLuvDecodeTile:
  414|     10|{
  415|     10|    tmsize_t rowlen = TIFFTileRowSize(tif);
  416|       |
  417|     10|    if (rowlen == 0)
  ------------------
  |  Branch (417:9): [True: 0, False: 10]
  ------------------
  418|      0|        return 0;
  419|       |
  420|     10|    assert(cc % rowlen == 0);
  ------------------
  |  Branch (420:5): [True: 0, False: 10]
  |  Branch (420:5): [True: 10, False: 0]
  ------------------
  421|  50.8k|    while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
  ------------------
  |  Branch (421:12): [True: 50.8k, False: 0]
  |  Branch (421:18): [True: 50.8k, False: 10]
  ------------------
  422|  50.8k|    {
  423|  50.8k|        bp += rowlen;
  424|  50.8k|        cc -= rowlen;
  425|  50.8k|    }
  426|     10|    return (cc == 0);
  427|     10|}
tif_luv.c:LogLuvCleanup:
 1813|     65|{
 1814|     65|    LogLuvState *sp = (LogLuvState *)tif->tif_data;
 1815|       |
 1816|     65|    assert(sp != 0);
  ------------------
  |  Branch (1816:5): [True: 0, False: 65]
  |  Branch (1816:5): [True: 65, False: 0]
  ------------------
 1817|       |
 1818|     65|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1819|     65|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1820|       |
 1821|     65|    if (sp->tbuf)
  ------------------
  |  Branch (1821:9): [True: 48, False: 17]
  ------------------
 1822|     48|        _TIFFfreeExt(tif, sp->tbuf);
 1823|     65|    _TIFFfreeExt(tif, sp);
 1824|     65|    tif->tif_data = NULL;
 1825|       |
 1826|     65|    _TIFFSetDefaultCompressionState(tif);
 1827|     65|}
tif_luv.c:LogLuvVGetField:
 1897|    367|{
 1898|    367|    LogLuvState *sp = (LogLuvState *)tif->tif_data;
 1899|       |
 1900|    367|    switch (tag)
 1901|    367|    {
 1902|      0|        case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  743|      0|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
  |  Branch (1902:9): [True: 0, False: 367]
  ------------------
 1903|      0|            *va_arg(ap, int *) = sp->user_datafmt;
 1904|      0|            return (1);
 1905|    367|        default:
  ------------------
  |  Branch (1905:9): [True: 367, False: 0]
  ------------------
 1906|    367|            return (*sp->vgetparent)(tif, tag, ap);
 1907|    367|    }
 1908|    367|}
tif_luv.c:LogLuvVSetField:
 1830|  1.03k|{
 1831|  1.03k|    static const char module[] = "LogLuvVSetField";
 1832|  1.03k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|  1.03k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1833|  1.03k|    int bps, fmt;
 1834|       |
 1835|  1.03k|    switch (tag)
 1836|  1.03k|    {
 1837|     18|        case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  743|     18|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
  |  Branch (1837:9): [True: 18, False: 1.02k]
  ------------------
 1838|     18|            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|     18|            switch (sp->user_datafmt)
 1846|     18|            {
 1847|      0|                case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      0|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1847:17): [True: 0, False: 18]
  ------------------
 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: 18]
  ------------------
 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: 18]
  ------------------
 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|     18|                case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|     18|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1860:17): [True: 18, False: 0]
  ------------------
 1861|     18|                    bps = 8;
 1862|     18|                    fmt = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|     18|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1863|     18|                    break;
 1864|      0|                default:
  ------------------
  |  Branch (1864:17): [True: 0, False: 18]
  ------------------
 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|     18|            }
 1871|     18|            TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
  ------------------
  |  |  180|     18|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1872|     18|            TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt);
  ------------------
  |  |  333|     18|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
 1873|       |            /*
 1874|       |             * Must recalculate sizes should bits/sample change.
 1875|       |             */
 1876|     18|            tif->tif_dir.td_tilesize =
 1877|     18|                isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)-1;
  ------------------
  |  |  278|     18|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     18|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 11, False: 7]
  |  |  ------------------
  ------------------
 1878|     18|            tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 1879|     18|            return (1);
 1880|      0|        case TIFFTAG_SGILOGENCODE:
  ------------------
  |  |  748|      0|#define TIFFTAG_SGILOGENCODE 65561     /* SGILog data encoding control*/
  ------------------
  |  Branch (1880:9): [True: 0, False: 1.03k]
  ------------------
 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|  1.02k|        default:
  ------------------
  |  Branch (1891:9): [True: 1.02k, False: 18]
  ------------------
 1892|  1.02k|            return (*sp->vsetparent)(tif, tag, ap);
 1893|  1.03k|    }
 1894|  1.03k|}

TIFFInitLZMA:
  505|     20|{
  506|     20|    static const char module[] = "TIFFInitLZMA";
  507|     20|    LZMAState *sp;
  508|     20|    lzma_stream tmp_stream = LZMA_STREAM_INIT;
  509|       |
  510|     20|    (void)scheme;
  511|     20|    assert(scheme == COMPRESSION_LZMA);
  ------------------
  |  Branch (511:5): [True: 0, False: 20]
  |  Branch (511:5): [True: 20, False: 0]
  ------------------
  512|       |
  513|       |    /*
  514|       |     * Merge codec-specific tag information.
  515|       |     */
  516|     20|    if (!_TIFFMergeFields(tif, lzmaFields, TIFFArrayCount(lzmaFields)))
  ------------------
  |  |  339|     20|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (516:9): [True: 0, False: 20]
  ------------------
  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|     20|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZMAState));
  526|     20|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (526:9): [True: 0, False: 20]
  ------------------
  527|      0|        goto bad;
  528|     20|    sp = GetLZMAState(tif);
  ------------------
  |  |   63|     20|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  529|     20|    memcpy(&sp->stream, &tmp_stream, sizeof(lzma_stream));
  530|       |
  531|       |    /*
  532|       |     * Override parent get/set field methods.
  533|       |     */
  534|     20|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  535|     20|    tif->tif_tagmethods.vgetfield = LZMAVGetField; /* hook for codec tags */
  536|     20|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  537|     20|    tif->tif_tagmethods.vsetfield = LZMAVSetField; /* hook for codec tags */
  538|       |
  539|       |    /* Default values for codec-specific fields */
  540|     20|    sp->preset = LZMA_PRESET_DEFAULT; /* default comp. level */
  541|     20|    sp->check = LZMA_CHECK_NONE;
  542|     20|    sp->state = 0;
  543|       |
  544|       |    /* Data filters. So far we are using delta and LZMA2 filters only. */
  545|     20|    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|     20|    sp->opt_delta.dist = (tif->tif_dir.td_bitspersample % 8)
  ------------------
  |  Branch (550:26): [True: 20, False: 0]
  ------------------
  551|     20|                             ? 1
  552|     20|                             : tif->tif_dir.td_bitspersample / 8;
  553|     20|    sp->filters[0].id = LZMA_FILTER_DELTA;
  554|     20|    sp->filters[0].options = &sp->opt_delta;
  555|       |
  556|     20|    lzma_lzma_preset(&sp->opt_lzma, (uint32_t)sp->preset);
  557|     20|    sp->filters[1].id = LZMA_FILTER_LZMA2;
  558|     20|    sp->filters[1].options = &sp->opt_lzma;
  559|       |
  560|     20|    sp->filters[2].id = LZMA_VLI_UNKNOWN;
  561|     20|    sp->filters[2].options = NULL;
  562|       |
  563|       |    /*
  564|       |     * Install codec methods.
  565|       |     */
  566|     20|    tif->tif_fixuptags = LZMAFixupTags;
  567|     20|    tif->tif_setupdecode = LZMASetupDecode;
  568|     20|    tif->tif_predecode = LZMAPreDecode;
  569|     20|    tif->tif_decoderow = LZMADecode;
  570|     20|    tif->tif_decodestrip = LZMADecode;
  571|     20|    tif->tif_decodetile = LZMADecode;
  572|     20|    tif->tif_setupencode = LZMASetupEncode;
  573|     20|    tif->tif_preencode = LZMAPreEncode;
  574|     20|    tif->tif_postencode = LZMAPostEncode;
  575|     20|    tif->tif_encoderow = LZMAEncode;
  576|     20|    tif->tif_encodestrip = LZMAEncode;
  577|     20|    tif->tif_encodetile = LZMAEncode;
  578|     20|    tif->tif_cleanup = LZMACleanup;
  579|     20|    tif->tif_getmaxcompressionratio = LZMAGetMaxCompressionRatio;
  580|       |
  581|       |    /*
  582|       |     * Setup predictor setup.
  583|       |     */
  584|     20|    (void)TIFFPredictorInit(tif);
  585|     20|    return 1;
  586|      0|bad:
  587|      0|    TIFFErrorExtR(tif, module, "No space for LZMA2 state block");
  588|      0|    return 0;
  589|     20|}
tif_lzma.c:LZMAVGetField:
  470|    485|{
  471|    485|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|    485|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  472|       |
  473|    485|    switch (tag)
  474|    485|    {
  475|      0|        case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  751|      0|#define TIFFTAG_LZMAPRESET 65562       /* LZMA2 preset (compression level) */
  ------------------
  |  Branch (475:9): [True: 0, False: 485]
  ------------------
  476|      0|            *va_arg(ap, int *) = sp->preset;
  477|      0|            break;
  478|    485|        default:
  ------------------
  |  Branch (478:9): [True: 485, False: 0]
  ------------------
  479|    485|            return (*sp->vgetparent)(tif, tag, ap);
  480|    485|    }
  481|      0|    return 1;
  482|    485|}
tif_lzma.c:LZMAVSetField:
  443|    354|{
  444|    354|    static const char module[] = "LZMAVSetField";
  445|    354|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|    354|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  446|       |
  447|    354|    switch (tag)
  448|    354|    {
  449|      0|        case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  751|      0|#define TIFFTAG_LZMAPRESET 65562       /* LZMA2 preset (compression level) */
  ------------------
  |  Branch (449:9): [True: 0, False: 354]
  ------------------
  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|    354|        default:
  ------------------
  |  Branch (463:9): [True: 354, False: 0]
  ------------------
  464|    354|            return (*sp->vsetparent)(tif, tag, ap);
  465|    354|    }
  466|       |    /*NOTREACHED*/
  467|    354|}
tif_lzma.c:LZMAStrerror:
   71|    215|{
   72|    215|    switch (ret)
   73|    215|    {
   74|      0|        case LZMA_OK:
  ------------------
  |  Branch (74:9): [True: 0, False: 215]
  ------------------
   75|      0|            return "operation completed successfully";
   76|      0|        case LZMA_STREAM_END:
  ------------------
  |  Branch (76:9): [True: 0, False: 215]
  ------------------
   77|      0|            return "end of stream was reached";
   78|      0|        case LZMA_NO_CHECK:
  ------------------
  |  Branch (78:9): [True: 0, False: 215]
  ------------------
   79|      0|            return "input stream has no integrity check";
   80|      0|        case LZMA_UNSUPPORTED_CHECK:
  ------------------
  |  Branch (80:9): [True: 0, False: 215]
  ------------------
   81|      0|            return "cannot calculate the integrity check";
   82|      0|        case LZMA_GET_CHECK:
  ------------------
  |  Branch (82:9): [True: 0, False: 215]
  ------------------
   83|      0|            return "integrity check type is now available";
   84|      0|        case LZMA_MEM_ERROR:
  ------------------
  |  Branch (84:9): [True: 0, False: 215]
  ------------------
   85|      0|            return "cannot allocate memory";
   86|      0|        case LZMA_MEMLIMIT_ERROR:
  ------------------
  |  Branch (86:9): [True: 0, False: 215]
  ------------------
   87|      0|            return "memory usage limit was reached";
   88|    134|        case LZMA_FORMAT_ERROR:
  ------------------
  |  Branch (88:9): [True: 134, False: 81]
  ------------------
   89|    134|            return "file format not recognized";
   90|      0|        case LZMA_OPTIONS_ERROR:
  ------------------
  |  Branch (90:9): [True: 0, False: 215]
  ------------------
   91|      0|            return "invalid or unsupported options";
   92|      0|        case LZMA_DATA_ERROR:
  ------------------
  |  Branch (92:9): [True: 0, False: 215]
  ------------------
   93|      0|            return "data is corrupt";
   94|     81|        case LZMA_BUF_ERROR:
  ------------------
  |  Branch (94:9): [True: 81, False: 134]
  ------------------
   95|     81|            return "no progress is possible (stream is truncated or corrupt)";
   96|      0|        case LZMA_PROG_ERROR:
  ------------------
  |  Branch (96:9): [True: 0, False: 215]
  ------------------
   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: 215]
  ------------------
  110|      0|            return "unidentified liblzma error";
  111|    215|    }
  112|    215|}
tif_lzma.c:LZMAFixupTags:
  115|     16|{
  116|     16|    (void)tif;
  117|     16|    return 1;
  118|     16|}
tif_lzma.c:LZMASetupDecode:
  121|     13|{
  122|     13|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|     13|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|     13|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  123|       |
  124|     13|    assert(sp != NULL);
  ------------------
  |  Branch (124:5): [True: 0, False: 13]
  |  Branch (124:5): [True: 13, False: 0]
  ------------------
  125|       |
  126|       |    /* if we were last encoding, terminate this mode */
  127|     13|    if (sp->state & LSTATE_INIT_ENCODE)
  ------------------
  |  |   57|     13|#define LSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (127:9): [True: 0, False: 13]
  ------------------
  128|      0|    {
  129|      0|        lzma_end(&sp->stream);
  130|      0|        sp->state = 0;
  131|      0|    }
  132|       |
  133|     13|    sp->state |= LSTATE_INIT_DECODE;
  ------------------
  |  |   56|     13|#define LSTATE_INIT_DECODE 0x01
  ------------------
  134|     13|    return 1;
  135|     13|}
tif_lzma.c:LZMAPreDecode:
  141|    215|{
  142|    215|    static const char module[] = "LZMAPreDecode";
  143|    215|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|    215|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|    215|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  144|    215|    lzma_ret ret;
  145|       |
  146|    215|    (void)s;
  147|    215|    assert(sp != NULL);
  ------------------
  |  Branch (147:5): [True: 0, False: 215]
  |  Branch (147:5): [True: 215, False: 0]
  ------------------
  148|       |
  149|    215|    if ((sp->state & LSTATE_INIT_DECODE) == 0)
  ------------------
  |  |   56|    215|#define LSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (149:9): [True: 0, False: 215]
  ------------------
  150|      0|        tif->tif_setupdecode(tif);
  151|       |
  152|    215|    sp->stream.next_in = tif->tif_rawdata;
  153|    215|    sp->stream.avail_in = (size_t)tif->tif_rawcc;
  154|    215|    if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
  ------------------
  |  Branch (154:9): [True: 0, False: 215]
  ------------------
  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|    215|    ret = lzma_stream_decoder(&sp->stream, (uint64_t)-1, 0);
  166|    215|    if (ret != LZMA_OK)
  ------------------
  |  Branch (166:9): [True: 0, False: 215]
  ------------------
  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|    215|    sp->read_error = 0;
  174|       |
  175|    215|    return 1;
  176|    215|}
tif_lzma.c:LZMADecode:
  179|    217|{
  180|    217|    static const char module[] = "LZMADecode";
  181|    217|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|    217|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|    217|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  182|       |
  183|    217|    (void)s;
  184|    217|    assert(sp != NULL);
  ------------------
  |  Branch (184:5): [True: 0, False: 217]
  |  Branch (184:5): [True: 217, False: 0]
  ------------------
  185|    217|    assert(sp->state == LSTATE_INIT_DECODE);
  ------------------
  |  Branch (185:5): [True: 0, False: 217]
  |  Branch (185:5): [True: 217, False: 0]
  ------------------
  186|       |
  187|    217|    if (sp->read_error)
  ------------------
  |  Branch (187:9): [True: 2, False: 215]
  ------------------
  188|      2|    {
  189|      2|        memset(op, 0, (size_t)occ);
  190|      2|        TIFFErrorExtR(tif, module,
  191|      2|                      "LZMADecode: Scanline %" PRIu32 " cannot be read due to "
  192|      2|                      "previous error",
  193|      2|                      tif->tif_dir.td_row);
  194|      2|        return 0;
  195|      2|    }
  196|       |
  197|    215|    sp->stream.next_in = tif->tif_rawcp;
  198|    215|    sp->stream.avail_in = (size_t)tif->tif_rawcc;
  199|       |
  200|    215|    sp->stream.next_out = op;
  201|    215|    sp->stream.avail_out = (size_t)occ;
  202|    215|    if ((tmsize_t)sp->stream.avail_out != occ)
  ------------------
  |  Branch (202:9): [True: 0, False: 215]
  ------------------
  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|    215|    do
  213|    377|    {
  214|       |        /*
  215|       |         * Save the current stream state to properly recover from the
  216|       |         * decoding errors later.
  217|       |         */
  218|    377|        const uint8_t *next_in = sp->stream.next_in;
  219|    377|        size_t avail_in = sp->stream.avail_in;
  220|       |
  221|    377|        lzma_ret ret = lzma_code(&sp->stream, LZMA_RUN);
  222|    377|        if (ret == LZMA_STREAM_END)
  ------------------
  |  Branch (222:13): [True: 0, False: 377]
  ------------------
  223|      0|            break;
  224|    377|        if (ret == LZMA_MEMLIMIT_ERROR)
  ------------------
  |  Branch (224:13): [True: 0, False: 377]
  ------------------
  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|    377|        if (ret != LZMA_OK)
  ------------------
  |  Branch (241:13): [True: 215, False: 162]
  ------------------
  242|    215|        {
  243|    215|            TIFFErrorExtR(tif, module,
  244|    215|                          "Decoding error at scanline %" PRIu32 ", %s",
  245|    215|                          tif->tif_dir.td_row, LZMAStrerror(ret));
  246|    215|            break;
  247|    215|        }
  248|    377|    } while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (248:14): [True: 162, False: 0]
  ------------------
  249|    215|    if (sp->stream.avail_out != 0)
  ------------------
  |  Branch (249:9): [True: 215, False: 0]
  ------------------
  250|    215|    {
  251|    215|        sp->read_error = 1;
  252|    215|        memset(sp->stream.next_out, 0, sp->stream.avail_out);
  253|    215|        TIFFErrorExtR(tif, module,
  254|    215|                      "Not enough data at scanline %" PRIu32
  255|    215|                      " (short %" TIFF_SIZE_FORMAT " bytes)",
  256|    215|                      tif->tif_dir.td_row, sp->stream.avail_out);
  257|    215|        return 0;
  258|    215|    }
  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|    215|}
tif_lzma.c:LZMACleanup:
  421|     20|{
  422|     20|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|     20|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  423|       |
  424|     20|    assert(sp != 0);
  ------------------
  |  Branch (424:5): [True: 0, False: 20]
  |  Branch (424:5): [True: 20, False: 0]
  ------------------
  425|       |
  426|     20|    (void)TIFFPredictorCleanup(tif);
  427|       |
  428|     20|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
  429|     20|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
  430|       |
  431|     20|    if (sp->state)
  ------------------
  |  Branch (431:9): [True: 12, False: 8]
  ------------------
  432|     12|    {
  433|     12|        lzma_end(&sp->stream);
  434|     12|        sp->state = 0;
  435|     12|    }
  436|     20|    _TIFFfreeExt(tif, sp);
  437|     20|    tif->tif_data = NULL;
  438|       |
  439|     20|    _TIFFSetDefaultCompressionState(tif);
  440|     20|}
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|    470|{
 1412|    470|    static const char module[] = "TIFFInitLZW";
 1413|    470|    (void)scheme;
 1414|    470|    assert(scheme == COMPRESSION_LZW);
  ------------------
  |  Branch (1414:5): [True: 0, False: 470]
  |  Branch (1414:5): [True: 470, False: 0]
  ------------------
 1415|       |    /*
 1416|       |     * Allocate state block so tag methods have storage to record values.
 1417|       |     */
 1418|    470|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZWCodecState));
 1419|    470|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1419:9): [True: 0, False: 470]
  ------------------
 1420|      0|        goto bad;
 1421|    470|    LZWDecoderState(tif)->dec_codetab = NULL;
  ------------------
  |  |  164|    470|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    470|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1422|    470|    LZWDecoderState(tif)->dec_decode = NULL;
  ------------------
  |  |  164|    470|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    470|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1423|    470|    LZWEncoderState(tif)->enc_hashtab = NULL;
  ------------------
  |  |  165|    470|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    470|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1424|    470|    LZWState(tif)->rw_mode = tif->tif_mode;
  ------------------
  |  |  163|    470|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  ------------------
 1425|       |
 1426|       |    /*
 1427|       |     * Install codec methods.
 1428|       |     */
 1429|    470|    tif->tif_fixuptags = LZWFixupTags;
 1430|    470|    tif->tif_setupdecode = LZWSetupDecode;
 1431|    470|    tif->tif_predecode = LZWPreDecode;
 1432|    470|    tif->tif_decoderow = LZWDecode;
 1433|    470|    tif->tif_decodestrip = LZWDecode;
 1434|    470|    tif->tif_decodetile = LZWDecode;
 1435|    470|#ifndef LZW_READ_ONLY
 1436|    470|    tif->tif_setupencode = LZWSetupEncode;
 1437|    470|    tif->tif_preencode = LZWPreEncode;
 1438|    470|    tif->tif_postencode = LZWPostEncode;
 1439|    470|    tif->tif_encoderow = LZWEncode;
 1440|    470|    tif->tif_encodestrip = LZWEncode;
 1441|    470|    tif->tif_encodetile = LZWEncode;
 1442|    470|#endif
 1443|    470|    tif->tif_getmaxcompressionratio = LZWGetMaxCompressionRatio;
 1444|    470|    tif->tif_cleanup = LZWCleanup;
 1445|       |    /*
 1446|       |     * Setup predictor setup.
 1447|       |     */
 1448|    470|    (void)TIFFPredictorInit(tif);
 1449|    470|    return (1);
 1450|      0|bad:
 1451|      0|    TIFFErrorExtR(tif, module, "No space for LZW state block");
 1452|      0|    return (0);
 1453|    470|}
tif_lzw.c:LZWFixupTags:
  177|    449|{
  178|    449|    (void)tif;
  179|    449|    return (1);
  180|    449|}
tif_lzw.c:LZWSetupDecode:
  183|    512|{
  184|    512|    static const char module[] = "LZWSetupDecode";
  185|    512|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|    512|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    512|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  186|    512|    int code;
  187|       |
  188|    512|    if (sp == NULL)
  ------------------
  |  Branch (188:9): [True: 0, False: 512]
  ------------------
  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|    512|    if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (211:9): [True: 435, False: 77]
  ------------------
  212|    435|    {
  213|    435|        sp->dec_codetab = (code_t *)_TIFFmallocExt(tif, CSIZE * sizeof(code_t));
  ------------------
  |  |   79|    435|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|    435|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  214|    435|        if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (214:13): [True: 0, False: 435]
  ------------------
  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|    435|        code = 255;
  223|    435|        do
  224|   111k|        {
  225|   111k|            sp->dec_codetab[code].firstchar = (unsigned char)code;
  226|   111k|            sp->dec_codetab[code].value = (unsigned char)code;
  227|   111k|            sp->dec_codetab[code].repeated = true;
  228|   111k|            sp->dec_codetab[code].length = 1;
  229|   111k|            sp->dec_codetab[code].next = NULL;
  230|   111k|        } while (code--);
  ------------------
  |  Branch (230:18): [True: 110k, False: 435]
  ------------------
  231|       |        /*
  232|       |         * Zero-out the unused entries  */
  233|       |        /* Silence false positive */
  234|       |        /* coverity[overrun-buffer-arg] */
  235|    435|        memset(&sp->dec_codetab[CODE_CLEAR], 0,
  ------------------
  |  |   71|    435|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  236|    435|               (CODE_FIRST - CODE_CLEAR) * sizeof(code_t));
  ------------------
  |  |   73|    435|#define CODE_FIRST 258 /* first free code entry */
  ------------------
                             (CODE_FIRST - CODE_CLEAR) * sizeof(code_t));
  ------------------
  |  |   71|    435|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  237|    435|    }
  238|    512|    return (1);
  239|    512|}
tif_lzw.c:LZWPreDecode:
  245|  17.2k|{
  246|  17.2k|    static const char module[] = "LZWPreDecode";
  247|  17.2k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  17.2k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  17.2k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  248|       |
  249|  17.2k|    (void)s;
  250|  17.2k|    assert(sp != NULL);
  ------------------
  |  Branch (250:5): [True: 0, False: 17.2k]
  |  Branch (250:5): [True: 17.2k, False: 0]
  ------------------
  251|  17.2k|    if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (251:9): [True: 0, False: 17.2k]
  ------------------
  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|  17.2k|    if (tif->tif_rawcc >= 2 && tif->tif_rawdata[0] == 0 &&
  ------------------
  |  Branch (261:9): [True: 15.7k, False: 1.43k]
  |  Branch (261:32): [True: 3.51k, False: 12.2k]
  ------------------
  262|  3.51k|        (tif->tif_rawdata[1] & 0x1))
  ------------------
  |  Branch (262:9): [True: 1.85k, False: 1.65k]
  ------------------
  263|  1.85k|    {
  264|  1.85k|#ifdef LZW_COMPAT
  265|  1.85k|        if (!sp->dec_decode)
  ------------------
  |  Branch (265:13): [True: 76, False: 1.78k]
  ------------------
  266|     76|        {
  267|     76|            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|     76|            tif->tif_decoderow = LZWDecodeCompat;
  276|     76|            tif->tif_decodestrip = LZWDecodeCompat;
  277|     76|            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|     76|            (*tif->tif_setupdecode)(tif);
  284|     76|            sp->dec_decode = LZWDecodeCompat;
  285|     76|        }
  286|  1.85k|        sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |  103|  1.85k|#define lzw_maxcode base.maxcode
  ------------------
                      sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  1.85k|#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.85k|    }
  296|  15.3k|    else
  297|  15.3k|    {
  298|  15.3k|        sp->lzw_maxcode = MAXCODE(BITS_MIN) - 1;
  ------------------
  |  |  103|  15.3k|#define lzw_maxcode base.maxcode
  ------------------
                      sp->lzw_maxcode = MAXCODE(BITS_MIN) - 1;
  ------------------
  |  |   63|  15.3k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  299|  15.3k|        sp->dec_decode = LZWDecode;
  300|  15.3k|    }
  301|  17.2k|    sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |  102|  17.2k|#define lzw_nbits base.nbits
  ------------------
                  sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |   68|  17.2k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  302|  17.2k|    sp->lzw_nextbits = 0;
  ------------------
  |  |  106|  17.2k|#define lzw_nextbits base.nextbits
  ------------------
  303|  17.2k|    sp->lzw_nextdata = 0;
  ------------------
  |  |  105|  17.2k|#define lzw_nextdata base.nextdata
  ------------------
  304|       |
  305|  17.2k|    sp->dec_restart = 0;
  306|  17.2k|    sp->dec_nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  17.2k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  307|  17.2k|    sp->dec_bitsleft = 0;
  308|  17.2k|    sp->old_tif_rawcc = 0;
  309|  17.2k|    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|  17.2k|    sp->dec_oldcodep = &sp->dec_codetab[0];
  318|  17.2k|    sp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask - 1];
  319|  17.2k|    sp->read_error = 0;
  320|  17.2k|    return (1);
  321|  17.2k|}
tif_lzw.c:LZWDecodeCompat:
  800|  11.0k|{
  801|  11.0k|    static const char module[] = "LZWDecodeCompat";
  802|  11.0k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  11.0k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  11.0k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  803|  11.0k|    uint8_t *op = (uint8_t *)op0;
  804|  11.0k|    tmsize_t occ = occ0;
  805|  11.0k|    uint8_t *tp;
  806|  11.0k|    uint8_t *bp;
  807|  11.0k|    int code, nbits;
  808|  11.0k|    int len;
  809|  11.0k|    long nextbits, nbitsmask;
  810|  11.0k|    WordType nextdata;
  811|  11.0k|    code_t *codep, *free_entp, *maxcodep, *oldcodep;
  812|       |
  813|  11.0k|    (void)s;
  814|  11.0k|    assert(sp != NULL);
  ------------------
  |  Branch (814:5): [True: 0, False: 11.0k]
  |  Branch (814:5): [True: 11.0k, False: 0]
  ------------------
  815|       |
  816|       |    /*
  817|       |     * Restart interrupted output operation.
  818|       |     */
  819|  11.0k|    if (sp->dec_restart)
  ------------------
  |  Branch (819:9): [True: 2.73k, False: 8.34k]
  ------------------
  820|  2.73k|    {
  821|  2.73k|        tmsize_t residue;
  822|       |
  823|  2.73k|        codep = sp->dec_codep;
  824|  2.73k|        residue = codep->length - sp->dec_restart;
  825|  2.73k|        if (residue > occ)
  ------------------
  |  Branch (825:13): [True: 979, False: 1.76k]
  ------------------
  826|    979|        {
  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|    979|            sp->dec_restart += occ;
  834|    979|            do
  835|  1.30k|            {
  836|  1.30k|                codep = codep->next;
  837|  1.30k|            } while (--residue > occ);
  ------------------
  |  Branch (837:22): [True: 326, False: 979]
  ------------------
  838|    979|            tp = op + occ;
  839|    979|            do
  840|  1.10k|            {
  841|  1.10k|                *--tp = codep->value;
  842|  1.10k|                codep = codep->next;
  843|  1.10k|            } while (--occ);
  ------------------
  |  Branch (843:22): [True: 122, False: 979]
  ------------------
  844|    979|            return (1);
  845|    979|        }
  846|       |        /*
  847|       |         * Residue satisfies only part of the decode request.
  848|       |         */
  849|  1.76k|        op += residue;
  850|  1.76k|        occ -= residue;
  851|  1.76k|        tp = op;
  852|  1.76k|        do
  853|  2.24k|        {
  854|  2.24k|            *--tp = codep->value;
  855|  2.24k|            codep = codep->next;
  856|  2.24k|        } while (--residue);
  ------------------
  |  Branch (856:18): [True: 485, False: 1.76k]
  ------------------
  857|  1.76k|        sp->dec_restart = 0;
  858|  1.76k|    }
  859|       |
  860|  10.1k|    bp = (uint8_t *)tif->tif_rawcp;
  861|       |
  862|  10.1k|    sp->dec_bitsleft +=
  863|  10.1k|        (((uint64_t)tif->tif_rawcc - (uint64_t)sp->old_tif_rawcc) << 3);
  864|  10.1k|    uint64_t dec_bitsleft = sp->dec_bitsleft;
  865|       |
  866|  10.1k|    nbits = sp->lzw_nbits;
  ------------------
  |  |  102|  10.1k|#define lzw_nbits base.nbits
  ------------------
  867|  10.1k|    nextdata = sp->lzw_nextdata;
  ------------------
  |  |  105|  10.1k|#define lzw_nextdata base.nextdata
  ------------------
  868|  10.1k|    nextbits = sp->lzw_nextbits;
  ------------------
  |  |  106|  10.1k|#define lzw_nextbits base.nextbits
  ------------------
  869|  10.1k|    nbitsmask = sp->dec_nbitsmask;
  870|  10.1k|    oldcodep = sp->dec_oldcodep;
  871|  10.1k|    free_entp = sp->dec_free_entp;
  872|  10.1k|    maxcodep = sp->dec_maxcodep;
  873|       |
  874|  86.3k|    while (occ > 0)
  ------------------
  |  Branch (874:12): [True: 81.3k, False: 5.01k]
  ------------------
  875|  81.3k|    {
  876|  81.3k|        NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  766|  81.3k|    {                                                                          \
  |  |  767|  81.3k|        if (dec_bitsleft < (uint64_t)nbits)                                    \
  |  |  ------------------
  |  |  |  Branch (767:13): [True: 357, False: 80.9k]
  |  |  ------------------
  |  |  768|  81.3k|        {                                                                      \
  |  |  769|    357|            TIFFWarningExtR(_tif, module,                                      \
  |  |  770|    357|                            "LZWDecode: Strip %" PRIu32                        \
  |  |  771|    357|                            " not terminated with EOI code",                   \
  |  |  772|    357|                            _tif->tif_dir.td_curstrip);                        \
  |  |  773|    357|            _code = CODE_EOI;                                                  \
  |  |  ------------------
  |  |  |  |   72|    357|#define CODE_EOI 257   /* end-of-information code */
  |  |  ------------------
  |  |  774|    357|        }                                                                      \
  |  |  775|  81.3k|        else                                                                   \
  |  |  776|  81.3k|        {                                                                      \
  |  |  777|  80.9k|            _get(_sp, _bp, _code);                                             \
  |  |  ------------------
  |  |  |  |  876|  80.9k|        NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  786|  80.9k|    {                                                                          \
  |  |  |  |  |  |  787|  80.9k|        nextdata |= (unsigned long)*(bp)++ << nextbits;                        \
  |  |  |  |  |  |  788|  80.9k|        nextbits += 8;                                                         \
  |  |  |  |  |  |  789|  80.9k|        if (nextbits < nbits)                                                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (789:13): [True: 25.4k, False: 55.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  80.9k|        {                                                                      \
  |  |  |  |  |  |  791|  25.4k|            nextdata |= (unsigned long)*(bp)++ << nextbits;                    \
  |  |  |  |  |  |  792|  25.4k|            nextbits += 8;                                                     \
  |  |  |  |  |  |  793|  25.4k|        }                                                                      \
  |  |  |  |  |  |  794|  80.9k|        code = (hcode_t)(nextdata & (unsigned long)nbitsmask);                 \
  |  |  |  |  |  |  795|  80.9k|        nextdata >>= nbits;                                                    \
  |  |  |  |  |  |  796|  80.9k|        nextbits -= nbits;                                                     \
  |  |  |  |  |  |  797|  80.9k|    }
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  778|  80.9k|            dec_bitsleft -= (uint64_t)nbits;                                   \
  |  |  779|  80.9k|        }                                                                      \
  |  |  780|  81.3k|    }
  ------------------
  877|  81.3k|        if (code == CODE_EOI)
  ------------------
  |  |   72|  81.3k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (877:13): [True: 376, False: 80.9k]
  ------------------
  878|    376|            break;
  879|  80.9k|        if (code == CODE_CLEAR)
  ------------------
  |  |   71|  80.9k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (879:13): [True: 1.60k, False: 79.3k]
  ------------------
  880|  1.60k|        {
  881|  1.60k|            do
  882|  1.78k|            {
  883|  1.78k|                free_entp = sp->dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  1.78k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  884|  1.78k|                _TIFFmemset(free_entp, 0,
  885|  1.78k|                            (CSIZE - CODE_FIRST) * sizeof(code_t));
  ------------------
  |  |   79|  1.78k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  1.78k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
                                          (CSIZE - CODE_FIRST) * sizeof(code_t));
  ------------------
  |  |   73|  1.78k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  886|  1.78k|                nbits = BITS_MIN;
  ------------------
  |  |   68|  1.78k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  887|  1.78k|                nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  1.78k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  888|  1.78k|                maxcodep = sp->dec_codetab + nbitsmask;
  889|  1.78k|                NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  766|  1.78k|    {                                                                          \
  |  |  767|  1.78k|        if (dec_bitsleft < (uint64_t)nbits)                                    \
  |  |  ------------------
  |  |  |  Branch (767:13): [True: 231, False: 1.54k]
  |  |  ------------------
  |  |  768|  1.78k|        {                                                                      \
  |  |  769|    231|            TIFFWarningExtR(_tif, module,                                      \
  |  |  770|    231|                            "LZWDecode: Strip %" PRIu32                        \
  |  |  771|    231|                            " not terminated with EOI code",                   \
  |  |  772|    231|                            _tif->tif_dir.td_curstrip);                        \
  |  |  773|    231|            _code = CODE_EOI;                                                  \
  |  |  ------------------
  |  |  |  |   72|    231|#define CODE_EOI 257   /* end-of-information code */
  |  |  ------------------
  |  |  774|    231|        }                                                                      \
  |  |  775|  1.78k|        else                                                                   \
  |  |  776|  1.78k|        {                                                                      \
  |  |  777|  1.54k|            _get(_sp, _bp, _code);                                             \
  |  |  ------------------
  |  |  |  |  889|  1.54k|                NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  786|  1.54k|    {                                                                          \
  |  |  |  |  |  |  787|  1.54k|        nextdata |= (unsigned long)*(bp)++ << nextbits;                        \
  |  |  |  |  |  |  788|  1.54k|        nextbits += 8;                                                         \
  |  |  |  |  |  |  789|  1.54k|        if (nextbits < nbits)                                                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (789:13): [True: 164, False: 1.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  1.54k|        {                                                                      \
  |  |  |  |  |  |  791|    164|            nextdata |= (unsigned long)*(bp)++ << nextbits;                    \
  |  |  |  |  |  |  792|    164|            nextbits += 8;                                                     \
  |  |  |  |  |  |  793|    164|        }                                                                      \
  |  |  |  |  |  |  794|  1.54k|        code = (hcode_t)(nextdata & (unsigned long)nbitsmask);                 \
  |  |  |  |  |  |  795|  1.54k|        nextdata >>= nbits;                                                    \
  |  |  |  |  |  |  796|  1.54k|        nextbits -= nbits;                                                     \
  |  |  |  |  |  |  797|  1.54k|    }
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  778|  1.54k|            dec_bitsleft -= (uint64_t)nbits;                                   \
  |  |  779|  1.54k|        }                                                                      \
  |  |  780|  1.78k|    }
  ------------------
  890|  1.78k|            } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  1.78k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (890:22): [True: 180, False: 1.60k]
  ------------------
  891|  1.60k|            if (code == CODE_EOI)
  ------------------
  |  |   72|  1.60k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (891:17): [True: 384, False: 1.21k]
  ------------------
  892|    384|                break;
  893|  1.21k|            if (code > CODE_CLEAR)
  ------------------
  |  |   71|  1.21k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (893:17): [True: 196, False: 1.02k]
  ------------------
  894|    196|            {
  895|    196|                TIFFErrorExtR(
  896|    196|                    tif, tif->tif_name,
  897|    196|                    "LZWDecode: Corrupted LZW table at scanline %" PRIu32,
  898|    196|                    tif->tif_dir.td_row);
  899|    196|                return (0);
  900|    196|            }
  901|  1.02k|            *op++ = (uint8_t)code;
  902|  1.02k|            occ--;
  903|  1.02k|            oldcodep = sp->dec_codetab + code;
  904|  1.02k|            continue;
  905|  1.21k|        }
  906|  79.3k|        codep = sp->dec_codetab + code;
  907|       |
  908|       |        /*
  909|       |         * Add the new entry to the code table.
  910|       |         */
  911|  79.3k|        if (free_entp < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (911:13): [True: 2.04k, False: 77.3k]
  ------------------
  912|  77.3k|            free_entp >= &sp->dec_codetab[CSIZE])
  ------------------
  |  |   79|  77.3k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  77.3k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (912:13): [True: 1, False: 77.3k]
  ------------------
  913|  2.04k|        {
  914|  2.04k|            TIFFErrorExtR(tif, module,
  915|  2.04k|                          "Corrupted LZW table at scanline %" PRIu32,
  916|  2.04k|                          tif->tif_dir.td_row);
  917|  2.04k|            return (0);
  918|  2.04k|        }
  919|       |
  920|  77.3k|        free_entp->next = oldcodep;
  921|  77.3k|        if (free_entp->next < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (921:13): [True: 0, False: 77.3k]
  ------------------
  922|  77.3k|            free_entp->next >= &sp->dec_codetab[CSIZE])
  ------------------
  |  |   79|  77.3k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  77.3k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (922:13): [True: 0, False: 77.3k]
  ------------------
  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|  77.3k|        free_entp->firstchar = free_entp->next->firstchar;
  930|  77.3k|        free_entp->length = (uint16_t)(free_entp->next->length + 1);
  931|  77.3k|        free_entp->value =
  932|  77.3k|            (codep < free_entp) ? codep->firstchar : free_entp->firstchar;
  ------------------
  |  Branch (932:13): [True: 77.2k, False: 97]
  ------------------
  933|  77.3k|        if (++free_entp > maxcodep)
  ------------------
  |  Branch (933:13): [True: 5.44k, False: 71.8k]
  ------------------
  934|  5.44k|        {
  935|  5.44k|            if (++nbits > BITS_MAX) /* should not happen */
  ------------------
  |  |   69|  5.44k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (935:17): [True: 5.37k, False: 72]
  ------------------
  936|  5.37k|                nbits = BITS_MAX;
  ------------------
  |  |   69|  5.37k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  937|  5.44k|            nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  5.44k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  938|  5.44k|            maxcodep = sp->dec_codetab + nbitsmask;
  939|  5.44k|        }
  940|  77.3k|        oldcodep = codep;
  941|  77.3k|        if (code >= 256)
  ------------------
  |  Branch (941:13): [True: 4.14k, False: 73.1k]
  ------------------
  942|  4.14k|        {
  943|       |            /*
  944|       |             * Code maps to a string, copy string
  945|       |             * value to output (written in reverse).
  946|       |             */
  947|  4.14k|            if (codep->length == 0)
  ------------------
  |  Branch (947:17): [True: 97, False: 4.05k]
  ------------------
  948|     97|            {
  949|     97|                TIFFErrorExtR(
  950|     97|                    tif, module,
  951|     97|                    "Wrong length of decoded "
  952|     97|                    "string: data probably corrupted at scanline %" PRIu32,
  953|     97|                    tif->tif_dir.td_row);
  954|     97|                return (0);
  955|     97|            }
  956|  4.05k|            if (codep->length > occ)
  ------------------
  |  Branch (956:17): [True: 1.99k, False: 2.05k]
  ------------------
  957|  1.99k|            {
  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.99k|                sp->dec_codep = codep;
  965|  1.99k|                do
  966|  3.59k|                {
  967|  3.59k|                    codep = codep->next;
  968|  3.59k|                } while (codep->length > occ);
  ------------------
  |  Branch (968:26): [True: 1.59k, False: 1.99k]
  ------------------
  969|  1.99k|                sp->dec_restart = occ;
  970|  1.99k|                tp = op + occ;
  971|  1.99k|                do
  972|  2.52k|                {
  973|  2.52k|                    *--tp = codep->value;
  974|  2.52k|                    codep = codep->next;
  975|  2.52k|                } while (--occ);
  ------------------
  |  Branch (975:26): [True: 530, False: 1.99k]
  ------------------
  976|  1.99k|                break;
  977|  1.99k|            }
  978|  2.05k|            len = codep->length;
  979|  2.05k|            tp = op + len;
  980|  2.05k|            do
  981|  4.68k|            {
  982|  4.68k|                *--tp = codep->value;
  983|  4.68k|                codep = codep->next;
  984|  4.68k|            } while (codep && tp > op);
  ------------------
  |  Branch (984:22): [True: 2.63k, False: 2.05k]
  |  Branch (984:31): [True: 2.63k, False: 0]
  ------------------
  985|  2.05k|            assert(occ >= len);
  ------------------
  |  Branch (985:13): [True: 0, False: 2.05k]
  |  Branch (985:13): [True: 2.05k, False: 0]
  ------------------
  986|  2.05k|            op += len;
  987|  2.05k|            occ -= len;
  988|  2.05k|        }
  989|  73.1k|        else
  990|  73.1k|        {
  991|  73.1k|            *op++ = (uint8_t)code;
  992|  73.1k|            occ--;
  993|  73.1k|        }
  994|  77.3k|    }
  995|       |
  996|  7.77k|    tif->tif_rawcc -= (tmsize_t)((uint8_t *)bp - tif->tif_rawcp);
  997|  7.77k|    tif->tif_rawcp = (uint8_t *)bp;
  998|       |
  999|  7.77k|    sp->old_tif_rawcc = tif->tif_rawcc;
 1000|  7.77k|    sp->dec_bitsleft = dec_bitsleft;
 1001|       |
 1002|  7.77k|    sp->lzw_nbits = (unsigned short)nbits;
  ------------------
  |  |  102|  7.77k|#define lzw_nbits base.nbits
  ------------------
 1003|  7.77k|    sp->lzw_nextdata = nextdata;
  ------------------
  |  |  105|  7.77k|#define lzw_nextdata base.nextdata
  ------------------
 1004|  7.77k|    sp->lzw_nextbits = nextbits;
  ------------------
  |  |  106|  7.77k|#define lzw_nextbits base.nextbits
  ------------------
 1005|  7.77k|    sp->dec_nbitsmask = nbitsmask;
 1006|  7.77k|    sp->dec_oldcodep = oldcodep;
 1007|  7.77k|    sp->dec_free_entp = free_entp;
 1008|  7.77k|    sp->dec_maxcodep = maxcodep;
 1009|       |
 1010|  7.77k|    if (occ > 0)
  ------------------
  |  Branch (1010:9): [True: 760, False: 7.01k]
  ------------------
 1011|    760|    {
 1012|    760|        TIFFErrorExtR(tif, module,
 1013|    760|                      "Not enough data at scanline %" PRIu32 " (short %" PRIu64
 1014|    760|                      " bytes)",
 1015|    760|                      tif->tif_dir.td_row, (uint64_t)occ);
 1016|    760|        return (0);
 1017|    760|    }
 1018|  7.01k|    return (1);
 1019|  7.77k|}
tif_lzw.c:LZWDecode:
  403|  18.0k|{
  404|  18.0k|    static const char module[] = "LZWDecode";
  405|  18.0k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  18.0k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  18.0k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  406|  18.0k|    uint8_t *op = (uint8_t *)op0;
  407|  18.0k|    tmsize_t occ = occ0;
  408|  18.0k|    uint8_t *bp;
  409|  18.0k|    long nbits, nextbits, nbitsmask;
  410|  18.0k|    WordType nextdata;
  411|  18.0k|    code_t *free_entp, *maxcodep, *oldcodep;
  412|       |
  413|  18.0k|    (void)s;
  414|  18.0k|    assert(sp != NULL);
  ------------------
  |  Branch (414:5): [True: 0, False: 18.0k]
  |  Branch (414:5): [True: 18.0k, False: 0]
  ------------------
  415|  18.0k|    assert(sp->dec_codetab != NULL);
  ------------------
  |  Branch (415:5): [True: 0, False: 18.0k]
  |  Branch (415:5): [True: 18.0k, False: 0]
  ------------------
  416|       |
  417|  18.0k|    if (sp->read_error)
  ------------------
  |  Branch (417:9): [True: 39, False: 17.9k]
  ------------------
  418|     39|    {
  419|     39|        memset(op, 0, (size_t)occ);
  420|     39|        TIFFErrorExtR(tif, module,
  421|     39|                      "LZWDecode: Scanline %" PRIu32 " cannot be read due to "
  422|     39|                      "previous error",
  423|     39|                      tif->tif_dir.td_row);
  424|     39|        return 0;
  425|     39|    }
  426|       |
  427|       |    /*
  428|       |     * Restart interrupted output operation.
  429|       |     */
  430|  17.9k|    if (sp->dec_restart)
  ------------------
  |  Branch (430:9): [True: 1.80k, False: 16.1k]
  ------------------
  431|  1.80k|    {
  432|  1.80k|        tmsize_t residue;
  433|       |
  434|  1.80k|        code_t *codep = sp->dec_codep;
  435|  1.80k|        residue = codep->length - sp->dec_restart;
  436|  1.80k|        if (residue > occ)
  ------------------
  |  Branch (436:13): [True: 407, False: 1.40k]
  ------------------
  437|    407|        {
  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|    407|            sp->dec_restart += occ;
  445|    407|            do
  446|    744|            {
  447|    744|                codep = codep->next;
  448|    744|            } while (--residue > occ && codep);
  ------------------
  |  Branch (448:22): [True: 337, False: 407]
  |  Branch (448:41): [True: 337, False: 0]
  ------------------
  449|    407|            if (codep)
  ------------------
  |  Branch (449:17): [True: 407, False: 0]
  ------------------
  450|    407|            {
  451|    407|                uint8_t *tp = op + occ;
  452|    407|                do
  453|    723|                {
  454|    723|                    *--tp = codep->value;
  455|    723|                    codep = codep->next;
  456|    723|                } while (--occ && codep);
  ------------------
  |  Branch (456:26): [True: 316, False: 407]
  |  Branch (456:35): [True: 316, False: 0]
  ------------------
  457|    407|            }
  458|    407|            return (1);
  459|    407|        }
  460|       |        /*
  461|       |         * Residue satisfies only part of the decode request.
  462|       |         */
  463|  1.40k|        op += residue;
  464|  1.40k|        occ -= residue;
  465|  1.40k|        uint8_t *tp = op;
  466|  1.40k|        do
  467|  2.64k|        {
  468|  2.64k|            *--tp = codep->value;
  469|  2.64k|            codep = codep->next;
  470|  2.64k|        } while (--residue && codep);
  ------------------
  |  Branch (470:18): [True: 1.24k, False: 1.40k]
  |  Branch (470:31): [True: 1.24k, False: 0]
  ------------------
  471|  1.40k|        sp->dec_restart = 0;
  472|  1.40k|    }
  473|       |
  474|  17.5k|    bp = (uint8_t *)tif->tif_rawcp;
  475|  17.5k|    sp->dec_bitsleft +=
  476|  17.5k|        (((uint64_t)tif->tif_rawcc - (uint64_t)sp->old_tif_rawcc) << 3);
  477|  17.5k|    uint64_t dec_bitsleft = sp->dec_bitsleft;
  478|  17.5k|    nbits = sp->lzw_nbits;
  ------------------
  |  |  102|  17.5k|#define lzw_nbits base.nbits
  ------------------
  479|  17.5k|    nextdata = sp->lzw_nextdata;
  ------------------
  |  |  105|  17.5k|#define lzw_nextdata base.nextdata
  ------------------
  480|  17.5k|    nextbits = sp->lzw_nextbits;
  ------------------
  |  |  106|  17.5k|#define lzw_nextbits base.nextbits
  ------------------
  481|  17.5k|    nbitsmask = sp->dec_nbitsmask;
  482|  17.5k|    oldcodep = sp->dec_oldcodep;
  483|  17.5k|    free_entp = sp->dec_free_entp;
  484|  17.5k|    maxcodep = sp->dec_maxcodep;
  485|  17.5k|    code_t *const dec_codetab = sp->dec_codetab;
  486|  17.5k|    code_t *codep;
  487|       |
  488|  17.5k|    if (occ == 0)
  ------------------
  |  Branch (488:9): [True: 433, False: 17.1k]
  ------------------
  489|    433|    {
  490|    433|        goto after_loop;
  491|    433|    }
  492|       |
  493|   312k|begin:
  494|   312k|{
  495|   312k|    WordType code;
  496|   312k|    GetNextCodeLZW();
  ------------------
  |  |  362|   312k|    do                                                                         \
  |  |  363|   312k|    {                                                                          \
  |  |  364|   312k|        nextbits -= nbits;                                                     \
  |  |  365|   312k|        if (nextbits < 0)                                                      \
  |  |  ------------------
  |  |  |  Branch (365:13): [True: 59.6k, False: 252k]
  |  |  ------------------
  |  |  366|   312k|        {                                                                      \
  |  |  367|  59.6k|            if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE)                           \
  |  |  ------------------
  |  |  |  |   45|  59.6k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  59.6k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (367:17): [True: 55.9k, False: 3.69k]
  |  |  ------------------
  |  |  368|  59.6k|            {                                                                  \
  |  |  369|  55.9k|                unsigned codetmp = (unsigned)(nextdata << (-nextbits));        \
  |  |  370|  55.9k|                GetNextData(nextdata, bp);                                     \
  |  |  ------------------
  |  |  |  |  335|  55.9k|    memcpy(&nextdata, bp, sizeof(nextdata));                                   \
  |  |  |  |  336|  55.9k|    nextdata = __builtin_bswap64(nextdata)
  |  |  ------------------
  |  |  371|  55.9k|                bp += SIZEOF_WORDTYPE;                                         \
  |  |  ------------------
  |  |  |  |   45|  55.9k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  55.9k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  55.9k|                nextbits += 8 * SIZEOF_WORDTYPE;                               \
  |  |  ------------------
  |  |  |  |   45|  55.9k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  55.9k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|  55.9k|                dec_bitsleft -= 8 * SIZEOF_WORDTYPE;                           \
  |  |  ------------------
  |  |  |  |   45|  55.9k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  55.9k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|  55.9k|                code = (WordType)((codetmp | (nextdata >> nextbits)) &         \
  |  |  375|  55.9k|                                  (WordType)nbitsmask);                        \
  |  |  376|  55.9k|                break;                                                         \
  |  |  377|  55.9k|            }                                                                  \
  |  |  378|  59.6k|            else                                                               \
  |  |  379|  59.6k|            {                                                                  \
  |  |  380|  3.69k|                if (dec_bitsleft < 8)                                          \
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 543, False: 3.15k]
  |  |  ------------------
  |  |  381|  3.69k|                {                                                              \
  |  |  382|    543|                    goto no_eoi;                                               \
  |  |  383|    543|                }                                                              \
  |  |  384|  3.69k|                nextdata = (nextdata << 8) | *(bp)++;                          \
  |  |  385|  3.15k|                nextbits += 8;                                                 \
  |  |  386|  3.15k|                dec_bitsleft -= 8;                                             \
  |  |  387|  3.15k|                if (nextbits < 0)                                              \
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 1.98k, False: 1.17k]
  |  |  ------------------
  |  |  388|  3.15k|                {                                                              \
  |  |  389|  1.98k|                    if (dec_bitsleft < 8)                                      \
  |  |  ------------------
  |  |  |  Branch (389:25): [True: 1.15k, False: 828]
  |  |  ------------------
  |  |  390|  1.98k|                    {                                                          \
  |  |  391|  1.15k|                        goto no_eoi;                                           \
  |  |  392|  1.15k|                    }                                                          \
  |  |  393|  1.98k|                    nextdata = (nextdata << 8) | *(bp)++;                      \
  |  |  394|    828|                    nextbits += 8;                                             \
  |  |  395|    828|                    dec_bitsleft -= 8;                                         \
  |  |  396|    828|                }                                                              \
  |  |  397|  3.15k|            }                                                                  \
  |  |  398|  59.6k|        }                                                                      \
  |  |  399|   312k|        code = (WordType)((nextdata >> nextbits) & (WordType)nbitsmask);       \
  |  |  400|   254k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (400:14): [Folded, False: 254k]
  |  |  ------------------
  ------------------
  497|   310k|    codep = dec_codetab + (unsigned long)code;
  498|   310k|    if (code >= CODE_FIRST)
  ------------------
  |  |   73|   310k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  |  Branch (498:9): [True: 94.8k, False: 215k]
  ------------------
  499|  94.8k|        goto code_above_or_equal_to_258;
  500|   215k|    if (code < 256)
  ------------------
  |  Branch (500:9): [True: 209k, False: 6.09k]
  ------------------
  501|   209k|        goto code_below_256;
  502|  6.09k|    if (code == CODE_EOI)
  ------------------
  |  |   72|  6.09k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (502:9): [True: 44, False: 6.05k]
  ------------------
  503|     44|        goto after_loop;
  504|  6.05k|    goto code_clear;
  505|       |
  506|   209k|code_below_256:
  507|   209k|{
  508|   209k|    if (codep > free_entp)
  ------------------
  |  Branch (508:9): [True: 6.92k, False: 202k]
  ------------------
  509|  6.92k|        goto error_code;
  510|   202k|    free_entp->next = oldcodep;
  511|   202k|    free_entp->firstchar = oldcodep->firstchar;
  512|   202k|    free_entp->length = (uint16_t)(oldcodep->length + 1);
  513|   202k|    free_entp->value = (uint8_t)code;
  514|   202k|    free_entp->repeated =
  515|   202k|        (bool)(oldcodep->repeated & (oldcodep->value == code));
  516|   202k|    if (++free_entp > maxcodep)
  ------------------
  |  Branch (516:9): [True: 4.68k, False: 198k]
  ------------------
  517|  4.68k|    {
  518|  4.68k|        if (++nbits > BITS_MAX) /* should not happen for a conformant encoder */
  ------------------
  |  |   69|  4.68k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (518:13): [True: 4.57k, False: 112]
  ------------------
  519|  4.57k|            nbits = BITS_MAX;
  ------------------
  |  |   69|  4.57k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  520|  4.68k|        nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  4.68k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  521|  4.68k|        maxcodep = dec_codetab + nbitsmask - 1;
  522|  4.68k|        if (free_entp >= &dec_codetab[CSIZE])
  ------------------
  |  |   79|  4.68k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  4.68k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (522:13): [True: 1, False: 4.68k]
  ------------------
  523|      1|        {
  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|      1|            free_entp = dec_codetab - 1;
  529|      1|        }
  530|  4.68k|    }
  531|   202k|    oldcodep = codep;
  532|   202k|    *op++ = (uint8_t)code;
  533|   202k|    occ--;
  534|   202k|    if (occ == 0)
  ------------------
  |  Branch (534:9): [True: 1.72k, False: 201k]
  ------------------
  535|  1.72k|        goto after_loop;
  536|   201k|    goto begin;
  537|   202k|}
  538|       |
  539|   201k|code_above_or_equal_to_258:
  540|  94.8k|{
  541|       |    /*
  542|       |     * Add the new entry to the code table.
  543|       |     */
  544|       |
  545|  94.8k|    if (codep >= free_entp)
  ------------------
  |  Branch (545:9): [True: 10.8k, False: 84.0k]
  ------------------
  546|  10.8k|    {
  547|  10.8k|        if (codep != free_entp)
  ------------------
  |  Branch (547:13): [True: 2.28k, False: 8.58k]
  ------------------
  548|  2.28k|            goto error_code;
  549|  8.58k|        free_entp->value = oldcodep->firstchar;
  550|  8.58k|    }
  551|  84.0k|    else
  552|  84.0k|    {
  553|  84.0k|        free_entp->value = codep->firstchar;
  554|  84.0k|    }
  555|  92.6k|    free_entp->repeated =
  556|  92.6k|        (bool)(oldcodep->repeated & (oldcodep->value == free_entp->value));
  557|  92.6k|    free_entp->next = oldcodep;
  558|       |
  559|  92.6k|    free_entp->firstchar = oldcodep->firstchar;
  560|  92.6k|    free_entp->length = (uint16_t)(oldcodep->length + 1);
  561|  92.6k|    if (++free_entp > maxcodep)
  ------------------
  |  Branch (561:9): [True: 787, False: 91.8k]
  ------------------
  562|    787|    {
  563|    787|        if (++nbits > BITS_MAX) /* should not happen for a conformant encoder */
  ------------------
  |  |   69|    787|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (563:13): [True: 749, False: 38]
  ------------------
  564|    749|            nbits = BITS_MAX;
  ------------------
  |  |   69|    749|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  565|    787|        nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|    787|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  566|    787|        maxcodep = dec_codetab + nbitsmask - 1;
  567|    787|        if (free_entp >= &dec_codetab[CSIZE])
  ------------------
  |  |   79|    787|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|    787|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (567:13): [True: 1, False: 786]
  ------------------
  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|    787|    }
  576|  92.6k|    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|  92.6k|    unsigned short len = codep->length;
  584|       |
  585|  92.6k|    if (len < 3) /* equivalent to len == 2 given all other conditions */
  ------------------
  |  Branch (585:9): [True: 45.6k, False: 46.9k]
  ------------------
  586|  45.6k|    {
  587|  45.6k|        if (occ <= 2)
  ------------------
  |  Branch (587:13): [True: 1.20k, False: 44.4k]
  ------------------
  588|  1.20k|        {
  589|  1.20k|            if (occ == 2)
  ------------------
  |  Branch (589:17): [True: 612, False: 592]
  ------------------
  590|    612|            {
  591|    612|                memcpy(op, &(codep->firstchar), 2);
  592|    612|                op += 2;
  593|    612|                occ -= 2;
  594|    612|                goto after_loop;
  595|    612|            }
  596|    592|            goto too_short_buffer;
  597|  1.20k|        }
  598|       |
  599|  44.4k|        memcpy(op, &(codep->firstchar), 2);
  600|  44.4k|        op += 2;
  601|  44.4k|        occ -= 2;
  602|  44.4k|        goto begin; /* we can save the comparison occ > 0 */
  603|  45.6k|    }
  604|       |
  605|  46.9k|    if (len == 3)
  ------------------
  |  Branch (605:9): [True: 31.4k, False: 15.5k]
  ------------------
  606|  31.4k|    {
  607|  31.4k|        if (occ <= 3)
  ------------------
  |  Branch (607:13): [True: 834, False: 30.6k]
  ------------------
  608|    834|        {
  609|    834|            if (occ == 3)
  ------------------
  |  Branch (609:17): [True: 318, False: 516]
  ------------------
  610|    318|            {
  611|    318|                op[0] = codep->firstchar;
  612|    318|                op[1] = codep->next->value;
  613|    318|                op[2] = codep->value;
  614|    318|                op += 3;
  615|    318|                occ -= 3;
  616|    318|                goto after_loop;
  617|    318|            }
  618|    516|            goto too_short_buffer;
  619|    834|        }
  620|       |
  621|  30.6k|        op[0] = codep->firstchar;
  622|  30.6k|        op[1] = codep->next->value;
  623|  30.6k|        op[2] = codep->value;
  624|  30.6k|        op += 3;
  625|  30.6k|        occ -= 3;
  626|  30.6k|        goto begin; /* we can save the comparison occ > 0 */
  627|  31.4k|    }
  628|       |
  629|  15.5k|    if (len > occ)
  ------------------
  |  Branch (629:9): [True: 919, False: 14.5k]
  ------------------
  630|    919|    {
  631|    919|        goto too_short_buffer;
  632|    919|    }
  633|       |
  634|  14.5k|    if (codep->repeated)
  ------------------
  |  Branch (634:9): [True: 8.10k, False: 6.48k]
  ------------------
  635|  8.10k|    {
  636|  8.10k|        memset(op, codep->value, len);
  637|  8.10k|        op += len;
  638|  8.10k|        occ -= len;
  639|  8.10k|        if (occ == 0)
  ------------------
  |  Branch (639:13): [True: 277, False: 7.83k]
  ------------------
  640|    277|            goto after_loop;
  641|  7.83k|        goto begin;
  642|  8.10k|    }
  643|       |
  644|  6.48k|    uint8_t *tp = op + len;
  645|       |
  646|  6.48k|    assert(len >= 4);
  ------------------
  |  Branch (646:5): [True: 0, False: 6.48k]
  |  Branch (646:5): [True: 6.48k, False: 0]
  ------------------
  647|       |
  648|  6.48k|    *--tp = codep->value;
  649|  6.48k|    codep = codep->next;
  650|  6.48k|    *--tp = codep->value;
  651|  6.48k|    codep = codep->next;
  652|  6.48k|    *--tp = codep->value;
  653|  6.48k|    codep = codep->next;
  654|  6.48k|    *--tp = codep->value;
  655|  6.48k|    if (tp > op)
  ------------------
  |  Branch (655:9): [True: 2.18k, False: 4.30k]
  ------------------
  656|  2.18k|    {
  657|  2.18k|        do
  658|  6.43k|        {
  659|  6.43k|            codep = codep->next;
  660|  6.43k|            *--tp = codep->value;
  661|  6.43k|        } while (tp > op);
  ------------------
  |  Branch (661:18): [True: 4.25k, False: 2.18k]
  ------------------
  662|  2.18k|    }
  663|       |
  664|  6.48k|    assert(occ >= len);
  ------------------
  |  Branch (664:5): [True: 0, False: 6.48k]
  |  Branch (664:5): [True: 6.48k, False: 0]
  ------------------
  665|  6.48k|    op += len;
  666|  6.48k|    occ -= len;
  667|  6.48k|    if (occ == 0)
  ------------------
  |  Branch (667:9): [True: 296, False: 6.19k]
  ------------------
  668|    296|        goto after_loop;
  669|  6.19k|    goto begin;
  670|  6.48k|}
  671|       |
  672|  6.19k|code_clear:
  673|  6.05k|{
  674|  6.05k|    free_entp = dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  6.05k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  675|  6.05k|    nbits = BITS_MIN;
  ------------------
  |  |   68|  6.05k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  676|  6.05k|    nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  6.05k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  677|  6.05k|    maxcodep = dec_codetab + (unsigned long)nbitsmask - 1;
  678|  6.05k|    do
  679|  6.74k|    {
  680|  6.74k|        GetNextCodeLZW();
  ------------------
  |  |  362|  6.74k|    do                                                                         \
  |  |  363|  6.74k|    {                                                                          \
  |  |  364|  6.74k|        nextbits -= nbits;                                                     \
  |  |  365|  6.74k|        if (nextbits < 0)                                                      \
  |  |  ------------------
  |  |  |  Branch (365:13): [True: 1.65k, False: 5.08k]
  |  |  ------------------
  |  |  366|  6.74k|        {                                                                      \
  |  |  367|  1.65k|            if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE)                           \
  |  |  ------------------
  |  |  |  |   45|  1.65k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  1.65k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (367:17): [True: 562, False: 1.09k]
  |  |  ------------------
  |  |  368|  1.65k|            {                                                                  \
  |  |  369|    562|                unsigned codetmp = (unsigned)(nextdata << (-nextbits));        \
  |  |  370|    562|                GetNextData(nextdata, bp);                                     \
  |  |  ------------------
  |  |  |  |  335|    562|    memcpy(&nextdata, bp, sizeof(nextdata));                                   \
  |  |  |  |  336|    562|    nextdata = __builtin_bswap64(nextdata)
  |  |  ------------------
  |  |  371|    562|                bp += SIZEOF_WORDTYPE;                                         \
  |  |  ------------------
  |  |  |  |   45|    562|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    562|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|    562|                nextbits += 8 * SIZEOF_WORDTYPE;                               \
  |  |  ------------------
  |  |  |  |   45|    562|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    562|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|    562|                dec_bitsleft -= 8 * SIZEOF_WORDTYPE;                           \
  |  |  ------------------
  |  |  |  |   45|    562|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    562|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|    562|                code = (WordType)((codetmp | (nextdata >> nextbits)) &         \
  |  |  375|    562|                                  (WordType)nbitsmask);                        \
  |  |  376|    562|                break;                                                         \
  |  |  377|    562|            }                                                                  \
  |  |  378|  1.65k|            else                                                               \
  |  |  379|  1.65k|            {                                                                  \
  |  |  380|  1.09k|                if (dec_bitsleft < 8)                                          \
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 277, False: 819]
  |  |  ------------------
  |  |  381|  1.09k|                {                                                              \
  |  |  382|    277|                    goto no_eoi;                                               \
  |  |  383|    277|                }                                                              \
  |  |  384|  1.09k|                nextdata = (nextdata << 8) | *(bp)++;                          \
  |  |  385|    819|                nextbits += 8;                                                 \
  |  |  386|    819|                dec_bitsleft -= 8;                                             \
  |  |  387|    819|                if (nextbits < 0)                                              \
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 428, False: 391]
  |  |  ------------------
  |  |  388|    819|                {                                                              \
  |  |  389|    428|                    if (dec_bitsleft < 8)                                      \
  |  |  ------------------
  |  |  |  Branch (389:25): [True: 206, False: 222]
  |  |  ------------------
  |  |  390|    428|                    {                                                          \
  |  |  391|    206|                        goto no_eoi;                                           \
  |  |  392|    206|                    }                                                          \
  |  |  393|    428|                    nextdata = (nextdata << 8) | *(bp)++;                      \
  |  |  394|    222|                    nextbits += 8;                                             \
  |  |  395|    222|                    dec_bitsleft -= 8;                                         \
  |  |  396|    222|                }                                                              \
  |  |  397|    819|            }                                                                  \
  |  |  398|  1.65k|        }                                                                      \
  |  |  399|  6.74k|        code = (WordType)((nextdata >> nextbits) & (WordType)nbitsmask);       \
  |  |  400|  5.69k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (400:14): [Folded, False: 5.69k]
  |  |  ------------------
  ------------------
  681|  6.74k|    } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  6.26k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (681:14): [True: 693, False: 5.56k]
  ------------------
  682|  5.56k|    if (code == CODE_EOI)
  ------------------
  |  |   72|  5.56k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (682:9): [True: 137, False: 5.43k]
  ------------------
  683|    137|        goto after_loop;
  684|  5.43k|    if (code > CODE_EOI)
  ------------------
  |  |   72|  5.43k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (684:9): [True: 157, False: 5.27k]
  ------------------
  685|    157|    {
  686|    157|        goto error_code;
  687|    157|    }
  688|  5.27k|    *op++ = (uint8_t)code;
  689|  5.27k|    occ--;
  690|  5.27k|    oldcodep = dec_codetab + code;
  691|  5.27k|    if (occ == 0)
  ------------------
  |  Branch (691:9): [True: 185, False: 5.08k]
  ------------------
  692|    185|        goto after_loop;
  693|  5.08k|    goto begin;
  694|  5.27k|}
  695|  5.27k|}
  696|       |
  697|  5.08k|too_short_buffer:
  698|  2.02k|{
  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.02k|    sp->dec_codep = codep;
  706|  2.02k|    do
  707|  4.34k|    {
  708|  4.34k|        codep = codep->next;
  709|  4.34k|    } while (codep->length > occ);
  ------------------
  |  Branch (709:14): [True: 2.31k, False: 2.02k]
  ------------------
  710|       |
  711|  2.02k|    sp->dec_restart = occ;
  712|  2.02k|    uint8_t *tp = op + occ;
  713|  2.02k|    do
  714|  3.57k|    {
  715|  3.57k|        *--tp = codep->value;
  716|  3.57k|        codep = codep->next;
  717|  3.57k|    } while (--occ);
  ------------------
  |  Branch (717:14): [True: 1.54k, False: 2.02k]
  ------------------
  718|  2.02k|}
  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: 181, False: 5.87k]
  ------------------
  734|    181|    {
  735|    181|        memset(op, 0, (size_t)occ);
  736|    181|        sp->read_error = 1;
  737|    181|        TIFFErrorExtR(tif, module,
  738|    181|                      "Not enough data at scanline %" PRIu32 " (short %" PRIu64
  739|    181|                      " bytes)",
  740|    181|                      tif->tif_dir.td_row, (uint64_t)occ);
  741|    181|        return (0);
  742|    181|    }
  743|  5.87k|    return (1);
  744|       |
  745|  2.18k|no_eoi:
  746|  2.18k|    memset(op, 0, (size_t)occ);
  747|  2.18k|    sp->read_error = 1;
  748|  2.18k|    TIFFErrorExtR(tif, module,
  749|  2.18k|                  "LZWDecode: Strip %" PRIu32 " not terminated with EOI code",
  750|  2.18k|                  tif->tif_dir.td_curstrip);
  751|  2.18k|    return 0;
  752|  9.36k|error_code:
  753|  9.36k|    memset(op, 0, (size_t)occ);
  754|  9.36k|    sp->read_error = 1;
  755|  9.36k|    TIFFErrorExtR(tif, tif->tif_name, "Using code not yet in table");
  756|  9.36k|    return 0;
  757|  6.05k|}
tif_lzw.c:LZWGetMaxCompressionRatio:
 1396|      7|{
 1397|      7|    (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|      7|    return 1400;
 1408|      7|}
tif_lzw.c:LZWCleanup:
 1378|    470|{
 1379|    470|    (void)TIFFPredictorCleanup(tif);
 1380|       |
 1381|    470|    assert(tif->tif_data != NULL);
  ------------------
  |  Branch (1381:5): [True: 0, False: 470]
  |  Branch (1381:5): [True: 470, False: 0]
  ------------------
 1382|       |
 1383|    470|    if (LZWDecoderState(tif)->dec_codetab)
  ------------------
  |  |  164|    470|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    470|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1383:9): [True: 435, False: 35]
  ------------------
 1384|    435|        _TIFFfreeExt(tif, LZWDecoderState(tif)->dec_codetab);
  ------------------
  |  |  164|    435|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    435|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1385|       |
 1386|    470|    if (LZWEncoderState(tif)->enc_hashtab)
  ------------------
  |  |  165|    470|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    470|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1386:9): [True: 0, False: 470]
  ------------------
 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|    470|    _TIFFfreeExt(tif, tif->tif_data);
 1390|    470|    tif->tif_data = NULL;
 1391|       |
 1392|    470|    _TIFFSetDefaultCompressionState(tif);
 1393|    470|}

TIFFInitNeXT:
  187|     34|{
  188|     34|    (void)scheme;
  189|     34|    tif->tif_predecode = NeXTPreDecode;
  190|     34|    tif->tif_decoderow = NeXTDecode;
  191|     34|    tif->tif_decodestrip = NeXTDecode;
  192|     34|    tif->tif_decodetile = NeXTDecode;
  193|     34|    return (1);
  194|     34|}
tif_next.c:NeXTPreDecode:
  172|  1.44k|{
  173|  1.44k|    static const char module[] = "NeXTPreDecode";
  174|  1.44k|    TIFFDirectory *td = &tif->tif_dir;
  175|  1.44k|    (void)s;
  176|       |
  177|  1.44k|    if (td->td_bitspersample != 2)
  ------------------
  |  Branch (177:9): [True: 0, False: 1.44k]
  ------------------
  178|      0|    {
  179|      0|        TIFFErrorExtR(tif, module, "Unsupported BitsPerSample = %" PRIu16,
  180|      0|                      td->td_bitspersample);
  181|      0|        return (0);
  182|      0|    }
  183|  1.44k|    return (1);
  184|  1.44k|}
tif_next.c:NeXTDecode:
   59|  28.5k|{
   60|  28.5k|    static const char module[] = "NeXTDecode";
   61|  28.5k|    unsigned char *bp, *op;
   62|  28.5k|    tmsize_t cc;
   63|  28.5k|    uint8_t *row;
   64|  28.5k|    tmsize_t scanline, n;
   65|       |
   66|  28.5k|    (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|  7.43M|    for (op = (unsigned char *)buf, cc = occ; cc-- > 0;)
  ------------------
  |  Branch (72:47): [True: 7.40M, False: 28.5k]
  ------------------
   73|  7.40M|        *op++ = 0xff;
   74|       |
   75|  28.5k|    bp = (unsigned char *)tif->tif_rawcp;
   76|  28.5k|    cc = tif->tif_rawcc;
   77|  28.5k|    scanline = tif->tif_dir.td_scanlinesize;
   78|  28.5k|    if (occ % scanline)
  ------------------
  |  Branch (78:9): [True: 0, False: 28.5k]
  ------------------
   79|      0|    {
   80|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
   81|      0|        return (0);
   82|      0|    }
   83|   105k|    for (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline)
  ------------------
  |  Branch (83:21): [True: 81.9k, False: 23.6k]
  |  Branch (83:31): [True: 78.2k, False: 3.62k]
  ------------------
   84|  78.2k|    {
   85|  78.2k|        n = *bp++;
   86|  78.2k|        cc--;
   87|  78.2k|        switch (n)
   88|  78.2k|        {
   89|  4.09k|            case LITERALROW:
  ------------------
  |  |   55|  4.09k|#define LITERALROW 0x00
  ------------------
  |  Branch (89:13): [True: 4.09k, False: 74.1k]
  ------------------
   90|       |                /*
   91|       |                 * The entire scanline is given as literal values.
   92|       |                 */
   93|  4.09k|                if (cc < scanline)
  ------------------
  |  Branch (93:21): [True: 345, False: 3.75k]
  ------------------
   94|    345|                    goto bad;
   95|  3.75k|                _TIFFmemcpy(row, bp, scanline);
   96|  3.75k|                bp += scanline;
   97|  3.75k|                cc -= scanline;
   98|  3.75k|                break;
   99|    650|            case LITERALSPAN:
  ------------------
  |  |   56|    650|#define LITERALSPAN 0x40
  ------------------
  |  Branch (99:13): [True: 650, False: 77.6k]
  ------------------
  100|    650|            {
  101|    650|                tmsize_t off;
  102|       |                /*
  103|       |                 * The scanline has a literal span that begins at some
  104|       |                 * offset.
  105|       |                 */
  106|    650|                if (cc < 4)
  ------------------
  |  Branch (106:21): [True: 149, False: 501]
  ------------------
  107|    149|                    goto bad;
  108|    501|                off = (bp[0] * 256) + bp[1];
  109|    501|                n = (bp[2] * 256) + bp[3];
  110|    501|                if (cc < 4 + n || off + n > scanline)
  ------------------
  |  Branch (110:21): [True: 196, False: 305]
  |  Branch (110:35): [True: 138, False: 167]
  ------------------
  111|    334|                    goto bad;
  112|    167|                _TIFFmemcpy(row + off, bp + 4, n);
  113|    167|                bp += 4 + n;
  114|    167|                cc -= 4 + n;
  115|    167|                break;
  116|    501|            }
  117|  73.5k|            default:
  ------------------
  |  Branch (117:13): [True: 73.5k, False: 4.74k]
  ------------------
  118|  73.5k|            {
  119|  73.5k|                uint32_t npixels = 0, grey;
  120|  73.5k|                tmsize_t op_offset = 0;
  121|  73.5k|                uint32_t imagewidth = tif->tif_dir.td_imagewidth;
  122|  73.5k|                if (isTiled(tif))
  ------------------
  |  |  278|  73.5k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  73.5k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 65.7k, False: 7.82k]
  |  |  ------------------
  ------------------
  123|  65.7k|                    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|  73.5k|                op = row;
  132|  73.5k|                for (;;)
  133|   204k|                {
  134|   204k|                    grey = (uint32_t)((n >> 6) & 0x3);
  135|   204k|                    n &= 0x3f;
  136|       |                    /*
  137|       |                     * Ensure the run does not exceed the scanline
  138|       |                     * bounds, potentially resulting in a security
  139|       |                     * issue.
  140|       |                     */
  141|  3.91M|                    while (n-- > 0 && npixels < imagewidth &&
  ------------------
  |  Branch (141:28): [True: 3.77M, False: 133k]
  |  Branch (141:39): [True: 3.70M, False: 70.9k]
  ------------------
  142|  3.70M|                           op_offset < scanline)
  ------------------
  |  Branch (142:28): [True: 3.70M, False: 144]
  ------------------
  143|  3.70M|                        SETPIXEL(op, grey);
  ------------------
  |  |   34|  3.70M|    {                                                                          \
  |  |   35|  3.70M|        switch (npixels++ & 3)                                                 \
  |  |   36|  3.70M|        {                                                                      \
  |  |   37|   949k|            case 0:                                                            \
  |  |  ------------------
  |  |  |  Branch (37:13): [True: 949k, False: 2.75M]
  |  |  ------------------
  |  |   38|   949k|                op[0] = (unsigned char)((v) << 6);                             \
  |  |   39|   949k|                break;                                                         \
  |  |   40|   926k|            case 1:                                                            \
  |  |  ------------------
  |  |  |  Branch (40:13): [True: 926k, False: 2.78M]
  |  |  ------------------
  |  |   41|   926k|                op[0] |= (unsigned char)((v) << 4);                            \
  |  |   42|   926k|                break;                                                         \
  |  |   43|   923k|            case 2:                                                            \
  |  |  ------------------
  |  |  |  Branch (43:13): [True: 923k, False: 2.78M]
  |  |  ------------------
  |  |   44|   923k|                op[0] |= (unsigned char)((v) << 2);                            \
  |  |   45|   923k|                break;                                                         \
  |  |   46|   907k|            case 3:                                                            \
  |  |  ------------------
  |  |  |  Branch (46:13): [True: 907k, False: 2.79M]
  |  |  ------------------
  |  |   47|   907k|                *op++ |= (unsigned char)(v);                                   \
  |  |   48|   907k|                op_offset++;                                                   \
  |  |   49|   907k|                break;                                                         \
  |  |   50|      0|            default:                                                           \
  |  |  ------------------
  |  |  |  Branch (50:13): [True: 0, False: 3.70M]
  |  |  ------------------
  |  |   51|      0|                break;                                                         \
  |  |   52|  3.70M|        }                                                                      \
  |  |   53|  3.70M|    }
  ------------------
  144|   204k|                    if (npixels >= imagewidth)
  ------------------
  |  Branch (144:25): [True: 73.0k, False: 131k]
  ------------------
  145|  73.0k|                        break;
  146|   131k|                    if (op_offset >= scanline)
  ------------------
  |  Branch (146:25): [True: 145, False: 130k]
  ------------------
  147|    145|                    {
  148|    145|                        TIFFErrorExtR(tif, module,
  149|    145|                                      "Invalid data for scanline %" PRIu32,
  150|    145|                                      tif->tif_dir.td_row);
  151|    145|                        return (0);
  152|    145|                    }
  153|   130k|                    if (cc == 0)
  ------------------
  |  Branch (153:25): [True: 354, False: 130k]
  ------------------
  154|    354|                        goto bad;
  155|   130k|                    n = *bp++;
  156|   130k|                    cc--;
  157|   130k|                }
  158|  73.0k|                break;
  159|  73.5k|            }
  160|  78.2k|        }
  161|  78.2k|    }
  162|  27.2k|    tif->tif_rawcp = (uint8_t *)bp;
  163|  27.2k|    tif->tif_rawcc = cc;
  164|  27.2k|    return (1);
  165|  1.18k|bad:
  166|       |    TIFFErrorExtR(tif, module, "Not enough data for scanline %" PRIu32,
  167|  1.18k|                  tif->tif_dir.td_row);
  168|  1.18k|    return (0);
  169|  28.5k|}

TIFFInitOJPEG:
  454|  1.10k|{
  455|  1.10k|    static const char module[] = "TIFFInitOJPEG";
  456|  1.10k|    OJPEGState *sp;
  457|       |
  458|  1.10k|    (void)scheme;
  459|  1.10k|    assert(scheme == COMPRESSION_OJPEG);
  ------------------
  |  Branch (459:5): [True: 0, False: 1.10k]
  |  Branch (459:5): [True: 1.10k, False: 0]
  ------------------
  460|       |
  461|       |    /*
  462|       |     * Merge codec-specific tag information.
  463|       |     */
  464|  1.10k|    if (!_TIFFMergeFields(tif, ojpegFields, TIFFArrayCount(ojpegFields)))
  ------------------
  |  |  339|  1.10k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (464:9): [True: 0, False: 1.10k]
  ------------------
  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.10k|    sp = (OJPEGState *)_TIFFmallocExt(tif, sizeof(OJPEGState));
  473|  1.10k|    if (sp == NULL)
  ------------------
  |  Branch (473:9): [True: 0, False: 1.10k]
  ------------------
  474|      0|    {
  475|      0|        TIFFErrorExtR(tif, module, "No space for OJPEG state block");
  476|      0|        return (0);
  477|      0|    }
  478|  1.10k|    _TIFFmemset(sp, 0, sizeof(OJPEGState));
  479|  1.10k|    sp->tif = tif;
  480|  1.10k|    sp->jpeg_proc = 1;
  481|  1.10k|    sp->subsampling_hor = 2;
  482|  1.10k|    sp->subsampling_ver = 2;
  483|  1.10k|    TIFFSetField(tif, TIFFTAG_YCBCRSUBSAMPLING, 2, 2);
  ------------------
  |  |  388|  1.10k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  484|       |    /* tif codec methods */
  485|  1.10k|    tif->tif_fixuptags = OJPEGFixupTags;
  486|  1.10k|    tif->tif_setupdecode = OJPEGSetupDecode;
  487|  1.10k|    tif->tif_predecode = OJPEGPreDecode;
  488|  1.10k|    tif->tif_postdecode = OJPEGPostDecode;
  489|  1.10k|    tif->tif_decoderow = OJPEGDecode;
  490|  1.10k|    tif->tif_decodestrip = OJPEGDecode;
  491|  1.10k|    tif->tif_decodetile = OJPEGDecode;
  492|  1.10k|    tif->tif_setupencode = OJPEGSetupEncode;
  493|  1.10k|    tif->tif_preencode = OJPEGPreEncode;
  494|  1.10k|    tif->tif_postencode = OJPEGPostEncode;
  495|  1.10k|    tif->tif_encoderow = OJPEGEncode;
  496|  1.10k|    tif->tif_encodestrip = OJPEGEncode;
  497|  1.10k|    tif->tif_encodetile = OJPEGEncode;
  498|  1.10k|    tif->tif_cleanup = OJPEGCleanup;
  499|  1.10k|    tif->tif_data = (uint8_t *)sp;
  500|       |    /* tif tag methods */
  501|  1.10k|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  502|  1.10k|    tif->tif_tagmethods.vgetfield = OJPEGVGetField;
  503|  1.10k|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  504|  1.10k|    tif->tif_tagmethods.vsetfield = OJPEGVSetField;
  505|  1.10k|    sp->printdir = tif->tif_tagmethods.printdir;
  506|  1.10k|    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.10k|    tif->tif_flags |= TIFF_NOREADRAW;
  ------------------
  |  |  138|  1.10k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  514|  1.10k|    return (1);
  515|  1.10k|}
tif_ojpeg.c:OJPEGVGetField:
  518|  17.9k|{
  519|  17.9k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  520|  17.9k|    switch (tag)
  521|  17.9k|    {
  522|      0|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|      0|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (522:9): [True: 0, False: 17.9k]
  ------------------
  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: 17.9k]
  ------------------
  526|      0|            *va_arg(ap, uint64_t *) =
  527|      0|                (uint64_t)sp->jpeg_interchange_format_length;
  528|      0|            break;
  529|  2.90k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  2.90k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (529:9): [True: 2.90k, False: 15.0k]
  ------------------
  530|  2.90k|            if (sp->subsamplingcorrect_done == 0)
  ------------------
  |  Branch (530:17): [True: 1.03k, False: 1.87k]
  ------------------
  531|  1.03k|                OJPEGSubsamplingCorrect(tif);
  532|  2.90k|            *va_arg(ap, uint16_t *) = (uint16_t)sp->subsampling_hor;
  533|  2.90k|            *va_arg(ap, uint16_t *) = (uint16_t)sp->subsampling_ver;
  534|  2.90k|            break;
  535|      0|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|      0|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (535:9): [True: 0, False: 17.9k]
  ------------------
  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: 17.9k]
  ------------------
  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: 17.9k]
  ------------------
  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: 17.9k]
  ------------------
  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: 17.9k]
  ------------------
  551|      0|            *va_arg(ap, uint16_t *) = sp->restart_interval;
  552|      0|            break;
  553|  15.0k|        default:
  ------------------
  |  Branch (553:9): [True: 15.0k, False: 2.90k]
  ------------------
  554|  15.0k|            return (*sp->vgetparent)(tif, tag, ap);
  555|  17.9k|    }
  556|  2.90k|    return (1);
  557|  17.9k|}
tif_ojpeg.c:OJPEGSubsamplingCorrect:
 1082|  1.05k|{
 1083|  1.05k|    static const char module[] = "OJPEGSubsamplingCorrect";
 1084|  1.05k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1085|  1.05k|    uint8_t mh;
 1086|  1.05k|    uint8_t mv;
 1087|       |
 1088|  1.05k|    assert(sp->subsamplingcorrect_done == 0);
  ------------------
  |  Branch (1088:5): [True: 0, False: 1.05k]
  |  Branch (1088:5): [True: 1.05k, False: 0]
  ------------------
 1089|  1.05k|    if ((tif->tif_dir.td_samplesperpixel != 3) ||
  ------------------
  |  Branch (1089:9): [True: 25, False: 1.03k]
  ------------------
 1090|  1.03k|        ((tif->tif_dir.td_photometric != PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|  1.03k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1090:10): [True: 22, False: 1.00k]
  ------------------
 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|     46|    {
 1093|     46|        if (sp->subsampling_tag != 0)
  ------------------
  |  Branch (1093:13): [True: 1, False: 45]
  ------------------
 1094|      1|            TIFFWarningExtR(tif, module,
 1095|      1|                            "Subsampling tag not appropriate for this "
 1096|      1|                            "Photometric and/or SamplesPerPixel");
 1097|     46|        sp->subsampling_hor = 1;
 1098|     46|        sp->subsampling_ver = 1;
 1099|     46|        sp->subsampling_force_desubsampling_inside_decompression = 0;
 1100|     46|    }
 1101|  1.00k|    else
 1102|  1.00k|    {
 1103|  1.00k|        sp->subsamplingcorrect_done = 1;
 1104|  1.00k|        mh = sp->subsampling_hor;
 1105|  1.00k|        mv = sp->subsampling_ver;
 1106|  1.00k|        sp->subsamplingcorrect = 1;
 1107|  1.00k|        OJPEGReadHeaderInfoSec(tif);
 1108|  1.00k|        if (sp->subsampling_force_desubsampling_inside_decompression != 0)
  ------------------
  |  Branch (1108:13): [True: 36, False: 973]
  ------------------
 1109|     36|        {
 1110|     36|            sp->subsampling_hor = 1;
 1111|     36|            sp->subsampling_ver = 1;
 1112|     36|        }
 1113|  1.00k|        sp->subsamplingcorrect = 0;
 1114|  1.00k|        if (((sp->subsampling_hor != mh) || (sp->subsampling_ver != mv)) &&
  ------------------
  |  Branch (1114:14): [True: 39, False: 970]
  |  Branch (1114:45): [True: 0, False: 970]
  ------------------
 1115|     39|            (sp->subsampling_force_desubsampling_inside_decompression == 0))
  ------------------
  |  Branch (1115:13): [True: 4, False: 35]
  ------------------
 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|  1.00k|        if (sp->subsampling_force_desubsampling_inside_decompression != 0)
  ------------------
  |  Branch (1134:13): [True: 36, False: 973]
  ------------------
 1135|     36|        {
 1136|     36|            if (sp->subsampling_tag == 0)
  ------------------
  |  Branch (1136:17): [True: 34, False: 2]
  ------------------
 1137|     34|                TIFFWarningExtR(
 1138|     34|                    tif, module,
 1139|     34|                    "Subsampling tag is not set, yet subsampling inside JPEG "
 1140|     34|                    "data does not match default values [2,2] (nor any other "
 1141|     34|                    "values allowed in TIFF); assuming subsampling inside JPEG "
 1142|     34|                    "data is correct and desubsampling inside JPEG "
 1143|     34|                    "decompression");
 1144|      2|            else
 1145|      2|                TIFFWarningExtR(
 1146|      2|                    tif, module,
 1147|      2|                    "Subsampling inside JPEG data does not match subsampling "
 1148|      2|                    "tag values [%" PRIu8 ",%" PRIu8
 1149|      2|                    "] (nor any other values allowed in TIFF); assuming "
 1150|      2|                    "subsampling inside JPEG data is correct and desubsampling "
 1151|      2|                    "inside JPEG decompression",
 1152|      2|                    mh, mv);
 1153|     36|        }
 1154|  1.00k|        if (sp->subsampling_force_desubsampling_inside_decompression == 0)
  ------------------
  |  Branch (1154:13): [True: 973, False: 36]
  ------------------
 1155|    973|        {
 1156|    973|            if (sp->subsampling_hor < sp->subsampling_ver)
  ------------------
  |  Branch (1156:17): [True: 17, False: 956]
  ------------------
 1157|     17|                TIFFWarningExtR(tif, module,
 1158|     17|                                "Subsampling values [%" PRIu8 ",%" PRIu8
 1159|     17|                                "] are not allowed in TIFF",
 1160|     17|                                sp->subsampling_hor, sp->subsampling_ver);
 1161|    973|        }
 1162|  1.00k|    }
 1163|  1.05k|    sp->subsamplingcorrect_done = 1;
 1164|  1.05k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSec:
 1536|  2.03k|{
 1537|  2.03k|    static const char module[] = "OJPEGReadHeaderInfoSec";
 1538|  2.03k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1539|  2.03k|    uint8_t m;
 1540|  2.03k|    uint16_t n;
 1541|  2.03k|    uint8_t o;
 1542|  2.03k|    if (sp->file_size == 0)
  ------------------
  |  Branch (1542:9): [True: 1.04k, False: 987]
  ------------------
 1543|  1.04k|        sp->file_size = TIFFGetFileSize(tif);
  ------------------
  |  |  289|  1.04k|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 1544|  2.03k|    if (sp->jpeg_interchange_format != 0)
  ------------------
  |  Branch (1544:9): [True: 684, False: 1.35k]
  ------------------
 1545|    684|    {
 1546|    684|        if (sp->jpeg_interchange_format >= sp->file_size)
  ------------------
  |  Branch (1546:13): [True: 0, False: 684]
  ------------------
 1547|      0|        {
 1548|      0|            sp->jpeg_interchange_format = 0;
 1549|      0|            sp->jpeg_interchange_format_length = 0;
 1550|      0|        }
 1551|    684|        else
 1552|    684|        {
 1553|    684|            if ((sp->jpeg_interchange_format_length == 0) ||
  ------------------
  |  Branch (1553:17): [True: 332, False: 352]
  ------------------
 1554|    352|                (sp->jpeg_interchange_format >
  ------------------
  |  Branch (1554:17): [True: 0, False: 352]
  ------------------
 1555|    352|                 UINT64_MAX - sp->jpeg_interchange_format_length) ||
 1556|    352|                (sp->jpeg_interchange_format +
  ------------------
  |  Branch (1556:17): [True: 0, False: 352]
  ------------------
 1557|    352|                     sp->jpeg_interchange_format_length >
 1558|    352|                 sp->file_size))
 1559|    332|                sp->jpeg_interchange_format_length =
 1560|    332|                    sp->file_size - sp->jpeg_interchange_format;
 1561|    684|        }
 1562|    684|    }
 1563|  2.03k|    sp->in_buffer_source = osibsNotSetYet;
 1564|  2.03k|    sp->in_buffer_next_strile = 0;
 1565|  2.03k|    sp->in_buffer_strile_count = tif->tif_dir.td_nstrips;
 1566|  2.03k|    sp->in_buffer_file_togo = 0;
 1567|  2.03k|    sp->in_buffer_togo = 0;
 1568|  2.03k|    do
 1569|  18.1k|    {
 1570|  18.1k|        if (OJPEGReadBytePeek(sp, &m) == 0)
  ------------------
  |  Branch (1570:13): [True: 73, False: 18.0k]
  ------------------
 1571|     73|            return (0);
 1572|  18.0k|        if (m != 255)
  ------------------
  |  Branch (1572:13): [True: 1.76k, False: 16.2k]
  ------------------
 1573|  1.76k|            break;
 1574|  16.2k|        OJPEGReadByteAdvance(sp);
 1575|  16.2k|        do
 1576|   971k|        {
 1577|   971k|            if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1577:17): [True: 5, False: 971k]
  ------------------
 1578|      5|                return (0);
 1579|   971k|        } while (m == 255);
  ------------------
  |  Branch (1579:18): [True: 954k, False: 16.2k]
  ------------------
 1580|  16.2k|        switch (m)
 1581|  16.2k|        {
 1582|  6.37k|            case JPEG_MARKER_SOI:
  ------------------
  |  |  163|  6.37k|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (1582:13): [True: 6.37k, False: 9.89k]
  ------------------
 1583|       |                /* this type of marker has no data, and should be skipped */
 1584|  6.37k|                break;
 1585|    148|            case JPEG_MARKER_COM:
  ------------------
  |  |  169|    148|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (1585:13): [True: 148, False: 16.1k]
  ------------------
 1586|    549|            case JPEG_MARKER_APP0:
  ------------------
  |  |  168|    549|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1586:13): [True: 401, False: 15.8k]
  ------------------
 1587|    551|            case JPEG_MARKER_APP0 + 1:
  ------------------
  |  |  168|    551|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1587:13): [True: 2, False: 16.2k]
  ------------------
 1588|    551|            case JPEG_MARKER_APP0 + 2:
  ------------------
  |  |  168|    551|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1588:13): [True: 0, False: 16.2k]
  ------------------
 1589|    573|            case JPEG_MARKER_APP0 + 3:
  ------------------
  |  |  168|    573|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1589:13): [True: 22, False: 16.2k]
  ------------------
 1590|    856|            case JPEG_MARKER_APP0 + 4:
  ------------------
  |  |  168|    856|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1590:13): [True: 283, False: 15.9k]
  ------------------
 1591|    872|            case JPEG_MARKER_APP0 + 5:
  ------------------
  |  |  168|    872|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1591:13): [True: 16, False: 16.2k]
  ------------------
 1592|    872|            case JPEG_MARKER_APP0 + 6:
  ------------------
  |  |  168|    872|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1592:13): [True: 0, False: 16.2k]
  ------------------
 1593|  1.00k|            case JPEG_MARKER_APP0 + 7:
  ------------------
  |  |  168|  1.00k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1593:13): [True: 133, False: 16.1k]
  ------------------
 1594|  1.00k|            case JPEG_MARKER_APP0 + 8:
  ------------------
  |  |  168|  1.00k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1594:13): [True: 0, False: 16.2k]
  ------------------
 1595|  1.00k|            case JPEG_MARKER_APP0 + 9:
  ------------------
  |  |  168|  1.00k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1595:13): [True: 0, False: 16.2k]
  ------------------
 1596|  1.00k|            case JPEG_MARKER_APP0 + 10:
  ------------------
  |  |  168|  1.00k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1596:13): [True: 0, False: 16.2k]
  ------------------
 1597|  1.01k|            case JPEG_MARKER_APP0 + 11:
  ------------------
  |  |  168|  1.01k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1597:13): [True: 6, False: 16.2k]
  ------------------
 1598|  1.19k|            case JPEG_MARKER_APP0 + 12:
  ------------------
  |  |  168|  1.19k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1598:13): [True: 180, False: 16.0k]
  ------------------
 1599|  1.19k|            case JPEG_MARKER_APP0 + 13:
  ------------------
  |  |  168|  1.19k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1599:13): [True: 0, False: 16.2k]
  ------------------
 1600|  1.19k|            case JPEG_MARKER_APP0 + 14:
  ------------------
  |  |  168|  1.19k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1600:13): [True: 0, False: 16.2k]
  ------------------
 1601|  1.32k|            case JPEG_MARKER_APP0 + 15:
  ------------------
  |  |  168|  1.32k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1601:13): [True: 131, False: 16.1k]
  ------------------
 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.32k|                if (OJPEGReadWord(sp, &n) == 0)
  ------------------
  |  Branch (1604:21): [True: 2, False: 1.32k]
  ------------------
 1605|      2|                    return (0);
 1606|  1.32k|                if (n < 2)
  ------------------
  |  Branch (1606:21): [True: 0, False: 1.32k]
  ------------------
 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.32k|                if (n > 2)
  ------------------
  |  Branch (1612:21): [True: 1.31k, False: 6]
  ------------------
 1613|  1.31k|                    OJPEGReadSkip(sp, (uint16_t)(n - 2));
 1614|  1.32k|                break;
 1615|    348|            case JPEG_MARKER_DRI:
  ------------------
  |  |  167|    348|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (1615:13): [True: 348, False: 15.9k]
  ------------------
 1616|    348|                if (OJPEGReadHeaderInfoSecStreamDri(tif) == 0)
  ------------------
  |  Branch (1616:21): [True: 13, False: 335]
  ------------------
 1617|     13|                    return (0);
 1618|    335|                break;
 1619|  6.42k|            case JPEG_MARKER_DQT:
  ------------------
  |  |  166|  6.42k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (1619:13): [True: 6.42k, False: 9.83k]
  ------------------
 1620|  6.42k|                if (OJPEGReadHeaderInfoSecStreamDqt(tif) == 0)
  ------------------
  |  Branch (1620:21): [True: 34, False: 6.39k]
  ------------------
 1621|     34|                    return (0);
 1622|  6.39k|                break;
 1623|  6.39k|            case JPEG_MARKER_DHT:
  ------------------
  |  |  161|  1.63k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (1623:13): [True: 1.63k, False: 14.6k]
  ------------------
 1624|  1.63k|                if (OJPEGReadHeaderInfoSecStreamDht(tif) == 0)
  ------------------
  |  Branch (1624:21): [True: 12, False: 1.62k]
  ------------------
 1625|     12|                    return (0);
 1626|  1.62k|                break;
 1627|  1.62k|            case JPEG_MARKER_SOF0:
  ------------------
  |  |  158|     51|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (1627:13): [True: 51, False: 16.2k]
  ------------------
 1628|     53|            case JPEG_MARKER_SOF1:
  ------------------
  |  |  159|     53|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (1628:13): [True: 2, False: 16.2k]
  ------------------
 1629|    116|            case JPEG_MARKER_SOF3:
  ------------------
  |  |  160|    116|#define JPEG_MARKER_SOF3 0xC3
  ------------------
  |  Branch (1629:13): [True: 63, False: 16.2k]
  ------------------
 1630|    116|                if (OJPEGReadHeaderInfoSecStreamSof(tif, m) == 0)
  ------------------
  |  Branch (1630:21): [True: 53, False: 63]
  ------------------
 1631|     53|                    return (0);
 1632|     63|                if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1632:21): [True: 38, False: 25]
  ------------------
 1633|     38|                    return (1);
 1634|     25|                break;
 1635|     25|            case JPEG_MARKER_SOS:
  ------------------
  |  |  165|     20|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1635:13): [True: 20, False: 16.2k]
  ------------------
 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: 2, False: 18]
  ------------------
 1640|      2|                    return (0);
 1641|     18|                break;
 1642|     22|            default:
  ------------------
  |  Branch (1642:13): [True: 22, False: 16.2k]
  ------------------
 1643|     22|                TIFFErrorExtR(tif, module,
 1644|     22|                              "Unknown marker type %" PRIu8 " in JPEG data", m);
 1645|     22|                return (0);
 1646|  16.2k|        }
 1647|  16.2k|    } while (m != JPEG_MARKER_SOS);
  ------------------
  |  |  165|  16.0k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1647:14): [True: 16.0k, False: 18]
  ------------------
 1648|  1.78k|    if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1648:9): [True: 868, False: 914]
  ------------------
 1649|    868|        return (1);
 1650|    914|    if (sp->sof_log == 0)
  ------------------
  |  Branch (1650:9): [True: 859, False: 55]
  ------------------
 1651|    859|    {
 1652|    859|        if (OJPEGReadHeaderInfoSecTablesQTable(tif) == 0)
  ------------------
  |  Branch (1652:13): [True: 47, False: 812]
  ------------------
 1653|     47|            return (0);
 1654|    812|        sp->sof_marker_id = JPEG_MARKER_SOF0;
  ------------------
  |  |  158|    812|#define JPEG_MARKER_SOF0 0xC0
  ------------------
 1655|  3.22k|        for (o = 0; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1655:21): [True: 2.41k, False: 812]
  ------------------
 1656|  2.41k|            sp->sof_c[o] = (uint8_t)o;
 1657|    812|        sp->sof_hv[0] =
 1658|    812|            (uint8_t)((sp->subsampling_hor << 4) | sp->subsampling_ver);
 1659|  2.41k|        for (o = 1; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1659:21): [True: 1.59k, False: 812]
  ------------------
 1660|  1.59k|            sp->sof_hv[o] = 17;
 1661|    812|        sp->sof_x = sp->strile_width;
 1662|    812|        sp->sof_y = sp->strile_length_total;
 1663|    812|        sp->sof_log = 1;
 1664|    812|        if (OJPEGReadHeaderInfoSecTablesDcTable(tif) == 0)
  ------------------
  |  Branch (1664:13): [True: 38, False: 774]
  ------------------
 1665|     38|            return (0);
 1666|    774|        if (OJPEGReadHeaderInfoSecTablesAcTable(tif) == 0)
  ------------------
  |  Branch (1666:13): [True: 51, False: 723]
  ------------------
 1667|     51|            return (0);
 1668|  2.16k|        for (o = 1; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1668:21): [True: 1.44k, False: 723]
  ------------------
 1669|  1.44k|            sp->sos_cs[o] = o;
 1670|    723|    }
 1671|    778|    return (1);
 1672|    914|}
tif_ojpeg.c:OJPEGReadBytePeek:
 2364|  18.1k|{
 2365|  18.1k|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2365:9): [True: 5.74k, False: 12.3k]
  ------------------
 2366|  5.74k|    {
 2367|  5.74k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2367:13): [True: 73, False: 5.67k]
  ------------------
 2368|     73|            return (0);
 2369|  5.74k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2369:9): [True: 0, False: 5.67k]
  |  Branch (2369:9): [True: 5.67k, False: 0]
  ------------------
 2370|  5.67k|    }
 2371|  18.0k|    *byte = *(sp->in_buffer_cur);
 2372|  18.0k|    return (1);
 2373|  18.1k|}
tif_ojpeg.c:OJPEGReadBufferFill:
 2256|   910k|{
 2257|   910k|    uint16_t m;
 2258|   910k|    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|   910k|    do
 2263|  16.0M|    {
 2264|  16.0M|        if (sp->in_buffer_file_togo != 0)
  ------------------
  |  Branch (2264:13): [True: 530k, False: 15.4M]
  ------------------
 2265|   530k|        {
 2266|   530k|            if (sp->in_buffer_file_pos_log == 0)
  ------------------
  |  Branch (2266:17): [True: 444k, False: 86.7k]
  ------------------
 2267|   444k|            {
 2268|   444k|                TIFFSeekFile(sp->tif, sp->in_buffer_file_pos, SEEK_SET);
  ------------------
  |  |  287|   444k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2269|   444k|                sp->in_buffer_file_pos_log = 1;
 2270|   444k|            }
 2271|   530k|            m = OJPEG_BUFFER;
  ------------------
  |  |  155|   530k|#define OJPEG_BUFFER 2048
  ------------------
 2272|   530k|            if ((uint64_t)m > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2272:17): [True: 441k, False: 89.5k]
  ------------------
 2273|   441k|                m = (uint16_t)sp->in_buffer_file_togo;
 2274|   530k|            n = TIFFReadFile(sp->tif, sp->in_buffer, (tmsize_t)m);
  ------------------
  |  |  283|   530k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2275|   530k|            if (n <= 0)
  ------------------
  |  Branch (2275:17): [True: 2, False: 530k]
  ------------------
 2276|      2|                return (0);
 2277|   530k|            assert(n > 0);
  ------------------
  |  Branch (2277:13): [True: 0, False: 530k]
  |  Branch (2277:13): [True: 530k, False: 0]
  ------------------
 2278|   530k|            assert(n <= OJPEG_BUFFER);
  ------------------
  |  Branch (2278:13): [True: 0, False: 530k]
  |  Branch (2278:13): [True: 530k, False: 0]
  ------------------
 2279|   530k|            assert(n < 65536);
  ------------------
  |  Branch (2279:13): [True: 0, False: 530k]
  |  Branch (2279:13): [True: 530k, False: 0]
  ------------------
 2280|   530k|            assert((uint64_t)n <= sp->in_buffer_file_togo);
  ------------------
  |  Branch (2280:13): [True: 0, False: 530k]
  |  Branch (2280:13): [True: 530k, False: 0]
  ------------------
 2281|   530k|            m = (uint16_t)n;
 2282|   530k|            sp->in_buffer_togo = m;
 2283|   530k|            sp->in_buffer_cur = sp->in_buffer;
 2284|   530k|            sp->in_buffer_file_togo -= m;
 2285|   530k|            sp->in_buffer_file_pos += m;
 2286|   530k|            break;
 2287|   530k|        }
 2288|  15.4M|        sp->in_buffer_file_pos_log = 0;
 2289|  15.4M|        switch (sp->in_buffer_source)
 2290|  15.4M|        {
 2291|  2.03k|            case osibsNotSetYet:
  ------------------
  |  Branch (2291:13): [True: 2.03k, False: 15.4M]
  ------------------
 2292|  2.03k|                if (sp->jpeg_interchange_format != 0)
  ------------------
  |  Branch (2292:21): [True: 684, False: 1.35k]
  ------------------
 2293|    684|                {
 2294|    684|                    sp->in_buffer_file_pos = sp->jpeg_interchange_format;
 2295|    684|                    sp->in_buffer_file_togo =
 2296|    684|                        sp->jpeg_interchange_format_length;
 2297|    684|                }
 2298|  2.03k|                sp->in_buffer_source = osibsJpegInterchangeFormat;
 2299|  2.03k|                break;
 2300|   364k|            case osibsJpegInterchangeFormat:
  ------------------
  |  Branch (2300:13): [True: 364k, False: 15.1M]
  ------------------
 2301|   364k|                sp->in_buffer_source = osibsStrile;
 2302|   364k|                break;
 2303|  15.1M|            case osibsStrile:
  ------------------
  |  Branch (2303:13): [True: 15.1M, False: 383k]
  ------------------
 2304|  15.1M|                if (sp->in_buffer_next_strile == sp->in_buffer_strile_count)
  ------------------
  |  Branch (2304:21): [True: 16.0k, False: 15.0M]
  ------------------
 2305|  16.0k|                    sp->in_buffer_source = osibsEof;
 2306|  15.0M|                else
 2307|  15.0M|                {
 2308|  15.0M|                    int err = 0;
 2309|  15.0M|                    sp->in_buffer_file_pos = TIFFGetStrileOffsetWithErr(
 2310|  15.0M|                        sp->tif, sp->in_buffer_next_strile, &err);
 2311|  15.0M|                    if (err)
  ------------------
  |  Branch (2311:25): [True: 354k, False: 14.7M]
  ------------------
 2312|   354k|                        return 0;
 2313|  14.7M|                    if (sp->in_buffer_file_pos != 0)
  ------------------
  |  Branch (2313:25): [True: 414k, False: 14.3M]
  ------------------
 2314|   414k|                    {
 2315|   414k|                        uint64_t bytecount = TIFFGetStrileByteCountWithErr(
 2316|   414k|                            sp->tif, sp->in_buffer_next_strile, &err);
 2317|   414k|                        if (err)
  ------------------
  |  Branch (2317:29): [True: 8.74k, False: 405k]
  ------------------
 2318|  8.74k|                            return 0;
 2319|   405k|                        if (sp->in_buffer_file_pos >= sp->file_size)
  ------------------
  |  Branch (2319:29): [True: 383k, False: 22.4k]
  ------------------
 2320|   383k|                            sp->in_buffer_file_pos = 0;
 2321|  22.4k|                        else if (bytecount == 0)
  ------------------
  |  Branch (2321:34): [True: 2.16k, False: 20.2k]
  ------------------
 2322|  2.16k|                            sp->in_buffer_file_togo =
 2323|  2.16k|                                sp->file_size - sp->in_buffer_file_pos;
 2324|  20.2k|                        else
 2325|  20.2k|                        {
 2326|  20.2k|                            sp->in_buffer_file_togo = bytecount;
 2327|  20.2k|                            if (sp->in_buffer_file_togo == 0)
  ------------------
  |  Branch (2327:33): [True: 0, False: 20.2k]
  ------------------
 2328|      0|                                sp->in_buffer_file_pos = 0;
 2329|  20.2k|                            else if (sp->in_buffer_file_pos >
  ------------------
  |  Branch (2329:38): [True: 330, False: 19.9k]
  ------------------
 2330|  20.2k|                                         UINT64_MAX - sp->in_buffer_file_togo ||
 2331|  19.9k|                                     sp->in_buffer_file_pos +
  ------------------
  |  Branch (2331:38): [True: 13.3k, False: 6.59k]
  ------------------
 2332|  19.9k|                                             sp->in_buffer_file_togo >
 2333|  19.9k|                                         sp->file_size)
 2334|  13.6k|                                sp->in_buffer_file_togo =
 2335|  13.6k|                                    sp->file_size - sp->in_buffer_file_pos;
 2336|  20.2k|                        }
 2337|   405k|                    }
 2338|  14.7M|                    sp->in_buffer_next_strile++;
 2339|  14.7M|                }
 2340|  14.7M|                break;
 2341|  14.7M|            case osibsEof:
  ------------------
  |  Branch (2341:13): [True: 16.2k, False: 15.4M]
  ------------------
 2342|  16.2k|            default:
  ------------------
  |  Branch (2342:13): [True: 0, False: 15.4M]
  ------------------
 2343|  16.2k|                return (0);
 2344|  15.4M|        }
 2345|  15.4M|    } while (1);
  ------------------
  |  Branch (2345:14): [True: 15.1M, Folded]
  ------------------
 2346|   530k|    return (1);
 2347|   910k|}
tif_ojpeg.c:OJPEGReadByteAdvance:
 2376|  16.2k|{
 2377|  16.2k|    assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2377:5): [True: 0, False: 16.2k]
  |  Branch (2377:5): [True: 16.2k, False: 0]
  ------------------
 2378|  16.2k|    sp->in_buffer_cur++;
 2379|  16.2k|    sp->in_buffer_togo--;
 2380|  16.2k|}
tif_ojpeg.c:OJPEGReadByte:
 2350|   337M|{
 2351|   337M|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2351:9): [True: 858k, False: 336M]
  ------------------
 2352|   858k|    {
 2353|   858k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2353:13): [True: 376k, False: 481k]
  ------------------
 2354|   376k|            return (0);
 2355|   858k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2355:9): [True: 0, False: 481k]
  |  Branch (2355:9): [True: 481k, False: 0]
  ------------------
 2356|   481k|    }
 2357|   337M|    *byte = *(sp->in_buffer_cur);
 2358|   337M|    sp->in_buffer_cur++;
 2359|   337M|    sp->in_buffer_togo--;
 2360|   337M|    return (1);
 2361|   337M|}
tif_ojpeg.c:OJPEGReadWord:
 2383|  19.9k|{
 2384|  19.9k|    uint8_t m;
 2385|  19.9k|    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (2385:9): [True: 1.45k, False: 18.5k]
  ------------------
 2386|  1.45k|        return (0);
 2387|  18.5k|    *word = (uint16_t)(m << 8);
 2388|  18.5k|    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (2388:9): [True: 507, False: 17.9k]
  ------------------
 2389|    507|        return (0);
 2390|  17.9k|    *word |= m;
 2391|  17.9k|    return (1);
 2392|  18.5k|}
tif_ojpeg.c:OJPEGReadSkip:
 2423|  7.17k|{
 2424|  7.17k|    uint16_t m;
 2425|  7.17k|    uint16_t n;
 2426|  7.17k|    m = len;
 2427|  7.17k|    n = m;
 2428|  7.17k|    if (n > sp->in_buffer_togo)
  ------------------
  |  Branch (2428:9): [True: 3.25k, False: 3.91k]
  ------------------
 2429|  3.25k|        n = sp->in_buffer_togo;
 2430|  7.17k|    sp->in_buffer_cur += n;
 2431|  7.17k|    sp->in_buffer_togo = (uint16_t)(sp->in_buffer_togo - n);
 2432|  7.17k|    m = (uint16_t)(m - n);
 2433|  7.17k|    if (m > 0)
  ------------------
  |  Branch (2433:9): [True: 3.25k, False: 3.91k]
  ------------------
 2434|  3.25k|    {
 2435|  3.25k|        assert(sp->in_buffer_togo == 0);
  ------------------
  |  Branch (2435:9): [True: 0, False: 3.25k]
  |  Branch (2435:9): [True: 3.25k, False: 0]
  ------------------
 2436|  3.25k|        n = m;
 2437|  3.25k|        if ((uint64_t)n > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2437:13): [True: 2.41k, False: 842]
  ------------------
 2438|  2.41k|            n = (uint16_t)sp->in_buffer_file_togo;
 2439|  3.25k|        sp->in_buffer_file_pos += n;
 2440|  3.25k|        sp->in_buffer_file_togo -= n;
 2441|  3.25k|        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|  3.25k|    }
 2449|  7.17k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDri:
 1675|    348|{
 1676|       |    /* This could easily cause trouble in some cases... but no such cases have
 1677|       |       occurred so far */
 1678|    348|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDri";
 1679|    348|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1680|    348|    uint16_t m;
 1681|    348|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1681:9): [True: 3, False: 345]
  ------------------
 1682|      3|        return (0);
 1683|    345|    if (m != 4)
  ------------------
  |  Branch (1683:9): [True: 4, False: 341]
  ------------------
 1684|      4|    {
 1685|      4|        TIFFErrorExtR(tif, module, "Corrupt DRI marker in JPEG data");
 1686|      4|        return (0);
 1687|      4|    }
 1688|    341|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1688:9): [True: 6, False: 335]
  ------------------
 1689|      6|        return (0);
 1690|    335|    sp->restart_interval = m;
 1691|    335|    return (1);
 1692|    341|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDqt:
 1695|  6.42k|{
 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|  6.42k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDqt";
 1699|  6.42k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1700|  6.42k|    uint16_t m;
 1701|  6.42k|    uint32_t na;
 1702|  6.42k|    uint8_t *nb;
 1703|  6.42k|    uint8_t o;
 1704|  6.42k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1704:9): [True: 0, False: 6.42k]
  ------------------
 1705|      0|        return (0);
 1706|  6.42k|    if (m <= 2)
  ------------------
  |  Branch (1706:9): [True: 0, False: 6.42k]
  ------------------
 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|  6.42k|    if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1712:9): [True: 4.24k, False: 2.18k]
  ------------------
 1713|  4.24k|        OJPEGReadSkip(sp, (uint16_t)(m - 2));
 1714|  2.18k|    else
 1715|  2.18k|    {
 1716|  2.18k|        m = (uint16_t)(m - 2);
 1717|  2.18k|        do
 1718|  2.51k|        {
 1719|  2.51k|            if (m < 65)
  ------------------
  |  Branch (1719:17): [True: 0, False: 2.51k]
  ------------------
 1720|      0|            {
 1721|      0|                TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1722|      0|                return (0);
 1723|      0|            }
 1724|  2.51k|            na = sizeof(uint32_t) + 69;
 1725|  2.51k|            nb = (uint8_t *)_TIFFmallocExt(tif, na);
 1726|  2.51k|            if (nb == 0)
  ------------------
  |  Branch (1726:17): [True: 0, False: 2.51k]
  ------------------
 1727|      0|            {
 1728|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1729|      0|                return (0);
 1730|      0|            }
 1731|  2.51k|            *(uint32_t *)nb = na;
 1732|  2.51k|            nb[sizeof(uint32_t)] = 255;
 1733|  2.51k|            nb[sizeof(uint32_t) + 1] = JPEG_MARKER_DQT;
  ------------------
  |  |  166|  2.51k|#define JPEG_MARKER_DQT 0xDB
  ------------------
 1734|  2.51k|            nb[sizeof(uint32_t) + 2] = 0;
 1735|  2.51k|            nb[sizeof(uint32_t) + 3] = 67;
 1736|  2.51k|            if (OJPEGReadBlock(sp, 65, &nb[sizeof(uint32_t) + 4]) == 0)
  ------------------
  |  Branch (1736:17): [True: 4, False: 2.51k]
  ------------------
 1737|      4|            {
 1738|      4|                _TIFFfreeExt(tif, nb);
 1739|      4|                return (0);
 1740|      4|            }
 1741|  2.51k|            o = nb[sizeof(uint32_t) + 4] & 15;
 1742|  2.51k|            if (3 < o)
  ------------------
  |  Branch (1742:17): [True: 30, False: 2.48k]
  ------------------
 1743|     30|            {
 1744|     30|                TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1745|     30|                _TIFFfreeExt(tif, nb);
 1746|     30|                return (0);
 1747|     30|            }
 1748|  2.48k|            if (sp->qtable[o] != 0)
  ------------------
  |  Branch (1748:17): [True: 2.42k, False: 60]
  ------------------
 1749|  2.42k|                _TIFFfreeExt(tif, sp->qtable[o]);
 1750|  2.48k|            sp->qtable[o] = nb;
 1751|  2.48k|            m = (uint16_t)(m - 65);
 1752|  2.48k|        } while (m > 0);
  ------------------
  |  Branch (1752:18): [True: 329, False: 2.15k]
  ------------------
 1753|  2.18k|    }
 1754|  6.39k|    return (1);
 1755|  6.42k|}
tif_ojpeg.c:OJPEGReadBlock:
 2395|  3.11k|{
 2396|  3.11k|    uint16_t mlen;
 2397|  3.11k|    uint8_t *mmem;
 2398|  3.11k|    uint16_t n;
 2399|  3.11k|    assert(len > 0);
  ------------------
  |  Branch (2399:5): [True: 0, False: 3.11k]
  |  Branch (2399:5): [True: 3.11k, False: 0]
  ------------------
 2400|  3.11k|    mlen = len;
 2401|  3.11k|    mmem = (uint8_t *)mem;
 2402|  3.11k|    do
 2403|  4.94k|    {
 2404|  4.94k|        if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2404:13): [True: 1.83k, False: 3.11k]
  ------------------
 2405|  1.83k|        {
 2406|  1.83k|            if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2406:17): [True: 9, False: 1.82k]
  ------------------
 2407|      9|                return (0);
 2408|  1.83k|            assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2408:13): [True: 0, False: 1.82k]
  |  Branch (2408:13): [True: 1.82k, False: 0]
  ------------------
 2409|  1.82k|        }
 2410|  4.93k|        n = mlen;
 2411|  4.93k|        if (n > sp->in_buffer_togo)
  ------------------
  |  Branch (2411:13): [True: 1.83k, False: 3.10k]
  ------------------
 2412|  1.83k|            n = sp->in_buffer_togo;
 2413|  4.93k|        _TIFFmemcpy(mmem, sp->in_buffer_cur, n);
 2414|  4.93k|        sp->in_buffer_cur += n;
 2415|  4.93k|        sp->in_buffer_togo = (uint16_t)(sp->in_buffer_togo - n);
 2416|  4.93k|        mlen = (uint16_t)(mlen - n);
 2417|  4.93k|        mmem += n;
 2418|  4.93k|    } while (mlen > 0);
  ------------------
  |  Branch (2418:14): [True: 1.83k, False: 3.10k]
  ------------------
 2419|  3.10k|    return (1);
 2420|  3.11k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDht:
 1758|  1.63k|{
 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.63k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDht";
 1764|  1.63k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1765|  1.63k|    uint16_t m;
 1766|  1.63k|    uint32_t na;
 1767|  1.63k|    uint8_t *nb;
 1768|  1.63k|    uint8_t o;
 1769|  1.63k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1769:9): [True: 3, False: 1.63k]
  ------------------
 1770|      3|        return (0);
 1771|  1.63k|    if (m <= 2)
  ------------------
  |  Branch (1771:9): [True: 0, False: 1.63k]
  ------------------
 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.63k|    if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1777:9): [True: 1.03k, False: 594]
  ------------------
 1778|  1.03k|    {
 1779|  1.03k|        OJPEGReadSkip(sp, (uint16_t)(m - 2));
 1780|  1.03k|    }
 1781|    594|    else
 1782|    594|    {
 1783|    594|        na = (uint32_t)(sizeof(uint32_t) + 2 + m);
 1784|    594|        nb = (uint8_t *)_TIFFmallocExt(tif, na);
 1785|    594|        if (nb == 0)
  ------------------
  |  Branch (1785:13): [True: 0, False: 594]
  ------------------
 1786|      0|        {
 1787|      0|            TIFFErrorExtR(tif, module, "Out of memory");
 1788|      0|            return (0);
 1789|      0|        }
 1790|    594|        *(uint32_t *)nb = na;
 1791|    594|        nb[sizeof(uint32_t)] = 255;
 1792|    594|        nb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|    594|#define JPEG_MARKER_DHT 0xC4
  ------------------
 1793|    594|        nb[sizeof(uint32_t) + 2] = (uint8_t)(m >> 8);
 1794|    594|        nb[sizeof(uint32_t) + 3] = (uint8_t)(m & 255);
 1795|    594|        if (OJPEGReadBlock(sp, (uint16_t)(m - 2), &nb[sizeof(uint32_t) + 4]) ==
  ------------------
  |  Branch (1795:13): [True: 5, False: 589]
  ------------------
 1796|    594|            0)
 1797|      5|        {
 1798|      5|            _TIFFfreeExt(tif, nb);
 1799|      5|            return (0);
 1800|      5|        }
 1801|    589|        o = nb[sizeof(uint32_t) + 4];
 1802|    589|        if ((o & 240) == 0)
  ------------------
  |  Branch (1802:13): [True: 189, False: 400]
  ------------------
 1803|    189|        {
 1804|    189|            if (3 < o)
  ------------------
  |  Branch (1804:17): [True: 2, False: 187]
  ------------------
 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|    187|            if (sp->dctable[o] != 0)
  ------------------
  |  Branch (1810:17): [True: 132, False: 55]
  ------------------
 1811|    132|                _TIFFfreeExt(tif, sp->dctable[o]);
 1812|    187|            sp->dctable[o] = nb;
 1813|    187|        }
 1814|    400|        else
 1815|    400|        {
 1816|    400|            if ((o & 240) != 16)
  ------------------
  |  Branch (1816:17): [True: 2, False: 398]
  ------------------
 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|    398|            o &= 15;
 1823|    398|            if (3 < o)
  ------------------
  |  Branch (1823:17): [True: 0, False: 398]
  ------------------
 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|    398|            if (sp->actable[o] != 0)
  ------------------
  |  Branch (1829:17): [True: 384, False: 14]
  ------------------
 1830|    384|                _TIFFfreeExt(tif, sp->actable[o]);
 1831|    398|            sp->actable[o] = nb;
 1832|    398|        }
 1833|    589|    }
 1834|  1.62k|    return (1);
 1835|  1.63k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSof:
 1838|    116|{
 1839|       |    /* this marker needs to be checked, and part of its data needs to be saved
 1840|       |     * for regeneration later on */
 1841|    116|    static const char module[] = "OJPEGReadHeaderInfoSecStreamSof";
 1842|    116|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1843|    116|    uint16_t m;
 1844|    116|    uint16_t n;
 1845|    116|    uint8_t o;
 1846|    116|    uint16_t p;
 1847|    116|    uint16_t q;
 1848|    116|    if (sp->sof_log != 0)
  ------------------
  |  Branch (1848:9): [True: 3, False: 113]
  ------------------
 1849|      3|    {
 1850|      3|        TIFFErrorExtR(tif, module, "Corrupt JPEG data");
 1851|      3|        return (0);
 1852|      3|    }
 1853|    113|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1853:9): [True: 59, False: 54]
  ------------------
 1854|     59|        sp->sof_marker_id = marker_id;
 1855|       |    /* Lf: data length */
 1856|    113|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1856:9): [True: 5, False: 108]
  ------------------
 1857|      5|        return (0);
 1858|    108|    if (m < 11)
  ------------------
  |  Branch (1858:9): [True: 2, False: 106]
  ------------------
 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|    106|    m = (uint16_t)(m - 8);
 1865|    106|    if (m % 3 != 0)
  ------------------
  |  Branch (1865:9): [True: 0, False: 106]
  ------------------
 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|    106|    n = m / 3;
 1872|    106|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1872:9): [True: 53, False: 53]
  ------------------
 1873|     53|    {
 1874|     53|        if (n != sp->samples_per_pixel)
  ------------------
  |  Branch (1874:13): [True: 6, False: 47]
  ------------------
 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|     53|    }
 1882|       |    /* P: Sample precision */
 1883|    100|    if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1883:9): [True: 6, False: 94]
  ------------------
 1884|      6|        return (0);
 1885|     94|    if (o != 8)
  ------------------
  |  Branch (1885:9): [True: 5, False: 89]
  ------------------
 1886|      5|    {
 1887|      5|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1887:13): [True: 0, False: 5]
  ------------------
 1888|      0|            TIFFErrorExtR(tif, module,
 1889|      0|                          "JPEG compressed data indicates unexpected number of "
 1890|      0|                          "bits per sample");
 1891|      5|        return (0);
 1892|      5|    }
 1893|       |    /* Y: Number of lines, X: Number of samples per line */
 1894|     89|    if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1894:9): [True: 45, False: 44]
  ------------------
 1895|     45|        OJPEGReadSkip(sp, 4);
 1896|     44|    else
 1897|     44|    {
 1898|       |        /* Y: Number of lines */
 1899|     44|        if (OJPEGReadWord(sp, &p) == 0)
  ------------------
  |  Branch (1899:13): [True: 0, False: 44]
  ------------------
 1900|      0|            return (0);
 1901|     44|        if (((uint32_t)p < sp->image_length) &&
  ------------------
  |  Branch (1901:13): [True: 2, False: 42]
  ------------------
 1902|      2|            ((uint32_t)p < sp->strile_length_total))
  ------------------
  |  Branch (1902:13): [True: 2, False: 0]
  ------------------
 1903|      2|        {
 1904|      2|            TIFFErrorExtR(tif, module,
 1905|      2|                          "JPEG compressed data indicates unexpected height");
 1906|      2|            return (0);
 1907|      2|        }
 1908|     42|        sp->sof_y = p;
 1909|       |        /* X: Number of samples per line */
 1910|     42|        if (OJPEGReadWord(sp, &p) == 0)
  ------------------
  |  Branch (1910:13): [True: 0, False: 42]
  ------------------
 1911|      0|            return (0);
 1912|     42|        if (((uint32_t)p < sp->image_width) && ((uint32_t)p < sp->strile_width))
  ------------------
  |  Branch (1912:13): [True: 27, False: 15]
  |  Branch (1912:48): [True: 3, False: 24]
  ------------------
 1913|      3|        {
 1914|      3|            TIFFErrorExtR(tif, module,
 1915|      3|                          "JPEG compressed data indicates unexpected width");
 1916|      3|            return (0);
 1917|      3|        }
 1918|     39|        if ((uint32_t)p > sp->strile_width)
  ------------------
  |  Branch (1918:13): [True: 0, False: 39]
  ------------------
 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|     39|        sp->sof_x = p;
 1926|     39|    }
 1927|       |    /* Nf: Number of image components in frame */
 1928|     84|    if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1928:9): [True: 5, False: 79]
  ------------------
 1929|      5|        return (0);
 1930|     79|    if (o != n)
  ------------------
  |  Branch (1930:9): [True: 4, False: 75]
  ------------------
 1931|      4|    {
 1932|      4|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1932:13): [True: 1, False: 3]
  ------------------
 1933|      1|            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|    972|    for (q = 0; q < n; q++)
  ------------------
  |  Branch (1939:17): [True: 909, False: 63]
  ------------------
 1940|    909|    {
 1941|       |        /* C: Component identifier */
 1942|    909|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1942:13): [True: 0, False: 909]
  ------------------
 1943|      0|            return (0);
 1944|    909|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1944:13): [True: 93, False: 816]
  ------------------
 1945|     93|            sp->sof_c[q] = o;
 1946|       |        /* H: Horizontal sampling factor, and V: Vertical sampling factor */
 1947|    909|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1947:13): [True: 0, False: 909]
  ------------------
 1948|      0|            return (0);
 1949|    909|        if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1949:13): [True: 816, False: 93]
  ------------------
 1950|    816|        {
 1951|    816|            if (q == 0)
  ------------------
  |  Branch (1951:17): [True: 40, False: 776]
  ------------------
 1952|     40|            {
 1953|     40|                sp->subsampling_hor = (o >> 4);
 1954|     40|                sp->subsampling_ver = (o & 15);
 1955|     40|                if (((sp->subsampling_hor != 1) && (sp->subsampling_hor != 2) &&
  ------------------
  |  Branch (1955:22): [True: 32, False: 8]
  |  Branch (1955:52): [True: 19, False: 13]
  ------------------
 1956|     19|                     (sp->subsampling_hor != 4)) ||
  ------------------
  |  Branch (1956:22): [True: 12, False: 7]
  ------------------
 1957|     28|                    ((sp->subsampling_ver != 1) && (sp->subsampling_ver != 2) &&
  ------------------
  |  Branch (1957:22): [True: 15, False: 13]
  |  Branch (1957:52): [True: 5, False: 10]
  ------------------
 1958|      5|                     (sp->subsampling_ver != 4)))
  ------------------
  |  Branch (1958:22): [True: 2, False: 3]
  ------------------
 1959|     14|                    sp->subsampling_force_desubsampling_inside_decompression =
 1960|     14|                        1;
 1961|     40|            }
 1962|    776|            else
 1963|    776|            {
 1964|    776|                if (o != 17)
  ------------------
  |  Branch (1964:21): [True: 764, False: 12]
  ------------------
 1965|    764|                    sp->subsampling_force_desubsampling_inside_decompression =
 1966|    764|                        1;
 1967|    776|            }
 1968|    816|        }
 1969|     93|        else
 1970|     93|        {
 1971|     93|            sp->sof_hv[q] = o;
 1972|     93|            if (sp->subsampling_force_desubsampling_inside_decompression == 0)
  ------------------
  |  Branch (1972:17): [True: 22, False: 71]
  ------------------
 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|     93|        }
 1996|       |        /* Tq: Quantization table destination selector */
 1997|    903|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1997:13): [True: 6, False: 897]
  ------------------
 1998|      6|            return (0);
 1999|    897|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1999:13): [True: 83, False: 814]
  ------------------
 2000|     83|            sp->sof_tq[q] = o;
 2001|    897|    }
 2002|     63|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (2002:9): [True: 25, False: 38]
  ------------------
 2003|     25|        sp->sof_log = 1;
 2004|     63|    return (1);
 2005|     75|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSos:
 2008|  9.68k|{
 2009|       |    /* this marker needs to be checked, and part of its data needs to be saved
 2010|       |     * for regeneration later on */
 2011|  9.68k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamSos";
 2012|  9.68k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2013|  9.68k|    uint16_t m;
 2014|  9.68k|    uint8_t n;
 2015|  9.68k|    uint8_t o;
 2016|  9.68k|    assert(sp->subsamplingcorrect == 0);
  ------------------
  |  Branch (2016:5): [True: 0, False: 9.68k]
  |  Branch (2016:5): [True: 9.68k, False: 0]
  ------------------
 2017|  9.68k|    if (sp->sof_log == 0)
  ------------------
  |  Branch (2017:9): [True: 0, False: 9.68k]
  ------------------
 2018|      0|    {
 2019|      0|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2020|      0|        return (0);
 2021|      0|    }
 2022|       |    /* Ls */
 2023|  9.68k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (2023:9): [True: 1.94k, False: 7.74k]
  ------------------
 2024|  1.94k|        return (0);
 2025|  7.74k|    if (m != 6 + sp->samples_per_pixel_per_plane * 2)
  ------------------
  |  Branch (2025:9): [True: 2.25k, False: 5.48k]
  ------------------
 2026|  2.25k|    {
 2027|  2.25k|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2028|  2.25k|        return (0);
 2029|  2.25k|    }
 2030|       |    /* Ns */
 2031|  5.48k|    if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2031:9): [True: 514, False: 4.97k]
  ------------------
 2032|    514|        return (0);
 2033|  4.97k|    if (n != sp->samples_per_pixel_per_plane)
  ------------------
  |  Branch (2033:9): [True: 3.08k, False: 1.89k]
  ------------------
 2034|  3.08k|    {
 2035|  3.08k|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2036|  3.08k|        return (0);
 2037|  3.08k|    }
 2038|       |    /* Cs, Td, and Ta */
 2039|  2.47k|    for (o = 0; o < sp->samples_per_pixel_per_plane; o++)
  ------------------
  |  Branch (2039:17): [True: 1.93k, False: 540]
  ------------------
 2040|  1.93k|    {
 2041|       |        /* Cs */
 2042|  1.93k|        if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2042:13): [True: 221, False: 1.70k]
  ------------------
 2043|    221|            return (0);
 2044|  1.70k|        sp->sos_cs[sp->plane_sample_offset + o] = n;
 2045|       |        /* Td and Ta */
 2046|  1.70k|        if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2046:13): [True: 1.13k, False: 577]
  ------------------
 2047|  1.13k|            return (0);
 2048|    577|        sp->sos_tda[sp->plane_sample_offset + o] = n;
 2049|    577|    }
 2050|       |    /* skip Ss, Se, Ah, en Al -> no check, as per Tom Lane recommendation, as
 2051|       |     * per LibJpeg source */
 2052|    540|    OJPEGReadSkip(sp, 3);
 2053|    540|    return (1);
 2054|  1.89k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesQTable:
 2057|    859|{
 2058|    859|    static const char module[] = "OJPEGReadHeaderInfoSecTablesQTable";
 2059|    859|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2060|    859|    uint8_t m;
 2061|    859|    uint8_t n;
 2062|    859|    uint32_t oa;
 2063|    859|    uint8_t *ob;
 2064|    859|    uint32_t p;
 2065|    859|    if (sp->qtable_offset[0] == 0)
  ------------------
  |  Branch (2065:9): [True: 18, False: 841]
  ------------------
 2066|     18|    {
 2067|     18|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2068|     18|        return (0);
 2069|     18|    }
 2070|    841|    sp->in_buffer_file_pos_log = 0;
 2071|  3.26k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2071:17): [True: 2.45k, False: 812]
  ------------------
 2072|  2.45k|    {
 2073|  2.45k|        if ((sp->qtable_offset[m] != 0) &&
  ------------------
  |  Branch (2073:13): [True: 945, False: 1.51k]
  ------------------
 2074|    945|            ((m == 0) || (sp->qtable_offset[m] != sp->qtable_offset[m - 1])))
  ------------------
  |  Branch (2074:14): [True: 841, False: 104]
  |  Branch (2074:26): [True: 102, False: 2]
  ------------------
 2075|    943|        {
 2076|    963|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2076:25): [True: 23, False: 940]
  ------------------
 2077|     23|            {
 2078|     23|                if (sp->qtable_offset[m] == sp->qtable_offset[n])
  ------------------
  |  Branch (2078:21): [True: 3, False: 20]
  ------------------
 2079|      3|                {
 2080|      3|                    TIFFErrorExtR(tif, module, "Corrupt JpegQTables tag value");
 2081|      3|                    return (0);
 2082|      3|                }
 2083|     23|            }
 2084|    940|            oa = sizeof(uint32_t) + 69;
 2085|    940|            ob = (uint8_t *)_TIFFmallocExt(tif, oa);
 2086|    940|            if (ob == 0)
  ------------------
  |  Branch (2086:17): [True: 0, False: 940]
  ------------------
 2087|      0|            {
 2088|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2089|      0|                return (0);
 2090|      0|            }
 2091|    940|            *(uint32_t *)ob = oa;
 2092|    940|            ob[sizeof(uint32_t)] = 255;
 2093|    940|            ob[sizeof(uint32_t) + 1] = JPEG_MARKER_DQT;
  ------------------
  |  |  166|    940|#define JPEG_MARKER_DQT 0xDB
  ------------------
 2094|    940|            ob[sizeof(uint32_t) + 2] = 0;
 2095|    940|            ob[sizeof(uint32_t) + 3] = 67;
 2096|    940|            ob[sizeof(uint32_t) + 4] = m;
 2097|    940|            TIFFSeekFile(tif, sp->qtable_offset[m], SEEK_SET);
  ------------------
  |  |  287|    940|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2098|    940|            p = (uint32_t)TIFFReadFile(tif, &ob[sizeof(uint32_t) + 5], 64);
  ------------------
  |  |  283|    940|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2099|    940|            if (p != 64)
  ------------------
  |  Branch (2099:17): [True: 26, False: 914]
  ------------------
 2100|     26|            {
 2101|     26|                _TIFFfreeExt(tif, ob);
 2102|     26|                return (0);
 2103|     26|            }
 2104|    914|            if (sp->qtable[m] != 0)
  ------------------
  |  Branch (2104:17): [True: 3, False: 911]
  ------------------
 2105|      3|                _TIFFfreeExt(tif, sp->qtable[m]);
 2106|    914|            sp->qtable[m] = ob;
 2107|    914|            sp->sof_tq[m] = m;
 2108|    914|        }
 2109|  1.51k|        else
 2110|  1.51k|            sp->sof_tq[m] = sp->sof_tq[m - 1];
 2111|  2.45k|    }
 2112|    812|    return (1);
 2113|    841|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesDcTable:
 2116|    812|{
 2117|    812|    static const char module[] = "OJPEGReadHeaderInfoSecTablesDcTable";
 2118|    812|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2119|    812|    uint8_t m;
 2120|    812|    uint8_t n;
 2121|    812|    uint8_t o[16];
 2122|    812|    uint32_t p;
 2123|    812|    uint32_t q;
 2124|    812|    uint32_t ra;
 2125|    812|    uint8_t *rb;
 2126|    812|    if (sp->dctable_offset[0] == 0)
  ------------------
  |  Branch (2126:9): [True: 23, False: 789]
  ------------------
 2127|     23|    {
 2128|     23|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2129|     23|        return (0);
 2130|     23|    }
 2131|    789|    sp->in_buffer_file_pos_log = 0;
 2132|  3.11k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2132:17): [True: 2.34k, False: 774]
  ------------------
 2133|  2.34k|    {
 2134|  2.34k|        if ((sp->dctable_offset[m] != 0) &&
  ------------------
  |  Branch (2134:13): [True: 1.52k, False: 819]
  ------------------
 2135|  1.52k|            ((m == 0) || (sp->dctable_offset[m] != sp->dctable_offset[m - 1])))
  ------------------
  |  Branch (2135:14): [True: 789, False: 734]
  |  Branch (2135:26): [True: 725, False: 9]
  ------------------
 2136|  1.51k|        {
 2137|  1.88k|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2137:25): [True: 375, False: 1.51k]
  ------------------
 2138|    375|            {
 2139|    375|                if (sp->dctable_offset[m] == sp->dctable_offset[n])
  ------------------
  |  Branch (2139:21): [True: 1, False: 374]
  ------------------
 2140|      1|                {
 2141|      1|                    TIFFErrorExtR(tif, module,
 2142|      1|                                  "Corrupt JpegDcTables tag value");
 2143|      1|                    return (0);
 2144|      1|                }
 2145|    375|            }
 2146|  1.51k|            TIFFSeekFile(tif, sp->dctable_offset[m], SEEK_SET);
  ------------------
  |  |  287|  1.51k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2147|  1.51k|            p = (uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  283|  1.51k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2148|  1.51k|            if (p != 16)
  ------------------
  |  Branch (2148:17): [True: 6, False: 1.50k]
  ------------------
 2149|      6|                return (0);
 2150|  1.50k|            q = 0;
 2151|  25.6k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2151:25): [True: 24.1k, False: 1.50k]
  ------------------
 2152|  24.1k|                q += o[n];
 2153|  1.50k|            ra = (uint32_t)(sizeof(uint32_t) + 21 + q);
 2154|  1.50k|            rb = (uint8_t *)_TIFFmallocExt(tif, ra);
 2155|  1.50k|            if (rb == 0)
  ------------------
  |  Branch (2155:17): [True: 0, False: 1.50k]
  ------------------
 2156|      0|            {
 2157|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2158|      0|                return (0);
 2159|      0|            }
 2160|  1.50k|            *(uint32_t *)rb = ra;
 2161|  1.50k|            rb[sizeof(uint32_t)] = 255;
 2162|  1.50k|            rb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|  1.50k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 2163|  1.50k|            rb[sizeof(uint32_t) + 2] = (uint8_t)((19 + q) >> 8);
 2164|  1.50k|            rb[sizeof(uint32_t) + 3] = ((19 + q) & 255);
 2165|  1.50k|            rb[sizeof(uint32_t) + 4] = m;
 2166|  25.6k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2166:25): [True: 24.1k, False: 1.50k]
  ------------------
 2167|  24.1k|                rb[sizeof(uint32_t) + 5 + n] = o[n];
 2168|  1.50k|            p = (uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  283|  1.50k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2169|  1.50k|            if (p != q)
  ------------------
  |  Branch (2169:17): [True: 8, False: 1.49k]
  ------------------
 2170|      8|            {
 2171|      8|                _TIFFfreeExt(tif, rb);
 2172|      8|                return (0);
 2173|      8|            }
 2174|  1.49k|            if (sp->dctable[m] != 0)
  ------------------
  |  Branch (2174:17): [True: 4, False: 1.49k]
  ------------------
 2175|      4|                _TIFFfreeExt(tif, sp->dctable[m]);
 2176|  1.49k|            sp->dctable[m] = rb;
 2177|  1.49k|            sp->sos_tda[m] = (uint8_t)(m << 4);
 2178|  1.49k|        }
 2179|    828|        else
 2180|    828|            sp->sos_tda[m] = sp->sos_tda[m - 1];
 2181|  2.34k|    }
 2182|    774|    return (1);
 2183|    789|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesAcTable:
 2186|    774|{
 2187|    774|    static const char module[] = "OJPEGReadHeaderInfoSecTablesAcTable";
 2188|    774|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2189|    774|    uint8_t m;
 2190|    774|    uint8_t n;
 2191|    774|    uint8_t o[16];
 2192|    774|    uint32_t p;
 2193|    774|    uint32_t q;
 2194|    774|    uint32_t ra;
 2195|    774|    uint8_t *rb;
 2196|    774|    if (sp->actable_offset[0] == 0)
  ------------------
  |  Branch (2196:9): [True: 14, False: 760]
  ------------------
 2197|     14|    {
 2198|     14|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2199|     14|        return (0);
 2200|     14|    }
 2201|    760|    sp->in_buffer_file_pos_log = 0;
 2202|  2.95k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2202:17): [True: 2.23k, False: 723]
  ------------------
 2203|  2.23k|    {
 2204|  2.23k|        if ((sp->actable_offset[m] != 0) &&
  ------------------
  |  Branch (2204:13): [True: 1.40k, False: 830]
  ------------------
 2205|  1.40k|            ((m == 0) || (sp->actable_offset[m] != sp->actable_offset[m - 1])))
  ------------------
  |  Branch (2205:14): [True: 760, False: 641]
  |  Branch (2205:26): [True: 616, False: 25]
  ------------------
 2206|  1.37k|        {
 2207|  1.49k|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2207:25): [True: 115, False: 1.37k]
  ------------------
 2208|    115|            {
 2209|    115|                if (sp->actable_offset[m] == sp->actable_offset[n])
  ------------------
  |  Branch (2209:21): [True: 1, False: 114]
  ------------------
 2210|      1|                {
 2211|      1|                    TIFFErrorExtR(tif, module,
 2212|      1|                                  "Corrupt JpegAcTables tag value");
 2213|      1|                    return (0);
 2214|      1|                }
 2215|    115|            }
 2216|  1.37k|            TIFFSeekFile(tif, sp->actable_offset[m], SEEK_SET);
  ------------------
  |  |  287|  1.37k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2217|  1.37k|            p = (uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  283|  1.37k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2218|  1.37k|            if (p != 16)
  ------------------
  |  Branch (2218:17): [True: 31, False: 1.34k]
  ------------------
 2219|     31|                return (0);
 2220|  1.34k|            q = 0;
 2221|  22.8k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2221:25): [True: 21.5k, False: 1.34k]
  ------------------
 2222|  21.5k|                q += o[n];
 2223|  1.34k|            ra = (uint32_t)(sizeof(uint32_t) + 21 + q);
 2224|  1.34k|            rb = (uint8_t *)_TIFFmallocExt(tif, ra);
 2225|  1.34k|            if (rb == 0)
  ------------------
  |  Branch (2225:17): [True: 0, False: 1.34k]
  ------------------
 2226|      0|            {
 2227|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2228|      0|                return (0);
 2229|      0|            }
 2230|  1.34k|            *(uint32_t *)rb = ra;
 2231|  1.34k|            rb[sizeof(uint32_t)] = 255;
 2232|  1.34k|            rb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|  1.34k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 2233|  1.34k|            rb[sizeof(uint32_t) + 2] = (uint8_t)((19 + q) >> 8);
 2234|  1.34k|            rb[sizeof(uint32_t) + 3] = ((19 + q) & 255);
 2235|  1.34k|            rb[sizeof(uint32_t) + 4] = (16 | m);
 2236|  22.8k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2236:25): [True: 21.5k, False: 1.34k]
  ------------------
 2237|  21.5k|                rb[sizeof(uint32_t) + 5 + n] = o[n];
 2238|  1.34k|            p = (uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  283|  1.34k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2239|  1.34k|            if (p != q)
  ------------------
  |  Branch (2239:17): [True: 5, False: 1.33k]
  ------------------
 2240|      5|            {
 2241|      5|                _TIFFfreeExt(tif, rb);
 2242|      5|                return (0);
 2243|      5|            }
 2244|  1.33k|            if (sp->actable[m] != 0)
  ------------------
  |  Branch (2244:17): [True: 3, False: 1.33k]
  ------------------
 2245|      3|                _TIFFfreeExt(tif, sp->actable[m]);
 2246|  1.33k|            sp->actable[m] = rb;
 2247|  1.33k|            sp->sos_tda[m] = (sp->sos_tda[m] | m);
 2248|  1.33k|        }
 2249|    855|        else
 2250|    855|            sp->sos_tda[m] = (sp->sos_tda[m] | (sp->sos_tda[m - 1] & 15));
 2251|  2.23k|    }
 2252|    723|    return (1);
 2253|    760|}
tif_ojpeg.c:OJPEGVSetField:
  560|  13.6k|{
  561|  13.6k|    static const char module[] = "OJPEGVSetField";
  562|  13.6k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  563|  13.6k|    uint32_t ma;
  564|  13.6k|    uint64_t *mb;
  565|  13.6k|    uint32_t n;
  566|  13.6k|    const TIFFField *fip;
  567|       |
  568|  13.6k|    switch (tag)
  569|  13.6k|    {
  570|    340|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|    340|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (570:9): [True: 340, False: 13.3k]
  ------------------
  571|    340|            sp->jpeg_interchange_format = (uint64_t)va_arg(ap, uint64_t);
  572|    340|            break;
  573|      5|        case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|      5|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (573:9): [True: 5, False: 13.6k]
  ------------------
  574|      5|            sp->jpeg_interchange_format_length = (uint64_t)va_arg(ap, uint64_t);
  575|      5|            break;
  576|    765|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|    765|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (576:9): [True: 765, False: 12.8k]
  ------------------
  577|    765|            sp->subsampling_tag = 1;
  578|    765|            sp->subsampling_hor = (uint8_t)va_arg(ap, uint16_vap);
  579|    765|            sp->subsampling_ver = (uint8_t)va_arg(ap, uint16_vap);
  580|    765|            tif->tif_dir.td_ycbcrsubsampling[0] = sp->subsampling_hor;
  581|    765|            tif->tif_dir.td_ycbcrsubsampling[1] = sp->subsampling_ver;
  582|    765|            break;
  583|    906|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|    906|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (583:9): [True: 906, False: 12.7k]
  ------------------
  584|    906|            ma = (uint32_t)va_arg(ap, uint32_t);
  585|    906|            if (ma != 0)
  ------------------
  |  Branch (585:17): [True: 906, False: 0]
  ------------------
  586|    906|            {
  587|    906|                if (ma > 3)
  ------------------
  |  Branch (587:21): [True: 3, False: 903]
  ------------------
  588|      3|                {
  589|      3|                    TIFFErrorExtR(tif, module,
  590|      3|                                  "JpegQTables tag has incorrect count");
  591|      3|                    return (0);
  592|      3|                }
  593|    903|                sp->qtable_offset_count = (uint8_t)ma;
  594|    903|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  595|  2.14k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (595:29): [True: 1.23k, False: 903]
  ------------------
  596|  1.23k|                    sp->qtable_offset[n] = mb[n];
  597|    903|            }
  598|    903|            break;
  599|    903|        case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|    846|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (599:9): [True: 846, False: 12.8k]
  ------------------
  600|    846|            ma = (uint32_t)va_arg(ap, uint32_t);
  601|    846|            if (ma != 0)
  ------------------
  |  Branch (601:17): [True: 846, False: 0]
  ------------------
  602|    846|            {
  603|    846|                if (ma > 3)
  ------------------
  |  Branch (603:21): [True: 0, False: 846]
  ------------------
  604|      0|                {
  605|      0|                    TIFFErrorExtR(tif, module,
  606|      0|                                  "JpegDcTables tag has incorrect count");
  607|      0|                    return (0);
  608|      0|                }
  609|    846|                sp->dctable_offset_count = (uint8_t)ma;
  610|    846|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  611|  2.55k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (611:29): [True: 1.71k, False: 846]
  ------------------
  612|  1.71k|                    sp->dctable_offset[n] = mb[n];
  613|    846|            }
  614|    846|            break;
  615|    846|        case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|    831|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (615:9): [True: 831, False: 12.8k]
  ------------------
  616|    831|            ma = (uint32_t)va_arg(ap, uint32_t);
  617|    831|            if (ma != 0)
  ------------------
  |  Branch (617:17): [True: 830, False: 1]
  ------------------
  618|    830|            {
  619|    830|                if (ma > 3)
  ------------------
  |  Branch (619:21): [True: 2, False: 828]
  ------------------
  620|      2|                {
  621|      2|                    TIFFErrorExtR(tif, module,
  622|      2|                                  "JpegAcTables tag has incorrect count");
  623|      2|                    return (0);
  624|      2|                }
  625|    828|                sp->actable_offset_count = (uint8_t)ma;
  626|    828|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  627|  3.31k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (627:29): [True: 2.48k, False: 828]
  ------------------
  628|  2.48k|                    sp->actable_offset[n] = mb[n];
  629|    828|            }
  630|    829|            break;
  631|    829|        case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|      1|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (631:9): [True: 1, False: 13.6k]
  ------------------
  632|      1|            sp->jpeg_proc = (uint8_t)va_arg(ap, uint16_vap);
  633|      1|            break;
  634|     13|        case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|     13|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (634:9): [True: 13, False: 13.6k]
  ------------------
  635|     13|            sp->restart_interval = (uint16_t)va_arg(ap, uint16_vap);
  636|     13|            break;
  637|  9.94k|        default:
  ------------------
  |  Branch (637:9): [True: 9.94k, False: 3.70k]
  ------------------
  638|  9.94k|            return (*sp->vsetparent)(tif, tag, ap);
  639|  13.6k|    }
  640|  3.70k|    fip = TIFFFieldWithTag(tif, tag);
  641|  3.70k|    if (fip == NULL) /* shouldn't happen */
  ------------------
  |  Branch (641:9): [True: 0, False: 3.70k]
  ------------------
  642|      0|        return (0);
  643|  3.70k|    TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|  3.70k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|  3.70k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|  3.70k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  644|  3.70k|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  3.70k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
  645|  3.70k|    return (1);
  646|  3.70k|}
tif_ojpeg.c:OJPEGFixupTags:
  691|  1.06k|{
  692|  1.06k|    (void)tif;
  693|  1.06k|    return (1);
  694|  1.06k|}
tif_ojpeg.c:OJPEGSetupDecode:
  697|    997|{
  698|    997|    static const char module[] = "OJPEGSetupDecode";
  699|    997|    TIFFWarningExtR(tif, module,
  700|    997|                    "Deprecated and troublesome old-style JPEG compression "
  701|    997|                    "mode, please convert to new-style JPEG compression and "
  702|    997|                    "notify vendor of writing software");
  703|    997|    return (1);
  704|    997|}
tif_ojpeg.c:OJPEGPreDecode:
  707|   622k|{
  708|   622k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  709|   622k|    uint32_t m;
  710|   622k|    if (sp->subsamplingcorrect_done == 0)
  ------------------
  |  Branch (710:9): [True: 20, False: 622k]
  ------------------
  711|     20|        OJPEGSubsamplingCorrect(tif);
  712|   622k|    if (sp->readheader_done == 0)
  ------------------
  |  Branch (712:9): [True: 1.06k, False: 621k]
  ------------------
  713|  1.06k|    {
  714|  1.06k|        if (OJPEGReadHeaderInfo(tif) == 0)
  ------------------
  |  Branch (714:13): [True: 282, False: 778]
  ------------------
  715|    282|            return (0);
  716|  1.06k|    }
  717|   621k|    if (sp->sos_end[s].log == 0)
  ------------------
  |  Branch (717:9): [True: 382k, False: 239k]
  ------------------
  718|   382k|    {
  719|   382k|        if (OJPEGReadSecondarySos(tif, s) == 0)
  ------------------
  |  Branch (719:13): [True: 382k, False: 522]
  ------------------
  720|   382k|            return (0);
  721|   382k|    }
  722|   239k|    if (isTiled(tif))
  ------------------
  |  |  278|   239k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|   239k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 236k, False: 3.59k]
  |  |  ------------------
  ------------------
  723|   236k|        m = tif->tif_dir.td_curtile;
  724|  3.59k|    else
  725|  3.59k|        m = tif->tif_dir.td_curstrip;
  726|   239k|    if ((sp->writeheader_done != 0) &&
  ------------------
  |  Branch (726:9): [True: 229k, False: 10.6k]
  ------------------
  727|   229k|        ((sp->write_cursample != s) || (sp->write_curstrile > m)))
  ------------------
  |  Branch (727:10): [True: 38.3k, False: 190k]
  |  Branch (727:40): [True: 1.48k, False: 189k]
  ------------------
  728|  39.8k|    {
  729|  39.8k|        if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (729:13): [True: 39.8k, False: 0]
  ------------------
  730|  39.8k|            OJPEGLibjpegSessionAbort(tif);
  731|  39.8k|        sp->writeheader_done = 0;
  732|  39.8k|    }
  733|   239k|    if (sp->writeheader_done == 0)
  ------------------
  |  Branch (733:9): [True: 50.4k, False: 189k]
  ------------------
  734|  50.4k|    {
  735|  50.4k|        sp->plane_sample_offset = (uint8_t)s;
  736|  50.4k|        sp->write_cursample = s;
  737|  50.4k|        sp->write_curstrile = s * tif->tif_dir.td_stripsperimage;
  738|  50.4k|        if ((sp->in_buffer_file_pos_log == 0) ||
  ------------------
  |  Branch (738:13): [True: 24.8k, False: 25.5k]
  ------------------
  739|  25.5k|            (sp->in_buffer_file_pos - sp->in_buffer_togo !=
  ------------------
  |  Branch (739:13): [True: 23.3k, False: 2.27k]
  ------------------
  740|  25.5k|             sp->sos_end[s].in_buffer_file_pos))
  741|  48.1k|        {
  742|  48.1k|            sp->in_buffer_source = sp->sos_end[s].in_buffer_source;
  743|  48.1k|            sp->in_buffer_next_strile = sp->sos_end[s].in_buffer_next_strile;
  744|  48.1k|            sp->in_buffer_file_pos = sp->sos_end[s].in_buffer_file_pos;
  745|  48.1k|            sp->in_buffer_file_pos_log = 0;
  746|  48.1k|            sp->in_buffer_file_togo = sp->sos_end[s].in_buffer_file_togo;
  747|  48.1k|            sp->in_buffer_togo = 0;
  748|  48.1k|            sp->in_buffer_cur = 0;
  749|  48.1k|        }
  750|  50.4k|        if (OJPEGWriteHeaderInfo(tif) == 0)
  ------------------
  |  Branch (750:13): [True: 9.55k, False: 40.9k]
  ------------------
  751|  9.55k|            return (0);
  752|  50.4k|    }
  753|       |
  754|   230k|    sp->subsampling_convert_state = 0;
  755|       |
  756|  5.55M|    while (sp->write_curstrile < m)
  ------------------
  |  Branch (756:12): [True: 5.32M, False: 226k]
  ------------------
  757|  5.32M|    {
  758|  5.32M|        if (sp->libjpeg_jpeg_query_style == 0)
  ------------------
  |  Branch (758:13): [True: 254k, False: 5.07M]
  ------------------
  759|   254k|        {
  760|   254k|            if (OJPEGPreDecodeSkipRaw(tif) == 0)
  ------------------
  |  Branch (760:17): [True: 872, False: 253k]
  ------------------
  761|    872|                return (0);
  762|   254k|        }
  763|  5.07M|        else
  764|  5.07M|        {
  765|  5.07M|            if (OJPEGPreDecodeSkipScanlines(tif) == 0)
  ------------------
  |  Branch (765:17): [True: 2.97k, False: 5.06M]
  ------------------
  766|  2.97k|                return (0);
  767|  5.07M|        }
  768|  5.32M|        sp->write_curstrile++;
  769|  5.32M|    }
  770|   226k|    sp->decoder_ok = 1;
  771|   226k|    return (1);
  772|   230k|}
tif_ojpeg.c:OJPEGReadHeaderInfo:
 1167|  1.06k|{
 1168|  1.06k|    static const char module[] = "OJPEGReadHeaderInfo";
 1169|  1.06k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1170|  1.06k|    assert(sp->readheader_done == 0);
  ------------------
  |  Branch (1170:5): [True: 0, False: 1.06k]
  |  Branch (1170:5): [True: 1.06k, False: 0]
  ------------------
 1171|  1.06k|    sp->image_width = tif->tif_dir.td_imagewidth;
 1172|  1.06k|    sp->image_length = tif->tif_dir.td_imagelength;
 1173|  1.06k|    if (isTiled(tif))
  ------------------
  |  |  278|  1.06k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  1.06k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 810, False: 250]
  |  |  ------------------
  ------------------
 1174|    810|    {
 1175|    810|        sp->strile_width = tif->tif_dir.td_tilewidth;
 1176|    810|        sp->strile_length = tif->tif_dir.td_tilelength;
 1177|    810|        sp->strile_length_total =
 1178|    810|            ((sp->image_length + sp->strile_length - 1) / sp->strile_length) *
 1179|    810|            sp->strile_length;
 1180|    810|    }
 1181|    250|    else
 1182|    250|    {
 1183|    250|        sp->strile_width = sp->image_width;
 1184|    250|        sp->strile_length = tif->tif_dir.td_rowsperstrip;
 1185|    250|        if (sp->strile_length == (uint32_t)-1)
  ------------------
  |  Branch (1185:13): [True: 0, False: 250]
  ------------------
 1186|      0|            sp->strile_length = sp->image_length;
 1187|    250|        sp->strile_length_total = sp->image_length;
 1188|    250|    }
 1189|  1.06k|    if (tif->tif_dir.td_samplesperpixel == 1)
  ------------------
  |  Branch (1189:9): [True: 37, False: 1.02k]
  ------------------
 1190|     37|    {
 1191|     37|        sp->samples_per_pixel = 1;
 1192|     37|        sp->plane_sample_offset = 0;
 1193|     37|        sp->samples_per_pixel_per_plane = sp->samples_per_pixel;
 1194|     37|        sp->subsampling_hor = 1;
 1195|     37|        sp->subsampling_ver = 1;
 1196|     37|    }
 1197|  1.02k|    else
 1198|  1.02k|    {
 1199|  1.02k|        if (tif->tif_dir.td_samplesperpixel != 3)
  ------------------
  |  Branch (1199:13): [True: 6, False: 1.01k]
  ------------------
 1200|      6|        {
 1201|      6|            TIFFErrorExtR(tif, module,
 1202|      6|                          "SamplesPerPixel %" PRIu8
 1203|      6|                          " not supported for this compression scheme",
 1204|      6|                          sp->samples_per_pixel);
 1205|      6|            return (0);
 1206|      6|        }
 1207|  1.01k|        sp->samples_per_pixel = 3;
 1208|  1.01k|        sp->plane_sample_offset = 0;
 1209|  1.01k|        if (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.01k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1209:13): [True: 305, False: 712]
  ------------------
 1210|    305|            sp->samples_per_pixel_per_plane = 3;
 1211|    712|        else
 1212|    712|            sp->samples_per_pixel_per_plane = 1;
 1213|  1.01k|    }
 1214|  1.05k|    if (sp->strile_length < sp->image_length)
  ------------------
  |  Branch (1214:9): [True: 212, False: 842]
  ------------------
 1215|    212|    {
 1216|    212|        if (((sp->subsampling_hor != 1) && (sp->subsampling_hor != 2) &&
  ------------------
  |  Branch (1216:14): [True: 94, False: 118]
  |  Branch (1216:44): [True: 8, False: 86]
  ------------------
 1217|      8|             (sp->subsampling_hor != 4)) ||
  ------------------
  |  Branch (1217:14): [True: 3, False: 5]
  ------------------
 1218|    209|            ((sp->subsampling_ver != 1) && (sp->subsampling_ver != 2) &&
  ------------------
  |  Branch (1218:14): [True: 99, False: 110]
  |  Branch (1218:44): [True: 9, False: 90]
  ------------------
 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|    206|        if (sp->strile_length % ((uint32_t)sp->subsampling_ver * 8) != 0)
  ------------------
  |  Branch (1224:13): [True: 18, False: 188]
  ------------------
 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|    188|        {
 1232|       |            /* Values were validated above as 1, 2, or 4. */
 1233|    188|            uint32_t mcu_width = (uint32_t)sp->subsampling_hor * 8;
 1234|    188|            uint32_t mcu_height = (uint32_t)sp->subsampling_ver * 8;
 1235|    188|            uint32_t mcu_cols =
 1236|    188|                TIFFhowmany_32_maxuint_compat(sp->strile_width, mcu_width);
  ------------------
  |  |  318|    188|    (((uint32_t)(x) / (uint32_t)(y)) +                                         \
  |  |  319|    188|     ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
  |  |  ------------------
  |  |  |  Branch (319:7): [True: 144, False: 44]
  |  |  ------------------
  ------------------
 1237|    188|            uint32_t mcu_rows = sp->strile_length / mcu_height;
 1238|    188|            if (mcu_cols == 0 || mcu_rows == 0)
  ------------------
  |  Branch (1238:17): [True: 0, False: 188]
  |  Branch (1238:34): [True: 0, False: 188]
  ------------------
 1239|      0|            {
 1240|      0|                sp->restart_interval = 0;
 1241|      0|            }
 1242|    188|            else
 1243|    188|            {
 1244|    188|                uint32_t restart_interval =
 1245|    188|                    _TIFFMultiply32(tif, mcu_cols, mcu_rows, module);
 1246|    188|                if (restart_interval == 0 || restart_interval > UINT16_MAX)
  ------------------
  |  Branch (1246:21): [True: 0, False: 188]
  |  Branch (1246:46): [True: 3, False: 185]
  ------------------
 1247|      3|                {
 1248|      3|                    TIFFErrorExtR(tif, module,
 1249|      3|                                  "Integer overflow in restart interval");
 1250|      3|                    return (0);
 1251|      3|                }
 1252|    185|                sp->restart_interval = (uint16_t)restart_interval;
 1253|    185|            }
 1254|    188|        }
 1255|    188|    }
 1256|  1.02k|    if (OJPEGReadHeaderInfoSec(tif) == 0)
  ------------------
  |  Branch (1256:9): [True: 249, False: 778]
  ------------------
 1257|    249|        return (0);
 1258|    778|    sp->sos_end[0].log = 1;
 1259|    778|    sp->sos_end[0].in_buffer_source = sp->in_buffer_source;
 1260|    778|    sp->sos_end[0].in_buffer_next_strile = sp->in_buffer_next_strile;
 1261|    778|    sp->sos_end[0].in_buffer_file_pos =
 1262|    778|        sp->in_buffer_file_pos - sp->in_buffer_togo;
 1263|    778|    sp->sos_end[0].in_buffer_file_togo =
 1264|    778|        sp->in_buffer_file_togo + sp->in_buffer_togo;
 1265|    778|    sp->readheader_done = 1;
 1266|    778|    return (1);
 1267|  1.02k|}
tif_ojpeg.c:OJPEGReadSecondarySos:
 1270|   382k|{
 1271|   382k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1272|   382k|    uint8_t m;
 1273|   382k|    assert(s > 0);
  ------------------
  |  Branch (1273:5): [True: 0, False: 382k]
  |  Branch (1273:5): [True: 382k, False: 0]
  ------------------
 1274|   382k|    assert(s < 3);
  ------------------
  |  Branch (1274:5): [True: 0, False: 382k]
  |  Branch (1274:5): [True: 382k, False: 0]
  ------------------
 1275|   382k|    assert(sp->sos_end[0].log != 0);
  ------------------
  |  Branch (1275:5): [True: 0, False: 382k]
  |  Branch (1275:5): [True: 382k, False: 0]
  ------------------
 1276|   382k|    assert(sp->sos_end[s].log == 0);
  ------------------
  |  Branch (1276:5): [True: 0, False: 382k]
  |  Branch (1276:5): [True: 382k, False: 0]
  ------------------
 1277|   382k|    sp->plane_sample_offset = (uint8_t)(s - 1);
 1278|   563k|    while (sp->sos_end[sp->plane_sample_offset].log == 0)
  ------------------
  |  Branch (1278:12): [True: 180k, False: 382k]
  ------------------
 1279|   180k|        sp->plane_sample_offset--;
 1280|   382k|    sp->in_buffer_source =
 1281|   382k|        sp->sos_end[sp->plane_sample_offset].in_buffer_source;
 1282|   382k|    sp->in_buffer_next_strile =
 1283|   382k|        sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile;
 1284|   382k|    sp->in_buffer_file_pos =
 1285|   382k|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos;
 1286|   382k|    sp->in_buffer_file_pos_log = 0;
 1287|   382k|    sp->in_buffer_file_togo =
 1288|   382k|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo;
 1289|   382k|    sp->in_buffer_togo = 0;
 1290|   382k|    sp->in_buffer_cur = 0;
 1291|   383k|    while (sp->plane_sample_offset < s)
  ------------------
  |  Branch (1291:12): [True: 382k, False: 522]
  ------------------
 1292|   382k|    {
 1293|   382k|        do
 1294|   313M|        {
 1295|   313M|            if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1295:17): [True: 366k, False: 313M]
  ------------------
 1296|   366k|                return (0);
 1297|   313M|            if (m == 255)
  ------------------
  |  Branch (1297:17): [True: 18.4M, False: 294M]
  ------------------
 1298|  18.4M|            {
 1299|  18.4M|                do
 1300|  23.0M|                {
 1301|  23.0M|                    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1301:25): [True: 6.60k, False: 23.0M]
  ------------------
 1302|  6.60k|                        return (0);
 1303|  23.0M|                    if (m != 255)
  ------------------
  |  Branch (1303:25): [True: 18.4M, False: 4.56M]
  ------------------
 1304|  18.4M|                        break;
 1305|  23.0M|                } while (1);
  ------------------
  |  Branch (1305:26): [True: 4.56M, Folded]
  ------------------
 1306|  18.4M|                if (m == JPEG_MARKER_SOS)
  ------------------
  |  |  165|  18.4M|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1306:21): [True: 9.66k, False: 18.4M]
  ------------------
 1307|  9.66k|                    break;
 1308|  18.4M|            }
 1309|   313M|        } while (1);
  ------------------
  |  Branch (1309:18): [True: 313M, Folded]
  ------------------
 1310|  9.66k|        sp->plane_sample_offset++;
 1311|  9.66k|        if (OJPEGReadHeaderInfoSecStreamSos(tif) == 0)
  ------------------
  |  Branch (1311:13): [True: 9.14k, False: 522]
  ------------------
 1312|  9.14k|            return (0);
 1313|    522|        sp->sos_end[sp->plane_sample_offset].log = 1;
 1314|    522|        sp->sos_end[sp->plane_sample_offset].in_buffer_source =
 1315|    522|            sp->in_buffer_source;
 1316|    522|        sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile =
 1317|    522|            sp->in_buffer_next_strile;
 1318|    522|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos =
 1319|    522|            sp->in_buffer_file_pos - sp->in_buffer_togo;
 1320|    522|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo =
 1321|    522|            sp->in_buffer_file_togo + sp->in_buffer_togo;
 1322|    522|    }
 1323|    522|    return (1);
 1324|   382k|}
tif_ojpeg.c:OJPEGLibjpegSessionAbort:
 1527|  41.0k|{
 1528|  41.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1529|  41.0k|    assert(sp->libjpeg_session_active != 0);
  ------------------
  |  Branch (1529:5): [True: 0, False: 41.0k]
  |  Branch (1529:5): [True: 41.0k, False: 0]
  ------------------
 1530|  41.0k|    jpeg_destroy(
 1531|  41.0k|        (tiff_ojpeg_common_struct *)(&(sp->libjpeg_jpeg_decompress_struct)));
 1532|  41.0k|    sp->libjpeg_session_active = 0;
 1533|  41.0k|}
tif_ojpeg.c:OJPEGWriteHeaderInfo:
 1327|  50.4k|{
 1328|  50.4k|    static const char module[] = "OJPEGWriteHeaderInfo";
 1329|  50.4k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1330|  50.4k|    uint8_t **m;
 1331|  50.4k|    uint32_t n;
 1332|       |    /* if a previous attempt failed, don't try again */
 1333|  50.4k|    if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (1333:9): [True: 9.40k, False: 41.0k]
  ------------------
 1334|  9.40k|        return 0;
 1335|  41.0k|    sp->out_state = ososSoi;
 1336|  41.0k|    sp->restart_index = 0;
 1337|  41.0k|    jpeg_std_error(&(sp->libjpeg_jpeg_error_mgr));
 1338|  41.0k|    sp->libjpeg_jpeg_error_mgr.output_message =
 1339|  41.0k|        OJPEGLibjpegJpegErrorMgrOutputMessage;
 1340|  41.0k|    sp->libjpeg_jpeg_error_mgr.error_exit = OJPEGLibjpegJpegErrorMgrErrorExit;
 1341|  41.0k|    sp->libjpeg_jpeg_decompress_struct.err = &(sp->libjpeg_jpeg_error_mgr);
 1342|  41.0k|    sp->libjpeg_jpeg_decompress_struct.client_data = (void *)tif;
 1343|  41.0k|    if (jpeg_create_decompress_encap(
  ------------------
  |  Branch (1343:9): [True: 0, False: 41.0k]
  ------------------
 1344|  41.0k|            sp, &(sp->libjpeg_jpeg_decompress_struct)) == 0)
 1345|      0|        return (0);
 1346|  41.0k|    sp->libjpeg_session_active = 1;
 1347|  41.0k|    sp->libjpeg_jpeg_source_mgr.bytes_in_buffer = 0;
 1348|  41.0k|    sp->libjpeg_jpeg_source_mgr.init_source =
 1349|  41.0k|        OJPEGLibjpegJpegSourceMgrInitSource;
 1350|  41.0k|    sp->libjpeg_jpeg_source_mgr.fill_input_buffer =
 1351|  41.0k|        OJPEGLibjpegJpegSourceMgrFillInputBuffer;
 1352|  41.0k|    sp->libjpeg_jpeg_source_mgr.skip_input_data =
 1353|  41.0k|        OJPEGLibjpegJpegSourceMgrSkipInputData;
 1354|  41.0k|    sp->libjpeg_jpeg_source_mgr.resync_to_restart =
 1355|  41.0k|        OJPEGLibjpegJpegSourceMgrResyncToRestart;
 1356|  41.0k|    sp->libjpeg_jpeg_source_mgr.term_source =
 1357|  41.0k|        OJPEGLibjpegJpegSourceMgrTermSource;
 1358|  41.0k|    sp->libjpeg_jpeg_decompress_struct.src = &(sp->libjpeg_jpeg_source_mgr);
 1359|  41.0k|    if (jpeg_read_header_encap(sp, &(sp->libjpeg_jpeg_decompress_struct), 1) ==
  ------------------
  |  Branch (1359:9): [True: 87, False: 40.9k]
  ------------------
 1360|  41.0k|        0)
 1361|     87|        return (0);
 1362|  40.9k|    if ((sp->subsampling_force_desubsampling_inside_decompression == 0) &&
  ------------------
  |  Branch (1362:9): [True: 40.1k, False: 822]
  ------------------
 1363|  40.1k|        (sp->samples_per_pixel_per_plane > 1))
  ------------------
  |  Branch (1363:9): [True: 1.12k, False: 39.0k]
  ------------------
 1364|  1.12k|    {
 1365|  1.12k|        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|  1.12k|        sp->libjpeg_jpeg_query_style = 0;
 1370|  1.12k|        if (sp->subsampling_convert_log == 0)
  ------------------
  |  Branch (1370:13): [True: 106, False: 1.01k]
  ------------------
 1371|    106|        {
 1372|    106|            assert(sp->subsampling_convert_ycbcrbuf == 0);
  ------------------
  |  Branch (1372:13): [True: 0, False: 106]
  |  Branch (1372:13): [True: 106, False: 0]
  ------------------
 1373|    106|            assert(sp->subsampling_convert_ycbcrimage == 0);
  ------------------
  |  Branch (1373:13): [True: 0, False: 106]
  |  Branch (1373:13): [True: 106, False: 0]
  ------------------
 1374|       |            /* Check for division by zero. */
 1375|    106|            if (sp->subsampling_hor == 0 || sp->subsampling_ver == 0)
  ------------------
  |  Branch (1375:17): [True: 0, False: 106]
  |  Branch (1375:45): [True: 0, False: 106]
  ------------------
 1376|      0|                return (0);
 1377|       |            /* Check for potential overflow in subsampling_convert_ylinelen
 1378|       |             * computation.
 1379|       |             */
 1380|    106|            if (sp->strile_width >
  ------------------
  |  Branch (1380:17): [True: 0, False: 106]
  ------------------
 1381|    106|                UINT32_MAX - ((uint32_t)sp->subsampling_hor * 8 - 1))
 1382|      0|                return (0);
 1383|    106|            sp->subsampling_convert_ylinelen =
 1384|    106|                ((sp->strile_width + (uint32_t)sp->subsampling_hor * 8 - 1) /
 1385|    106|                 ((uint32_t)sp->subsampling_hor * 8) *
 1386|    106|                 ((uint32_t)sp->subsampling_hor * 8));
 1387|    106|            sp->subsampling_convert_ylines = (uint32_t)sp->subsampling_ver * 8;
 1388|    106|            sp->subsampling_convert_clinelen =
 1389|    106|                sp->subsampling_convert_ylinelen / sp->subsampling_hor;
 1390|    106|            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|    106|            {
 1396|    106|                uint64_t ybuflen64 =
 1397|    106|                    (uint64_t)sp->subsampling_convert_ylinelen *
 1398|    106|                    sp->subsampling_convert_ylines;
 1399|    106|                uint64_t cbuflen64 =
 1400|    106|                    (uint64_t)sp->subsampling_convert_clinelen *
 1401|    106|                    sp->subsampling_convert_clines;
 1402|    106|                uint64_t ycbcrbuflen64 = ybuflen64 + 2 * cbuflen64;
 1403|    106|                if (ybuflen64 > UINT32_MAX || cbuflen64 > UINT32_MAX ||
  ------------------
  |  Branch (1403:21): [True: 0, False: 106]
  |  Branch (1403:47): [True: 0, False: 106]
  ------------------
 1404|    106|                    ycbcrbuflen64 > UINT32_MAX)
  ------------------
  |  Branch (1404:21): [True: 0, False: 106]
  ------------------
 1405|      0|                {
 1406|      0|                    TIFFErrorExtR(tif, module,
 1407|      0|                                  "Integer overflow in OJPEG buffer size");
 1408|      0|                    return (0);
 1409|      0|                }
 1410|    106|                sp->subsampling_convert_ybuflen = (uint32_t)ybuflen64;
 1411|    106|                sp->subsampling_convert_cbuflen = (uint32_t)cbuflen64;
 1412|    106|                sp->subsampling_convert_ycbcrbuflen = (uint32_t)ycbcrbuflen64;
 1413|    106|            }
 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|    106|                tif, 1, sp->subsampling_convert_ycbcrbuflen);
 1427|    106|            if (sp->subsampling_convert_ycbcrbuf == 0)
  ------------------
  |  Branch (1427:17): [True: 0, False: 106]
  ------------------
 1428|      0|            {
 1429|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1430|      0|                return (0);
 1431|      0|            }
 1432|    106|            sp->subsampling_convert_ybuf = sp->subsampling_convert_ycbcrbuf;
 1433|    106|            sp->subsampling_convert_cbbuf =
 1434|    106|                sp->subsampling_convert_ybuf + sp->subsampling_convert_ybuflen;
 1435|    106|            sp->subsampling_convert_crbuf =
 1436|    106|                sp->subsampling_convert_cbbuf + sp->subsampling_convert_cbuflen;
 1437|    106|            sp->subsampling_convert_ycbcrimagelen =
 1438|    106|                3 + sp->subsampling_convert_ylines +
 1439|    106|                2 * sp->subsampling_convert_clines;
 1440|    106|            sp->subsampling_convert_ycbcrimage = (uint8_t **)_TIFFmallocExt(
 1441|    106|                tif, (tmsize_t)((size_t)sp->subsampling_convert_ycbcrimagelen *
 1442|    106|                                sizeof(uint8_t *)));
 1443|    106|            if (sp->subsampling_convert_ycbcrimage == 0)
  ------------------
  |  Branch (1443:17): [True: 0, False: 106]
  ------------------
 1444|      0|            {
 1445|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1446|      0|                return (0);
 1447|      0|            }
 1448|    106|            m = sp->subsampling_convert_ycbcrimage;
 1449|    106|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3);
 1450|    106|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3 +
 1451|    106|                               sp->subsampling_convert_ylines);
 1452|    106|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3 +
 1453|    106|                               sp->subsampling_convert_ylines +
 1454|    106|                               sp->subsampling_convert_clines);
 1455|  1.29k|            for (n = 0; n < sp->subsampling_convert_ylines; n++)
  ------------------
  |  Branch (1455:25): [True: 1.18k, False: 106]
  ------------------
 1456|  1.18k|                *m++ = sp->subsampling_convert_ybuf +
 1457|  1.18k|                       n * sp->subsampling_convert_ylinelen;
 1458|    954|            for (n = 0; n < sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1458:25): [True: 848, False: 106]
  ------------------
 1459|    848|                *m++ = sp->subsampling_convert_cbbuf +
 1460|    848|                       n * sp->subsampling_convert_clinelen;
 1461|    954|            for (n = 0; n < sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1461:25): [True: 848, False: 106]
  ------------------
 1462|    848|                *m++ = sp->subsampling_convert_crbuf +
 1463|    848|                       n * sp->subsampling_convert_clinelen;
 1464|    106|            sp->subsampling_convert_clinelenout =
 1465|    106|                sp->strile_width / sp->subsampling_hor +
 1466|    106|                ((sp->strile_width % sp->subsampling_hor) != 0 ? 1 : 0);
  ------------------
  |  Branch (1466:18): [True: 21, False: 85]
  ------------------
 1467|    106|            sp->subsampling_convert_state = 0;
 1468|    106|            sp->error_in_raw_data_decoding = 0;
 1469|       |
 1470|    106|            const uint64_t bpl =
 1471|    106|                (uint64_t)sp->subsampling_convert_clinelenout *
 1472|    106|                ((uint64_t)sp->subsampling_ver * sp->subsampling_hor + 2);
 1473|    106|            if (bpl > UINT32_MAX)
  ------------------
  |  Branch (1473:17): [True: 0, False: 106]
  ------------------
 1474|      0|                return (0);
 1475|    106|            sp->bytes_per_line = (uint32_t)bpl;
 1476|       |
 1477|    106|            sp->lines_per_strile =
 1478|    106|                sp->strile_length / sp->subsampling_ver +
 1479|    106|                ((sp->strile_length % sp->subsampling_ver) != 0 ? 1 : 0);
  ------------------
  |  Branch (1479:18): [True: 15, False: 91]
  ------------------
 1480|    106|            sp->subsampling_convert_log = 1;
 1481|    106|        }
 1482|  1.12k|    }
 1483|  39.8k|    else
 1484|  39.8k|    {
 1485|  39.8k|        sp->libjpeg_jpeg_decompress_struct.jpeg_color_space = JCS_UNKNOWN;
 1486|  39.8k|        sp->libjpeg_jpeg_decompress_struct.out_color_space = JCS_UNKNOWN;
 1487|  39.8k|        sp->libjpeg_jpeg_query_style = 1;
 1488|  39.8k|        sp->bytes_per_line =
 1489|  39.8k|            _TIFFMultiply32(tif, sp->samples_per_pixel_per_plane,
 1490|  39.8k|                            sp->strile_width, "OJPEGWriteHeaderInfo");
 1491|  39.8k|        if (sp->bytes_per_line == 0)
  ------------------
  |  Branch (1491:13): [True: 0, False: 39.8k]
  ------------------
 1492|      0|            return (0);
 1493|  39.8k|        sp->lines_per_strile = sp->strile_length;
 1494|  39.8k|    }
 1495|  40.9k|    if (jpeg_start_decompress_encap(sp,
  ------------------
  |  Branch (1495:9): [True: 56, False: 40.9k]
  ------------------
 1496|  40.9k|                                    &(sp->libjpeg_jpeg_decompress_struct)) == 0)
 1497|     56|        return (0);
 1498|  40.9k|    if (sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width)
  ------------------
  |  Branch (1498:9): [True: 1, False: 40.9k]
  ------------------
 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|  40.9k|    if (sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor !=
  ------------------
  |  Branch (1507:9): [True: 1, False: 40.9k]
  ------------------
 1508|  40.9k|            sp->subsampling_hor ||
 1509|  40.9k|        sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor !=
  ------------------
  |  Branch (1509:9): [True: 1, False: 40.9k]
  ------------------
 1510|  40.9k|            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|  40.9k|    sp->writeheader_done = 1;
 1523|  40.9k|    return (1);
 1524|  40.9k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrOutputMessage:
 2803|  39.7k|{
 2804|  39.7k|    char buffer[JMSG_LENGTH_MAX];
 2805|  39.7k|    (*cinfo->err->format_message)(cinfo, buffer);
 2806|  39.7k|    TIFFWarningExtR(((TIFF *)(cinfo->client_data)), "LibJpeg", "%s", buffer);
 2807|  39.7k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrErrorExit:
 2810|    143|{
 2811|    143|    char buffer[JMSG_LENGTH_MAX];
 2812|    143|    (*cinfo->err->format_message)(cinfo, buffer);
 2813|    143|    TIFFErrorExtR(((TIFF *)(cinfo->client_data)), "LibJpeg", "%s", buffer);
 2814|    143|    jpeg_encap_unwind((TIFF *)(cinfo->client_data));
 2815|    143|}
tif_ojpeg.c:jpeg_encap_unwind:
 2795|  4.13k|{
 2796|  4.13k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2797|  4.13k|    LONGJMP(sp->exit_jmpbuf, 1);
  ------------------
  |  |  153|  4.13k|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
 2798|  4.13k|}
tif_ojpeg.c:jpeg_create_decompress_encap:
 2723|  41.0k|{
 2724|  41.0k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  41.0k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2724:9): [True: 0, False: 41.0k]
  ------------------
 2725|      0|        return 0;
 2726|  41.0k|    else
 2727|  41.0k|    {
 2728|       |        jpeg_create_decompress(cinfo);
 2729|  41.0k|        return 1;
 2730|  41.0k|    }
 2731|  41.0k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrInitSource:
 2819|  41.0k|{
 2820|  41.0k|    (void)cinfo;
 2821|  41.0k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrFillInputBuffer:
 2825|   378k|{
 2826|   378k|    TIFF *tif = (TIFF *)cinfo->client_data;
 2827|   378k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2828|   378k|    void *mem = 0;
 2829|   378k|    uint32_t len = 0U;
 2830|   378k|    if (OJPEGWriteStream(tif, &mem, &len) == 0)
  ------------------
  |  Branch (2830:9): [True: 2.67k, False: 375k]
  ------------------
 2831|  2.67k|    {
 2832|  2.67k|        TIFFErrorExtR(tif, "LibJpeg", "Premature end of JPEG data");
 2833|  2.67k|        jpeg_encap_unwind(tif);
 2834|  2.67k|    }
 2835|   378k|    sp->libjpeg_jpeg_source_mgr.bytes_in_buffer = len;
 2836|   378k|    sp->libjpeg_jpeg_source_mgr.next_input_byte = (const JOCTET *)mem;
 2837|   378k|    return (1);
 2838|   378k|}
tif_ojpeg.c:OJPEGWriteStream:
 2452|   378k|{
 2453|   378k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2454|   378k|    *len = 0;
 2455|   378k|    do
 2456|   708k|    {
 2457|   708k|        assert(sp->out_state <= ososEoi);
  ------------------
  |  Branch (2457:9): [True: 0, False: 708k]
  |  Branch (2457:9): [True: 708k, False: 0]
  ------------------
 2458|   708k|        switch (sp->out_state)
 2459|   708k|        {
 2460|  41.0k|            case ososSoi:
  ------------------
  |  Branch (2460:13): [True: 41.0k, False: 667k]
  ------------------
 2461|  41.0k|                OJPEGWriteStreamSoi(tif, mem, len);
 2462|  41.0k|                break;
 2463|  41.0k|            case ososQTable0:
  ------------------
  |  Branch (2463:13): [True: 41.0k, False: 667k]
  ------------------
 2464|  41.0k|                OJPEGWriteStreamQTable(tif, 0, mem, len);
 2465|  41.0k|                break;
 2466|  41.0k|            case ososQTable1:
  ------------------
  |  Branch (2466:13): [True: 41.0k, False: 667k]
  ------------------
 2467|  41.0k|                OJPEGWriteStreamQTable(tif, 1, mem, len);
 2468|  41.0k|                break;
 2469|  41.0k|            case ososQTable2:
  ------------------
  |  Branch (2469:13): [True: 41.0k, False: 667k]
  ------------------
 2470|  41.0k|                OJPEGWriteStreamQTable(tif, 2, mem, len);
 2471|  41.0k|                break;
 2472|  41.0k|            case ososQTable3:
  ------------------
  |  Branch (2472:13): [True: 41.0k, False: 667k]
  ------------------
 2473|  41.0k|                OJPEGWriteStreamQTable(tif, 3, mem, len);
 2474|  41.0k|                break;
 2475|  41.0k|            case ososDcTable0:
  ------------------
  |  Branch (2475:13): [True: 41.0k, False: 667k]
  ------------------
 2476|  41.0k|                OJPEGWriteStreamDcTable(tif, 0, mem, len);
 2477|  41.0k|                break;
 2478|  41.0k|            case ososDcTable1:
  ------------------
  |  Branch (2478:13): [True: 41.0k, False: 667k]
  ------------------
 2479|  41.0k|                OJPEGWriteStreamDcTable(tif, 1, mem, len);
 2480|  41.0k|                break;
 2481|  41.0k|            case ososDcTable2:
  ------------------
  |  Branch (2481:13): [True: 41.0k, False: 667k]
  ------------------
 2482|  41.0k|                OJPEGWriteStreamDcTable(tif, 2, mem, len);
 2483|  41.0k|                break;
 2484|  41.0k|            case ososDcTable3:
  ------------------
  |  Branch (2484:13): [True: 41.0k, False: 667k]
  ------------------
 2485|  41.0k|                OJPEGWriteStreamDcTable(tif, 3, mem, len);
 2486|  41.0k|                break;
 2487|  41.0k|            case ososAcTable0:
  ------------------
  |  Branch (2487:13): [True: 41.0k, False: 667k]
  ------------------
 2488|  41.0k|                OJPEGWriteStreamAcTable(tif, 0, mem, len);
 2489|  41.0k|                break;
 2490|  41.0k|            case ososAcTable1:
  ------------------
  |  Branch (2490:13): [True: 41.0k, False: 667k]
  ------------------
 2491|  41.0k|                OJPEGWriteStreamAcTable(tif, 1, mem, len);
 2492|  41.0k|                break;
 2493|  41.0k|            case ososAcTable2:
  ------------------
  |  Branch (2493:13): [True: 41.0k, False: 667k]
  ------------------
 2494|  41.0k|                OJPEGWriteStreamAcTable(tif, 2, mem, len);
 2495|  41.0k|                break;
 2496|  41.0k|            case ososAcTable3:
  ------------------
  |  Branch (2496:13): [True: 41.0k, False: 667k]
  ------------------
 2497|  41.0k|                OJPEGWriteStreamAcTable(tif, 3, mem, len);
 2498|  41.0k|                break;
 2499|  41.0k|            case ososDri:
  ------------------
  |  Branch (2499:13): [True: 41.0k, False: 667k]
  ------------------
 2500|  41.0k|                OJPEGWriteStreamDri(tif, mem, len);
 2501|  41.0k|                break;
 2502|  41.0k|            case ososSof:
  ------------------
  |  Branch (2502:13): [True: 41.0k, False: 667k]
  ------------------
 2503|  41.0k|                OJPEGWriteStreamSof(tif, mem, len);
 2504|  41.0k|                break;
 2505|  41.0k|            case ososSos:
  ------------------
  |  Branch (2505:13): [True: 41.0k, False: 667k]
  ------------------
 2506|  41.0k|                OJPEGWriteStreamSos(tif, mem, len);
 2507|  41.0k|                break;
 2508|  46.1k|            case ososCompressed:
  ------------------
  |  Branch (2508:13): [True: 46.1k, False: 662k]
  ------------------
 2509|  46.1k|                if (OJPEGWriteStreamCompressed(tif, mem, len) == 0)
  ------------------
  |  Branch (2509:21): [True: 2.67k, False: 43.4k]
  ------------------
 2510|  2.67k|                    return (0);
 2511|  43.4k|                break;
 2512|  43.4k|            case ososRst:
  ------------------
  |  Branch (2512:13): [True: 5.65k, False: 702k]
  ------------------
 2513|  5.65k|                OJPEGWriteStreamRst(tif, mem, len);
 2514|  5.65k|                break;
 2515|     79|            case ososEoi:
  ------------------
  |  Branch (2515:13): [True: 79, False: 708k]
  ------------------
 2516|     79|                OJPEGWriteStreamEoi(tif, mem, len);
 2517|     79|                break;
 2518|      0|            default:
  ------------------
  |  Branch (2518:13): [True: 0, False: 708k]
  ------------------
 2519|      0|                break;
 2520|   708k|        }
 2521|   708k|    } while (*len == 0);
  ------------------
  |  Branch (2521:14): [True: 330k, False: 375k]
  ------------------
 2522|   375k|    return (1);
 2523|   378k|}
tif_ojpeg.c:OJPEGWriteStreamSoi:
 2526|  41.0k|{
 2527|  41.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2528|  41.0k|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2528:5): [True: 0, Folded]
  |  Branch (2528:5): [True: 41.0k, Folded]
  ------------------
 2529|  41.0k|    sp->out_buffer[0] = 255;
 2530|  41.0k|    sp->out_buffer[1] = JPEG_MARKER_SOI;
  ------------------
  |  |  163|  41.0k|#define JPEG_MARKER_SOI 0xD8
  ------------------
 2531|  41.0k|    *len = 2;
 2532|  41.0k|    *mem = (void *)sp->out_buffer;
 2533|  41.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2534|  41.0k|}
tif_ojpeg.c:OJPEGWriteStreamQTable:
 2538|   164k|{
 2539|   164k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2540|   164k|    if (sp->qtable[table_index] != 0)
  ------------------
  |  Branch (2540:9): [True: 43.4k, False: 120k]
  ------------------
 2541|  43.4k|    {
 2542|  43.4k|        *mem = (void *)(sp->qtable[table_index] + sizeof(uint32_t));
 2543|  43.4k|        *len = (uint32_t)(*((uint32_t *)sp->qtable[table_index]) -
 2544|  43.4k|                          sizeof(uint32_t));
 2545|  43.4k|    }
 2546|   164k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2547|   164k|}
tif_ojpeg.c:OJPEGWriteStreamDcTable:
 2551|   164k|{
 2552|   164k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2553|   164k|    if (sp->dctable[table_index] != 0)
  ------------------
  |  Branch (2553:9): [True: 73.3k, False: 90.8k]
  ------------------
 2554|  73.3k|    {
 2555|  73.3k|        *mem = (void *)(sp->dctable[table_index] + sizeof(uint32_t));
 2556|  73.3k|        *len = (uint32_t)(*((uint32_t *)sp->dctable[table_index]) -
 2557|  73.3k|                          sizeof(uint32_t));
 2558|  73.3k|    }
 2559|   164k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2560|   164k|}
tif_ojpeg.c:OJPEGWriteStreamAcTable:
 2564|   164k|{
 2565|   164k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2566|   164k|    if (sp->actable[table_index] != 0)
  ------------------
  |  Branch (2566:9): [True: 84.2k, False: 79.9k]
  ------------------
 2567|  84.2k|    {
 2568|  84.2k|        *mem = (void *)(sp->actable[table_index] + sizeof(uint32_t));
 2569|  84.2k|        *len = (uint32_t)(*((uint32_t *)sp->actable[table_index]) -
 2570|  84.2k|                          sizeof(uint32_t));
 2571|  84.2k|    }
 2572|   164k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2573|   164k|}
tif_ojpeg.c:OJPEGWriteStreamDri:
 2576|  41.0k|{
 2577|  41.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2578|  41.0k|    assert(OJPEG_BUFFER >= 6);
  ------------------
  |  Branch (2578:5): [True: 0, Folded]
  |  Branch (2578:5): [True: 41.0k, Folded]
  ------------------
 2579|  41.0k|    if (sp->restart_interval != 0)
  ------------------
  |  Branch (2579:9): [True: 2.12k, False: 38.9k]
  ------------------
 2580|  2.12k|    {
 2581|  2.12k|        sp->out_buffer[0] = 255;
 2582|  2.12k|        sp->out_buffer[1] = JPEG_MARKER_DRI;
  ------------------
  |  |  167|  2.12k|#define JPEG_MARKER_DRI 0xDD
  ------------------
 2583|  2.12k|        sp->out_buffer[2] = 0;
 2584|  2.12k|        sp->out_buffer[3] = 4;
 2585|  2.12k|        sp->out_buffer[4] = (uint8_t)(sp->restart_interval >> 8);
 2586|  2.12k|        sp->out_buffer[5] = (uint8_t)(sp->restart_interval & 255);
 2587|  2.12k|        *len = 6;
 2588|  2.12k|        *mem = (void *)sp->out_buffer;
 2589|  2.12k|    }
 2590|  41.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2591|  41.0k|}
tif_ojpeg.c:OJPEGWriteStreamSof:
 2594|  41.0k|{
 2595|  41.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2596|  41.0k|    uint8_t m;
 2597|  41.0k|    assert(OJPEG_BUFFER >= 2 + 8 + sp->samples_per_pixel_per_plane * 3);
  ------------------
  |  Branch (2597:5): [True: 0, False: 41.0k]
  |  Branch (2597:5): [True: 41.0k, False: 0]
  ------------------
 2598|  41.0k|    assert(255 >= 8 + sp->samples_per_pixel_per_plane * 3);
  ------------------
  |  Branch (2598:5): [True: 0, False: 41.0k]
  |  Branch (2598:5): [True: 41.0k, False: 0]
  ------------------
 2599|  41.0k|    sp->out_buffer[0] = 255;
 2600|  41.0k|    sp->out_buffer[1] = sp->sof_marker_id;
 2601|       |    /* Lf */
 2602|  41.0k|    sp->out_buffer[2] = 0;
 2603|  41.0k|    sp->out_buffer[3] = (uint8_t)(8 + sp->samples_per_pixel_per_plane * 3);
 2604|       |    /* P */
 2605|  41.0k|    sp->out_buffer[4] = 8;
 2606|       |    /* Y */
 2607|  41.0k|    sp->out_buffer[5] = (uint8_t)(sp->sof_y >> 8);
 2608|  41.0k|    sp->out_buffer[6] = (uint8_t)(sp->sof_y & 255);
 2609|       |    /* X */
 2610|  41.0k|    sp->out_buffer[7] = (uint8_t)(sp->sof_x >> 8);
 2611|  41.0k|    sp->out_buffer[8] = (uint8_t)(sp->sof_x & 255);
 2612|       |    /* Nf */
 2613|  41.0k|    sp->out_buffer[9] = sp->samples_per_pixel_per_plane;
 2614|  84.3k|    for (m = 0; m < sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2614:17): [True: 43.3k, False: 41.0k]
  ------------------
 2615|  43.3k|    {
 2616|       |        /* C */
 2617|  43.3k|        sp->out_buffer[10 + m * 3] = sp->sof_c[sp->plane_sample_offset + m];
 2618|       |        /* H and V */
 2619|  43.3k|        sp->out_buffer[10 + m * 3 + 1] =
 2620|  43.3k|            sp->sof_hv[sp->plane_sample_offset + m];
 2621|       |        /* Tq */
 2622|  43.3k|        sp->out_buffer[10 + m * 3 + 2] =
 2623|  43.3k|            sp->sof_tq[sp->plane_sample_offset + m];
 2624|  43.3k|    }
 2625|  41.0k|    *len = 10 + (uint32_t)sp->samples_per_pixel_per_plane * 3;
 2626|  41.0k|    *mem = (void *)sp->out_buffer;
 2627|  41.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2628|  41.0k|}
tif_ojpeg.c:OJPEGWriteStreamSos:
 2631|  41.0k|{
 2632|  41.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2633|  41.0k|    uint8_t m;
 2634|  41.0k|    assert(OJPEG_BUFFER >= 2 + 6 + sp->samples_per_pixel_per_plane * 2);
  ------------------
  |  Branch (2634:5): [True: 0, False: 41.0k]
  |  Branch (2634:5): [True: 41.0k, False: 0]
  ------------------
 2635|  41.0k|    assert(255 >= 6 + sp->samples_per_pixel_per_plane * 2);
  ------------------
  |  Branch (2635:5): [True: 0, False: 41.0k]
  |  Branch (2635:5): [True: 41.0k, False: 0]
  ------------------
 2636|  41.0k|    sp->out_buffer[0] = 255;
 2637|  41.0k|    sp->out_buffer[1] = JPEG_MARKER_SOS;
  ------------------
  |  |  165|  41.0k|#define JPEG_MARKER_SOS 0xDA
  ------------------
 2638|       |    /* Ls */
 2639|  41.0k|    sp->out_buffer[2] = 0;
 2640|  41.0k|    sp->out_buffer[3] = (uint8_t)(6 + sp->samples_per_pixel_per_plane * 2);
 2641|       |    /* Ns */
 2642|  41.0k|    sp->out_buffer[4] = sp->samples_per_pixel_per_plane;
 2643|  84.3k|    for (m = 0; m < sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2643:17): [True: 43.3k, False: 41.0k]
  ------------------
 2644|  43.3k|    {
 2645|       |        /* Cs */
 2646|  43.3k|        sp->out_buffer[5 + m * 2] = sp->sos_cs[sp->plane_sample_offset + m];
 2647|       |        /* Td and Ta */
 2648|  43.3k|        sp->out_buffer[5 + m * 2 + 1] =
 2649|  43.3k|            sp->sos_tda[sp->plane_sample_offset + m];
 2650|  43.3k|    }
 2651|       |    /* Ss */
 2652|  41.0k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2] = 0;
 2653|       |    /* Se */
 2654|  41.0k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2 + 1] = 63;
 2655|       |    /* Ah and Al */
 2656|  41.0k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2 + 2] = 0;
 2657|  41.0k|    *len = 8 + (uint32_t)sp->samples_per_pixel_per_plane * 2;
 2658|  41.0k|    *mem = (void *)sp->out_buffer;
 2659|  41.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2660|  41.0k|}
tif_ojpeg.c:OJPEGWriteStreamCompressed:
 2663|  46.1k|{
 2664|  46.1k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2665|  46.1k|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2665:9): [True: 44.9k, False: 1.17k]
  ------------------
 2666|  44.9k|    {
 2667|  44.9k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2667:13): [True: 2.67k, False: 42.2k]
  ------------------
 2668|  2.67k|            return (0);
 2669|  44.9k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2669:9): [True: 0, False: 42.2k]
  |  Branch (2669:9): [True: 42.2k, False: 0]
  ------------------
 2670|  42.2k|    }
 2671|  43.4k|    *len = sp->in_buffer_togo;
 2672|  43.4k|    *mem = (void *)sp->in_buffer_cur;
 2673|  43.4k|    sp->in_buffer_togo = 0;
 2674|  43.4k|    if (sp->in_buffer_file_togo == 0)
  ------------------
  |  Branch (2674:9): [True: 41.0k, False: 2.40k]
  ------------------
 2675|  41.0k|    {
 2676|  41.0k|        switch (sp->in_buffer_source)
 2677|  41.0k|        {
 2678|  27.5k|            case osibsStrile:
  ------------------
  |  Branch (2678:13): [True: 27.5k, False: 13.5k]
  ------------------
 2679|  27.5k|                if (sp->in_buffer_next_strile < sp->in_buffer_strile_count)
  ------------------
  |  Branch (2679:21): [True: 27.2k, False: 302]
  ------------------
 2680|  27.2k|                    sp->out_state = ososRst;
 2681|    302|                else
 2682|    302|                    sp->out_state = ososEoi;
 2683|  27.5k|                break;
 2684|      0|            case osibsEof:
  ------------------
  |  Branch (2684:13): [True: 0, False: 41.0k]
  ------------------
 2685|      0|                sp->out_state = ososEoi;
 2686|      0|                break;
 2687|      0|            case osibsNotSetYet:
  ------------------
  |  Branch (2687:13): [True: 0, False: 41.0k]
  ------------------
 2688|  13.5k|            case osibsJpegInterchangeFormat:
  ------------------
  |  Branch (2688:13): [True: 13.5k, False: 27.5k]
  ------------------
 2689|  13.5k|            default:
  ------------------
  |  Branch (2689:13): [True: 0, False: 41.0k]
  ------------------
 2690|  13.5k|                break;
 2691|  41.0k|        }
 2692|  41.0k|    }
 2693|  43.4k|    return (1);
 2694|  43.4k|}
tif_ojpeg.c:OJPEGWriteStreamRst:
 2697|  5.65k|{
 2698|  5.65k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2699|  5.65k|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2699:5): [True: 0, Folded]
  |  Branch (2699:5): [True: 5.65k, Folded]
  ------------------
 2700|  5.65k|    sp->out_buffer[0] = 255;
 2701|  5.65k|    sp->out_buffer[1] = (uint8_t)(JPEG_MARKER_RST0 + sp->restart_index);
  ------------------
  |  |  162|  5.65k|#define JPEG_MARKER_RST0 0XD0
  ------------------
 2702|  5.65k|    sp->restart_index++;
 2703|  5.65k|    if (sp->restart_index == 8)
  ------------------
  |  Branch (2703:9): [True: 191, False: 5.46k]
  ------------------
 2704|    191|        sp->restart_index = 0;
 2705|  5.65k|    *len = 2;
 2706|  5.65k|    *mem = (void *)sp->out_buffer;
 2707|  5.65k|    sp->out_state = ososCompressed;
 2708|  5.65k|}
tif_ojpeg.c:OJPEGWriteStreamEoi:
 2711|     79|{
 2712|     79|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2713|     79|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2713:5): [True: 0, Folded]
  |  Branch (2713:5): [True: 79, Folded]
  ------------------
 2714|     79|    sp->out_buffer[0] = 255;
 2715|     79|    sp->out_buffer[1] = JPEG_MARKER_EOI;
  ------------------
  |  |  164|     79|#define JPEG_MARKER_EOI 0xD9
  ------------------
 2716|     79|    *len = 2;
 2717|     79|    *mem = (void *)sp->out_buffer;
 2718|     79|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrResyncToRestart:
 2857|  1.32k|{
 2858|  1.32k|    TIFF *tif = (TIFF *)cinfo->client_data;
 2859|  1.32k|    (void)desired;
 2860|  1.32k|    TIFFErrorExtR(tif, "LibJpeg", "Unexpected error");
 2861|  1.32k|    jpeg_encap_unwind(tif);
 2862|  1.32k|    return (0);
 2863|  1.32k|}
tif_ojpeg.c:jpeg_read_header_encap:
 2738|  41.0k|{
 2739|  41.0k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  41.0k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2739:9): [True: 87, False: 40.9k]
  ------------------
 2740|     87|        return 0;
 2741|  40.9k|    else
 2742|  40.9k|    {
 2743|  40.9k|        jpeg_read_header(cinfo, require_image);
 2744|  40.9k|        return 1;
 2745|  40.9k|    }
 2746|  41.0k|}
tif_ojpeg.c:jpeg_start_decompress_encap:
 2752|  40.9k|{
 2753|  40.9k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  40.9k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2753:9): [True: 56, False: 40.9k]
  ------------------
 2754|     56|        return 0;
 2755|  40.9k|    else
 2756|  40.9k|    {
 2757|  40.9k|        jpeg_start_decompress(cinfo);
 2758|  40.9k|        return 1;
 2759|  40.9k|    }
 2760|  40.9k|}
tif_ojpeg.c:OJPEGPreDecodeSkipRaw:
  775|   254k|{
  776|   254k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  777|   254k|    uint32_t m;
  778|   254k|    m = sp->lines_per_strile;
  779|   254k|    if (sp->subsampling_convert_state != 0)
  ------------------
  |  Branch (779:9): [True: 0, False: 254k]
  ------------------
  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.26M|    while (m >= sp->subsampling_convert_clines)
  ------------------
  |  Branch (792:12): [True: 1.01M, False: 253k]
  ------------------
  793|  1.01M|    {
  794|  1.01M|        if (jpeg_read_raw_data_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (794:13): [True: 552, False: 1.01M]
  ------------------
  795|  1.01M|                                     sp->subsampling_convert_ycbcrimage,
  796|  1.01M|                                     (uint32_t)sp->subsampling_ver * 8) == 0)
  797|    552|            return (0);
  798|  1.01M|        m -= sp->subsampling_convert_clines;
  799|  1.01M|    }
  800|   253k|    if (m > 0)
  ------------------
  |  Branch (800:9): [True: 320, False: 253k]
  ------------------
  801|    320|    {
  802|    320|        if (jpeg_read_raw_data_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (802:13): [True: 320, False: 0]
  ------------------
  803|    320|                                     sp->subsampling_convert_ycbcrimage,
  804|    320|                                     (uint32_t)sp->subsampling_ver * 8) == 0)
  805|    320|            return (0);
  806|      0|        sp->subsampling_convert_state = m;
  807|      0|    }
  808|   253k|    return (1);
  809|   253k|}
tif_ojpeg.c:jpeg_read_raw_data_encap:
 2782|  1.10M|{
 2783|  1.10M|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  1.10M|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2783:9): [True: 906, False: 1.10M]
  ------------------
 2784|    906|        return 0;
 2785|  1.10M|    else
 2786|  1.10M|    {
 2787|  1.10M|        jpeg_read_raw_data(cinfo, (JSAMPIMAGE)data, max_lines);
 2788|  1.10M|        return 1;
 2789|  1.10M|    }
 2790|  1.10M|}
tif_ojpeg.c:OJPEGPreDecodeSkipScanlines:
  812|  5.07M|{
  813|  5.07M|    static const char module[] = "OJPEGPreDecodeSkipScanlines";
  814|  5.07M|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  815|  5.07M|    uint32_t m;
  816|  5.07M|    if (sp->skip_buffer == NULL)
  ------------------
  |  Branch (816:9): [True: 339, False: 5.07M]
  ------------------
  817|    339|    {
  818|    339|        sp->skip_buffer = (uint8_t *)_TIFFmallocExt(tif, sp->bytes_per_line);
  819|    339|        if (sp->skip_buffer == NULL)
  ------------------
  |  Branch (819:13): [True: 0, False: 339]
  ------------------
  820|      0|        {
  821|      0|            TIFFErrorExtR(tif, module, "Out of memory");
  822|      0|            return (0);
  823|      0|        }
  824|    339|    }
  825|   173M|    for (m = 0; m < sp->lines_per_strile; m++)
  ------------------
  |  Branch (825:17): [True: 168M, False: 5.06M]
  ------------------
  826|   168M|    {
  827|   168M|        if (jpeg_read_scanlines_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (827:13): [True: 2.97k, False: 168M]
  ------------------
  828|   168M|                                      &sp->skip_buffer, 1) == 0)
  829|  2.97k|            return (0);
  830|   168M|    }
  831|  5.06M|    return (1);
  832|  5.07M|}
tif_ojpeg.c:jpeg_read_scanlines_encap:
 2767|   189M|{
 2768|   189M|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|   189M|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2768:9): [True: 3.08k, False: 189M]
  ------------------
 2769|  3.08k|        return 0;
 2770|   189M|    else
 2771|   189M|    {
 2772|   189M|        jpeg_read_scanlines(cinfo, (JSAMPARRAY)scanlines, max_lines);
 2773|   189M|        return 1;
 2774|   189M|    }
 2775|   189M|}
tif_ojpeg.c:OJPEGDecode:
  835|   269k|{
  836|   269k|    static const char module[] = "OJPEGDecode";
  837|   269k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  838|   269k|    (void)s;
  839|   269k|    if (!sp->decoder_ok)
  ------------------
  |  Branch (839:9): [True: 0, False: 269k]
  ------------------
  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|   269k|    if (sp->libjpeg_session_active == 0)
  ------------------
  |  Branch (846:9): [True: 33, False: 269k]
  ------------------
  847|     33|    {
  848|     33|        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|     33|        TIFFErrorExtR(tif, module,
  857|     33|                      "Cannot decode: libjpeg_session_active == 0");
  858|     33|        return 0;
  859|     33|    }
  860|   269k|    if (sp->error_in_raw_data_decoding)
  ------------------
  |  Branch (860:9): [True: 11, False: 269k]
  ------------------
  861|     11|    {
  862|     11|        memset(buf, 0, (size_t)cc);
  863|     11|        return 0;
  864|     11|    }
  865|   269k|    if (sp->libjpeg_jpeg_query_style == 0)
  ------------------
  |  Branch (865:9): [True: 38.9k, False: 230k]
  ------------------
  866|  38.9k|    {
  867|  38.9k|        if (OJPEGDecodeRaw(tif, buf, cc) == 0)
  ------------------
  |  Branch (867:13): [True: 35, False: 38.9k]
  ------------------
  868|     35|        {
  869|     35|            memset(buf, 0, (size_t)cc);
  870|     35|            return (0);
  871|     35|        }
  872|  38.9k|    }
  873|   230k|    else
  874|   230k|    {
  875|   230k|        if (OJPEGDecodeScanlines(tif, buf, cc) == 0)
  ------------------
  |  Branch (875:13): [True: 116, False: 230k]
  ------------------
  876|    116|        {
  877|    116|            memset(buf, 0, (size_t)cc);
  878|    116|            return (0);
  879|    116|        }
  880|   230k|    }
  881|   269k|    return (1);
  882|   269k|}
tif_ojpeg.c:OJPEGDecodeRaw:
  885|  38.9k|{
  886|  38.9k|    static const char module[] = "OJPEGDecodeRaw";
  887|  38.9k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  888|  38.9k|    uint8_t *m;
  889|  38.9k|    tmsize_t n;
  890|  38.9k|    uint8_t *oy;
  891|  38.9k|    uint8_t *ocb;
  892|  38.9k|    uint8_t *ocr;
  893|  38.9k|    uint8_t *p;
  894|  38.9k|    uint32_t q;
  895|  38.9k|    uint8_t *r;
  896|  38.9k|    uint8_t sx, sy;
  897|  38.9k|    if (cc % sp->bytes_per_line != 0)
  ------------------
  |  Branch (897:9): [True: 1, False: 38.9k]
  ------------------
  898|      1|    {
  899|      1|        TIFFErrorExtR(tif, module, "Fractional scanline not read");
  900|      1|        return (0);
  901|      1|    }
  902|  38.9k|    assert(cc > 0);
  ------------------
  |  Branch (902:5): [True: 0, False: 38.9k]
  |  Branch (902:5): [True: 38.9k, False: 0]
  ------------------
  903|  38.9k|    m = buf;
  904|  38.9k|    n = cc;
  905|  38.9k|    do
  906|   699k|    {
  907|   699k|        if (sp->subsampling_convert_state == 0)
  ------------------
  |  Branch (907:13): [True: 92.1k, False: 606k]
  ------------------
  908|  92.1k|        {
  909|  92.1k|            if (jpeg_read_raw_data_encap(
  ------------------
  |  Branch (909:17): [True: 34, False: 92.0k]
  ------------------
  910|  92.1k|                    sp, &(sp->libjpeg_jpeg_decompress_struct),
  911|  92.1k|                    sp->subsampling_convert_ycbcrimage,
  912|  92.1k|                    (uint32_t)sp->subsampling_ver * 8) == 0)
  913|     34|            {
  914|     34|                sp->error_in_raw_data_decoding = 1;
  915|     34|                return (0);
  916|     34|            }
  917|  92.1k|        }
  918|   698k|        oy = sp->subsampling_convert_ybuf +
  919|   698k|             sp->subsampling_convert_state * sp->subsampling_ver *
  920|   698k|                 sp->subsampling_convert_ylinelen;
  921|   698k|        ocb = sp->subsampling_convert_cbbuf +
  922|   698k|              sp->subsampling_convert_state * sp->subsampling_convert_clinelen;
  923|   698k|        ocr = sp->subsampling_convert_crbuf +
  924|   698k|              sp->subsampling_convert_state * sp->subsampling_convert_clinelen;
  925|   698k|        p = m;
  926|   236M|        for (q = 0; q < sp->subsampling_convert_clinelenout; q++)
  ------------------
  |  Branch (926:21): [True: 236M, False: 698k]
  ------------------
  927|   236M|        {
  928|   236M|            r = oy;
  929|   481M|            for (sy = 0; sy < sp->subsampling_ver; sy++)
  ------------------
  |  Branch (929:26): [True: 244M, False: 236M]
  ------------------
  930|   244M|            {
  931|   507M|                for (sx = 0; sx < sp->subsampling_hor; sx++)
  ------------------
  |  Branch (931:30): [True: 262M, False: 244M]
  ------------------
  932|   262M|                    *p++ = *r++;
  933|   244M|                r += sp->subsampling_convert_ylinelen - sp->subsampling_hor;
  934|   244M|            }
  935|   236M|            oy += sp->subsampling_hor;
  936|   236M|            *p++ = *ocb++;
  937|   236M|            *p++ = *ocr++;
  938|   236M|        }
  939|   698k|        sp->subsampling_convert_state++;
  940|   698k|        if (sp->subsampling_convert_state == sp->subsampling_convert_clines)
  ------------------
  |  Branch (940:13): [True: 85.8k, False: 613k]
  ------------------
  941|  85.8k|            sp->subsampling_convert_state = 0;
  942|   698k|        m += sp->bytes_per_line;
  943|   698k|        n -= sp->bytes_per_line;
  944|   698k|    } while (n > 0);
  ------------------
  |  Branch (944:14): [True: 660k, False: 38.9k]
  ------------------
  945|  38.9k|    return (1);
  946|  38.9k|}
tif_ojpeg.c:OJPEGDecodeScanlines:
  949|   230k|{
  950|   230k|    static const char module[] = "OJPEGDecodeScanlines";
  951|   230k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  952|   230k|    uint8_t *m;
  953|   230k|    tmsize_t n;
  954|   230k|    if (cc % sp->bytes_per_line != 0)
  ------------------
  |  Branch (954:9): [True: 0, False: 230k]
  ------------------
  955|      0|    {
  956|      0|        TIFFErrorExtR(tif, module, "Fractional scanline not read");
  957|      0|        return (0);
  958|      0|    }
  959|   230k|    assert(cc > 0);
  ------------------
  |  Branch (959:5): [True: 0, False: 230k]
  |  Branch (959:5): [True: 230k, False: 0]
  ------------------
  960|   230k|    m = buf;
  961|   230k|    n = cc;
  962|   230k|    do
  963|  21.3M|    {
  964|  21.3M|        if (jpeg_read_scanlines_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (964:13): [True: 116, False: 21.3M]
  ------------------
  965|  21.3M|                                      &m, 1) == 0)
  966|    116|            return (0);
  967|  21.3M|        m += sp->bytes_per_line;
  968|  21.3M|        n -= sp->bytes_per_line;
  969|  21.3M|    } while (n > 0);
  ------------------
  |  Branch (969:14): [True: 21.0M, False: 230k]
  ------------------
  970|   230k|    return (1);
  971|   230k|}
tif_ojpeg.c:OJPEGPostDecode:
  974|   269k|{
  975|   269k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  976|   269k|    (void)buf;
  977|   269k|    (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|   269k|    sp->write_curstrile++;
  987|   269k|    if (sp->write_curstrile % tif->tif_dir.td_stripsperimage == 0)
  ------------------
  |  Branch (987:9): [True: 933, False: 268k]
  ------------------
  988|    933|    {
  989|    933|        assert(sp->libjpeg_session_active != 0);
  ------------------
  |  Branch (989:9): [True: 0, False: 933]
  |  Branch (989:9): [True: 933, False: 0]
  ------------------
  990|    933|        OJPEGLibjpegSessionAbort(tif);
  991|    933|        sp->writeheader_done = 0;
  992|    933|    }
  993|   269k|}
tif_ojpeg.c:OJPEGCleanup:
 1036|  1.10k|{
 1037|  1.10k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1038|  1.10k|    if (sp != 0)
  ------------------
  |  Branch (1038:9): [True: 1.10k, False: 0]
  ------------------
 1039|  1.10k|    {
 1040|  1.10k|        tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1041|  1.10k|        tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1042|  1.10k|        tif->tif_tagmethods.printdir = sp->printdir;
 1043|  1.10k|        if (sp->qtable[0] != 0)
  ------------------
  |  Branch (1043:13): [True: 859, False: 249]
  ------------------
 1044|    859|            _TIFFfreeExt(tif, sp->qtable[0]);
 1045|  1.10k|        if (sp->qtable[1] != 0)
  ------------------
  |  Branch (1045:13): [True: 81, False: 1.02k]
  ------------------
 1046|     81|            _TIFFfreeExt(tif, sp->qtable[1]);
 1047|  1.10k|        if (sp->qtable[2] != 0)
  ------------------
  |  Branch (1047:13): [True: 20, False: 1.08k]
  ------------------
 1048|     20|            _TIFFfreeExt(tif, sp->qtable[2]);
 1049|  1.10k|        if (sp->qtable[3] != 0)
  ------------------
  |  Branch (1049:13): [True: 11, False: 1.09k]
  ------------------
 1050|     11|            _TIFFfreeExt(tif, sp->qtable[3]);
 1051|  1.10k|        if (sp->dctable[0] != 0)
  ------------------
  |  Branch (1051:13): [True: 801, False: 307]
  ------------------
 1052|    801|            _TIFFfreeExt(tif, sp->dctable[0]);
 1053|  1.10k|        if (sp->dctable[1] != 0)
  ------------------
  |  Branch (1053:13): [True: 351, False: 757]
  ------------------
 1054|    351|            _TIFFfreeExt(tif, sp->dctable[1]);
 1055|  1.10k|        if (sp->dctable[2] != 0)
  ------------------
  |  Branch (1055:13): [True: 369, False: 739]
  ------------------
 1056|    369|            _TIFFfreeExt(tif, sp->dctable[2]);
 1057|  1.10k|        if (sp->dctable[3] != 0)
  ------------------
  |  Branch (1057:13): [True: 29, False: 1.07k]
  ------------------
 1058|     29|            _TIFFfreeExt(tif, sp->dctable[3]);
 1059|  1.10k|        if (sp->actable[0] != 0)
  ------------------
  |  Branch (1059:13): [True: 746, False: 362]
  ------------------
 1060|    746|            _TIFFfreeExt(tif, sp->actable[0]);
 1061|  1.10k|        if (sp->actable[1] != 0)
  ------------------
  |  Branch (1061:13): [True: 490, False: 618]
  ------------------
 1062|    490|            _TIFFfreeExt(tif, sp->actable[1]);
 1063|  1.10k|        if (sp->actable[2] != 0)
  ------------------
  |  Branch (1063:13): [True: 106, False: 1.00k]
  ------------------
 1064|    106|            _TIFFfreeExt(tif, sp->actable[2]);
 1065|  1.10k|        if (sp->actable[3] != 0)
  ------------------
  |  Branch (1065:13): [True: 8, False: 1.10k]
  ------------------
 1066|      8|            _TIFFfreeExt(tif, sp->actable[3]);
 1067|  1.10k|        if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (1067:13): [True: 273, False: 835]
  ------------------
 1068|    273|            OJPEGLibjpegSessionAbort(tif);
 1069|  1.10k|        if (sp->subsampling_convert_ycbcrbuf != 0)
  ------------------
  |  Branch (1069:13): [True: 106, False: 1.00k]
  ------------------
 1070|    106|            _TIFFfreeExt(tif, sp->subsampling_convert_ycbcrbuf);
 1071|  1.10k|        if (sp->subsampling_convert_ycbcrimage != 0)
  ------------------
  |  Branch (1071:13): [True: 106, False: 1.00k]
  ------------------
 1072|    106|            _TIFFfreeExt(tif, sp->subsampling_convert_ycbcrimage);
 1073|  1.10k|        if (sp->skip_buffer != 0)
  ------------------
  |  Branch (1073:13): [True: 339, False: 769]
  ------------------
 1074|    339|            _TIFFfreeExt(tif, sp->skip_buffer);
 1075|  1.10k|        _TIFFfreeExt(tif, sp);
 1076|       |        tif->tif_data = NULL;
 1077|  1.10k|        _TIFFSetDefaultCompressionState(tif);
 1078|  1.10k|    }
 1079|  1.10k|}

_TIFFgetMode:
   57|  6.25k|{
   58|  6.25k|    int m = -1;
   59|       |
   60|  6.25k|    switch (mode[0])
   61|  6.25k|    {
   62|  6.25k|        case 'r':
  ------------------
  |  Branch (62:9): [True: 6.25k, False: 0]
  ------------------
   63|  6.25k|            m = O_RDONLY;
   64|  6.25k|            if (mode[1] == '+')
  ------------------
  |  Branch (64:17): [True: 0, False: 6.25k]
  ------------------
   65|      0|                m = O_RDWR;
   66|  6.25k|            break;
   67|      0|        case 'w':
  ------------------
  |  Branch (67:9): [True: 0, False: 6.25k]
  ------------------
   68|      0|        case 'a':
  ------------------
  |  Branch (68:9): [True: 0, False: 6.25k]
  ------------------
   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: 6.25k]
  ------------------
   74|      0|            _TIFFErrorEarly(opts, clientdata, module, "\"%s\": Bad mode", mode);
   75|      0|            break;
   76|  6.25k|    }
   77|  6.25k|    return (m);
   78|  6.25k|}
_TIFFmallocExt:
  174|  2.18M|{
  175|  2.18M|    if (tif != NULL && tif->tif_max_single_mem_alloc > 0 &&
  ------------------
  |  Branch (175:9): [True: 2.17M, False: 6.25k]
  |  Branch (175:24): [True: 0, False: 2.17M]
  ------------------
  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.18M|    if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
  ------------------
  |  Branch (181:9): [True: 2.17M, False: 6.25k]
  |  Branch (181:24): [True: 0, False: 2.17M]
  ------------------
  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.18M|    return _TIFFmalloc(s);
  198|  2.18M|}
_TIFFcallocExt:
  202|  1.51k|{
  203|  1.51k|    if (nmemb <= 0 || siz <= 0 || nmemb > TIFF_TMSIZE_T_MAX / siz)
  ------------------
  |  |   68|  1.51k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (203:9): [True: 0, False: 1.51k]
  |  Branch (203:23): [True: 0, False: 1.51k]
  |  Branch (203:35): [True: 0, False: 1.51k]
  ------------------
  204|      0|        return NULL;
  205|  1.51k|    if (tif != NULL && tif->tif_max_single_mem_alloc > 0)
  ------------------
  |  Branch (205:9): [True: 1.51k, False: 0]
  |  Branch (205:24): [True: 0, False: 1.51k]
  ------------------
  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.51k|    if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
  ------------------
  |  Branch (214:9): [True: 1.51k, False: 0]
  |  Branch (214:24): [True: 0, False: 1.51k]
  ------------------
  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.51k|    return _TIFFcalloc(nmemb, siz);
  232|  1.51k|}
_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.26M|{
  277|  2.26M|    if (p != NULL && tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
  ------------------
  |  Branch (277:9): [True: 2.25M, False: 6.44k]
  |  Branch (277:22): [True: 2.25M, False: 6.25k]
  |  Branch (277:37): [True: 0, False: 2.25M]
  ------------------
  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.26M|    _TIFFfree(p);
  287|  2.26M|}
TIFFClientOpen:
  294|  6.25k|{
  295|  6.25k|    return TIFFClientOpenExt(name, mode, clientdata, readproc, writeproc,
  296|  6.25k|                             seekproc, closeproc, sizeproc, mapproc, unmapproc,
  297|       |                             NULL);
  298|  6.25k|}
TIFFClientOpenExt:
  306|  6.25k|{
  307|  6.25k|    static const char module[] = "TIFFClientOpenExt";
  308|  6.25k|    TIFF *tif;
  309|  6.25k|    int m;
  310|  6.25k|    const char *cp;
  311|  6.25k|    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|  6.25k|    assert(sizeof(uint8_t) == 1);
  ------------------
  |  Branch (317:5): [True: 0, Folded]
  |  Branch (317:5): [True: 6.25k, Folded]
  ------------------
  318|  6.25k|    assert(sizeof(int8_t) == 1);
  ------------------
  |  Branch (318:5): [True: 0, Folded]
  |  Branch (318:5): [True: 6.25k, Folded]
  ------------------
  319|  6.25k|    assert(sizeof(uint16_t) == 2);
  ------------------
  |  Branch (319:5): [True: 0, Folded]
  |  Branch (319:5): [True: 6.25k, Folded]
  ------------------
  320|  6.25k|    assert(sizeof(int16_t) == 2);
  ------------------
  |  Branch (320:5): [True: 0, Folded]
  |  Branch (320:5): [True: 6.25k, Folded]
  ------------------
  321|  6.25k|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (321:5): [True: 0, Folded]
  |  Branch (321:5): [True: 6.25k, Folded]
  ------------------
  322|  6.25k|    assert(sizeof(int32_t) == 4);
  ------------------
  |  Branch (322:5): [True: 0, Folded]
  |  Branch (322:5): [True: 6.25k, Folded]
  ------------------
  323|  6.25k|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (323:5): [True: 0, Folded]
  |  Branch (323:5): [True: 6.25k, Folded]
  ------------------
  324|  6.25k|    assert(sizeof(int64_t) == 8);
  ------------------
  |  Branch (324:5): [True: 0, Folded]
  |  Branch (324:5): [True: 6.25k, Folded]
  ------------------
  325|  6.25k|    {
  326|  6.25k|        union
  327|  6.25k|        {
  328|  6.25k|            uint8_t a8[2];
  329|  6.25k|            uint16_t a16;
  330|  6.25k|        } n;
  331|  6.25k|        n.a8[0] = 1;
  332|  6.25k|        n.a8[1] = 0;
  333|  6.25k|        (void)n;
  334|       |#if WORDS_BIGENDIAN
  335|       |        assert(n.a16 == 256);
  336|       |#else
  337|  6.25k|        assert(n.a16 == 1);
  ------------------
  |  Branch (337:9): [True: 0, False: 6.25k]
  |  Branch (337:9): [True: 6.25k, False: 0]
  ------------------
  338|  6.25k|#endif
  339|  6.25k|    }
  340|       |
  341|  6.25k|    m = _TIFFgetMode(opts, clientdata, mode, module);
  342|  6.25k|    if (m == -1)
  ------------------
  |  Branch (342:9): [True: 0, False: 6.25k]
  ------------------
  343|      0|        goto bad2;
  344|  6.25k|    size_to_alloc = (tmsize_t)(sizeof(TIFF) + strlen(name) + 1);
  345|  6.25k|    if (opts && opts->max_single_mem_alloc > 0 &&
  ------------------
  |  Branch (345:9): [True: 0, False: 6.25k]
  |  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|  6.25k|    if (opts && opts->max_cumulated_mem_alloc > 0 &&
  ------------------
  |  Branch (356:9): [True: 0, False: 6.25k]
  |  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|  6.25k|    tif = (TIFF *)_TIFFmallocExt(NULL, size_to_alloc);
  368|  6.25k|    if (tif == NULL)
  ------------------
  |  Branch (368:9): [True: 0, False: 6.25k]
  ------------------
  369|      0|    {
  370|      0|        _TIFFErrorEarly(opts, clientdata, module,
  371|      0|                        "%s: Out of memory (TIFF structure)", name);
  372|      0|        goto bad2;
  373|      0|    }
  374|  6.25k|    _TIFFmemset(tif, 0, sizeof(*tif));
  375|  6.25k|    tif->tif_name = (char *)tif + sizeof(TIFF);
  376|  6.25k|    strcpy(tif->tif_name, name);
  377|  6.25k|    tif->tif_mode = m & ~(O_CREAT | O_TRUNC);
  378|  6.25k|    tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER; /* non-existent directory */
  ------------------
  |  |   65|  6.25k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
  379|  6.25k|    tif->tif_curdircount = TIFF_NON_EXISTENT_DIR_NUMBER;
  ------------------
  |  |   65|  6.25k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
  380|  6.25k|    tif->tif_curoff = 0;
  381|  6.25k|    tif->tif_clientdata = clientdata;
  382|  6.25k|    tif->tif_readproc = readproc;
  383|  6.25k|    tif->tif_writeproc = writeproc;
  384|  6.25k|    tif->tif_seekproc = seekproc;
  385|  6.25k|    tif->tif_closeproc = closeproc;
  386|  6.25k|    tif->tif_sizeproc = sizeproc;
  387|  6.25k|    tif->tif_mapproc = mapproc ? mapproc : _tiffDummyMapProc;
  ------------------
  |  Branch (387:24): [True: 6.25k, False: 0]
  ------------------
  388|  6.25k|    tif->tif_unmapproc = unmapproc ? unmapproc : _tiffDummyUnmapProc;
  ------------------
  |  Branch (388:26): [True: 6.25k, False: 0]
  ------------------
  389|  6.25k|    if (opts)
  ------------------
  |  Branch (389:9): [True: 0, False: 6.25k]
  ------------------
  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|  6.25k|    _TIFFResetTifDirAndInitStrileCounters(&tif->tif_dir);
  403|       |
  404|  6.25k|    if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc)
  ------------------
  |  Branch (404:9): [True: 0, False: 6.25k]
  |  Branch (404:22): [True: 0, False: 6.25k]
  |  Branch (404:36): [True: 0, False: 6.25k]
  |  Branch (404:49): [True: 0, False: 6.25k]
  |  Branch (404:63): [True: 0, False: 6.25k]
  ------------------
  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|  6.25k|    _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|  6.25k|    tif->tif_flags = FILLORDER_MSB2LSB;
  ------------------
  |  |  241|  6.25k|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
  419|  6.25k|    if (m == O_RDONLY)
  ------------------
  |  Branch (419:9): [True: 6.25k, False: 0]
  ------------------
  420|  6.25k|        tif->tif_flags |= TIFF_MAPPED;
  ------------------
  |  |  130|  6.25k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  421|       |
  422|  6.25k|#ifdef STRIPCHOP_DEFAULT
  423|  6.25k|    if (m == O_RDONLY || m == O_RDWR)
  ------------------
  |  Branch (423:9): [True: 6.25k, False: 0]
  |  Branch (423:26): [True: 0, False: 0]
  ------------------
  424|  6.25k|        tif->tif_flags |= STRIPCHOP_DEFAULT;
  ------------------
  |  |  113|  6.25k|#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
  |  |  ------------------
  |  |  |  |  134|  6.25k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  |  |  ------------------
  ------------------
  425|  6.25k|#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|  18.7k|    for (cp = mode; *cp; cp++)
  ------------------
  |  Branch (482:21): [True: 12.5k, False: 6.25k]
  ------------------
  483|  12.5k|        switch (*cp)
  484|  12.5k|        {
  485|      0|            case 'b':
  ------------------
  |  Branch (485:13): [True: 0, False: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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|  6.25k|            case 'm':
  ------------------
  |  Branch (517:13): [True: 6.25k, False: 6.25k]
  ------------------
  518|  6.25k|                if (m == O_RDONLY)
  ------------------
  |  Branch (518:21): [True: 6.25k, False: 0]
  ------------------
  519|  6.25k|                    tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  130|  6.25k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  520|  6.25k|                break;
  521|      0|            case 'C':
  ------------------
  |  Branch (521:13): [True: 0, False: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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: 12.5k]
  ------------------
  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|  6.25k|            default:
  ------------------
  |  Branch (544:13): [True: 6.25k, False: 6.25k]
  ------------------
  545|  6.25k|                break;
  546|  12.5k|        }
  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|  6.25k|    if ((m & O_TRUNC) ||
  ------------------
  |  Branch (558:9): [True: 0, False: 6.25k]
  ------------------
  559|  6.25k|        !ReadOK(tif, &tif->tif_header, sizeof(TIFFHeaderClassic)))
  ------------------
  |  |  300|  6.25k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  6.25k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (559:9): [True: 0, False: 6.25k]
  ------------------
  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|  6.25k|    if (tif->tif_header.common.tiff_magic != TIFF_BIGENDIAN &&
  ------------------
  |  |   51|  12.5k|#define TIFF_BIGENDIAN 0x4d4d
  ------------------
  |  Branch (635:9): [True: 5.99k, False: 257]
  ------------------
  636|  5.99k|        tif->tif_header.common.tiff_magic != TIFF_LITTLEENDIAN
  ------------------
  |  |   52|  12.2k|#define TIFF_LITTLEENDIAN 0x4949
  ------------------
  |  Branch (636:9): [True: 3, False: 5.99k]
  ------------------
  637|      3|#if MDI_SUPPORT
  638|      3|        &&
  639|       |#if HOST_BIGENDIAN
  640|       |        tif->tif_header.common.tiff_magic != MDI_BIGENDIAN
  641|       |#else
  642|      3|        tif->tif_header.common.tiff_magic != MDI_LITTLEENDIAN
  ------------------
  |  |   53|      3|#define MDI_LITTLEENDIAN 0x5045
  ------------------
  |  Branch (642:9): [True: 3, False: 0]
  ------------------
  643|  6.25k|#endif
  644|  6.25k|    )
  645|      3|    {
  646|      3|        TIFFErrorExtR(tif, name,
  647|      3|                      "Not a TIFF or MDI file, bad magic number %" PRIu16
  648|      3|                      " (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|      3|                      tif->tif_header.common.tiff_magic,
  657|      3|                      tif->tif_header.common.tiff_magic);
  658|      3|        goto bad;
  659|      3|    }
  660|  6.24k|    if (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN)
  ------------------
  |  |   51|  6.24k|#define TIFF_BIGENDIAN 0x4d4d
  ------------------
  |  Branch (660:9): [True: 257, False: 5.99k]
  ------------------
  661|    257|    {
  662|    257|#if !WORDS_BIGENDIAN
  663|    257|        tif->tif_flags |= TIFF_SWAB;
  ------------------
  |  |  126|    257|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  664|    257|#endif
  665|    257|    }
  666|  5.99k|    else
  667|  5.99k|    {
  668|       |#if WORDS_BIGENDIAN
  669|       |        tif->tif_flags |= TIFF_SWAB;
  670|       |#endif
  671|  5.99k|    }
  672|  6.24k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  6.24k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (672:9): [True: 257, False: 5.99k]
  ------------------
  673|    257|        TIFFSwabShort(&tif->tif_header.common.tiff_version);
  674|  6.24k|    if ((tif->tif_header.common.tiff_version != TIFF_VERSION_CLASSIC) &&
  ------------------
  |  |   48|  6.24k|#define TIFF_VERSION_CLASSIC 42
  ------------------
  |  Branch (674:9): [True: 48, False: 6.19k]
  ------------------
  675|     48|        (tif->tif_header.common.tiff_version != TIFF_VERSION_BIG))
  ------------------
  |  |   49|     48|#define TIFF_VERSION_BIG 43
  ------------------
  |  Branch (675:9): [True: 1, False: 47]
  ------------------
  676|      1|    {
  677|      1|        TIFFErrorExtR(tif, name,
  678|      1|                      "Not a TIFF file, bad version number %" PRIu16
  679|      1|                      " (0x%" PRIx16 ")",
  680|      1|                      tif->tif_header.common.tiff_version,
  681|      1|                      tif->tif_header.common.tiff_version);
  682|      1|        goto bad;
  683|      1|    }
  684|  6.24k|    if (tif->tif_header.common.tiff_version == TIFF_VERSION_CLASSIC)
  ------------------
  |  |   48|  6.24k|#define TIFF_VERSION_CLASSIC 42
  ------------------
  |  Branch (684:9): [True: 6.19k, False: 47]
  ------------------
  685|  6.19k|    {
  686|  6.19k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  6.19k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (686:13): [True: 254, False: 5.94k]
  ------------------
  687|    254|            TIFFSwabLong(&tif->tif_header.classic.tiff_diroff);
  688|  6.19k|        tif->tif_header_size = sizeof(TIFFHeaderClassic);
  689|  6.19k|    }
  690|     47|    else
  691|     47|    {
  692|     47|        if (!ReadOK(tif,
  ------------------
  |  |  300|     47|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|     47|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (692:13): [True: 0, False: 47]
  ------------------
  693|     47|                    ((uint8_t *)(&tif->tif_header) + sizeof(TIFFHeaderClassic)),
  694|     47|                    (sizeof(TIFFHeaderBig) - sizeof(TIFFHeaderClassic))))
  695|      0|        {
  696|      0|            TIFFErrorExtR(tif, name, "Cannot read TIFF header");
  697|      0|            goto bad;
  698|      0|        }
  699|     47|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     47|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (699:13): [True: 3, False: 44]
  ------------------
  700|      3|        {
  701|      3|            TIFFSwabShort(&tif->tif_header.big.tiff_offsetsize);
  702|      3|            TIFFSwabLong8(&tif->tif_header.big.tiff_diroff);
  703|      3|        }
  704|     47|        if (tif->tif_header.big.tiff_offsetsize != 8)
  ------------------
  |  Branch (704:13): [True: 0, False: 47]
  ------------------
  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|     47|        if (tif->tif_header.big.tiff_unused != 0)
  ------------------
  |  Branch (713:13): [True: 0, False: 47]
  ------------------
  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|     47|        tif->tif_header_size = sizeof(TIFFHeaderBig);
  723|     47|        tif->tif_flags |= TIFF_BIGTIFF;
  ------------------
  |  |  140|     47|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  724|     47|    }
  725|  6.24k|    tif->tif_flags |= TIFF_MYBUFFER;
  ------------------
  |  |  128|  6.24k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  726|  6.24k|    tif->tif_rawcp = tif->tif_rawdata = 0;
  727|  6.24k|    tif->tif_rawdatasize = 0;
  728|  6.24k|    tif->tif_rawdataoff = 0;
  729|  6.24k|    tif->tif_rawdataloaded = 0;
  730|       |
  731|  6.24k|    switch (mode[0])
  732|  6.24k|    {
  733|  6.24k|        case 'r':
  ------------------
  |  Branch (733:9): [True: 6.24k, False: 0]
  ------------------
  734|  6.24k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  6.24k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (734:17): [True: 6.19k, False: 47]
  ------------------
  735|  6.19k|                tif->tif_nextdiroff = tif->tif_header.classic.tiff_diroff;
  736|     47|            else
  737|     47|                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|  6.24k|            if (tif->tif_flags & TIFF_MAPPED)
  ------------------
  |  |  130|  6.24k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  |  Branch (743:17): [True: 0, False: 6.24k]
  ------------------
  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|  6.24k|            if (tif->tif_flags & TIFF_HEADERONLY)
  ------------------
  |  |  136|  6.24k|    0x10000U /* read header only, do not process the first directory */
  ------------------
  |  Branch (764:17): [True: 0, False: 6.24k]
  ------------------
  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|  6.24k|            if (TIFFReadDirectory(tif))
  ------------------
  |  Branch (774:17): [True: 4.70k, False: 1.54k]
  ------------------
  775|  4.70k|            {
  776|  4.70k|                return (tif);
  777|  4.70k|            }
  778|  1.54k|            break;
  779|  1.54k|        case 'a':
  ------------------
  |  Branch (779:9): [True: 0, False: 6.24k]
  ------------------
  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: 6.24k]
  ------------------
  789|      0|            break;
  790|  6.24k|    }
  791|  1.55k|bad:
  792|  1.55k|    tif->tif_mode = O_RDONLY; /* XXX avoid flush */
  793|  1.55k|    TIFFCleanup(tif);
  794|  1.55k|bad2:
  795|  1.55k|    return ((TIFF *)0);
  796|  1.55k|}
TIFFFileName:
  805|  1.33k|const char *TIFFFileName(TIFF *tif) { return (tif->tif_name); }
TIFFIsTiled:
  866|  12.6k|int TIFFIsTiled(TIFF *tif) { return (isTiled(tif)); }
  ------------------
  |  |  278|  12.6k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  12.6k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------

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

TIFFInitPixarLog:
 1804|    170|{
 1805|    170|    static const char module[] = "TIFFInitPixarLog";
 1806|       |
 1807|    170|    PixarLogState *sp;
 1808|       |
 1809|    170|    (void)scheme;
 1810|    170|    assert(scheme == COMPRESSION_PIXARLOG);
  ------------------
  |  Branch (1810:5): [True: 0, False: 170]
  |  Branch (1810:5): [True: 170, False: 0]
  ------------------
 1811|       |
 1812|       |    /*
 1813|       |     * Merge codec-specific tag information.
 1814|       |     */
 1815|    170|    if (!_TIFFMergeFields(tif, pixarlogFields, TIFFArrayCount(pixarlogFields)))
  ------------------
  |  |  339|    170|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1815:9): [True: 0, False: 170]
  ------------------
 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|    170|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(PixarLogState));
 1826|    170|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1826:9): [True: 0, False: 170]
  ------------------
 1827|      0|        goto bad;
 1828|    170|    sp = (PixarLogState *)tif->tif_data;
 1829|    170|    _TIFFmemset(sp, 0, sizeof(*sp));
 1830|    170|    sp->stream.data_type = Z_BINARY;
 1831|    170|    sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  765|    170|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
 1832|       |
 1833|       |    /*
 1834|       |     * Install codec methods.
 1835|       |     */
 1836|    170|    tif->tif_fixuptags = PixarLogFixupTags;
 1837|    170|    tif->tif_setupdecode = PixarLogSetupDecode;
 1838|    170|    tif->tif_predecode = PixarLogPreDecode;
 1839|    170|    tif->tif_decoderow = PixarLogDecode;
 1840|    170|    tif->tif_decodestrip = PixarLogDecode;
 1841|    170|    tif->tif_decodetile = PixarLogDecode;
 1842|    170|    tif->tif_setupencode = PixarLogSetupEncode;
 1843|    170|    tif->tif_preencode = PixarLogPreEncode;
 1844|    170|    tif->tif_postencode = PixarLogPostEncode;
 1845|    170|    tif->tif_encoderow = PixarLogEncode;
 1846|    170|    tif->tif_encodestrip = PixarLogEncode;
 1847|    170|    tif->tif_encodetile = PixarLogEncode;
 1848|    170|    tif->tif_close = PixarLogClose;
 1849|    170|    tif->tif_cleanup = PixarLogCleanup;
 1850|    170|    tif->tif_getmaxcompressionratio = PixarLogGetMaxCompressionRatio;
 1851|       |
 1852|       |    /* Override SetField so we can handle our private pseudo-tag */
 1853|    170|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1854|    170|    tif->tif_tagmethods.vgetfield = PixarLogVGetField; /* hook for codec tags */
 1855|    170|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1856|    170|    tif->tif_tagmethods.vsetfield = PixarLogVSetField; /* hook for codec tags */
 1857|       |
 1858|       |    /* Default values for codec-specific fields */
 1859|    170|    sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */
 1860|    170|    sp->state = 0;
 1861|       |
 1862|       |    /* we don't wish to use the predictor,
 1863|       |     * the default is none, which predictor value 1
 1864|       |     */
 1865|    170|    (void)TIFFPredictorInit(tif);
 1866|       |
 1867|       |    /*
 1868|       |     * build the companding tables
 1869|       |     */
 1870|    170|    PixarLogMakeTables(tif, sp);
 1871|       |
 1872|    170|    return (1);
 1873|      0|bad:
 1874|      0|    TIFFErrorExtR(tif, module, "No space for PixarLog state block");
 1875|      0|    return (0);
 1876|    170|}
tif_pixarlog.c:PixarLogFixupTags:
  822|    160|{
  823|    160|    (void)tif;
  824|    160|    return (1);
  825|    160|}
tif_pixarlog.c:PixarLogSetupDecode:
  828|    164|{
  829|    164|    static const char module[] = "PixarLogSetupDecode";
  830|    164|    TIFFDirectory *td = &tif->tif_dir;
  831|    164|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|    164|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  832|    164|    tmsize_t tbuf_size;
  833|    164|    uint32_t strip_height;
  834|       |
  835|    164|    assert(sp != NULL);
  ------------------
  |  Branch (835:5): [True: 0, False: 164]
  |  Branch (835:5): [True: 164, False: 0]
  ------------------
  836|       |
  837|       |    /* This function can possibly be called several times by */
  838|       |    /* PredictorSetupDecode() if this function succeeds but */
  839|       |    /* PredictorSetup() fails */
  840|    164|    if ((sp->state & PLSTATE_INIT) != 0)
  ------------------
  |  |  615|    164|#define PLSTATE_INIT 1
  ------------------
  |  Branch (840:9): [True: 1, False: 163]
  ------------------
  841|      1|        return 1;
  842|       |
  843|    163|    strip_height = td->td_rowsperstrip;
  844|    163|    if (strip_height > td->td_imagelength)
  ------------------
  |  Branch (844:9): [True: 141, False: 22]
  ------------------
  845|    141|        strip_height = td->td_imagelength;
  846|       |
  847|       |    /* Make sure no byte swapping happens on the data
  848|       |     * after decompression. */
  849|    163|    tif->tif_postdecode = _TIFFNoPostDecode;
  850|       |
  851|       |    /* for some reason, we can't do this in TIFFInitPixarLog */
  852|       |
  853|    163|    sp->stride =
  854|    163|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    163|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (854:10): [True: 151, False: 12]
  ------------------
  855|    163|                                                    : 1);
  856|    163|    tbuf_size = multiply_ms(
  857|    163|        multiply_ms(multiply_ms(sp->stride, td->td_imagewidth), strip_height),
  858|    163|        sizeof(uint16_t));
  859|       |    /* add one more stride in case input ends mid-stride */
  860|    163|    tbuf_size =
  861|    163|        add_ms(tbuf_size, (tmsize_t)(sizeof(uint16_t) * (size_t)sp->stride));
  862|    163|    if (tbuf_size == 0)
  ------------------
  |  Branch (862:9): [True: 0, False: 163]
  ------------------
  863|      0|        return (0); /* TODO: this is an error return without error report
  864|       |                       through TIFFErrorExt */
  865|    163|    sp->tbuf = (uint16_t *)_TIFFmallocExt(tif, tbuf_size);
  866|    163|    if (sp->tbuf == NULL)
  ------------------
  |  Branch (866:9): [True: 0, False: 163]
  ------------------
  867|      0|        return (0);
  868|    163|    sp->tbuf_size = tbuf_size;
  869|    163|    if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
  ------------------
  |  |  765|    163|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (869:9): [True: 163, False: 0]
  ------------------
  870|    163|        sp->user_datafmt = PixarLogGuessDataFmt(td);
  871|    163|    if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
  ------------------
  |  |  765|    163|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (871:9): [True: 11, False: 152]
  ------------------
  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|    152|    if (inflateInit(&sp->stream) != Z_OK)
  ------------------
  |  Branch (883:9): [True: 0, False: 152]
  ------------------
  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|    152|    else
  893|    152|    {
  894|    152|        sp->state |= PLSTATE_INIT;
  ------------------
  |  |  615|    152|#define PLSTATE_INIT 1
  ------------------
  895|    152|        return (1);
  896|    152|    }
  897|    152|}
tif_pixarlog.c:multiply_ms:
  805|    489|{
  806|    489|    return _TIFFMultiplySSize(NULL, m1, m2, NULL);
  807|    489|}
tif_pixarlog.c:add_ms:
  810|    163|{
  811|    163|    assert(m1 >= 0 && m2 >= 0);
  ------------------
  |  Branch (811:5): [True: 0, False: 163]
  |  Branch (811:5): [True: 0, False: 0]
  |  Branch (811:5): [True: 163, False: 0]
  |  Branch (811:5): [True: 163, False: 0]
  ------------------
  812|       |    /* if either input is zero, assume overflow already occurred */
  813|    163|    if (m1 == 0 || m2 == 0)
  ------------------
  |  Branch (813:9): [True: 0, False: 163]
  |  Branch (813:20): [True: 0, False: 163]
  ------------------
  814|      0|        return 0;
  815|    163|    else if (m1 > TIFF_TMSIZE_T_MAX - m2)
  ------------------
  |  |   68|    163|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (815:14): [True: 0, False: 163]
  ------------------
  816|      0|        return 0;
  817|       |
  818|    163|    return m1 + m2;
  819|    163|}
tif_pixarlog.c:PixarLogGuessDataFmt:
  768|    163|{
  769|    163|    int guess = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  765|    163|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  770|    163|    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|    163|    switch (td->td_bitspersample)
  776|    163|    {
  777|      0|        case 32:
  ------------------
  |  Branch (777:9): [True: 0, False: 163]
  ------------------
  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|     56|        case 16:
  ------------------
  |  Branch (781:9): [True: 56, False: 107]
  ------------------
  782|     56|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|    112|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|     55|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (782:17): [True: 1, False: 55]
  |  Branch (782:48): [True: 53, False: 2]
  ------------------
  783|     54|                guess = PIXARLOGDATAFMT_16BIT;
  ------------------
  |  |  719|     54|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  784|     56|            break;
  785|     16|        case 12:
  ------------------
  |  Branch (785:9): [True: 16, False: 147]
  ------------------
  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: 162]
  ------------------
  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|     84|        case 8:
  ------------------
  |  Branch (793:9): [True: 84, False: 79]
  ------------------
  794|     84|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|    168|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|     83|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (794:17): [True: 1, False: 83]
  |  Branch (794:48): [True: 81, False: 2]
  ------------------
  795|     82|                guess = PIXARLOGDATAFMT_8BIT;
  ------------------
  |  |  715|     82|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  796|     84|            break;
  797|      6|        default:
  ------------------
  |  Branch (797:9): [True: 6, False: 157]
  ------------------
  798|      6|            break;
  799|    163|    }
  800|       |
  801|    163|    return guess;
  802|    163|}
tif_pixarlog.c:PixarLogPreDecode:
  903|  11.9k|{
  904|  11.9k|    static const char module[] = "PixarLogPreDecode";
  905|  11.9k|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|  11.9k|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  906|       |
  907|  11.9k|    (void)s;
  908|  11.9k|    assert(sp != NULL);
  ------------------
  |  Branch (908:5): [True: 0, False: 11.9k]
  |  Branch (908:5): [True: 11.9k, False: 0]
  ------------------
  909|  11.9k|    sp->stream.next_in = tif->tif_rawdata;
  910|  11.9k|    assert(sizeof(sp->stream.avail_in) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (910:5): [True: 0, Folded]
  |  Branch (910:5): [True: 11.9k, 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|  11.9k|    sp->stream.avail_in = (uInt)tif->tif_rawcc;
  915|  11.9k|    if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
  ------------------
  |  Branch (915:9): [True: 0, False: 11.9k]
  ------------------
  916|      0|    {
  917|      0|        TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
  918|      0|        return (0);
  919|      0|    }
  920|  11.9k|    return (inflateReset(&sp->stream) == Z_OK);
  921|  11.9k|}
tif_pixarlog.c:PixarLogDecode:
  924|  12.5k|{
  925|  12.5k|    static const char module[] = "PixarLogDecode";
  926|  12.5k|    TIFFDirectory *td = &tif->tif_dir;
  927|  12.5k|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|  12.5k|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  928|  12.5k|    tmsize_t i;
  929|  12.5k|    tmsize_t nsamples;
  930|  12.5k|    tmsize_t llen;
  931|  12.5k|    uint16_t *up;
  932|       |
  933|  12.5k|    switch (sp->user_datafmt)
  934|  12.5k|    {
  935|      0|        case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|      0|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (935:9): [True: 0, False: 12.5k]
  ------------------
  936|      0|            nsamples = (tmsize_t)((uint64_t)occ /
  937|      0|                                  sizeof(float)); /* XXX float == 32 bits */
  938|      0|            break;
  939|  6.04k|        case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|  6.04k|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (939:9): [True: 6.04k, False: 6.45k]
  ------------------
  940|  6.64k|        case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|  6.64k|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (940:9): [True: 600, False: 11.9k]
  ------------------
  941|  6.64k|        case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|  6.64k|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (941:9): [True: 1, False: 12.5k]
  ------------------
  942|  6.64k|            nsamples =
  943|  6.64k|                (tmsize_t)((uint64_t)occ /
  944|  6.64k|                           sizeof(uint16_t)); /* XXX uint16_t == 16 bits */
  945|  6.64k|            break;
  946|  5.85k|        case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|  5.85k|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (946:9): [True: 5.85k, False: 6.64k]
  ------------------
  947|  5.85k|        case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|  5.85k|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (947:9): [True: 0, False: 12.5k]
  ------------------
  948|  5.85k|            nsamples = occ;
  949|  5.85k|            break;
  950|      0|        default:
  ------------------
  |  Branch (950:9): [True: 0, False: 12.5k]
  ------------------
  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|  12.5k|    }
  957|       |
  958|       |    /* stride (≤ td_samplesperpixel, max 65535) × imagewidth: fits tmsize_t */
  959|  12.5k|    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|  12.5k|    if (sp->user_datafmt == PIXARLOGDATAFMT_8BITABGR && sp->stride == 3)
  ------------------
  |  |  716|  25.0k|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (962:9): [True: 0, False: 12.5k]
  |  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|  12.5k|    (void)s;
 1011|  12.5k|    assert(sp != NULL);
  ------------------
  |  Branch (1011:5): [True: 0, False: 12.5k]
  |  Branch (1011:5): [True: 12.5k, False: 0]
  ------------------
 1012|       |
 1013|  12.5k|    sp->stream.next_in = tif->tif_rawcp;
 1014|  12.5k|    sp->stream.avail_in = (uInt)tif->tif_rawcc;
 1015|       |
 1016|  12.5k|    sp->stream.next_out = (unsigned char *)sp->tbuf;
 1017|  12.5k|    assert(sizeof(sp->stream.avail_out) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (1017:5): [True: 0, Folded]
  |  Branch (1017:5): [True: 12.5k, 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|  12.5k|    sp->stream.avail_out = (uInt)((unsigned long)nsamples * sizeof(uint16_t));
 1022|  12.5k|    if (sp->stream.avail_out != (unsigned long)nsamples * sizeof(uint16_t))
  ------------------
  |  Branch (1022:9): [True: 0, False: 12.5k]
  ------------------
 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|  12.5k|    if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
  ------------------
  |  Branch (1029:9): [True: 186, False: 12.3k]
  ------------------
 1030|    186|    {
 1031|    186|        TIFFErrorExtR(tif, module, "sp->stream.avail_out > sp->tbuf_size");
 1032|    186|        memset(op, 0, (size_t)occ);
 1033|    186|        return (0);
 1034|    186|    }
 1035|  12.3k|    do
 1036|  13.6k|    {
 1037|  13.6k|        int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
 1038|  13.6k|        if (state == Z_STREAM_END)
  ------------------
  |  Branch (1038:13): [True: 785, False: 12.8k]
  ------------------
 1039|    785|        {
 1040|    785|            break; /* XXX */
 1041|    785|        }
 1042|  12.8k|        if (state == Z_DATA_ERROR)
  ------------------
  |  Branch (1042:13): [True: 7.45k, False: 5.37k]
  ------------------
 1043|  7.45k|        {
 1044|  7.45k|            TIFFErrorExtR(tif, module,
 1045|  7.45k|                          "Decoding error at scanline %" PRIu32 ", %s",
 1046|  7.45k|                          tif->tif_dir.td_row,
 1047|  7.45k|                          sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1047:27): [True: 7.45k, False: 0]
  ------------------
 1048|  7.45k|            memset(op, 0, (size_t)occ);
 1049|  7.45k|            return (0);
 1050|  7.45k|        }
 1051|  5.37k|        if (state != Z_OK)
  ------------------
  |  Branch (1051:13): [True: 1.43k, False: 3.94k]
  ------------------
 1052|  1.43k|        {
 1053|  1.43k|            TIFFErrorExtR(tif, module, "ZLib error: %s",
 1054|  1.43k|                          sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1054:27): [True: 0, False: 1.43k]
  ------------------
 1055|  1.43k|            memset(op, 0, (size_t)occ);
 1056|  1.43k|            return (0);
 1057|  1.43k|        }
 1058|  5.37k|    } while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (1058:14): [True: 1.30k, False: 2.64k]
  ------------------
 1059|       |
 1060|       |    /* hopefully, we got all the bytes we needed */
 1061|  3.42k|    if (sp->stream.avail_out != 0)
  ------------------
  |  Branch (1061:9): [True: 785, False: 2.64k]
  ------------------
 1062|    785|    {
 1063|    785|        TIFFErrorExtR(tif, module,
 1064|    785|                      "Not enough data at scanline %" PRIu32
 1065|    785|                      " (short %u bytes)",
 1066|    785|                      tif->tif_dir.td_row, sp->stream.avail_out);
 1067|    785|        memset(op, 0, (size_t)occ);
 1068|    785|        return (0);
 1069|    785|    }
 1070|       |
 1071|  2.64k|    tif->tif_rawcp = sp->stream.next_in;
 1072|  2.64k|    tif->tif_rawcc = sp->stream.avail_in;
 1073|       |
 1074|  2.64k|    up = sp->tbuf;
 1075|       |    /* Swap bytes in the data if from a different endian machine. */
 1076|  2.64k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  2.64k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1076:9): [True: 0, False: 2.64k]
  ------------------
 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.64k|    if (nsamples % llen)
  ------------------
  |  Branch (1084:9): [True: 445, False: 2.19k]
  ------------------
 1085|    445|    {
 1086|    445|        TIFFWarningExtR(tif, module,
 1087|    445|                        "stride %" TIFF_SSIZE_FORMAT
 1088|    445|                        " is not a multiple of sample count, "
 1089|    445|                        "%" TIFF_SSIZE_FORMAT ", data truncated.",
 1090|    445|                        llen, nsamples);
 1091|    445|        nsamples -= nsamples % llen;
 1092|    445|    }
 1093|       |
 1094|  8.37k|    for (i = 0; i < nsamples; i += llen, up += llen)
  ------------------
  |  Branch (1094:17): [True: 5.73k, False: 2.64k]
  ------------------
 1095|  5.73k|    {
 1096|  5.73k|        switch (sp->user_datafmt)
 1097|  5.73k|        {
 1098|      0|            case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|      0|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (1098:13): [True: 0, False: 5.73k]
  ------------------
 1099|      0|                horizontalAccumulateF(up, llen, sp->stride, op, sp->ToLinearF);
 1100|      0|                op += (unsigned long)llen * sizeof(float);
 1101|      0|                break;
 1102|  1.42k|            case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|  1.42k|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (1102:13): [True: 1.42k, False: 4.30k]
  ------------------
 1103|  1.42k|                horizontalAccumulate16(up, llen, sp->stride, op,
 1104|  1.42k|                                       sp->ToLinear16);
 1105|  1.42k|                op += (unsigned long)llen * sizeof(uint16_t);
 1106|  1.42k|                break;
 1107|    577|            case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|    577|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (1107:13): [True: 577, False: 5.15k]
  ------------------
 1108|    577|                horizontalAccumulate12(up, llen, sp->stride, op, sp->ToLinearF);
 1109|    577|                op += (unsigned long)llen * sizeof(int16_t);
 1110|    577|                break;
 1111|      0|            case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|      0|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (1111:13): [True: 0, False: 5.73k]
  ------------------
 1112|      0|                horizontalAccumulate11(up, llen, sp->stride, op);
 1113|      0|                op += (unsigned long)llen * sizeof(uint16_t);
 1114|      0|                break;
 1115|  3.72k|            case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|  3.72k|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (1115:13): [True: 3.72k, False: 2.00k]
  ------------------
 1116|  3.72k|                horizontalAccumulate8(up, llen, sp->stride, (unsigned char *)op,
 1117|  3.72k|                                      sp->ToLinear8);
 1118|  3.72k|                op += (unsigned long)llen * sizeof(unsigned char);
 1119|  3.72k|                break;
 1120|      0|            case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|      0|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (1120:13): [True: 0, False: 5.73k]
  ------------------
 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.73k]
  ------------------
 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.73k|        }
 1137|  5.73k|    }
 1138|       |
 1139|  2.64k|    return (1);
 1140|  2.64k|}
tif_pixarlog.c:horizontalAccumulate16:
  317|  1.42k|{
  318|  1.42k|    unsigned int cr, cg, cb, ca, mask;
  319|       |
  320|  1.42k|    if (n >= stride)
  ------------------
  |  Branch (320:9): [True: 1.42k, False: 0]
  ------------------
  321|  1.42k|    {
  322|  1.42k|        mask = CODE_MASK;
  ------------------
  |  |  104|  1.42k|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  323|  1.42k|        if (stride == 3)
  ------------------
  |  Branch (323:13): [True: 474, False: 955]
  ------------------
  324|    474|        {
  325|    474|            PixarLogStore16NativeUnaligned(op, ToLinear16[cr = (wp[0] & mask)]);
  326|    474|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  327|    474|                                           ToLinear16[cg = (wp[1] & mask)]);
  328|    474|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  329|    474|                                           ToLinear16[cb = (wp[2] & mask)]);
  330|    474|            n -= 3;
  331|  1.32k|            while (n > 0)
  ------------------
  |  Branch (331:20): [True: 852, False: 474]
  ------------------
  332|    852|            {
  333|    852|                wp += 3;
  334|    852|                op += 3 * sizeof(uint16_t);
  335|    852|                n -= 3;
  336|    852|                PixarLogStore16NativeUnaligned(
  337|    852|                    op, ToLinear16[(cr += wp[0]) & mask]);
  338|    852|                PixarLogStore16NativeUnaligned(
  339|    852|                    op + sizeof(uint16_t), ToLinear16[(cg += wp[1]) & mask]);
  340|    852|                PixarLogStore16NativeUnaligned(
  341|    852|                    op + 2 * sizeof(uint16_t),
  342|    852|                    ToLinear16[(cb += wp[2]) & mask]);
  343|    852|            }
  344|    474|        }
  345|    955|        else if (stride == 4)
  ------------------
  |  Branch (345:18): [True: 512, False: 443]
  ------------------
  346|    512|        {
  347|    512|            PixarLogStore16NativeUnaligned(op, ToLinear16[cr = (wp[0] & mask)]);
  348|    512|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  349|    512|                                           ToLinear16[cg = (wp[1] & mask)]);
  350|    512|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  351|    512|                                           ToLinear16[cb = (wp[2] & mask)]);
  352|    512|            PixarLogStore16NativeUnaligned(op + 3 * sizeof(uint16_t),
  353|    512|                                           ToLinear16[ca = (wp[3] & mask)]);
  354|    512|            n -= 4;
  355|  1.47k|            while (n > 0)
  ------------------
  |  Branch (355:20): [True: 965, False: 512]
  ------------------
  356|    965|            {
  357|    965|                wp += 4;
  358|    965|                op += 4 * sizeof(uint16_t);
  359|    965|                n -= 4;
  360|    965|                PixarLogStore16NativeUnaligned(
  361|    965|                    op, ToLinear16[(cr += wp[0]) & mask]);
  362|    965|                PixarLogStore16NativeUnaligned(
  363|    965|                    op + sizeof(uint16_t), ToLinear16[(cg += wp[1]) & mask]);
  364|    965|                PixarLogStore16NativeUnaligned(
  365|    965|                    op + 2 * sizeof(uint16_t),
  366|    965|                    ToLinear16[(cb += wp[2]) & mask]);
  367|    965|                PixarLogStore16NativeUnaligned(
  368|    965|                    op + 3 * sizeof(uint16_t),
  369|    965|                    ToLinear16[(ca += wp[3]) & mask]);
  370|    965|            }
  371|    512|        }
  372|    443|        else
  373|    443|        {
  374|    443|            REPEAT(stride,
  ------------------
  |  |  110|    443|    {                                                                          \
  |  |  111|    443|        int i;                                                                 \
  |  |  112|    443|        i = n;                                                                 \
  |  |  113|    443|        do                                                                     \
  |  |  114|  1.00k|        {                                                                      \
  |  |  115|  1.00k|            i--;                                                               \
  |  |  116|  1.00k|            op;                                                                \
  |  |  117|  1.00k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 557, False: 443]
  |  |  ------------------
  |  |  118|    443|    }
  ------------------
  375|    443|                   PixarLogStore16NativeUnaligned(op, ToLinear16[*wp & mask]);
  376|    443|                   wp++; op += sizeof(uint16_t))
  377|    443|            n -= stride;
  378|  2.57k|            while (n > 0)
  ------------------
  |  Branch (378:20): [True: 2.12k, False: 443]
  ------------------
  379|  2.12k|            {
  380|  2.12k|                REPEAT(
  ------------------
  |  |  110|  2.12k|    {                                                                          \
  |  |  111|  2.12k|        int i;                                                                 \
  |  |  112|  2.12k|        i = n;                                                                 \
  |  |  113|  2.12k|        do                                                                     \
  |  |  114|  4.56k|        {                                                                      \
  |  |  115|  4.56k|            i--;                                                               \
  |  |  116|  4.56k|            op;                                                                \
  |  |  117|  4.56k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 2.44k, False: 2.12k]
  |  |  ------------------
  |  |  118|  2.12k|    }
  ------------------
  381|  2.12k|                    stride, *wp = (uint16_t)(*wp + wp[-stride]);
  382|  2.12k|                    PixarLogStore16NativeUnaligned(op, ToLinear16[*wp & mask]);
  383|  2.12k|                    wp++; op += sizeof(uint16_t))
  384|  2.12k|                n -= stride;
  385|  2.12k|            }
  386|    443|        }
  387|  1.42k|    }
  388|  1.42k|}
tif_pixarlog.c:PixarLogStore16NativeUnaligned:
  147|  16.0k|{
  148|  16.0k|    memcpy(cp, &v, sizeof(v));
  149|  16.0k|}
tif_pixarlog.c:horizontalAccumulate12:
  228|    577|{
  229|    577|    unsigned int cr, cg, cb, ca, mask;
  230|    577|    float t0, t1, t2, t3;
  231|       |
  232|    577|#define SCALE12 2048.0f
  233|    577|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  234|       |
  235|    577|    if (n >= stride)
  ------------------
  |  Branch (235:9): [True: 577, False: 0]
  ------------------
  236|    577|    {
  237|    577|        mask = CODE_MASK;
  ------------------
  |  |  104|    577|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  238|    577|        if (stride == 3)
  ------------------
  |  Branch (238:13): [True: 0, False: 577]
  ------------------
  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|    577|        else if (stride == 4)
  ------------------
  |  Branch (264:18): [True: 0, False: 577]
  ------------------
  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|    577|        else
  297|    577|        {
  298|    577|            REPEAT(stride, t0 = ToLinearF[*wp & mask] * SCALE12;
  ------------------
  |  |  110|    577|    {                                                                          \
  |  |  111|    577|        int i;                                                                 \
  |  |  112|    577|        i = n;                                                                 \
  |  |  113|    577|        do                                                                     \
  |  |  114|    577|        {                                                                      \
  |  |  115|    577|            i--;                                                               \
  |  |  116|  1.15k|            op;                                                                \
  |  |  ------------------
  |  |  |  Branch (116:13): [True: 294, False: 283]
  |  |  ------------------
  |  |  117|    577|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 0, False: 577]
  |  |  ------------------
  |  |  118|    577|    }
  ------------------
  299|    577|                   PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  300|    577|                   wp++; op += sizeof(uint16_t))
  301|    577|            n -= stride;
  302|    577|            while (n > 0)
  ------------------
  |  Branch (302:20): [True: 0, False: 577]
  ------------------
  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|    577|        }
  312|    577|    }
  313|    577|}
tif_pixarlog.c:horizontalAccumulate8:
  473|  3.72k|{
  474|  3.72k|    unsigned int cr, cg, cb, ca, mask;
  475|       |
  476|  3.72k|    if (n >= stride)
  ------------------
  |  Branch (476:9): [True: 3.72k, False: 0]
  ------------------
  477|  3.72k|    {
  478|  3.72k|        mask = CODE_MASK;
  ------------------
  |  |  104|  3.72k|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  479|  3.72k|        if (stride == 3)
  ------------------
  |  Branch (479:13): [True: 1.30k, False: 2.41k]
  ------------------
  480|  1.30k|        {
  481|  1.30k|            op[0] = ToLinear8[cr = (wp[0] & mask)];
  482|  1.30k|            op[1] = ToLinear8[cg = (wp[1] & mask)];
  483|  1.30k|            op[2] = ToLinear8[cb = (wp[2] & mask)];
  484|  1.30k|            n -= 3;
  485|  7.45k|            while (n > 0)
  ------------------
  |  Branch (485:20): [True: 6.15k, False: 1.30k]
  ------------------
  486|  6.15k|            {
  487|  6.15k|                n -= 3;
  488|  6.15k|                wp += 3;
  489|  6.15k|                op += 3;
  490|  6.15k|                op[0] = ToLinear8[(cr += wp[0]) & mask];
  491|  6.15k|                op[1] = ToLinear8[(cg += wp[1]) & mask];
  492|  6.15k|                op[2] = ToLinear8[(cb += wp[2]) & mask];
  493|  6.15k|            }
  494|  1.30k|        }
  495|  2.41k|        else if (stride == 4)
  ------------------
  |  Branch (495:18): [True: 539, False: 1.87k]
  ------------------
  496|    539|        {
  497|    539|            op[0] = ToLinear8[cr = (wp[0] & mask)];
  498|    539|            op[1] = ToLinear8[cg = (wp[1] & mask)];
  499|    539|            op[2] = ToLinear8[cb = (wp[2] & mask)];
  500|    539|            op[3] = ToLinear8[ca = (wp[3] & mask)];
  501|    539|            n -= 4;
  502|  6.74k|            while (n > 0)
  ------------------
  |  Branch (502:20): [True: 6.20k, False: 539]
  ------------------
  503|  6.20k|            {
  504|  6.20k|                n -= 4;
  505|  6.20k|                wp += 4;
  506|  6.20k|                op += 4;
  507|  6.20k|                op[0] = ToLinear8[(cr += wp[0]) & mask];
  508|  6.20k|                op[1] = ToLinear8[(cg += wp[1]) & mask];
  509|  6.20k|                op[2] = ToLinear8[(cb += wp[2]) & mask];
  510|  6.20k|                op[3] = ToLinear8[(ca += wp[3]) & mask];
  511|  6.20k|            }
  512|    539|        }
  513|  1.87k|        else
  514|  1.87k|        {
  515|  1.87k|            REPEAT(stride, *op = ToLinear8[*wp & mask]; wp++; op++)
  ------------------
  |  |  110|  1.87k|    {                                                                          \
  |  |  111|  1.87k|        int i;                                                                 \
  |  |  112|  1.87k|        i = n;                                                                 \
  |  |  113|  1.87k|        do                                                                     \
  |  |  114|  3.69k|        {                                                                      \
  |  |  115|  3.69k|            i--;                                                               \
  |  |  116|  3.69k|            op;                                                                \
  |  |  117|  3.69k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 1.81k, False: 1.87k]
  |  |  ------------------
  |  |  118|  1.87k|    }
  ------------------
  516|  1.87k|            n -= stride;
  517|  34.4k|            while (n > 0)
  ------------------
  |  Branch (517:20): [True: 32.5k, False: 1.87k]
  ------------------
  518|  32.5k|            {
  519|  32.5k|                REPEAT(stride, *wp = (uint16_t)(*wp + wp[-stride]);
  ------------------
  |  |  110|  32.5k|    {                                                                          \
  |  |  111|  32.5k|        int i;                                                                 \
  |  |  112|  32.5k|        i = n;                                                                 \
  |  |  113|  32.5k|        do                                                                     \
  |  |  114|  41.0k|        {                                                                      \
  |  |  115|  41.0k|            i--;                                                               \
  |  |  116|  41.0k|            op;                                                                \
  |  |  117|  41.0k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 8.46k, False: 32.5k]
  |  |  ------------------
  |  |  118|  32.5k|    }
  ------------------
  520|  32.5k|                       *op = ToLinear8[*wp & mask]; wp++; op++)
  521|  32.5k|                n -= stride;
  522|  32.5k|            }
  523|  1.87k|        }
  524|  3.72k|    }
  525|  3.72k|}
tif_pixarlog.c:PixarLogCleanup:
 1663|    170|{
 1664|    170|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1665|       |
 1666|    170|    assert(sp != 0);
  ------------------
  |  Branch (1666:5): [True: 0, False: 170]
  |  Branch (1666:5): [True: 170, False: 0]
  ------------------
 1667|       |
 1668|    170|    (void)TIFFPredictorCleanup(tif);
 1669|       |
 1670|    170|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1671|    170|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1672|       |
 1673|    170|    if (sp->FromLT2)
  ------------------
  |  Branch (1673:9): [True: 170, False: 0]
  ------------------
 1674|    170|        _TIFFfreeExt(tif, sp->FromLT2);
 1675|    170|    if (sp->From14)
  ------------------
  |  Branch (1675:9): [True: 170, False: 0]
  ------------------
 1676|    170|        _TIFFfreeExt(tif, sp->From14);
 1677|    170|    if (sp->From8)
  ------------------
  |  Branch (1677:9): [True: 170, False: 0]
  ------------------
 1678|    170|        _TIFFfreeExt(tif, sp->From8);
 1679|    170|    if (sp->ToLinearF)
  ------------------
  |  Branch (1679:9): [True: 170, False: 0]
  ------------------
 1680|    170|        _TIFFfreeExt(tif, sp->ToLinearF);
 1681|    170|    if (sp->ToLinear16)
  ------------------
  |  Branch (1681:9): [True: 170, False: 0]
  ------------------
 1682|    170|        _TIFFfreeExt(tif, sp->ToLinear16);
 1683|    170|    if (sp->ToLinear8)
  ------------------
  |  Branch (1683:9): [True: 170, False: 0]
  ------------------
 1684|    170|        _TIFFfreeExt(tif, sp->ToLinear8);
 1685|    170|    if (sp->state & PLSTATE_INIT)
  ------------------
  |  |  615|    170|#define PLSTATE_INIT 1
  ------------------
  |  Branch (1685:9): [True: 152, False: 18]
  ------------------
 1686|    152|    {
 1687|    152|        if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (1687:13): [True: 152, False: 0]
  ------------------
 1688|    152|            inflateEnd(&sp->stream);
 1689|      0|        else
 1690|      0|            deflateEnd(&sp->stream);
 1691|    152|    }
 1692|    170|    if (sp->tbuf)
  ------------------
  |  Branch (1692:9): [True: 152, False: 18]
  ------------------
 1693|    152|        _TIFFfreeExt(tif, sp->tbuf);
 1694|    170|    _TIFFfreeExt(tif, sp);
 1695|    170|    tif->tif_data = NULL;
 1696|       |
 1697|    170|    _TIFFSetDefaultCompressionState(tif);
 1698|    170|}
tif_pixarlog.c:PixarLogGetMaxCompressionRatio:
 1794|      2|{
 1795|      2|    (void)tif;
 1796|       |    /* cf https://zlib.net/zlib_tech.html */
 1797|      2|    const uint64_t MAX_DEFLATE_RATIO = 1032;
 1798|       |
 1799|       |    /* security margin as I don't understand what this codec does */
 1800|      2|    return MAX_DEFLATE_RATIO * (uint64_t)4;
 1801|      2|}
tif_pixarlog.c:PixarLogVGetField:
 1770|  2.94k|{
 1771|  2.94k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1772|       |
 1773|  2.94k|    switch (tag)
 1774|  2.94k|    {
 1775|      0|        case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  740|      0|#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
  ------------------
  |  Branch (1775:9): [True: 0, False: 2.94k]
  ------------------
 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: 2.94k]
  ------------------
 1779|      0|            *va_arg(ap, int *) = sp->user_datafmt;
 1780|      0|            break;
 1781|  2.94k|        default:
  ------------------
  |  Branch (1781:9): [True: 2.94k, False: 0]
  ------------------
 1782|  2.94k|            return (*sp->vgetparent)(tif, tag, ap);
 1783|  2.94k|    }
 1784|      0|    return (1);
 1785|  2.94k|}
tif_pixarlog.c:PixarLogVSetField:
 1701|  1.59k|{
 1702|  1.59k|    static const char module[] = "PixarLogVSetField";
 1703|  1.59k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1704|  1.59k|    int result;
 1705|       |
 1706|  1.59k|    switch (tag)
 1707|  1.59k|    {
 1708|      0|        case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  740|      0|#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
  ------------------
  |  Branch (1708:9): [True: 0, False: 1.59k]
  ------------------
 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.59k]
  ------------------
 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.59k|        default:
  ------------------
  |  Branch (1763:9): [True: 1.59k, False: 0]
  ------------------
 1764|  1.59k|            result = (*sp->vsetparent)(tif, tag, ap);
 1765|  1.59k|    }
 1766|  1.59k|    return (result);
 1767|  1.59k|}
tif_pixarlog.c:PixarLogMakeTables:
  630|    170|{
  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|    170|    int nlin, lt2size;
  644|    170|    int i, j;
  645|    170|    double b, c, linstep, v;
  646|    170|    float *ToLinearF;
  647|    170|    uint16_t *ToLinear16;
  648|    170|    unsigned char *ToLinear8;
  649|    170|    uint16_t *FromLT2;
  650|    170|    uint16_t *From14; /* Really for 16-bit data, but we shift down 2 */
  651|    170|    uint16_t *From8;
  652|       |
  653|    170|    c = log(RATIO);
  ------------------
  |  |  102|    170|#define RATIO 1.004  /* nominal ratio for log part */
  ------------------
  654|    170|    nlin = (int)(1. / c); /* nlin must be an integer */
  655|    170|    c = 1. / nlin;
  656|    170|    b = exp(-c * ONE); /* multiplicative scale factor [b*exp(c*ONE) = 1] */
  ------------------
  |  |  101|    170|#define ONE 1250     /* token value of 1.0 exactly */
  ------------------
  657|    170|    linstep = b * c * exp(1.);
  658|       |
  659|    170|    LogK1 = (float)(1. / c); /* if (v >= 2)  token = k1*log(v*k2) */
  660|    170|    LogK2 = (float)(1. / b);
  661|    170|    lt2size = (int)(2. / linstep) + 1;
  662|    170|    FromLT2 = (uint16_t *)_TIFFmallocExt(
  663|    170|        tif, (tmsize_t)((size_t)lt2size * sizeof(uint16_t)));
  664|    170|    From14 = (uint16_t *)_TIFFmallocExt(tif, 16384 * sizeof(uint16_t));
  665|    170|    From8 = (uint16_t *)_TIFFmallocExt(tif, 256 * sizeof(uint16_t));
  666|    170|    ToLinearF = (float *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(float));
  ------------------
  |  |  100|    170|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  667|    170|    ToLinear16 = (uint16_t *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(uint16_t));
  ------------------
  |  |  100|    170|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  668|    170|    ToLinear8 =
  669|    170|        (unsigned char *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(unsigned char));
  ------------------
  |  |  100|    170|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  670|    170|    if (FromLT2 == NULL || From14 == NULL || From8 == NULL ||
  ------------------
  |  Branch (670:9): [True: 0, False: 170]
  |  Branch (670:28): [True: 0, False: 170]
  |  Branch (670:46): [True: 0, False: 170]
  ------------------
  671|    170|        ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL)
  ------------------
  |  Branch (671:9): [True: 0, False: 170]
  |  Branch (671:30): [True: 0, False: 170]
  |  Branch (671:52): [True: 0, False: 170]
  ------------------
  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|    170|    j = 0;
  695|       |
  696|  42.6k|    for (i = 0; i < nlin; i++)
  ------------------
  |  Branch (696:17): [True: 42.5k, False: 170]
  ------------------
  697|  42.5k|    {
  698|  42.5k|        v = i * linstep;
  699|  42.5k|        ToLinearF[j++] = (float)v;
  700|  42.5k|    }
  701|       |
  702|   305k|    for (i = nlin; i < TSIZE; i++)
  ------------------
  |  |   99|   305k|#define TSIZE 2048   /* decode table size (11-bit tokens) */
  ------------------
  |  Branch (702:20): [True: 305k, False: 170]
  ------------------
  703|   305k|        ToLinearF[j++] = (float)(b * exp(c * i));
  704|       |
  705|    170|    ToLinearF[2048] = ToLinearF[2047];
  706|       |
  707|   348k|    for (i = 0; i < TSIZEP1; i++)
  ------------------
  |  |  100|   348k|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  |  Branch (707:17): [True: 348k, False: 170]
  ------------------
  708|   348k|    {
  709|   348k|        v = (double)ToLinearF[i] * 65535.0 + 0.5;
  710|   348k|        ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16_t)v;
  ------------------
  |  Branch (710:25): [True: 135k, False: 212k]
  ------------------
  711|   348k|        v = (double)ToLinearF[i] * 255.0 + 0.5;
  712|   348k|        ToLinear8[i] = (v > 255.0) ? 255 : (unsigned char)v;
  ------------------
  |  Branch (712:24): [True: 135k, False: 212k]
  ------------------
  713|   348k|    }
  714|       |
  715|    170|    j = 0;
  716|  4.64M|    for (i = 0; i < lt2size; i++)
  ------------------
  |  Branch (716:17): [True: 4.64M, False: 170]
  ------------------
  717|  4.64M|    {
  718|  4.64M|        if ((i * linstep) * (i * linstep) >
  ------------------
  |  Branch (718:13): [True: 241k, False: 4.39M]
  ------------------
  719|  4.64M|            (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  720|   241k|            j++;
  721|  4.64M|        FromLT2[i] = (uint16_t)j;
  722|  4.64M|    }
  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|    170|    j = 0;
  730|  2.78M|    for (i = 0; i < 16384; i++)
  ------------------
  |  Branch (730:17): [True: 2.78M, False: 170]
  ------------------
  731|  2.78M|    {
  732|  2.99M|        while ((i / 16383.) * (i / 16383.) >
  ------------------
  |  Branch (732:16): [True: 212k, False: 2.78M]
  ------------------
  733|  2.99M|               (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  734|   212k|            j++;
  735|  2.78M|        From14[i] = (uint16_t)j;
  736|  2.78M|    }
  737|       |
  738|    170|    j = 0;
  739|  43.6k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (739:17): [True: 43.5k, False: 170]
  ------------------
  740|  43.5k|    {
  741|   256k|        while ((i / 255.) * (i / 255.) >
  ------------------
  |  Branch (741:16): [True: 212k, False: 43.5k]
  ------------------
  742|   256k|               (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  743|   212k|            j++;
  744|  43.5k|        From8[i] = (uint16_t)j;
  745|  43.5k|    }
  746|       |
  747|    170|    Fltsize = (float)(lt2size / 2);
  748|       |
  749|    170|    sp->ToLinearF = ToLinearF;
  750|    170|    sp->ToLinear16 = ToLinear16;
  751|    170|    sp->ToLinear8 = ToLinear8;
  752|    170|    sp->FromLT2 = FromLT2;
  753|    170|    sp->From14 = From14;
  754|    170|    sp->From8 = From8;
  755|       |
  756|    170|    return 1;
  757|    170|}

TIFFPredictorInit:
 1205|    858|{
 1206|    858|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    858|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1207|       |
 1208|    858|    assert(sp != 0);
  ------------------
  |  Branch (1208:5): [True: 0, False: 858]
  |  Branch (1208:5): [True: 858, False: 0]
  ------------------
 1209|       |
 1210|       |    /*
 1211|       |     * Merge codec-specific tag information.
 1212|       |     */
 1213|    858|    if (!_TIFFMergeFields(tif, predictFields, TIFFArrayCount(predictFields)))
  ------------------
  |  |  339|    858|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1213:9): [True: 0, False: 858]
  ------------------
 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|    858|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1224|    858|    tif->tif_tagmethods.vgetfield =
 1225|    858|        PredictorVGetField; /* hook for predictor tag */
 1226|    858|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1227|    858|    tif->tif_tagmethods.vsetfield =
 1228|    858|        PredictorVSetField; /* hook for predictor tag */
 1229|    858|    sp->printdir = tif->tif_tagmethods.printdir;
 1230|    858|    tif->tif_tagmethods.printdir =
 1231|    858|        PredictorPrintDir; /* hook for predictor tag */
 1232|       |
 1233|    858|    sp->setupdecode = tif->tif_setupdecode;
 1234|    858|    tif->tif_setupdecode = PredictorSetupDecode;
 1235|    858|    sp->setupencode = tif->tif_setupencode;
 1236|    858|    tif->tif_setupencode = PredictorSetupEncode;
 1237|       |
 1238|    858|    sp->predictor = 1;      /* default value */
 1239|    858|    sp->encodepfunc = NULL; /* no predictor routine */
 1240|       |    sp->decodepfunc = NULL; /* no predictor routine */
 1241|    858|    return 1;
 1242|    858|}
TIFFPredictorCleanup:
 1245|    858|{
 1246|    858|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    858|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1247|       |
 1248|    858|    assert(sp != 0);
  ------------------
  |  Branch (1248:5): [True: 0, False: 858]
  |  Branch (1248:5): [True: 858, False: 0]
  ------------------
 1249|       |
 1250|    858|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1251|    858|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1252|    858|    tif->tif_tagmethods.printdir = sp->printdir;
 1253|    858|    tif->tif_setupdecode = sp->setupdecode;
 1254|    858|    tif->tif_setupencode = sp->setupencode;
 1255|       |
 1256|    858|    return 1;
 1257|    858|}
tif_predict.c:PredictorVGetField:
 1159|  9.66k|{
 1160|  9.66k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  9.66k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1161|       |
 1162|  9.66k|    assert(sp != NULL);
  ------------------
  |  Branch (1162:5): [True: 0, False: 9.66k]
  |  Branch (1162:5): [True: 9.66k, False: 0]
  ------------------
 1163|  9.66k|    assert(sp->vgetparent != NULL);
  ------------------
  |  Branch (1163:5): [True: 0, False: 9.66k]
  |  Branch (1163:5): [True: 9.66k, False: 0]
  ------------------
 1164|       |
 1165|  9.66k|    switch (tag)
 1166|  9.66k|    {
 1167|      0|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|      0|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1167:9): [True: 0, False: 9.66k]
  ------------------
 1168|      0|            *va_arg(ap, uint16_t *) = (uint16_t)sp->predictor;
 1169|      0|            break;
 1170|  9.66k|        default:
  ------------------
  |  Branch (1170:9): [True: 9.66k, False: 0]
  ------------------
 1171|  9.66k|            return (*sp->vgetparent)(tif, tag, ap);
 1172|  9.66k|    }
 1173|      0|    return 1;
 1174|  9.66k|}
tif_predict.c:PredictorVSetField:
 1139|  8.10k|{
 1140|  8.10k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  8.10k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1141|       |
 1142|  8.10k|    assert(sp != NULL);
  ------------------
  |  Branch (1142:5): [True: 0, False: 8.10k]
  |  Branch (1142:5): [True: 8.10k, False: 0]
  ------------------
 1143|  8.10k|    assert(sp->vsetparent != NULL);
  ------------------
  |  Branch (1143:5): [True: 0, False: 8.10k]
  |  Branch (1143:5): [True: 8.10k, False: 0]
  ------------------
 1144|       |
 1145|  8.10k|    switch (tag)
 1146|  8.10k|    {
 1147|    401|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|    401|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1147:9): [True: 401, False: 7.70k]
  ------------------
 1148|    401|            sp->predictor = (uint16_t)va_arg(ap, uint16_vap);
 1149|    401|            TIFFSetFieldBit(tif, FIELD_PREDICTOR);
  ------------------
  |  |  249|    401|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    401|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    401|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1150|    401|            break;
 1151|  7.70k|        default:
  ------------------
  |  Branch (1151:9): [True: 7.70k, False: 401]
  ------------------
 1152|  7.70k|            return (*sp->vsetparent)(tif, tag, ap);
 1153|  8.10k|    }
 1154|    401|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|    401|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1155|    401|    return 1;
 1156|  8.10k|}
tif_predict.c:PredictorSetupDecode:
  128|    869|{
  129|    869|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    869|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  130|    869|    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|    869|    if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))
  ------------------
  |  Branch (135:9): [True: 11, False: 858]
  |  Branch (135:37): [True: 19, False: 839]
  ------------------
  136|     30|        return 0;
  137|       |
  138|    839|    if (sp->predictor == 2)
  ------------------
  |  Branch (138:9): [True: 296, False: 543]
  ------------------
  139|    296|    {
  140|    296|        switch (td->td_bitspersample)
  141|    296|        {
  142|    116|            case 8:
  ------------------
  |  Branch (142:13): [True: 116, False: 180]
  ------------------
  143|    116|                sp->decodepfunc = horAcc8;
  144|    116|                break;
  145|     73|            case 16:
  ------------------
  |  Branch (145:13): [True: 73, False: 223]
  ------------------
  146|     73|                sp->decodepfunc = horAcc16;
  147|     73|                break;
  148|     34|            case 32:
  ------------------
  |  Branch (148:13): [True: 34, False: 262]
  ------------------
  149|     34|                sp->decodepfunc = horAcc32;
  150|     34|                break;
  151|     73|            case 64:
  ------------------
  |  Branch (151:13): [True: 73, False: 223]
  ------------------
  152|     73|                sp->decodepfunc = horAcc64;
  153|     73|                break;
  154|      0|            default:
  ------------------
  |  Branch (154:13): [True: 0, False: 296]
  ------------------
  155|      0|                break;
  156|    296|        }
  157|       |        /*
  158|       |         * Override default decoding method with one that does the
  159|       |         * predictor stuff.
  160|       |         */
  161|    296|        if (tif->tif_decoderow != PredictorDecodeRow)
  ------------------
  |  Branch (161:13): [True: 296, False: 0]
  ------------------
  162|    296|        {
  163|    296|            sp->decoderow = tif->tif_decoderow;
  164|    296|            tif->tif_decoderow = PredictorDecodeRow;
  165|    296|            sp->decodestrip = tif->tif_decodestrip;
  166|    296|            tif->tif_decodestrip = PredictorDecodeTile;
  167|    296|            sp->decodetile = tif->tif_decodetile;
  168|    296|            tif->tif_decodetile = PredictorDecodeTile;
  169|    296|        }
  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|    296|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    296|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (178:13): [True: 95, False: 201]
  ------------------
  179|     95|        {
  180|     95|            if (sp->decodepfunc == horAcc16)
  ------------------
  |  Branch (180:17): [True: 16, False: 79]
  ------------------
  181|     16|            {
  182|     16|                sp->decodepfunc = swabHorAcc16;
  183|     16|                tif->tif_postdecode = _TIFFNoPostDecode;
  184|     16|            }
  185|     79|            else if (sp->decodepfunc == horAcc32)
  ------------------
  |  Branch (185:22): [True: 31, False: 48]
  ------------------
  186|     31|            {
  187|     31|                sp->decodepfunc = swabHorAcc32;
  188|     31|                tif->tif_postdecode = _TIFFNoPostDecode;
  189|     31|            }
  190|     48|            else if (sp->decodepfunc == horAcc64)
  ------------------
  |  Branch (190:22): [True: 45, False: 3]
  ------------------
  191|     45|            {
  192|     45|                sp->decodepfunc = swabHorAcc64;
  193|     45|                tif->tif_postdecode = _TIFFNoPostDecode;
  194|     45|            }
  195|     95|        }
  196|    296|    }
  197|       |
  198|    543|    else if (sp->predictor == 3)
  ------------------
  |  Branch (198:14): [True: 41, False: 502]
  ------------------
  199|     41|    {
  200|     41|        sp->decodepfunc = fpAcc;
  201|       |        /*
  202|       |         * Override default decoding method with one that does the
  203|       |         * predictor stuff.
  204|       |         */
  205|     41|        if (tif->tif_decoderow != PredictorDecodeRow)
  ------------------
  |  Branch (205:13): [True: 41, False: 0]
  ------------------
  206|     41|        {
  207|     41|            sp->decoderow = tif->tif_decoderow;
  208|     41|            tif->tif_decoderow = PredictorDecodeRow;
  209|     41|            sp->decodestrip = tif->tif_decodestrip;
  210|     41|            tif->tif_decodestrip = PredictorDecodeTile;
  211|     41|            sp->decodetile = tif->tif_decodetile;
  212|     41|            tif->tif_decodetile = PredictorDecodeTile;
  213|     41|        }
  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|     41|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     41|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (219:13): [True: 14, False: 27]
  ------------------
  220|     14|        {
  221|     14|            tif->tif_postdecode = _TIFFNoPostDecode;
  222|     14|        }
  223|     41|    }
  224|       |
  225|    839|    return 1;
  226|    839|}
tif_predict.c:PredictorSetup:
   64|    858|{
   65|    858|    static const char module[] = "PredictorSetup";
   66|       |
   67|    858|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    858|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
   68|    858|    TIFFDirectory *td = &tif->tif_dir;
   69|       |
   70|    858|    switch (sp->predictor) /* no differencing */
   71|    858|    {
   72|    502|        case PREDICTOR_NONE:
  ------------------
  |  |  304|    502|#define PREDICTOR_NONE 1                   /* no prediction scheme used */
  ------------------
  |  Branch (72:9): [True: 502, False: 356]
  ------------------
   73|    502|            return 1;
   74|    310|        case PREDICTOR_HORIZONTAL:
  ------------------
  |  |  305|    310|#define PREDICTOR_HORIZONTAL 2             /* horizontal differencing */
  ------------------
  |  Branch (74:9): [True: 310, False: 548]
  ------------------
   75|    310|            if (td->td_bitspersample != 8 && td->td_bitspersample != 16 &&
  ------------------
  |  Branch (75:17): [True: 194, False: 116]
  |  Branch (75:46): [True: 121, False: 73]
  ------------------
   76|    121|                td->td_bitspersample != 32 && td->td_bitspersample != 64)
  ------------------
  |  Branch (76:17): [True: 87, False: 34]
  |  Branch (76:47): [True: 14, False: 73]
  ------------------
   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|    296|            break;
   85|    296|        case PREDICTOR_FLOATINGPOINT:
  ------------------
  |  |  306|     42|#define PREDICTOR_FLOATINGPOINT 3          /* floating point predictor */
  ------------------
  |  Branch (85:9): [True: 42, False: 816]
  ------------------
   86|     42|            if (td->td_sampleformat != SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|     42|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (86:17): [True: 0, False: 42]
  ------------------
   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|     42|            if (td->td_bitspersample != 16 && td->td_bitspersample != 24 &&
  ------------------
  |  Branch (95:17): [True: 29, False: 13]
  |  Branch (95:47): [True: 13, False: 16]
  ------------------
   96|     13|                td->td_bitspersample != 32 && td->td_bitspersample != 64)
  ------------------
  |  Branch (96:17): [True: 4, False: 9]
  |  Branch (96:47): [True: 1, False: 3]
  ------------------
   97|      1|            { /* Should 64 be allowed? */
   98|      1|                TIFFErrorExtR(
   99|      1|                    tif, module,
  100|      1|                    "Floating point \"Predictor\" not supported with %" PRIu16
  101|      1|                    "-bit samples",
  102|      1|                    td->td_bitspersample);
  103|      1|                return 0;
  104|      1|            }
  105|     41|            break;
  106|     41|        default:
  ------------------
  |  Branch (106:9): [True: 4, False: 854]
  ------------------
  107|      4|            TIFFErrorExtR(tif, module, "\"Predictor\" value %d not supported",
  108|      4|                          sp->predictor);
  109|      4|            return 0;
  110|    858|    }
  111|    337|    sp->stride =
  112|    337|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    337|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (112:10): [True: 328, False: 9]
  ------------------
  113|    337|                                                    : 1);
  114|       |    /*
  115|       |     * Calculate the scanline/tile-width size in bytes.
  116|       |     */
  117|    337|    if (isTiled(tif))
  ------------------
  |  |  278|    337|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    337|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 101, False: 236]
  |  |  ------------------
  ------------------
  118|    101|        sp->rowsize = TIFFTileRowSize(tif);
  119|    236|    else
  120|    236|        sp->rowsize = TIFFScanlineSize(tif);
  121|    337|    if (sp->rowsize == 0)
  ------------------
  |  Branch (121:9): [True: 0, False: 337]
  ------------------
  122|      0|        return 0;
  123|       |
  124|    337|    return 1;
  125|    337|}
tif_predict.c:horAcc8:
  446|  3.18k|{
  447|  3.18k|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|  3.18k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  448|       |
  449|  3.18k|    uint8_t *cp = cp0;
  450|  3.18k|    if ((cc % stride) != 0)
  ------------------
  |  Branch (450:9): [True: 0, False: 3.18k]
  ------------------
  451|      0|    {
  452|      0|        TIFFErrorExtR(tif, "horAcc8", "%s", "(cc%stride)!=0");
  453|      0|        return 0;
  454|      0|    }
  455|       |
  456|  3.18k|    if (cc > stride)
  ------------------
  |  Branch (456:9): [True: 2.97k, False: 218]
  ------------------
  457|  2.97k|    {
  458|       |        /*
  459|       |         * Pipeline the most common cases.
  460|       |         */
  461|  2.97k|        if (stride == 1)
  ------------------
  |  Branch (461:13): [True: 1.14k, False: 1.82k]
  ------------------
  462|  1.14k|        {
  463|  1.14k|            uint32_t acc = cp[0];
  464|  1.14k|            tmsize_t i = stride;
  465|  7.27k|            for (; i < cc - 3; i += 4)
  ------------------
  |  Branch (465:20): [True: 6.13k, False: 1.14k]
  ------------------
  466|  6.13k|            {
  467|  6.13k|                cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
  468|  6.13k|                cp[i + 1] = (uint8_t)((acc += cp[i + 1]) & 0xff);
  469|  6.13k|                cp[i + 2] = (uint8_t)((acc += cp[i + 2]) & 0xff);
  470|  6.13k|                cp[i + 3] = (uint8_t)((acc += cp[i + 3]) & 0xff);
  471|  6.13k|            }
  472|  2.39k|            for (; i < cc; i++)
  ------------------
  |  Branch (472:20): [True: 1.25k, False: 1.14k]
  ------------------
  473|  1.25k|            {
  474|  1.25k|                cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
  475|  1.25k|            }
  476|  1.14k|        }
  477|  1.82k|        else if (stride == 3)
  ------------------
  |  Branch (477:18): [True: 558, False: 1.27k]
  ------------------
  478|    558|        {
  479|    558|            uint32_t cr = cp[0];
  480|    558|            uint32_t cg = cp[1];
  481|    558|            uint32_t cb = cp[2];
  482|    558|            tmsize_t i = stride;
  483|  3.59k|            for (; i < cc; i += stride)
  ------------------
  |  Branch (483:20): [True: 3.03k, False: 558]
  ------------------
  484|  3.03k|            {
  485|  3.03k|                cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
  486|  3.03k|                cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
  487|  3.03k|                cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
  488|  3.03k|            }
  489|    558|        }
  490|  1.27k|        else if (stride == 4)
  ------------------
  |  Branch (490:18): [True: 728, False: 543]
  ------------------
  491|    728|        {
  492|    728|            uint32_t cr = cp[0];
  493|    728|            uint32_t cg = cp[1];
  494|    728|            uint32_t cb = cp[2];
  495|    728|            uint32_t ca = cp[3];
  496|    728|            tmsize_t i = stride;
  497|  7.20k|            for (; i < cc; i += stride)
  ------------------
  |  Branch (497:20): [True: 6.47k, False: 728]
  ------------------
  498|  6.47k|            {
  499|  6.47k|                cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
  500|  6.47k|                cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
  501|  6.47k|                cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
  502|  6.47k|                cp[i + 3] = (uint8_t)((ca += cp[i + 3]) & 0xff);
  503|  6.47k|            }
  504|    728|        }
  505|    543|        else
  506|    543|        {
  507|    543|            cc -= stride;
  508|    543|            do
  509|  2.72k|            {
  510|  2.72k|                REPEAT4(stride,
  ------------------
  |  |  327|  2.72k|    switch (n)                                                                 \
  |  |  328|  2.72k|    {                                                                          \
  |  |  329|  1.24k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 1.24k, False: 1.47k]
  |  |  ------------------
  |  |  330|  1.24k|        {                                                                      \
  |  |  331|  1.24k|            tmsize_t i;                                                        \
  |  |  332|  4.88k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 3.64k, False: 1.24k]
  |  |  ------------------
  |  |  333|  3.64k|            {                                                                  \
  |  |  334|  3.64k|                op;                                                            \
  |  |  335|  3.64k|            }                                                                  \
  |  |  336|  1.24k|        } /*-fallthrough*/                                                     \
  |  |  337|  1.24k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 0, False: 2.72k]
  |  |  ------------------
  |  |  338|  1.24k|            op; /*-fallthrough*/                                               \
  |  |  339|  1.24k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 0, False: 2.72k]
  |  |  ------------------
  |  |  340|  1.24k|            op; /*-fallthrough*/                                               \
  |  |  341|  2.72k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 1.47k, False: 1.24k]
  |  |  ------------------
  |  |  342|  2.72k|            op; /*-fallthrough*/                                               \
  |  |  343|  2.72k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 0, False: 2.72k]
  |  |  ------------------
  |  |  344|  2.72k|            op; /*-fallthrough*/                                               \
  |  |  345|  2.72k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 2.72k]
  |  |  ------------------
  |  |  346|  2.72k|    }
  ------------------
  511|  2.72k|                        cp[stride] = (uint8_t)((cp[stride] + *cp) & 0xff);
  512|  2.72k|                        cp++)
  513|  2.72k|                cc -= stride;
  514|  2.72k|            } while (cc > 0);
  ------------------
  |  Branch (514:22): [True: 2.17k, False: 543]
  ------------------
  515|    543|        }
  516|  2.97k|    }
  517|  3.18k|    return 1;
  518|  3.18k|}
tif_predict.c:horAcc16:
  530|  1.57k|{
  531|  1.57k|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|  1.57k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  532|  1.57k|    uint8_t *cp = cp0;
  533|  1.57k|    tmsize_t wc = cc / 2;
  534|       |
  535|  1.57k|    if ((cc % (2 * stride)) != 0)
  ------------------
  |  Branch (535:9): [True: 0, False: 1.57k]
  ------------------
  536|      0|    {
  537|      0|        TIFFErrorExtR(tif, "horAcc16", "%s", "cc%(2*stride))!=0");
  538|      0|        return 0;
  539|      0|    }
  540|       |
  541|  1.57k|    if (wc > stride)
  ------------------
  |  Branch (541:9): [True: 926, False: 650]
  ------------------
  542|    926|    {
  543|    926|        wc -= stride;
  544|    926|        do
  545|  9.59k|        {
  546|  9.59k|            REPEAT4(stride,
  ------------------
  |  |  327|  9.59k|    switch (n)                                                                 \
  |  |  328|  9.59k|    {                                                                          \
  |  |  329|    323|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 323, False: 9.27k]
  |  |  ------------------
  |  |  330|    323|        {                                                                      \
  |  |  331|    323|            tmsize_t i;                                                        \
  |  |  332|  1.22k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 902, False: 323]
  |  |  ------------------
  |  |  333|    902|            {                                                                  \
  |  |  334|    902|                op;                                                            \
  |  |  335|    902|            }                                                                  \
  |  |  336|    323|        } /*-fallthrough*/                                                     \
  |  |  337|    623|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 300, False: 9.29k]
  |  |  ------------------
  |  |  338|    623|            op; /*-fallthrough*/                                               \
  |  |  339|  7.43k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 6.81k, False: 2.78k]
  |  |  ------------------
  |  |  340|  7.43k|            op; /*-fallthrough*/                                               \
  |  |  341|  8.24k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 809, False: 8.78k]
  |  |  ------------------
  |  |  342|  8.24k|            op; /*-fallthrough*/                                               \
  |  |  343|  9.59k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 1.35k, False: 8.24k]
  |  |  ------------------
  |  |  344|  9.59k|            op; /*-fallthrough*/                                               \
  |  |  345|  9.59k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 9.59k]
  |  |  ------------------
  |  |  346|  9.59k|    }
  ------------------
  547|  9.59k|                    PredictorAccumulate16NativeUnaligned(cp + 2 * stride, cp);
  548|  9.59k|                    cp += 2)
  549|  9.59k|            wc -= stride;
  550|  9.59k|        } while (wc > 0);
  ------------------
  |  Branch (550:18): [True: 8.67k, False: 926]
  ------------------
  551|    926|    }
  552|  1.57k|    return 1;
  553|  1.57k|}
tif_predict.c:PredictorAccumulate16NativeUnaligned:
  365|  26.7k|{
  366|  26.7k|    uint16_t thisval;
  367|  26.7k|    uint16_t prevval;
  368|  26.7k|    memcpy(&thisval, current, sizeof(thisval));
  369|  26.7k|    memcpy(&prevval, previous, sizeof(prevval));
  370|  26.7k|    thisval =
  371|  26.7k|        (uint16_t)(((unsigned int)thisval + (unsigned int)prevval) & 0xffff);
  372|  26.7k|    memcpy(current, &thisval, sizeof(thisval));
  373|  26.7k|}
tif_predict.c:horAcc32:
  565|    611|{
  566|    611|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    611|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  567|    611|    uint8_t *cp = cp0;
  568|    611|    tmsize_t wc = cc / 4;
  569|       |
  570|    611|    if ((cc % (4 * stride)) != 0)
  ------------------
  |  Branch (570:9): [True: 0, False: 611]
  ------------------
  571|      0|    {
  572|      0|        TIFFErrorExtR(tif, "horAcc32", "%s", "cc%(4*stride))!=0");
  573|      0|        return 0;
  574|      0|    }
  575|       |
  576|    611|    if (wc > stride)
  ------------------
  |  Branch (576:9): [True: 343, False: 268]
  ------------------
  577|    343|    {
  578|    343|        wc -= stride;
  579|    343|        do
  580|  3.88k|        {
  581|  3.88k|            REPEAT4(stride,
  ------------------
  |  |  327|  3.88k|    switch (n)                                                                 \
  |  |  328|  3.88k|    {                                                                          \
  |  |  329|  1.86k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 1.86k, False: 2.01k]
  |  |  ------------------
  |  |  330|  1.86k|        {                                                                      \
  |  |  331|  1.86k|            tmsize_t i;                                                        \
  |  |  332|  3.90k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 2.04k, False: 1.86k]
  |  |  ------------------
  |  |  333|  2.04k|            {                                                                  \
  |  |  334|  2.04k|                op;                                                            \
  |  |  335|  2.04k|            }                                                                  \
  |  |  336|  1.86k|        } /*-fallthrough*/                                                     \
  |  |  337|  2.12k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 253, False: 3.62k]
  |  |  ------------------
  |  |  338|  2.12k|            op; /*-fallthrough*/                                               \
  |  |  339|  3.39k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 1.27k, False: 2.60k]
  |  |  ------------------
  |  |  340|  3.39k|            op; /*-fallthrough*/                                               \
  |  |  341|  3.53k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 135, False: 3.74k]
  |  |  ------------------
  |  |  342|  3.53k|            op; /*-fallthrough*/                                               \
  |  |  343|  3.88k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 350, False: 3.53k]
  |  |  ------------------
  |  |  344|  3.88k|            op; /*-fallthrough*/                                               \
  |  |  345|  3.88k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 3.88k]
  |  |  ------------------
  |  |  346|  3.88k|    }
  ------------------
  582|  3.88k|                    PredictorAccumulate32NativeUnaligned(cp + 4 * stride, cp);
  583|  3.88k|                    cp += 4)
  584|  3.88k|            wc -= stride;
  585|  3.88k|        } while (wc > 0);
  ------------------
  |  Branch (585:18): [True: 3.53k, False: 343]
  ------------------
  586|    343|    }
  587|    611|    return 1;
  588|    611|}
tif_predict.c:PredictorAccumulate32NativeUnaligned:
  378|  14.9k|{
  379|  14.9k|    uint32_t thisval;
  380|  14.9k|    uint32_t prevval;
  381|  14.9k|    memcpy(&thisval, current, sizeof(thisval));
  382|  14.9k|    memcpy(&prevval, previous, sizeof(prevval));
  383|  14.9k|    thisval += prevval;
  384|  14.9k|    memcpy(current, &thisval, sizeof(thisval));
  385|  14.9k|}
tif_predict.c:horAcc64:
  600|    369|{
  601|    369|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    369|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  602|    369|    uint8_t *cp = cp0;
  603|    369|    tmsize_t wc = cc / 8;
  604|       |
  605|    369|    if ((cc % (8 * stride)) != 0)
  ------------------
  |  Branch (605:9): [True: 0, False: 369]
  ------------------
  606|      0|    {
  607|      0|        TIFFErrorExtR(tif, "horAcc64", "%s", "cc%(8*stride))!=0");
  608|      0|        return 0;
  609|      0|    }
  610|       |
  611|    369|    if (wc > stride)
  ------------------
  |  Branch (611:9): [True: 257, False: 112]
  ------------------
  612|    257|    {
  613|    257|        wc -= stride;
  614|    257|        do
  615|  2.39k|        {
  616|  2.39k|            REPEAT4(stride,
  ------------------
  |  |  327|  2.39k|    switch (n)                                                                 \
  |  |  328|  2.39k|    {                                                                          \
  |  |  329|  1.18k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 1.18k, False: 1.20k]
  |  |  ------------------
  |  |  330|  1.18k|        {                                                                      \
  |  |  331|  1.18k|            tmsize_t i;                                                        \
  |  |  332|  3.51k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 2.33k, False: 1.18k]
  |  |  ------------------
  |  |  333|  2.33k|            {                                                                  \
  |  |  334|  2.33k|                op;                                                            \
  |  |  335|  2.33k|            }                                                                  \
  |  |  336|  1.18k|        } /*-fallthrough*/                                                     \
  |  |  337|  1.52k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 345, False: 2.04k]
  |  |  ------------------
  |  |  338|  1.52k|            op; /*-fallthrough*/                                               \
  |  |  339|  1.76k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 237, False: 2.15k]
  |  |  ------------------
  |  |  340|  1.76k|            op; /*-fallthrough*/                                               \
  |  |  341|  2.07k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 310, False: 2.08k]
  |  |  ------------------
  |  |  342|  2.07k|            op; /*-fallthrough*/                                               \
  |  |  343|  2.39k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 316, False: 2.07k]
  |  |  ------------------
  |  |  344|  2.39k|            op; /*-fallthrough*/                                               \
  |  |  345|  2.39k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 2.39k]
  |  |  ------------------
  |  |  346|  2.39k|    }
  ------------------
  617|  2.39k|                    PredictorAccumulate64NativeUnaligned(cp + 8 * stride, cp);
  618|  2.39k|                    cp += 8)
  619|  2.39k|            wc -= stride;
  620|  2.39k|        } while (wc > 0);
  ------------------
  |  Branch (620:18): [True: 2.13k, False: 257]
  ------------------
  621|    257|    }
  622|    369|    return 1;
  623|    369|}
tif_predict.c:PredictorAccumulate64NativeUnaligned:
  390|  10.0k|{
  391|  10.0k|    uint64_t thisval;
  392|  10.0k|    uint64_t prevval;
  393|  10.0k|    memcpy(&thisval, current, sizeof(thisval));
  394|  10.0k|    memcpy(&prevval, previous, sizeof(prevval));
  395|  10.0k|    thisval += prevval;
  396|  10.0k|    memcpy(current, &thisval, sizeof(thisval));
  397|  10.0k|}
tif_predict.c:PredictorDecodeRow:
  746|  2.39k|{
  747|  2.39k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  2.39k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  748|       |
  749|  2.39k|    assert(sp != NULL);
  ------------------
  |  Branch (749:5): [True: 0, False: 2.39k]
  |  Branch (749:5): [True: 2.39k, False: 0]
  ------------------
  750|  2.39k|    assert(sp->decoderow != NULL);
  ------------------
  |  Branch (750:5): [True: 0, False: 2.39k]
  |  Branch (750:5): [True: 2.39k, False: 0]
  ------------------
  751|  2.39k|    assert(sp->decodepfunc != NULL);
  ------------------
  |  Branch (751:5): [True: 0, False: 2.39k]
  |  Branch (751:5): [True: 2.39k, False: 0]
  ------------------
  752|       |
  753|  2.39k|    if ((*sp->decoderow)(tif, op0, occ0, s))
  ------------------
  |  Branch (753:9): [True: 2.21k, False: 180]
  ------------------
  754|  2.21k|    {
  755|  2.21k|        return (*sp->decodepfunc)(tif, op0, occ0);
  756|  2.21k|    }
  757|    180|    else
  758|    180|        return 0;
  759|  2.39k|}
tif_predict.c:PredictorDecodeTile:
  770|  7.44k|{
  771|  7.44k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  7.44k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  772|       |
  773|  7.44k|    assert(sp != NULL);
  ------------------
  |  Branch (773:5): [True: 0, False: 7.44k]
  |  Branch (773:5): [True: 7.44k, False: 0]
  ------------------
  774|  7.44k|    assert(sp->decodetile != NULL);
  ------------------
  |  Branch (774:5): [True: 0, False: 7.44k]
  |  Branch (774:5): [True: 7.44k, False: 0]
  ------------------
  775|       |
  776|  7.44k|    if ((*sp->decodetile)(tif, op0, occ0, s))
  ------------------
  |  Branch (776:9): [True: 1.60k, False: 5.84k]
  ------------------
  777|  1.60k|    {
  778|  1.60k|        tmsize_t rowsize = sp->rowsize;
  779|  1.60k|        assert(rowsize > 0);
  ------------------
  |  Branch (779:9): [True: 0, False: 1.60k]
  |  Branch (779:9): [True: 1.60k, False: 0]
  ------------------
  780|  1.60k|        if ((occ0 % rowsize) != 0)
  ------------------
  |  Branch (780:13): [True: 260, False: 1.34k]
  ------------------
  781|    260|        {
  782|    260|            TIFFErrorExtR(tif, "PredictorDecodeTile", "%s",
  783|    260|                          "occ0%rowsize != 0");
  784|    260|            return 0;
  785|    260|        }
  786|  1.60k|        assert(sp->decodepfunc != NULL);
  ------------------
  |  Branch (786:9): [True: 0, False: 1.34k]
  |  Branch (786:9): [True: 1.34k, False: 0]
  ------------------
  787|  5.15k|        while (occ0 > 0)
  ------------------
  |  Branch (787:16): [True: 3.80k, False: 1.34k]
  ------------------
  788|  3.80k|        {
  789|  3.80k|            if (!(*sp->decodepfunc)(tif, op0, rowsize))
  ------------------
  |  Branch (789:17): [True: 0, False: 3.80k]
  ------------------
  790|      0|                return 0;
  791|  3.80k|            occ0 -= rowsize;
  792|  3.80k|            op0 += rowsize;
  793|  3.80k|        }
  794|  1.34k|        return 1;
  795|  1.34k|    }
  796|  5.84k|    else
  797|  5.84k|        return 0;
  798|  7.44k|}
tif_predict.c:swabHorAcc16:
  521|    489|{
  522|    489|    tmsize_t wc = cc / 2;
  523|       |
  524|    489|    PredictorSwabByteStream16(cp0, wc);
  525|    489|    return horAcc16(tif, cp0, cc);
  526|    489|}
tif_predict.c:PredictorSwabByteStream16:
  400|    489|{
  401|  20.5k|    while (n-- > 0)
  ------------------
  |  Branch (401:12): [True: 20.0k, False: 489]
  ------------------
  402|  20.0k|    {
  403|  20.0k|        uint8_t tmp = cp[0];
  404|  20.0k|        cp[0] = cp[1];
  405|  20.0k|        cp[1] = tmp;
  406|  20.0k|        cp += 2;
  407|  20.0k|    }
  408|    489|}
tif_predict.c:swabHorAcc32:
  556|    583|{
  557|    583|    tmsize_t wc = cc / 4;
  558|       |
  559|    583|    PredictorSwabByteStream32(cp0, wc);
  560|    583|    return horAcc32(tif, cp0, cc);
  561|    583|}
tif_predict.c:PredictorSwabByteStream32:
  411|    583|{
  412|  12.8k|    while (n-- > 0)
  ------------------
  |  Branch (412:12): [True: 12.3k, False: 583]
  ------------------
  413|  12.3k|    {
  414|  12.3k|        uint8_t tmp = cp[0];
  415|  12.3k|        cp[0] = cp[3];
  416|  12.3k|        cp[3] = tmp;
  417|  12.3k|        tmp = cp[1];
  418|  12.3k|        cp[1] = cp[2];
  419|  12.3k|        cp[2] = tmp;
  420|  12.3k|        cp += 4;
  421|  12.3k|    }
  422|    583|}
tif_predict.c:swabHorAcc64:
  591|    240|{
  592|    240|    tmsize_t wc = cc / 8;
  593|       |
  594|    240|    PredictorSwabByteStream64(cp0, wc);
  595|    240|    return horAcc64(tif, cp0, cc);
  596|    240|}
tif_predict.c:PredictorSwabByteStream64:
  425|    240|{
  426|  10.8k|    while (n-- > 0)
  ------------------
  |  Branch (426:12): [True: 10.5k, False: 240]
  ------------------
  427|  10.5k|    {
  428|  10.5k|        uint8_t tmp = cp[0];
  429|  10.5k|        cp[0] = cp[7];
  430|  10.5k|        cp[7] = tmp;
  431|  10.5k|        tmp = cp[1];
  432|  10.5k|        cp[1] = cp[6];
  433|  10.5k|        cp[6] = tmp;
  434|  10.5k|        tmp = cp[2];
  435|  10.5k|        cp[2] = cp[5];
  436|  10.5k|        cp[5] = tmp;
  437|  10.5k|        tmp = cp[3];
  438|  10.5k|        cp[3] = cp[4];
  439|  10.5k|        cp[4] = tmp;
  440|  10.5k|        cp += 8;
  441|  10.5k|    }
  442|    240|}
tif_predict.c:fpAcc:
  629|    279|{
  630|    279|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    279|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  631|    279|    uint32_t bps = tif->tif_dir.td_bitspersample / 8;
  632|    279|    tmsize_t wc = cc / bps;
  633|    279|    tmsize_t count = cc;
  634|    279|    uint8_t *cp = cp0;
  635|    279|    uint8_t *tmp;
  636|       |
  637|    279|    if (cc % (bps * stride) != 0)
  ------------------
  |  Branch (637:9): [True: 0, False: 279]
  ------------------
  638|      0|    {
  639|      0|        TIFFErrorExtR(tif, "fpAcc", "%s", "cc%(bps*stride))!=0");
  640|      0|        return 0;
  641|      0|    }
  642|       |
  643|    279|    tmp = (uint8_t *)_TIFFmallocExt(tif, cc);
  644|    279|    if (!tmp)
  ------------------
  |  Branch (644:9): [True: 0, False: 279]
  ------------------
  645|      0|        return 0;
  646|       |
  647|    279|    if (stride == 1)
  ------------------
  |  Branch (647:9): [True: 253, False: 26]
  ------------------
  648|    253|    {
  649|       |        /* Optimization of general case */
  650|    253|#define OP                                                                     \
  651|    253|    do                                                                         \
  652|    253|    {                                                                          \
  653|    253|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  654|    253|        ++cp;                                                                  \
  655|    253|    } while (0)
  656|    738|        for (; count > 8; count -= 8)
  ------------------
  |  Branch (656:16): [True: 485, False: 253]
  ------------------
  657|    485|        {
  658|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  659|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  660|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  661|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  662|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  663|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  664|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  665|    485|            OP;
  ------------------
  |  |  651|    485|    do                                                                         \
  |  |  652|    485|    {                                                                          \
  |  |  653|    485|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    485|        ++cp;                                                                  \
  |  |  655|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  666|    485|        }
  667|    510|        for (; count > 1; count -= 1)
  ------------------
  |  Branch (667:16): [True: 257, False: 253]
  ------------------
  668|    257|        {
  669|    257|            OP;
  ------------------
  |  |  651|    257|    do                                                                         \
  |  |  652|    257|    {                                                                          \
  |  |  653|    257|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    257|        ++cp;                                                                  \
  |  |  655|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 257]
  |  |  ------------------
  ------------------
  670|    257|        }
  671|    253|#undef OP
  672|    253|    }
  673|     26|    else
  674|     26|    {
  675|    766|        while (count > stride)
  ------------------
  |  Branch (675:16): [True: 740, False: 26]
  ------------------
  676|    740|        {
  677|    740|            REPEAT4(stride, cp[stride] = (uint8_t)((cp[stride] + cp[0]) & 0xff);
  ------------------
  |  |  327|    740|    switch (n)                                                                 \
  |  |  328|    740|    {                                                                          \
  |  |  329|      6|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 6, False: 734]
  |  |  ------------------
  |  |  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: 731]
  |  |  ------------------
  |  |  338|     15|            op; /*-fallthrough*/                                               \
  |  |  339|    198|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 183, False: 557]
  |  |  ------------------
  |  |  340|    198|            op; /*-fallthrough*/                                               \
  |  |  341|    740|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 542, False: 198]
  |  |  ------------------
  |  |  342|    740|            op; /*-fallthrough*/                                               \
  |  |  343|    740|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 0, False: 740]
  |  |  ------------------
  |  |  344|    740|            op; /*-fallthrough*/                                               \
  |  |  345|    740|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 740]
  |  |  ------------------
  |  |  346|    740|    }
  ------------------
  678|    740|                    cp++)
  679|    740|            count -= stride;
  680|    740|        }
  681|     26|    }
  682|       |
  683|    279|    _TIFFmemcpy(tmp, cp0, cc);
  684|    279|    cp = (uint8_t *)cp0;
  685|    279|    count = 0;
  686|       |
  687|    279|#if defined(__x86_64__) || (defined(_M_X64) && !defined(_M_ARM64EC))
  688|    279|    if (bps == 4)
  ------------------
  |  Branch (688:9): [True: 13, False: 266]
  ------------------
  689|     13|    {
  690|       |        /* Optimization of general case */
  691|     87|        for (; count + 15 < wc; count += 16)
  ------------------
  |  Branch (691:16): [True: 74, False: 13]
  ------------------
  692|     74|        {
  693|       |            /* Interlace 4*16 byte values */
  694|       |
  695|     74|            __m128i xmm0 =
  696|     74|                _mm_loadu_si128((const __m128i *)(tmp + count + 3 * wc));
  697|     74|            __m128i xmm1 =
  698|     74|                _mm_loadu_si128((const __m128i *)(tmp + count + 2 * wc));
  699|     74|            __m128i xmm2 =
  700|     74|                _mm_loadu_si128((const __m128i *)(tmp + count + 1 * wc));
  701|     74|            __m128i xmm3 =
  702|     74|                _mm_loadu_si128((const __m128i *)(tmp + count + 0 * wc));
  703|       |            /* (xmm0_0, xmm1_0, xmm0_1, xmm1_1, xmm0_2, xmm1_2, ...) */
  704|     74|            __m128i tmp0 = _mm_unpacklo_epi8(xmm0, xmm1);
  705|       |            /* (xmm0_8, xmm1_8, xmm0_9, xmm1_9, xmm0_10, xmm1_10, ...) */
  706|     74|            __m128i tmp1 = _mm_unpackhi_epi8(xmm0, xmm1);
  707|       |            /* (xmm2_0, xmm3_0, xmm2_1, xmm3_1, xmm2_2, xmm3_2, ...) */
  708|     74|            __m128i tmp2 = _mm_unpacklo_epi8(xmm2, xmm3);
  709|       |            /* (xmm2_8, xmm3_8, xmm2_9, xmm3_9, xmm2_10, xmm3_10, ...) */
  710|     74|            __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|     74|            __m128i tmp2_0 = _mm_unpacklo_epi16(tmp0, tmp2);
  714|     74|            __m128i tmp2_1 = _mm_unpackhi_epi16(tmp0, tmp2);
  715|     74|            __m128i tmp2_2 = _mm_unpacklo_epi16(tmp1, tmp3);
  716|     74|            __m128i tmp2_3 = _mm_unpackhi_epi16(tmp1, tmp3);
  717|     74|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 0 * 16), tmp2_0);
  718|     74|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 1 * 16), tmp2_1);
  719|     74|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 2 * 16), tmp2_2);
  720|     74|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 3 * 16), tmp2_3);
  721|     74|        }
  722|     13|    }
  723|    279|#endif
  724|       |
  725|    821|    for (; count < wc; count++)
  ------------------
  |  Branch (725:12): [True: 542, False: 279]
  ------------------
  726|    542|    {
  727|    542|        uint32_t byte;
  728|  1.99k|        for (byte = 0; byte < bps; byte++)
  ------------------
  |  Branch (728:24): [True: 1.45k, False: 542]
  ------------------
  729|  1.45k|        {
  730|       |#if WORDS_BIGENDIAN
  731|       |            cp[bps * count + byte] = tmp[byte * wc + count];
  732|       |#else
  733|  1.45k|            cp[bps * count + byte] = tmp[(bps - byte - 1) * wc + count];
  734|  1.45k|#endif
  735|  1.45k|        }
  736|    542|    }
  737|    279|    _TIFFfreeExt(tif, tmp);
  738|    279|    return 1;
  739|    279|}

TIFFReadScanline:
  490|  2.05M|{
  491|  2.05M|    int e;
  492|       |
  493|  2.05M|    if (!TIFFCheckRead(tif, 0))
  ------------------
  |  Branch (493:9): [True: 0, False: 2.05M]
  ------------------
  494|      0|        return (-1);
  495|  2.05M|    if ((e = TIFFSeek(tif, row, sample)) != 0)
  ------------------
  |  Branch (495:9): [True: 2.05M, False: 380]
  ------------------
  496|  2.05M|    {
  497|       |        /*
  498|       |         * Decompress desired row into user buffer.
  499|       |         */
  500|  2.05M|        e = (*tif->tif_decoderow)(tif, (uint8_t *)buf,
  501|  2.05M|                                  tif->tif_dir.td_scanlinesize, sample);
  502|       |
  503|       |        /* we are now poised at the beginning of the next row */
  504|  2.05M|        tif->tif_dir.td_row = row + 1;
  505|       |
  506|  2.05M|        if (e)
  ------------------
  |  Branch (506:13): [True: 2.05M, False: 856]
  ------------------
  507|  2.05M|            (*tif->tif_postdecode)(tif, (uint8_t *)buf,
  508|  2.05M|                                   tif->tif_dir.td_scanlinesize);
  509|  2.05M|    }
  510|    380|    else
  511|    380|    {
  512|       |        /* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
  513|    380|        if (buf)
  ------------------
  |  Branch (513:13): [True: 380, False: 0]
  ------------------
  514|    380|            memset(buf, 0, (size_t)tif->tif_dir.td_scanlinesize);
  515|    380|    }
  516|  2.05M|    return (e > 0 ? 1 : -1);
  ------------------
  |  Branch (516:13): [True: 2.05M, False: 1.28k]
  ------------------
  517|  2.05M|}
TIFFReadEncodedStrip:
  572|   310k|{
  573|   310k|    static const char module[] = "TIFFReadEncodedStrip";
  574|   310k|    TIFFDirectory *td = &tif->tif_dir;
  575|   310k|    tmsize_t stripsize;
  576|   310k|    uint16_t plane;
  577|       |
  578|   310k|    stripsize = TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
  579|   310k|    if (stripsize == ((tmsize_t)(-1)))
  ------------------
  |  Branch (579:9): [True: 0, False: 310k]
  ------------------
  580|      0|        return ((tmsize_t)(-1));
  581|       |
  582|       |    /* shortcut to avoid an extra memcpy() */
  583|   310k|    if (td->td_compression == COMPRESSION_NONE && size != (tmsize_t)(-1) &&
  ------------------
  |  |  182|   621k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (583:9): [True: 265k, False: 45.5k]
  |  Branch (583:51): [True: 265k, False: 0]
  ------------------
  584|   265k|        size >= stripsize && !isMapped(tif) &&
  ------------------
  |  |  279|   572k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   261k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (584:9): [True: 261k, False: 3.74k]
  |  Branch (584:30): [True: 261k, False: 0]
  ------------------
  585|   261k|        ((tif->tif_flags & TIFF_NOREADRAW) == 0))
  ------------------
  |  |  138|   261k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (585:9): [True: 261k, False: 0]
  ------------------
  586|   261k|    {
  587|   261k|        if (TIFFReadRawStrip1(tif, strip, buf, stripsize, module) != stripsize)
  ------------------
  |  Branch (587:13): [True: 153k, False: 107k]
  ------------------
  588|   153k|            return ((tmsize_t)(-1));
  589|       |
  590|   107k|        if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  280|   215k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (590:13): [True: 700, False: 107k]
  ------------------
  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|   107k|        (*tif->tif_postdecode)(tif, (uint8_t *)buf, stripsize);
  595|   107k|        return (stripsize);
  596|   261k|    }
  597|       |
  598|  49.3k|    if ((size != (tmsize_t)(-1)) && (size < stripsize))
  ------------------
  |  Branch (598:9): [True: 49.3k, False: 0]
  |  Branch (598:37): [True: 3.79k, False: 45.5k]
  ------------------
  599|  3.79k|        stripsize = size;
  600|  49.3k|    if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (600:9): [True: 29.3k, False: 19.9k]
  ------------------
  601|  29.3k|    {
  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|  29.3k|        if (buf)
  ------------------
  |  Branch (604:13): [True: 29.3k, False: 0]
  ------------------
  605|  29.3k|            memset(buf, 0, (size_t)stripsize);
  606|  29.3k|        return ((tmsize_t)(-1));
  607|  29.3k|    }
  608|  19.9k|    if ((*tif->tif_decodestrip)(tif, (uint8_t *)buf, stripsize, plane) <= 0)
  ------------------
  |  Branch (608:9): [True: 15.1k, False: 4.76k]
  ------------------
  609|  15.1k|        return ((tmsize_t)(-1));
  610|  4.76k|    (*tif->tif_postdecode)(tif, (uint8_t *)buf, stripsize);
  611|  4.76k|    return (stripsize);
  612|  19.9k|}
_TIFFReadEncodedStripAndAllocBuffer:
  624|  98.9k|{
  625|  98.9k|    tmsize_t this_stripsize;
  626|  98.9k|    uint16_t plane;
  627|       |
  628|  98.9k|    if (*buf != NULL)
  ------------------
  |  Branch (628:9): [True: 98.1k, False: 762]
  ------------------
  629|  98.1k|    {
  630|  98.1k|        return TIFFReadEncodedStrip(tif, strip, *buf, size_to_read);
  631|  98.1k|    }
  632|       |
  633|    762|    this_stripsize = TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
  634|    762|    if (this_stripsize == ((tmsize_t)(-1)))
  ------------------
  |  Branch (634:9): [True: 0, False: 762]
  ------------------
  635|      0|        return ((tmsize_t)(-1));
  636|       |
  637|    762|    if ((size_to_read != (tmsize_t)(-1)) && (size_to_read < this_stripsize))
  ------------------
  |  Branch (637:9): [True: 762, False: 0]
  |  Branch (637:45): [True: 34, False: 728]
  ------------------
  638|     34|        this_stripsize = size_to_read;
  639|    762|    if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (639:9): [True: 119, False: 643]
  ------------------
  640|    119|        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|    643|    if (bufsizetoalloc > 100 * 1024 * 1024)
  ------------------
  |  Branch (647:9): [True: 6, False: 637]
  ------------------
  648|      6|    {
  649|      6|        const uint64_t maxCompressionRatio = TIFFGetMaxCompressionRatio(tif);
  650|      6|        if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (650:13): [True: 0, False: 6]
  ------------------
  651|      0|            (uint64_t)tif->tif_rawdatasize <
  ------------------
  |  Branch (651:13): [True: 0, False: 0]
  ------------------
  652|      0|                (uint64_t)this_stripsize / maxCompressionRatio)
  653|      0|        {
  654|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
  655|      0|                          "Likely invalid strip byte count for strip %u. "
  656|      0|                          "Uncompressed strip size is %" PRIu64 ", "
  657|      0|                          "compressed one is %" PRIu64,
  658|      0|                          strip, (uint64_t)this_stripsize,
  659|      0|                          (uint64_t)tif->tif_rawdatasize);
  660|      0|            return ((tmsize_t)(-1));
  661|      0|        }
  662|      6|    }
  663|       |
  664|    643|    *buf = _TIFFcallocExt(tif, 1, bufsizetoalloc);
  665|    643|    if (*buf == NULL)
  ------------------
  |  Branch (665:9): [True: 0, False: 643]
  ------------------
  666|      0|    {
  667|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "No space for strip buffer");
  668|      0|        return ((tmsize_t)(-1));
  669|      0|    }
  670|       |
  671|    643|    if ((*tif->tif_decodestrip)(tif, (uint8_t *)*buf, this_stripsize, plane) <=
  ------------------
  |  Branch (671:9): [True: 385, False: 258]
  ------------------
  672|    643|        0)
  673|    385|        return ((tmsize_t)(-1));
  674|    258|    (*tif->tif_postdecode)(tif, (uint8_t *)*buf, this_stripsize);
  675|    258|    return (this_stripsize);
  676|    643|}
TIFFFillStrip:
  818|  54.1k|{
  819|  54.1k|    static const char module[] = "TIFFFillStrip";
  820|  54.1k|    TIFFDirectory *td = &tif->tif_dir;
  821|       |
  822|  54.1k|    if ((tif->tif_flags & TIFF_NOREADRAW) == 0)
  ------------------
  |  |  138|  54.1k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (822:9): [True: 50.2k, False: 3.91k]
  ------------------
  823|  50.2k|    {
  824|  50.2k|        uint64_t bytecount = TIFFGetStrileByteCount(tif, strip);
  825|  50.2k|        if (bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX)
  ------------------
  |  |   49|  28.2k|#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
  ------------------
  |  Branch (825:13): [True: 21.9k, False: 28.2k]
  |  Branch (825:31): [True: 2, False: 28.2k]
  ------------------
  826|  21.9k|        {
  827|  21.9k|            TIFFErrorExtR(tif, module,
  828|  21.9k|                          "Invalid strip byte count %" PRIu64
  829|  21.9k|                          ", strip %" PRIu32,
  830|  21.9k|                          bytecount, strip);
  831|  21.9k|            return (0);
  832|  21.9k|        }
  833|       |
  834|       |        /* To avoid excessive memory allocations: */
  835|  28.2k|        const tmsize_t stripsize = TIFFStripSize(tif);
  836|  28.2k|        if (stripsize > 0)
  ------------------
  |  Branch (836:13): [True: 28.2k, False: 0]
  ------------------
  837|  28.2k|        {
  838|  28.2k|            if (bytecount > 1024 * 1024 &&
  ------------------
  |  Branch (838:17): [True: 712, False: 27.5k]
  ------------------
  839|    712|                (bytecount - 4096) / 10 > (uint64_t)stripsize)
  ------------------
  |  Branch (839:17): [True: 441, False: 271]
  ------------------
  840|    441|            {
  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|    441|                uint64_t newbytecount = (uint64_t)stripsize * 10 + 4096;
  852|    441|                TIFFWarningExtR(tif, module,
  853|    441|                                "Too large strip byte count %" PRIu64
  854|    441|                                ", strip %" PRIu32 ". Limiting to %" PRIu64,
  855|    441|                                bytecount, strip, newbytecount);
  856|    441|                bytecount = newbytecount;
  857|    441|            }
  858|  27.8k|            else if (stripsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (858:22): [True: 55, False: 27.7k]
  ------------------
  859|     55|            {
  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|     55|                const uint64_t maxCompressionRatio =
  866|     55|                    TIFFGetMaxCompressionRatio(tif);
  867|     55|                if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (867:21): [True: 17, False: 38]
  ------------------
  868|     17|                    bytecount < (uint64_t)stripsize / maxCompressionRatio)
  ------------------
  |  Branch (868:21): [True: 9, False: 8]
  ------------------
  869|      9|                {
  870|      9|                    TIFFErrorExtR(
  871|      9|                        tif, module,
  872|      9|                        "Likely invalid strip byte count for strip %u. "
  873|      9|                        "Uncompressed strip size is %" PRIu64 ", "
  874|      9|                        "compressed one is %" PRIu64,
  875|      9|                        strip, (uint64_t)stripsize, bytecount);
  876|      9|                    return 0;
  877|      9|                }
  878|     55|            }
  879|  28.2k|        }
  880|       |
  881|  28.2k|        if (isMapped(tif))
  ------------------
  |  |  279|  28.2k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  28.2k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 28.2k]
  |  |  ------------------
  ------------------
  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|  28.2k|        if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  279|  56.5k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  28.2k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 28.2k]
  |  |  ------------------
  ------------------
                      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|  28.2k|        else
  952|  28.2k|        {
  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|  28.2k|            tmsize_t bytecountm;
  959|  28.2k|            bytecountm = (tmsize_t)bytecount;
  960|  28.2k|            if ((uint64_t)bytecountm != bytecount)
  ------------------
  |  Branch (960:17): [True: 0, False: 28.2k]
  ------------------
  961|      0|            {
  962|      0|                TIFFErrorExtR(tif, module, "Integer overflow");
  963|      0|                return (0);
  964|      0|            }
  965|  28.2k|            if (bytecountm > tif->tif_rawdatasize)
  ------------------
  |  Branch (965:17): [True: 2.59k, False: 25.6k]
  ------------------
  966|  2.59k|            {
  967|  2.59k|                tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  111|  2.59k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
  968|  2.59k|                if ((tif->tif_flags & TIFF_MYBUFFER) == 0)
  ------------------
  |  |  128|  2.59k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (968:21): [True: 0, False: 2.59k]
  ------------------
  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.59k|            }
  976|  28.2k|            if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  145|  28.2k|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (976:17): [True: 0, False: 28.2k]
  ------------------
  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|  28.2k|            if (isMapped(tif))
  ------------------
  |  |  279|  28.2k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  28.2k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 28.2k]
  |  |  ------------------
  ------------------
  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|  28.2k|            else
  998|  28.2k|            {
  999|  28.2k|                if (TIFFReadRawStripOrTile2(tif, strip, 1, bytecountm,
  ------------------
  |  Branch (999:21): [True: 6.64k, False: 21.6k]
  ------------------
 1000|  28.2k|                                            module) != bytecountm)
 1001|  6.64k|                {
 1002|  6.64k|                    return (0);
 1003|  6.64k|                }
 1004|  28.2k|            }
 1005|       |
 1006|  21.6k|            tif->tif_rawdataoff = 0;
 1007|  21.6k|            tif->tif_rawdataloaded = bytecountm;
 1008|       |
 1009|  21.6k|            if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  280|  43.2k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1009:17): [True: 74, False: 21.5k]
  ------------------
 1010|     74|                (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  127|     74|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1010:17): [True: 4, False: 70]
  ------------------
 1011|      4|                TIFFReverseBits(tif->tif_rawdata, bytecountm);
 1012|  21.6k|        }
 1013|  28.2k|    }
 1014|  25.5k|    return (TIFFStartStrip(tif, strip));
 1015|  54.1k|}
TIFFReadTile:
 1028|  1.37M|{
 1029|  1.37M|    if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (1029:9): [True: 0, False: 1.37M]
  |  Branch (1029:35): [True: 607, False: 1.37M]
  ------------------
 1030|    607|        return ((tmsize_t)(-1));
 1031|  1.37M|    return (TIFFReadEncodedTile(tif, TIFFComputeTile(tif, x, y, z, s), buf,
 1032|  1.37M|                                (tmsize_t)(-1)));
 1033|  1.37M|}
TIFFReadEncodedTile:
 1040|  1.74M|{
 1041|  1.74M|    static const char module[] = "TIFFReadEncodedTile";
 1042|  1.74M|    TIFFDirectory *td = &tif->tif_dir;
 1043|  1.74M|    tmsize_t tilesize = tif->tif_dir.td_tilesize;
 1044|       |
 1045|  1.74M|    if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (1045:9): [True: 0, False: 1.74M]
  ------------------
 1046|      0|        return ((tmsize_t)(-1));
 1047|  1.74M|    if (tile >= td->td_nstrips)
  ------------------
  |  Branch (1047:9): [True: 0, False: 1.74M]
  ------------------
 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.74M|    if (td->td_compression == COMPRESSION_NONE && size != (tmsize_t)(-1) &&
  ------------------
  |  |  182|  3.48M|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (1056:9): [True: 581k, False: 1.16M]
  |  Branch (1056:51): [True: 0, False: 581k]
  ------------------
 1057|      0|        size >= tilesize && !isMapped(tif) &&
  ------------------
  |  |  279|  1.74M|#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.74M|    if (size == (tmsize_t)(-1))
  ------------------
  |  Branch (1071:9): [True: 1.74M, False: 0]
  ------------------
 1072|  1.74M|        size = tilesize;
 1073|      0|    else if (size > tilesize)
  ------------------
  |  Branch (1073:14): [True: 0, False: 0]
  ------------------
 1074|      0|        size = tilesize;
 1075|  1.74M|    if (!TIFFFillTile(tif, tile))
  ------------------
  |  Branch (1075:9): [True: 1.43M, False: 309k]
  ------------------
 1076|  1.43M|    {
 1077|       |        /* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
 1078|  1.43M|        if (buf)
  ------------------
  |  Branch (1078:13): [True: 1.43M, False: 0]
  ------------------
 1079|  1.43M|            memset(buf, 0, (size_t)size);
 1080|  1.43M|        return ((tmsize_t)(-1));
 1081|  1.43M|    }
 1082|   309k|    else if ((*tif->tif_decodetile)(tif, (uint8_t *)buf, size,
  ------------------
  |  Branch (1082:14): [True: 271k, False: 37.9k]
  ------------------
 1083|   309k|                                    (uint16_t)(tile / td->td_stripsperimage)))
 1084|   271k|    {
 1085|   271k|        (*tif->tif_postdecode)(tif, (uint8_t *)buf, size);
 1086|   271k|        return (size);
 1087|   271k|    }
 1088|  37.9k|    else
 1089|  37.9k|        return ((tmsize_t)(-1));
 1090|  1.74M|}
_TIFFReadTileAndAllocBuffer:
 1101|   367k|{
 1102|   367k|    if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (1102:9): [True: 0, False: 367k]
  |  Branch (1102:35): [True: 0, False: 367k]
  ------------------
 1103|      0|        return ((tmsize_t)(-1));
 1104|   367k|    return (_TIFFReadEncodedTileAndAllocBuffer(
 1105|   367k|        tif, TIFFComputeTile(tif, x, y, z, s), buf, bufsizetoalloc,
 1106|   367k|        (tmsize_t)(-1)));
 1107|   367k|}
_TIFFReadEncodedTileAndAllocBuffer:
 1118|   367k|{
 1119|   367k|    static const char module[] = "_TIFFReadEncodedTileAndAllocBuffer";
 1120|   367k|    TIFFDirectory *td = &tif->tif_dir;
 1121|   367k|    tmsize_t tilesize = tif->tif_dir.td_tilesize;
 1122|       |
 1123|   367k|    if (*buf != NULL)
  ------------------
  |  Branch (1123:9): [True: 365k, False: 2.58k]
  ------------------
 1124|   365k|    {
 1125|   365k|        return TIFFReadEncodedTile(tif, tile, *buf, size_to_read);
 1126|   365k|    }
 1127|       |
 1128|  2.58k|    if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (1128:9): [True: 0, False: 2.58k]
  ------------------
 1129|      0|        return ((tmsize_t)(-1));
 1130|  2.58k|    if (tile >= td->td_nstrips)
  ------------------
  |  Branch (1130:9): [True: 0, False: 2.58k]
  ------------------
 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.58k|    if (!TIFFFillTile(tif, tile))
  ------------------
  |  Branch (1138:9): [True: 322, False: 2.25k]
  ------------------
 1139|    322|        return ((tmsize_t)(-1));
 1140|       |
 1141|       |    /* Sanity checks to avoid excessive memory allocation */
 1142|       |    /* Cf https://gitlab.com/libtiff/libtiff/-/issues/479 */
 1143|  2.25k|    if (td->td_compression == COMPRESSION_NONE)
  ------------------
  |  |  182|  2.25k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (1143:9): [True: 32, False: 2.22k]
  ------------------
 1144|     32|    {
 1145|     32|        if (tif->tif_rawdatasize != tilesize)
  ------------------
  |  Branch (1145:13): [True: 12, False: 20]
  ------------------
 1146|     12|        {
 1147|     12|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1148|     12|                          "Invalid tile byte count for tile %u. "
 1149|     12|                          "Expected %" PRIu64 ", got %" PRIu64,
 1150|     12|                          tile, (uint64_t)tilesize,
 1151|     12|                          (uint64_t)tif->tif_rawdatasize);
 1152|     12|            return ((tmsize_t)(-1));
 1153|     12|        }
 1154|     32|    }
 1155|  2.22k|    else
 1156|  2.22k|    {
 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.22k|        if (bufsizetoalloc > 100 * 1024 * 1024)
  ------------------
  |  Branch (1161:13): [True: 29, False: 2.19k]
  ------------------
 1162|     29|        {
 1163|     29|            const uint64_t maxCompressionRatio =
 1164|     29|                TIFFGetMaxCompressionRatio(tif);
 1165|     29|            if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (1165:17): [True: 12, False: 17]
  ------------------
 1166|     12|                (uint64_t)tif->tif_rawdatasize <
  ------------------
  |  Branch (1166:17): [True: 0, False: 12]
  ------------------
 1167|     12|                    (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.22k|    }
 1179|       |
 1180|  2.24k|    *buf = _TIFFmallocExt(tif, bufsizetoalloc);
 1181|  2.24k|    if (*buf == NULL)
  ------------------
  |  Branch (1181:9): [True: 0, False: 2.24k]
  ------------------
 1182|      0|    {
 1183|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "No space for tile buffer");
 1184|      0|        return ((tmsize_t)(-1));
 1185|      0|    }
 1186|  2.24k|    _TIFFmemset(*buf, 0, bufsizetoalloc);
 1187|       |
 1188|  2.24k|    if (size_to_read == (tmsize_t)(-1))
  ------------------
  |  Branch (1188:9): [True: 2.24k, False: 0]
  ------------------
 1189|  2.24k|        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.24k|    if ((*tif->tif_decodetile)(tif, (uint8_t *)*buf, size_to_read,
  ------------------
  |  Branch (1192:9): [True: 1.76k, False: 483]
  ------------------
 1193|  2.24k|                               (uint16_t)(tile / td->td_stripsperimage)))
 1194|  1.76k|    {
 1195|  1.76k|        (*tif->tif_postdecode)(tif, (uint8_t *)*buf, size_to_read);
 1196|  1.76k|        return (size_to_read);
 1197|  1.76k|    }
 1198|    483|    else
 1199|    483|        return ((tmsize_t)(-1));
 1200|  2.24k|}
TIFFFillTile:
 1300|  1.74M|{
 1301|  1.74M|    static const char module[] = "TIFFFillTile";
 1302|  1.74M|    TIFFDirectory *td = &tif->tif_dir;
 1303|       |
 1304|  1.74M|    if ((tif->tif_flags & TIFF_NOREADRAW) == 0)
  ------------------
  |  |  138|  1.74M|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1304:9): [True: 1.12M, False: 618k]
  ------------------
 1305|  1.12M|    {
 1306|  1.12M|        uint64_t bytecount = TIFFGetStrileByteCount(tif, tile);
 1307|  1.12M|        if (bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX)
  ------------------
  |  |   49|   213k|#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
  ------------------
  |  Branch (1307:13): [True: 914k, False: 213k]
  |  Branch (1307:31): [True: 626, False: 213k]
  ------------------
 1308|   915k|        {
 1309|   915k|            TIFFErrorExtR(tif, module,
 1310|   915k|                          "%" PRIu64 ": Invalid tile byte count, tile %" PRIu32,
 1311|   915k|                          bytecount, tile);
 1312|   915k|            return (0);
 1313|   915k|        }
 1314|       |
 1315|       |        /* To avoid excessive memory allocations: */
 1316|   213k|        const tmsize_t tilesize = TIFFTileSize(tif);
 1317|   213k|        if (tilesize > 0)
  ------------------
  |  Branch (1317:13): [True: 213k, False: 0]
  ------------------
 1318|   213k|        {
 1319|   213k|            if (bytecount > 1024 * 1024 &&
  ------------------
  |  Branch (1319:17): [True: 1.23k, False: 211k]
  ------------------
 1320|  1.23k|                (bytecount - 4096) / 10 > (uint64_t)tilesize)
  ------------------
  |  Branch (1320:17): [True: 1.05k, False: 187]
  ------------------
 1321|  1.05k|            {
 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|  1.05k|                uint64_t newbytecount = (uint64_t)tilesize * 10 + 4096;
 1333|  1.05k|                TIFFWarningExtR(tif, module,
 1334|  1.05k|                                "Too large tile byte count %" PRIu64
 1335|  1.05k|                                ", tile %" PRIu32 ". Limiting to %" PRIu64,
 1336|  1.05k|                                bytecount, tile, newbytecount);
 1337|  1.05k|                bytecount = newbytecount;
 1338|  1.05k|            }
 1339|   212k|            else if (tilesize > 100 * 1024 * 1024)
  ------------------
  |  Branch (1339:22): [True: 675, False: 211k]
  ------------------
 1340|    675|            {
 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|    675|                const uint64_t maxCompressionRatio =
 1347|    675|                    TIFFGetMaxCompressionRatio(tif);
 1348|    675|                if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (1348:21): [True: 231, False: 444]
  ------------------
 1349|    231|                    bytecount < (uint64_t)tilesize / maxCompressionRatio)
  ------------------
  |  Branch (1349:21): [True: 45, False: 186]
  ------------------
 1350|     45|                {
 1351|     45|                    TIFFErrorExtR(tif, module,
 1352|     45|                                  "Likely invalid tile byte count for tile %u. "
 1353|     45|                                  "Uncompressed tile size is %" PRIu64 ", "
 1354|     45|                                  "compressed one is %" PRIu64,
 1355|     45|                                  tile, (uint64_t)tilesize, bytecount);
 1356|     45|                    return 0;
 1357|     45|                }
 1358|    675|            }
 1359|   213k|        }
 1360|       |
 1361|   213k|        if (isMapped(tif))
  ------------------
  |  |  279|   213k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   213k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 213k]
  |  |  ------------------
  ------------------
 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|   213k|        if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  279|   426k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   213k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 213k]
  |  |  ------------------
  ------------------
                      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|   213k|        else
 1411|   213k|        {
 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|   213k|            tmsize_t bytecountm;
 1418|   213k|            bytecountm = (tmsize_t)bytecount;
 1419|   213k|            if ((uint64_t)bytecountm != bytecount)
  ------------------
  |  Branch (1419:17): [True: 0, False: 213k]
  ------------------
 1420|      0|            {
 1421|      0|                TIFFErrorExtR(tif, module, "Integer overflow");
 1422|      0|                return (0);
 1423|      0|            }
 1424|   213k|            if (bytecountm > tif->tif_rawdatasize)
  ------------------
  |  Branch (1424:17): [True: 2.53k, False: 210k]
  ------------------
 1425|  2.53k|            {
 1426|  2.53k|                tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  116|  2.53k|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1427|  2.53k|                if ((tif->tif_flags & TIFF_MYBUFFER) == 0)
  ------------------
  |  |  128|  2.53k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (1427:21): [True: 0, False: 2.53k]
  ------------------
 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.53k|            }
 1435|   213k|            if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  145|   213k|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (1435:17): [True: 0, False: 213k]
  ------------------
 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|   213k|            if (isMapped(tif))
  ------------------
  |  |  279|   213k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   213k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 213k]
  |  |  ------------------
  ------------------
 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|   213k|            else
 1457|   213k|            {
 1458|   213k|                if (TIFFReadRawStripOrTile2(tif, tile, 0, bytecountm, module) !=
  ------------------
  |  Branch (1458:21): [True: 21.7k, False: 191k]
  ------------------
 1459|   213k|                    bytecountm)
 1460|  21.7k|                {
 1461|  21.7k|                    return (0);
 1462|  21.7k|                }
 1463|   213k|            }
 1464|       |
 1465|   191k|            tif->tif_rawdataoff = 0;
 1466|   191k|            tif->tif_rawdataloaded = bytecountm;
 1467|       |
 1468|   191k|            if (tif->tif_rawdata != NULL &&
  ------------------
  |  Branch (1468:17): [True: 191k, False: 0]
  ------------------
 1469|   191k|                !isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  280|   382k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1469:17): [True: 0, False: 191k]
  ------------------
 1470|      0|                (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  127|      0|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1470:17): [True: 0, False: 0]
  ------------------
 1471|      0|                TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdataloaded);
 1472|   191k|        }
 1473|   213k|    }
 1474|   809k|    return (TIFFStartTile(tif, tile));
 1475|  1.74M|}
_TIFFNoPostDecode:
 1799|  2.16M|{
 1800|  2.16M|    (void)tif;
 1801|  2.16M|    (void)buf;
 1802|  2.16M|    (void)cc;
 1803|  2.16M|}
_TIFFSwab16BitData:
 1806|  2.89k|{
 1807|  2.89k|    (void)tif;
 1808|  2.89k|    assert((cc & 1) == 0);
  ------------------
  |  Branch (1808:5): [True: 0, False: 2.89k]
  |  Branch (1808:5): [True: 2.89k, False: 0]
  ------------------
 1809|  2.89k|    TIFFSwabArrayOfShort((uint16_t *)buf, cc / 2);
 1810|  2.89k|}
_TIFFSwab24BitData:
 1813|    364|{
 1814|    364|    (void)tif;
 1815|    364|    assert((cc % 3) == 0);
  ------------------
  |  Branch (1815:5): [True: 0, False: 364]
  |  Branch (1815:5): [True: 364, False: 0]
  ------------------
 1816|    364|    TIFFSwabArrayOfTriples((uint8_t *)buf, cc / 3);
 1817|    364|}
_TIFFSwab32BitData:
 1820|    343|{
 1821|    343|    (void)tif;
 1822|    343|    assert((cc & 3) == 0);
  ------------------
  |  Branch (1822:5): [True: 0, False: 343]
  |  Branch (1822:5): [True: 343, False: 0]
  ------------------
 1823|    343|    TIFFSwabArrayOfLong((uint32_t *)buf, cc / 4);
 1824|    343|}
_TIFFSwab64BitData:
 1827|    256|{
 1828|    256|    (void)tif;
 1829|    256|    assert((cc & 7) == 0);
  ------------------
  |  Branch (1829:5): [True: 0, False: 256]
  |  Branch (1829:5): [True: 256, False: 0]
  ------------------
 1830|    256|    TIFFSwabArrayOfDouble((double *)buf, cc / 8);
 1831|    256|}
tif_read.c:TIFFSeek:
  327|  2.05M|{
  328|  2.05M|    TIFFDirectory *td = &tif->tif_dir;
  329|  2.05M|    uint32_t strip;
  330|  2.05M|    int whole_strip;
  331|  2.05M|    tmsize_t read_ahead = 0;
  332|       |
  333|       |    /*
  334|       |    ** Establish what strip we are working from.
  335|       |    */
  336|  2.05M|    if (row >= td->td_imagelength)
  ------------------
  |  Branch (336:9): [True: 0, False: 2.05M]
  ------------------
  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|  2.05M|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (343:9): [True: 0, False: 2.05M]
  ------------------
  344|      0|    {
  345|      0|        TIFFErrorExtR(tif, tif->tif_name,
  346|      0|                      "Cannot compute strip: RowsPerStrip is zero");
  347|      0|        return (0);
  348|      0|    }
  349|  2.05M|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  2.05M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (349:9): [True: 80.3k, False: 1.97M]
  ------------------
  350|  80.3k|    {
  351|  80.3k|        uint64_t sample_offset;
  352|  80.3k|        uint64_t strip64;
  353|  80.3k|        if (sample >= td->td_samplesperpixel)
  ------------------
  |  Branch (353:13): [True: 0, False: 80.3k]
  ------------------
  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|  80.3k|        sample_offset =
  361|  80.3k|            _TIFFMultiply64(tif, sample, td->td_stripsperimage, "TIFFSeek");
  362|  80.3k|        if (sample_offset == 0 && sample != 0 && td->td_stripsperimage != 0)
  ------------------
  |  Branch (362:13): [True: 80.3k, False: 0]
  |  Branch (362:35): [True: 0, False: 80.3k]
  |  Branch (362:50): [True: 0, False: 0]
  ------------------
  363|      0|            return (0);
  364|  80.3k|        strip64 = _TIFFAdd64(tif, sample_offset, row / td->td_rowsperstrip,
  365|  80.3k|                             "TIFFSeek");
  366|  80.3k|        if (strip64 == 0 &&
  ------------------
  |  Branch (366:13): [True: 77.1k, False: 3.11k]
  ------------------
  367|  77.1k|            (sample_offset != 0 || (row / td->td_rowsperstrip) != 0))
  ------------------
  |  Branch (367:14): [True: 0, False: 77.1k]
  |  Branch (367:36): [True: 0, False: 77.1k]
  ------------------
  368|      0|            return (0);
  369|  80.3k|        strip = _TIFFCastUInt64ToUInt32(tif, strip64, "TIFFSeek");
  370|  80.3k|        if (strip == 0 && strip64 != 0)
  ------------------
  |  Branch (370:13): [True: 77.1k, False: 3.11k]
  |  Branch (370:27): [True: 0, False: 77.1k]
  ------------------
  371|      0|            return (0);
  372|  80.3k|    }
  373|  1.97M|    else
  374|  1.97M|        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|  2.05M|    whole_strip = 1;
  409|  2.05M|#endif
  410|       |
  411|       |    /*
  412|       |     * If we haven't loaded this strip, do so now, possibly
  413|       |     * only reading the first part.
  414|       |     */
  415|  2.05M|    if (strip != tif->tif_dir.td_curstrip)
  ------------------
  |  Branch (415:9): [True: 4.04k, False: 2.05M]
  ------------------
  416|  4.04k|    { /* different strip, refill */
  417|       |
  418|  4.04k|        if (whole_strip)
  ------------------
  |  Branch (418:13): [True: 4.04k, False: 0]
  ------------------
  419|  4.04k|        {
  420|  4.04k|            if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (420:17): [True: 375, False: 3.67k]
  ------------------
  421|    375|                return (0);
  422|  4.04k|        }
  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|  4.04k|    }
  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|  2.05M|    if (row < tif->tif_dir.td_row)
  ------------------
  |  Branch (450:9): [True: 15, False: 2.05M]
  ------------------
  451|     15|    {
  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|     15|        if (tif->tif_rawdataoff != 0)
  ------------------
  |  Branch (461:13): [True: 0, False: 15]
  ------------------
  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|     15|        else
  467|     15|        {
  468|     15|            if (!TIFFStartStrip(tif, strip))
  ------------------
  |  Branch (468:17): [True: 5, False: 10]
  ------------------
  469|      5|                return (0);
  470|     15|        }
  471|     15|    }
  472|       |
  473|  2.05M|    if (row != tif->tif_dir.td_row)
  ------------------
  |  Branch (473:9): [True: 0, False: 2.05M]
  ------------------
  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|  2.05M|    return (1);
  487|  2.05M|}
tif_read.c:TIFFReadAndRealloc:
   56|   213k|{
   57|   213k|#if SIZEOF_SIZE_T == 8
   58|   213k|    tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  |   43|   213k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
   59|   213k|#endif
   60|   213k|    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|   426k|    while (already_read < size)
  ------------------
  |  Branch (83:12): [True: 213k, False: 213k]
  ------------------
   84|   213k|    {
   85|   213k|        tmsize_t bytes_read;
   86|   213k|        tmsize_t to_read = size - already_read;
   87|   213k|#if SIZEOF_SIZE_T == 8
   88|   213k|        if (to_read >= threshold && threshold < MAX_THRESHOLD &&
  ------------------
  |  |   46|   213k|    (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|     30|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|     30|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|     30|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |   47|   213k|     INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  |   43|     30|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (88:13): [True: 30, False: 213k]
  |  Branch (88:37): [True: 30, False: 0]
  ------------------
   89|     30|            already_read + to_read + rawdata_offset > tif->tif_rawdatasize)
  ------------------
  |  Branch (89:13): [True: 22, False: 8]
  ------------------
   90|     22|        {
   91|     22|            to_read = threshold;
   92|     22|            threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  |   44|     22|#define THRESHOLD_MULTIPLIER 10
  ------------------
   93|     22|        }
   94|   213k|#endif
   95|   213k|        if (already_read + to_read + rawdata_offset > tif->tif_rawdatasize)
  ------------------
  |  Branch (95:13): [True: 3.61k, False: 209k]
  ------------------
   96|  3.61k|        {
   97|  3.61k|            uint8_t *new_rawdata;
   98|  3.61k|            assert((tif->tif_flags & TIFF_MYBUFFER) != 0);
  ------------------
  |  Branch (98:13): [True: 0, False: 3.61k]
  |  Branch (98:13): [True: 3.61k, False: 0]
  ------------------
   99|  3.61k|            tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64(
  ------------------
  |  |  327|  3.61k|#define TIFFroundup_64(x, y) ((uint64_t)(TIFFhowmany_64(x, y) * (uint64_t)(y)))
  |  |  ------------------
  |  |  |  |  324|  3.61k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  |  |  ------------------
  ------------------
  100|  3.61k|                (uint64_t)already_read + (uint64_t)to_read +
  101|  3.61k|                    (uint64_t)rawdata_offset,
  102|  3.61k|                1024);
  103|  3.61k|            if (tif->tif_rawdatasize == 0)
  ------------------
  |  Branch (103:17): [True: 0, False: 3.61k]
  ------------------
  104|      0|            {
  105|      0|                TIFFErrorExtR(tif, module, "Invalid buffer size");
  106|      0|                return 0;
  107|      0|            }
  108|  3.61k|            new_rawdata = (uint8_t *)_TIFFreallocExt(tif, tif->tif_rawdata,
  109|  3.61k|                                                     tif->tif_rawdatasize);
  110|  3.61k|            if (new_rawdata == 0)
  ------------------
  |  Branch (110:17): [True: 0, False: 3.61k]
  ------------------
  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.61k|            tif->tif_rawdata = new_rawdata;
  121|  3.61k|        }
  122|   213k|        if (tif->tif_rawdata == NULL)
  ------------------
  |  Branch (122:13): [True: 0, False: 213k]
  ------------------
  123|      0|        {
  124|       |            /* should not happen in practice but helps CoverityScan */
  125|      0|            return 0;
  126|      0|        }
  127|       |
  128|   213k|        bytes_read = TIFFReadFile(
  ------------------
  |  |  283|   213k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  129|   213k|            tif, tif->tif_rawdata + rawdata_offset + already_read, to_read);
  130|   213k|        if (bytes_read < 0)
  ------------------
  |  Branch (130:13): [True: 0, False: 213k]
  ------------------
  131|       |            /* Treat read errors as short reads before updating offsets. */
  132|      0|            bytes_read = 0;
  133|   213k|        already_read += bytes_read;
  134|   213k|        if (bytes_read != to_read)
  ------------------
  |  Branch (134:13): [True: 576, False: 213k]
  ------------------
  135|    576|        {
  136|    576|            memset(
  137|    576|                tif->tif_rawdata + rawdata_offset + already_read, 0,
  138|    576|                (size_t)(tif->tif_rawdatasize - rawdata_offset - already_read));
  139|    576|            if (is_strip)
  ------------------
  |  Branch (139:17): [True: 121, False: 455]
  ------------------
  140|    121|            {
  141|    121|                TIFFErrorExtR(tif, module,
  142|    121|                              "Read error at scanline %" PRIu32
  143|    121|                              "; got %" TIFF_SSIZE_FORMAT " bytes, "
  144|    121|                              "expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|    121|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  145|    121|                              tif->tif_dir.td_row, already_read, size);
  146|    121|            }
  147|    455|            else
  148|    455|            {
  149|    455|                TIFFErrorExtR(tif, module,
  150|    455|                              "Read error at row %" PRIu32 ", col %" PRIu32
  151|    455|                              ", tile %" PRIu32 "; "
  152|    455|                              "got %" TIFF_SSIZE_FORMAT
  153|    455|                              " bytes, expected %" TIFF_SSIZE_FORMAT "",
  154|    455|                              tif->tif_dir.td_row, tif->tif_dir.td_col,
  155|    455|                              strip_or_tile, already_read, size);
  156|    455|            }
  157|    576|            return 0;
  158|    576|        }
  159|   213k|    }
  160|   213k|    return 1;
  161|   213k|}
tif_read.c:TIFFReadEncodedStripGetStripSize:
  526|   311k|{
  527|   311k|    static const char module[] = "TIFFReadEncodedStrip";
  528|   311k|    TIFFDirectory *td = &tif->tif_dir;
  529|   311k|    uint32_t rowsperstrip;
  530|   311k|    uint32_t stripsperplane;
  531|   311k|    uint32_t stripinplane;
  532|   311k|    uint32_t rows;
  533|   311k|    tmsize_t stripsize;
  534|   311k|    if (!TIFFCheckRead(tif, 0))
  ------------------
  |  Branch (534:9): [True: 0, False: 311k]
  ------------------
  535|      0|        return ((tmsize_t)(-1));
  536|   311k|    if (strip >= td->td_nstrips)
  ------------------
  |  Branch (536:9): [True: 0, False: 311k]
  ------------------
  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|   311k|    rowsperstrip = td->td_rowsperstrip;
  545|   311k|    if (rowsperstrip > td->td_imagelength)
  ------------------
  |  Branch (545:9): [True: 429, False: 311k]
  ------------------
  546|    429|        rowsperstrip = td->td_imagelength;
  547|   311k|    if (rowsperstrip == 0)
  ------------------
  |  Branch (547:9): [True: 0, False: 311k]
  ------------------
  548|      0|    {
  549|      0|        TIFFErrorExtR(tif, module, "rowsperstrip is zero");
  550|      0|        return ((tmsize_t)(-1));
  551|      0|    }
  552|   311k|    stripsperplane =
  553|   311k|        TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  318|   311k|    (((uint32_t)(x) / (uint32_t)(y)) +                                         \
  |  |  319|   311k|     ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
  |  |  ------------------
  |  |  |  Branch (319:7): [True: 274k, False: 37.4k]
  |  |  ------------------
  ------------------
  554|   311k|    stripinplane = (strip % stripsperplane);
  555|   311k|    if (pplane)
  ------------------
  |  Branch (555:9): [True: 311k, False: 0]
  ------------------
  556|   311k|        *pplane = (uint16_t)(strip / stripsperplane);
  557|   311k|    rows = td->td_imagelength - stripinplane * rowsperstrip;
  558|   311k|    if (rows > rowsperstrip)
  ------------------
  |  Branch (558:9): [True: 310k, False: 984]
  ------------------
  559|   310k|        rows = rowsperstrip;
  560|   311k|    stripsize = TIFFVStripSize(tif, rows);
  561|   311k|    if (stripsize == 0)
  ------------------
  |  Branch (561:9): [True: 0, False: 311k]
  ------------------
  562|      0|        return ((tmsize_t)(-1));
  563|   311k|    return stripsize;
  564|   311k|}
tif_read.c:TIFFReadRawStrip1:
  680|   261k|{
  681|   261k|    assert((tif->tif_flags & TIFF_NOREADRAW) == 0);
  ------------------
  |  Branch (681:5): [True: 0, False: 261k]
  |  Branch (681:5): [True: 261k, False: 0]
  ------------------
  682|   261k|    if (!isMapped(tif))
  ------------------
  |  |  279|   261k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   261k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (682:9): [True: 261k, False: 0]
  ------------------
  683|   261k|    {
  684|   261k|        tmsize_t cc;
  685|       |
  686|   261k|        if (!SeekOK(tif, TIFFGetStrileOffset(tif, strip)))
  ------------------
  |  |  303|   261k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (686:13): [True: 153k, False: 107k]
  ------------------
  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|   107k|        cc = TIFFReadFile(tif, buf, size);
  ------------------
  |  |  283|   107k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  694|   107k|        if (cc != size)
  ------------------
  |  Branch (694:13): [True: 83, False: 107k]
  ------------------
  695|     83|        {
  696|     83|            TIFFErrorExtR(tif, module,
  697|     83|                          "Read error at scanline %" PRIu32
  698|     83|                          "; got %" TIFF_SSIZE_FORMAT
  699|     83|                          " bytes, expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|     83|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  700|     83|                          tif->tif_dir.td_row, cc, size);
  701|     83|            return ((tmsize_t)(-1));
  702|     83|        }
  703|   107k|    }
  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|   107k|    return (size);
  737|   261k|}
tif_read.c:TIFFReadRawStripOrTile2:
  742|   241k|{
  743|   241k|    assert(!isMapped(tif));
  ------------------
  |  Branch (743:5): [True: 0, False: 241k]
  |  Branch (743:5): [True: 241k, False: 0]
  ------------------
  744|   241k|    assert((tif->tif_flags & TIFF_NOREADRAW) == 0);
  ------------------
  |  Branch (744:5): [True: 0, False: 241k]
  |  Branch (744:5): [True: 241k, False: 0]
  ------------------
  745|       |
  746|   241k|    if (!SeekOK(tif, TIFFGetStrileOffset(tif, strip_or_tile)))
  ------------------
  |  |  303|   241k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (746:9): [True: 27.8k, False: 213k]
  ------------------
  747|  27.8k|    {
  748|  27.8k|        if (is_strip)
  ------------------
  |  Branch (748:13): [True: 6.52k, False: 21.3k]
  ------------------
  749|  6.52k|        {
  750|  6.52k|            TIFFErrorExtR(tif, module,
  751|  6.52k|                          "Seek error at scanline %" PRIu32 ", strip %" PRIu32,
  752|  6.52k|                          tif->tif_dir.td_row, strip_or_tile);
  753|  6.52k|        }
  754|  21.3k|        else
  755|  21.3k|        {
  756|  21.3k|            TIFFErrorExtR(
  757|  21.3k|                tif, module,
  758|  21.3k|                "Seek error at row %" PRIu32 ", col %" PRIu32 ", tile %" PRIu32,
  759|  21.3k|                tif->tif_dir.td_row, tif->tif_dir.td_col, strip_or_tile);
  760|  21.3k|        }
  761|  27.8k|        return ((tmsize_t)(-1));
  762|  27.8k|    }
  763|       |
  764|   213k|    if (!TIFFReadAndRealloc(tif, size, 0, is_strip, strip_or_tile, module))
  ------------------
  |  Branch (764:9): [True: 576, False: 213k]
  ------------------
  765|    576|    {
  766|    576|        return ((tmsize_t)(-1));
  767|    576|    }
  768|       |
  769|   213k|    return (size);
  770|   213k|}
tif_read.c:TIFFStartStrip:
 1542|  25.5k|{
 1543|  25.5k|    TIFFDirectory *td = &tif->tif_dir;
 1544|       |
 1545|  25.5k|    if ((tif->tif_flags & TIFF_CODERSETUP) == 0)
  ------------------
  |  |  124|  25.5k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  |  Branch (1545:9): [True: 1.99k, False: 23.5k]
  ------------------
 1546|  1.99k|    {
 1547|  1.99k|        if (!(*tif->tif_setupdecode)(tif))
  ------------------
  |  Branch (1547:13): [True: 41, False: 1.95k]
  ------------------
 1548|     41|            return (0);
 1549|  1.95k|        tif->tif_flags |= TIFF_CODERSETUP;
  ------------------
  |  |  124|  1.95k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
 1550|  1.95k|    }
 1551|  25.5k|    if (td->td_stripsperimage == 0)
  ------------------
  |  Branch (1551:9): [True: 0, False: 25.5k]
  ------------------
 1552|      0|    {
 1553|      0|        TIFFErrorExtR(tif, "TIFFStartStrip", "Zero strips per image");
 1554|      0|        return 0;
 1555|      0|    }
 1556|  25.5k|    tif->tif_dir.td_curstrip = strip;
 1557|  25.5k|    tif->tif_dir.td_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
 1558|  25.5k|    tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  141|  25.5k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 1559|       |
 1560|  25.5k|    if (tif->tif_flags & TIFF_NOREADRAW)
  ------------------
  |  |  138|  25.5k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1560:9): [True: 3.91k, False: 21.5k]
  ------------------
 1561|  3.91k|    {
 1562|  3.91k|        tif->tif_rawcp = NULL;
 1563|  3.91k|        tif->tif_rawcc = 0;
 1564|  3.91k|    }
 1565|  21.5k|    else
 1566|  21.5k|    {
 1567|  21.5k|        tif->tif_rawcp = tif->tif_rawdata;
 1568|  21.5k|        if (tif->tif_rawdataloaded > 0)
  ------------------
  |  Branch (1568:13): [True: 21.5k, False: 0]
  ------------------
 1569|  21.5k|            tif->tif_rawcc = tif->tif_rawdataloaded;
 1570|      0|        else
 1571|      0|            tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, strip);
 1572|  21.5k|    }
 1573|  25.5k|    if ((*tif->tif_predecode)(tif, (uint16_t)(strip / td->td_stripsperimage)) ==
  ------------------
  |  Branch (1573:9): [True: 1.22k, False: 24.2k]
  ------------------
 1574|  25.5k|        0)
 1575|  1.22k|    {
 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|  1.22k|        tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  111|  1.22k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
 1582|  1.22k|        return 0;
 1583|  1.22k|    }
 1584|  24.2k|    return 1;
 1585|  25.5k|}
tif_read.c:TIFFStartTile:
 1592|   809k|{
 1593|   809k|    static const char module[] = "TIFFStartTile";
 1594|   809k|    TIFFDirectory *td = &tif->tif_dir;
 1595|   809k|    uint32_t howmany32;
 1596|   809k|    uint32_t tilemod;
 1597|       |
 1598|   809k|    if ((tif->tif_flags & TIFF_CODERSETUP) == 0)
  ------------------
  |  |  124|   809k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  |  Branch (1598:9): [True: 2.55k, False: 807k]
  ------------------
 1599|  2.55k|    {
 1600|  2.55k|        if (!(*tif->tif_setupdecode)(tif))
  ------------------
  |  Branch (1600:13): [True: 3, False: 2.55k]
  ------------------
 1601|      3|            return (0);
 1602|  2.55k|        tif->tif_flags |= TIFF_CODERSETUP;
  ------------------
  |  |  124|  2.55k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
 1603|  2.55k|    }
 1604|   809k|    tif->tif_dir.td_curtile = tile;
 1605|   809k|    if (td->td_tilewidth == 0)
  ------------------
  |  Branch (1605:9): [True: 0, False: 809k]
  ------------------
 1606|      0|    {
 1607|      0|        TIFFErrorExtR(tif, module, "Zero tilewidth");
 1608|      0|        return 0;
 1609|      0|    }
 1610|   809k|    howmany32 = TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth);
  ------------------
  |  |  312|   809k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 809k, False: 0]
  |  |  ------------------
  |  |  313|   809k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|   809k|         : 0U)
  ------------------
 1611|   809k|    if (howmany32 == 0)
  ------------------
  |  Branch (1611:9): [True: 0, False: 809k]
  ------------------
 1612|      0|    {
 1613|      0|        TIFFErrorExtR(tif, module, "Zero tiles");
 1614|      0|        return 0;
 1615|      0|    }
 1616|   809k|    tilemod = tile % howmany32;
 1617|   809k|    if (td->td_tilelength == 0)
  ------------------
  |  Branch (1617:9): [True: 0, False: 809k]
  ------------------
 1618|      0|    {
 1619|      0|        TIFFErrorExtR(tif, module, "Zero tilelength");
 1620|      0|        return 0;
 1621|      0|    }
 1622|   809k|    if (tilemod == 0)
  ------------------
  |  Branch (1622:9): [True: 75.2k, False: 734k]
  ------------------
 1623|  75.2k|    {
 1624|  75.2k|        tif->tif_dir.td_row = 0;
 1625|  75.2k|    }
 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: 461, False: 733k]
  ------------------
 1631|    461|            return 0;
 1632|   734k|    }
 1633|   809k|    howmany32 = TIFFhowmany_32(td->td_imagelength, td->td_tilelength);
  ------------------
  |  |  312|   809k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 809k, False: 0]
  |  |  ------------------
  |  |  313|   809k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|   809k|         : 0U)
  ------------------
 1634|   809k|    if (howmany32 == 0)
  ------------------
  |  Branch (1634:9): [True: 0, False: 809k]
  ------------------
 1635|      0|    {
 1636|      0|        TIFFErrorExtR(tif, module, "Zero tiles");
 1637|      0|        return 0;
 1638|      0|    }
 1639|   809k|    tilemod = tile % howmany32;
 1640|   809k|    if (tilemod == 0)
  ------------------
  |  Branch (1640:9): [True: 694k, False: 114k]
  ------------------
 1641|   694k|    {
 1642|   694k|        tif->tif_dir.td_col = 0;
 1643|   694k|    }
 1644|   114k|    else
 1645|   114k|    {
 1646|   114k|        tif->tif_dir.td_col =
 1647|   114k|            _TIFFMultiply32(tif, tilemod, td->td_tilewidth, module);
 1648|   114k|        if (tif->tif_dir.td_col == 0)
  ------------------
  |  Branch (1648:13): [True: 172, False: 114k]
  ------------------
 1649|    172|            return 0;
 1650|   114k|    }
 1651|   809k|    tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  141|   809k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 1652|   809k|    if (tif->tif_flags & TIFF_NOREADRAW)
  ------------------
  |  |  138|   809k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1652:9): [True: 618k, False: 190k]
  ------------------
 1653|   618k|    {
 1654|   618k|        tif->tif_rawcp = NULL;
 1655|   618k|        tif->tif_rawcc = 0;
 1656|   618k|    }
 1657|   190k|    else
 1658|   190k|    {
 1659|   190k|        tif->tif_rawcp = tif->tif_rawdata;
 1660|   190k|        if (tif->tif_rawdataloaded > 0)
  ------------------
  |  Branch (1660:13): [True: 190k, False: 0]
  ------------------
 1661|   190k|            tif->tif_rawcc = tif->tif_rawdataloaded;
 1662|      0|        else
 1663|      0|            tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, tile);
 1664|   190k|    }
 1665|   809k|    return (
 1666|   809k|        (*tif->tif_predecode)(tif, (uint16_t)(tile / td->td_stripsperimage)));
 1667|   809k|}
tif_read.c:TIFFCheckRead:
 1670|  5.86M|{
 1671|  5.86M|    if (tif->tif_mode == O_WRONLY)
  ------------------
  |  Branch (1671:9): [True: 0, False: 5.86M]
  ------------------
 1672|      0|    {
 1673|      0|        TIFFErrorExtR(tif, tif->tif_name, "File not open for reading");
 1674|      0|        return (0);
 1675|      0|    }
 1676|  5.86M|    if (tiles ^ isTiled(tif))
  ------------------
  |  |  278|  5.86M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  5.86M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1676:9): [True: 0, False: 5.86M]
  ------------------
 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.86M|    return (1);
 1684|  5.86M|}

_Z14TIFFStreamOpenPKcPNSt3__113basic_istreamIcNS1_11char_traitsIcEEEE:
  456|  6.25k|{
  457|       |    // NB: We don't support mapped files with streams so add 'm'
  458|  6.25k|    return _tiffStreamOpen(name, "rm", is);
  459|  6.25k|}
tif_stream.cxx:_ZL15_tiffStreamOpenPKcS0_Pv:
  399|  6.25k|    {
  400|  6.25k|        TIFF *tif;
  401|       |
  402|  6.25k|        if (strchr(mode, 'w'))
  ------------------
  |  Branch (402:13): [True: 0, False: 6.25k]
  ------------------
  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|  6.25k|        else
  419|  6.25k|        {
  420|  6.25k|            tiffis_data *data = new tiffis_data;
  421|  6.25k|            data->stream = reinterpret_cast<istream *>(fd);
  422|  6.25k|            data->start_pos = data->stream->tellg();
  423|       |            // Open for reading.
  424|  6.25k|            tif = TIFFClientOpen(
  425|  6.25k|                name, mode, reinterpret_cast<thandle_t>(data), _tiffisReadProc,
  426|  6.25k|                _tiffisWriteProc, _tiffisSeekProc, _tiffisCloseProc,
  427|  6.25k|                _tiffisSizeProc, _tiffDummyMapProcCxx, _tiffDummyUnmapProcCxx);
  428|  6.25k|            if (!tif)
  ------------------
  |  Branch (428:17): [True: 1.55k, False: 4.70k]
  ------------------
  429|  1.55k|            {
  430|  1.55k|                delete data;
  431|  1.55k|            }
  432|  6.25k|        }
  433|       |
  434|  6.25k|        return (tif);
  435|  6.25k|    }
tif_stream.cxx:_ZL15_tiffisReadProcPvS_l:
  109|   909k|    {
  110|   909k|        tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
  111|       |
  112|       |        // Verify that type does not overflow.
  113|   909k|        streamsize request_size = size;
  114|   909k|        if (static_cast<tmsize_t>(request_size) != size)
  ------------------
  |  Branch (114:13): [True: 0, False: 909k]
  ------------------
  115|      0|            return static_cast<tmsize_t>(-1);
  116|       |
  117|   909k|        data->stream->read((char *)buf, request_size);
  118|       |
  119|   909k|        return static_cast<tmsize_t>(data->stream->gcount());
  120|   909k|    }
tif_stream.cxx:_ZL15_tiffisSeekProcPvmi:
  242|   986k|    {
  243|   986k|        tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
  244|       |
  245|   986k|        if (data->start_pos == ios::pos_type(-1))
  ------------------
  |  Branch (245:13): [True: 0, False: 986k]
  ------------------
  246|      0|            return static_cast<uint64_t>(-1);
  247|       |
  248|   986k|        switch (whence)
  ------------------
  |  Branch (248:17): [True: 986k, False: 0]
  ------------------
  249|   986k|        {
  250|   986k|            case SEEK_SET:
  ------------------
  |  Branch (250:13): [True: 986k, False: 0]
  ------------------
  251|   986k|            {
  252|       |                // Compute 64-bit offset
  253|   986k|                uint64_t new_offset =
  254|   986k|                    static_cast<uint64_t>(data->start_pos) + off;
  255|       |
  256|       |                // Verify that value does not overflow
  257|   986k|                ios::off_type offset = static_cast<ios::off_type>(new_offset);
  258|   986k|                if (static_cast<uint64_t>(offset) != new_offset)
  ------------------
  |  Branch (258:21): [True: 0, False: 986k]
  ------------------
  259|      0|                    return static_cast<uint64_t>(-1);
  260|       |
  261|   986k|                data->stream->seekg(offset, ios::beg);
  262|   986k|                break;
  263|   986k|            }
  264|      0|            case SEEK_CUR:
  ------------------
  |  Branch (264:13): [True: 0, False: 986k]
  ------------------
  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: 986k]
  ------------------
  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|   986k|        }
  285|       |
  286|   986k|        ios::pos_type pos = data->stream->tellg();
  287|   986k|        if (pos == ios::pos_type(-1))
  ------------------
  |  Branch (287:13): [True: 187k, False: 798k]
  ------------------
  288|   187k|            return static_cast<uint64_t>(-1);
  289|       |
  290|   798k|        ios::off_type relative_pos = pos - data->start_pos;
  291|   798k|        if (relative_pos < 0)
  ------------------
  |  Branch (291:13): [True: 0, False: 798k]
  ------------------
  292|      0|            return static_cast<uint64_t>(-1);
  293|       |
  294|   798k|        return static_cast<uint64_t>(relative_pos);
  295|   798k|    }
tif_stream.cxx:_ZL16_tiffisCloseProcPv:
  376|  4.70k|    {
  377|       |        // Our stream was not allocated by us, so it shouldn't be closed by us.
  378|  4.70k|        delete reinterpret_cast<tiffis_data *>(fd);
  379|  4.70k|        return 0;
  380|  4.70k|    }
tif_stream.cxx:_ZL15_tiffisSizeProcPv:
  334|  2.73k|    {
  335|  2.73k|        tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
  336|  2.73k|        ios::pos_type pos = data->stream->tellg();
  337|  2.73k|        ios::pos_type len;
  338|       |
  339|       |        // Failed stream positions must not be converted to unsigned sizes.
  340|  2.73k|        if (pos == ios::pos_type(-1))
  ------------------
  |  Branch (340:13): [True: 622, False: 2.11k]
  ------------------
  341|    622|            return 0;
  342|       |
  343|  2.11k|        data->stream->seekg(0, ios::end);
  344|  2.11k|        if (data->stream->fail())
  ------------------
  |  Branch (344:13): [True: 0, False: 2.11k]
  ------------------
  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.11k|        len = data->stream->tellg();
  354|  2.11k|        if (len == ios::pos_type(-1))
  ------------------
  |  Branch (354:13): [True: 0, False: 2.11k]
  ------------------
  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.11k|        data->stream->seekg(pos);
  364|       |
  365|  2.11k|        return static_cast<uint64_t>(len);
  366|  2.11k|    }

TIFFComputeStrip:
   36|   311k|{
   37|   311k|    static const char module[] = "TIFFComputeStrip";
   38|   311k|    TIFFDirectory *td = &tif->tif_dir;
   39|   311k|    uint32_t strip;
   40|       |
   41|   311k|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (41:9): [True: 0, False: 311k]
  ------------------
   42|      0|    {
   43|      0|        TIFFErrorExtR(tif, module,
   44|      0|                      "Cannot compute strip: RowsPerStrip is zero");
   45|      0|        return 0;
   46|      0|    }
   47|   311k|    strip = row / td->td_rowsperstrip;
   48|   311k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|   311k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (48:9): [True: 213k, False: 98.0k]
  ------------------
   49|   213k|    {
   50|   213k|        uint64_t sample_offset;
   51|   213k|        uint64_t strip64;
   52|   213k|        if (sample >= td->td_samplesperpixel)
  ------------------
  |  Branch (52:13): [True: 2.28k, False: 211k]
  ------------------
   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|   211k|        sample_offset = _TIFFMultiply64(tif, sample, td->td_stripsperimage,
   60|   211k|                                        "TIFFComputeStrip");
   61|   211k|        if (sample_offset == 0 && sample != 0 && td->td_stripsperimage != 0)
  ------------------
  |  Branch (61:13): [True: 103k, False: 107k]
  |  Branch (61:35): [True: 0, False: 103k]
  |  Branch (61:50): [True: 0, False: 0]
  ------------------
   62|      0|            return (0);
   63|   211k|        strip64 = _TIFFAdd64(tif, sample_offset, strip, "TIFFComputeStrip");
   64|   211k|        if (strip64 == 0 && (sample_offset != 0 || strip != 0))
  ------------------
  |  Branch (64:13): [True: 190, False: 211k]
  |  Branch (64:30): [True: 0, False: 190]
  |  Branch (64:52): [True: 0, False: 190]
  ------------------
   65|      0|            return (0);
   66|   211k|        strip = _TIFFCastUInt64ToUInt32(tif, strip64, "TIFFComputeStrip");
   67|   211k|        if (strip == 0 && strip64 != 0)
  ------------------
  |  Branch (67:13): [True: 190, False: 211k]
  |  Branch (67:27): [True: 0, False: 190]
  ------------------
   68|      0|            return (0);
   69|   211k|    }
   70|   309k|    return (strip);
   71|   311k|}
TIFFNumberOfStrips:
   77|  3.45k|{
   78|  3.45k|    TIFFDirectory *td = &tif->tif_dir;
   79|  3.45k|    uint32_t nstrips;
   80|       |
   81|  3.45k|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (81:9): [True: 0, False: 3.45k]
  ------------------
   82|      0|    {
   83|      0|        TIFFWarningExtR(tif, "TIFFNumberOfStrips", "RowsPerStrip is zero");
   84|      0|        return 0;
   85|      0|    }
   86|  3.45k|    nstrips = (td->td_rowsperstrip == (uint32_t)-1
  ------------------
  |  Branch (86:16): [True: 1.36k, False: 2.08k]
  ------------------
   87|  3.45k|                   ? 1
   88|  3.45k|                   : TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
  ------------------
  |  |  312|  2.08k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.08k, False: 0]
  |  |  ------------------
  |  |  313|  2.08k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.08k|         : 0U)
  ------------------
   89|  3.45k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  3.45k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (89:9): [True: 529, False: 2.92k]
  ------------------
   90|    529|        nstrips =
   91|    529|            _TIFFMultiply32(tif, nstrips, (uint32_t)td->td_samplesperpixel,
   92|    529|                            "TIFFNumberOfStrips");
   93|  3.45k|    return (nstrips);
   94|  3.45k|}
_TIFFStrileSize64:
  101|   574k|{
  102|   574k|    static const char module[] = "_TIFFStrileSize64";
  103|   574k|    TIFFDirectory *td = &tif->tif_dir;
  104|   574k|    if (isStrip)
  ------------------
  |  Branch (104:9): [True: 346k, False: 228k]
  ------------------
  105|   346k|    {
  106|   346k|        if (nrows == (uint32_t)(-1))
  ------------------
  |  Branch (106:13): [True: 3, False: 346k]
  ------------------
  107|      3|            nrows = td->td_imagelength;
  108|   346k|    }
  109|   228k|    else
  110|   228k|    {
  111|   228k|        if (td->td_tilelength == 0 || td->td_tilewidth == 0 ||
  ------------------
  |  Branch (111:13): [True: 0, False: 228k]
  |  Branch (111:39): [True: 2, False: 228k]
  ------------------
  112|   228k|            td->td_tiledepth == 0)
  ------------------
  |  Branch (112:13): [True: 0, False: 228k]
  ------------------
  113|      2|            return (0);
  114|   228k|    }
  115|   574k|    if ((td->td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|   574k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (115:9): [True: 350k, False: 223k]
  ------------------
  116|   350k|        (td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|   350k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                      (td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  281|  90.5k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  133|  90.5k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (116:9): [True: 90.5k, False: 260k]
  |  Branch (116:54): [True: 46.8k, False: 43.6k]
  ------------------
  117|  46.8k|    {
  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|  46.8k|        uint16_t ycbcrsubsampling[2];
  127|  46.8k|        uint16_t samplingblock_samples;
  128|  46.8k|        uint32_t samplingblocks_hor;
  129|  46.8k|        uint32_t samplingblocks_ver;
  130|  46.8k|        uint64_t samplingrow_samples;
  131|  46.8k|        uint64_t samplingrow_size;
  132|  46.8k|        if (td->td_samplesperpixel != 3)
  ------------------
  |  Branch (132:13): [True: 2, False: 46.8k]
  ------------------
  133|      2|        {
  134|      2|            TIFFErrorExtR(tif, module, "Invalid td_samplesperpixel value");
  135|      2|            return 0;
  136|      2|        }
  137|  46.8k|        TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|  46.8k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  138|  46.8k|                              ycbcrsubsampling + 0, ycbcrsubsampling + 1);
  139|  46.8k|        if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 &&
  ------------------
  |  Branch (139:14): [True: 44.8k, False: 2.02k]
  |  Branch (139:42): [True: 39.4k, False: 5.39k]
  ------------------
  140|  39.4k|             ycbcrsubsampling[0] != 4) ||
  ------------------
  |  Branch (140:14): [True: 0, False: 39.4k]
  ------------------
  141|  46.8k|            (ycbcrsubsampling[1] != 1 && ycbcrsubsampling[1] != 2 &&
  ------------------
  |  Branch (141:14): [True: 45.2k, False: 1.63k]
  |  Branch (141:42): [True: 5.27k, False: 39.9k]
  ------------------
  142|  5.27k|             ycbcrsubsampling[1] != 4) ||
  ------------------
  |  Branch (142:14): [True: 0, False: 5.27k]
  ------------------
  143|  46.8k|            (ycbcrsubsampling[0] == 0 || ycbcrsubsampling[1] == 0))
  ------------------
  |  Branch (143:14): [True: 0, False: 46.8k]
  |  Branch (143:42): [True: 0, False: 46.8k]
  ------------------
  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|  46.8k|        samplingblock_samples =
  150|  46.8k|            (uint16_t)(ycbcrsubsampling[0] * ycbcrsubsampling[1] + 2);
  151|  46.8k|        const uint32_t width = isStrip ? td->td_imagewidth : td->td_tilewidth;
  ------------------
  |  Branch (151:32): [True: 41.8k, False: 5.05k]
  ------------------
  152|  46.8k|        samplingblocks_hor = TIFFhowmany_32(width, ycbcrsubsampling[0]);
  ------------------
  |  |  312|  46.8k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 46.8k, False: 0]
  |  |  ------------------
  |  |  313|  46.8k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  46.8k|         : 0U)
  ------------------
  153|  46.8k|        samplingblocks_ver = TIFFhowmany_32(nrows, ycbcrsubsampling[1]);
  ------------------
  |  |  312|  46.8k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 46.8k, False: 56]
  |  |  ------------------
  |  |  313|  46.8k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  46.8k|         : 0U)
  ------------------
  154|  46.8k|        samplingrow_samples = _TIFFMultiply64(tif, samplingblocks_hor,
  155|  46.8k|                                              samplingblock_samples, module);
  156|  46.8k|        samplingrow_size = TIFFhowmany8_64(_TIFFMultiply64(
  ------------------
  |  |  326|  46.8k|    (((x) & 0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
  |  |  ------------------
  |  |  |  Branch (326:6): [True: 1.01k, False: 45.8k]
  |  |  ------------------
  ------------------
  157|  46.8k|            tif, samplingrow_samples, td->td_bitspersample, module));
  158|  46.8k|        return (
  159|  46.8k|            _TIFFMultiply64(tif, samplingrow_size, samplingblocks_ver, module));
  160|  46.8k|    }
  161|   527k|    else
  162|   527k|        return (_TIFFMultiply64(tif, nrows,
  163|   527k|                                isStrip ? TIFFScanlineSize64(tif)
  ------------------
  |  Branch (163:33): [True: 304k, False: 223k]
  ------------------
  164|   527k|                                        : TIFFTileRowSize64(tif),
  165|   527k|                                module));
  166|   574k|}
TIFFVStripSize64:
  172|   346k|{
  173|   346k|    return _TIFFStrileSize64(tif, nrows, /* isStrip = */ TRUE);
  ------------------
  |  |   71|   346k|#define TRUE 1
  ------------------
  174|   346k|}
TIFFVStripSize:
  177|   311k|{
  178|   311k|    static const char module[] = "TIFFVStripSize";
  179|   311k|    uint64_t m;
  180|   311k|    m = TIFFVStripSize64(tif, nrows);
  181|   311k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  182|   311k|}
TIFFStripSize64:
  231|  34.4k|{
  232|  34.4k|    TIFFDirectory *td = &tif->tif_dir;
  233|  34.4k|    uint32_t rps = td->td_rowsperstrip;
  234|  34.4k|    if (rps > td->td_imagelength)
  ------------------
  |  Branch (234:9): [True: 4.98k, False: 29.4k]
  ------------------
  235|  4.98k|        rps = td->td_imagelength;
  236|  34.4k|    return (TIFFVStripSize64(tif, rps));
  237|  34.4k|}
TIFFStripSize:
  239|  34.2k|{
  240|  34.2k|    static const char module[] = "TIFFStripSize";
  241|  34.2k|    uint64_t m;
  242|  34.2k|    m = TIFFStripSize64(tif);
  243|  34.2k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  244|  34.2k|}
TIFFScanlineSize64:
  292|   315k|{
  293|   315k|    static const char module[] = "TIFFScanlineSize64";
  294|   315k|    TIFFDirectory *td = &tif->tif_dir;
  295|   315k|    uint64_t scanline_size;
  296|   315k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|   315k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (296:9): [True: 97.6k, False: 217k]
  ------------------
  297|  97.6k|    {
  298|  97.6k|        if ((td->td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|  97.6k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (298:13): [True: 2.77k, False: 94.8k]
  ------------------
  299|  2.77k|            (td->td_samplesperpixel == 3) && (!isUpSampled(tif)))
  ------------------
  |  |  281|  2.76k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  133|  2.76k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (299:13): [True: 2.76k, False: 2]
  |  Branch (299:46): [True: 2.24k, False: 527]
  ------------------
  300|  2.24k|        {
  301|  2.24k|            uint16_t ycbcrsubsampling[2];
  302|  2.24k|            uint16_t samplingblock_samples;
  303|  2.24k|            uint32_t samplingblocks_hor;
  304|  2.24k|            uint64_t samplingrow_samples;
  305|  2.24k|            uint64_t samplingrow_size;
  306|  2.24k|            if (td->td_samplesperpixel != 3)
  ------------------
  |  Branch (306:17): [True: 0, False: 2.24k]
  ------------------
  307|      0|            {
  308|      0|                TIFFErrorExtR(tif, module, "Invalid td_samplesperpixel value");
  309|      0|                return 0;
  310|      0|            }
  311|  2.24k|            TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|  2.24k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  312|  2.24k|                                  ycbcrsubsampling + 0, ycbcrsubsampling + 1);
  313|  2.24k|            if (((ycbcrsubsampling[0] != 1) && (ycbcrsubsampling[0] != 2) &&
  ------------------
  |  Branch (313:18): [True: 2.03k, False: 202]
  |  Branch (313:48): [True: 429, False: 1.61k]
  ------------------
  314|    429|                 (ycbcrsubsampling[0] != 4)) ||
  ------------------
  |  Branch (314:18): [True: 1, False: 428]
  ------------------
  315|  2.24k|                ((ycbcrsubsampling[1] != 1) && (ycbcrsubsampling[1] != 2) &&
  ------------------
  |  Branch (315:18): [True: 1.99k, False: 247]
  |  Branch (315:48): [True: 226, False: 1.76k]
  ------------------
  316|    226|                 (ycbcrsubsampling[1] != 4)) ||
  ------------------
  |  Branch (316:18): [True: 2, False: 224]
  ------------------
  317|  2.23k|                ((ycbcrsubsampling[0] == 0) || (ycbcrsubsampling[1] == 0)))
  ------------------
  |  Branch (317:18): [True: 0, False: 2.23k]
  |  Branch (317:48): [True: 0, False: 2.23k]
  ------------------
  318|      3|            {
  319|      3|                TIFFErrorExtR(tif, module, "Invalid YCbCr subsampling");
  320|      3|                return 0;
  321|      3|            }
  322|  2.23k|            samplingblock_samples =
  323|  2.23k|                (uint16_t)(ycbcrsubsampling[0] * ycbcrsubsampling[1] + 2);
  324|  2.23k|            samplingblocks_hor =
  325|  2.23k|                TIFFhowmany_32(td->td_imagewidth, ycbcrsubsampling[0]);
  ------------------
  |  |  312|  2.23k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.23k, False: 5]
  |  |  ------------------
  |  |  313|  2.23k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.23k|         : 0U)
  ------------------
  326|  2.23k|            samplingrow_samples = _TIFFMultiply64(
  327|  2.23k|                tif, samplingblocks_hor, samplingblock_samples, module);
  328|  2.23k|            samplingrow_size =
  329|  2.23k|                TIFFhowmany_64(_TIFFMultiply64(tif, samplingrow_samples,
  ------------------
  |  |  324|  2.23k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  330|  2.23k|                                               td->td_bitspersample, module),
  331|  2.23k|                               8);
  332|  2.23k|            scanline_size = (samplingrow_size / ycbcrsubsampling[1]);
  333|  2.23k|        }
  334|  95.3k|        else
  335|  95.3k|        {
  336|  95.3k|            uint64_t scanline_samples;
  337|  95.3k|            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|  95.3k|            scanline_samples = _TIFFMultiply64(tif, scanline_width,
  356|  95.3k|                                               td->td_samplesperpixel, module);
  357|  95.3k|            scanline_size =
  358|  95.3k|                TIFFhowmany_64(_TIFFMultiply64(tif, scanline_samples,
  ------------------
  |  |  324|  95.3k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  359|  95.3k|                                               td->td_bitspersample, module),
  360|  95.3k|                               8);
  361|  95.3k|        }
  362|  97.6k|    }
  363|   217k|    else
  364|   217k|    {
  365|   217k|        scanline_size =
  366|   217k|            TIFFhowmany_64(_TIFFMultiply64(tif, td->td_imagewidth,
  ------------------
  |  |  324|   217k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  367|   217k|                                           td->td_bitspersample, module),
  368|   217k|                           8);
  369|   217k|    }
  370|   315k|    if (scanline_size == 0)
  ------------------
  |  Branch (370:9): [True: 26, False: 315k]
  ------------------
  371|     26|    {
  372|     26|        TIFFErrorExtR(tif, module, "Computed scanline size is zero");
  373|     26|        return 0;
  374|     26|    }
  375|   315k|    return (scanline_size);
  376|   315k|}
TIFFScanlineSize:
  378|  11.0k|{
  379|  11.0k|    static const char module[] = "TIFFScanlineSize";
  380|  11.0k|    uint64_t m;
  381|  11.0k|    m = TIFFScanlineSize64(tif);
  382|  11.0k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  383|  11.0k|}

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

TIFFInitThunderScan:
  196|     21|{
  197|     21|    (void)scheme;
  198|       |
  199|     21|    tif->tif_setupdecode = ThunderSetupDecode;
  200|     21|    tif->tif_decoderow = ThunderDecodeRow;
  201|     21|    tif->tif_decodestrip = ThunderDecodeRow;
  202|     21|    return (1);
  203|     21|}
tif_thunder.c:ThunderSetupDecode:
   70|     21|{
   71|     21|    static const char module[] = "ThunderSetupDecode";
   72|       |
   73|     21|    if (tif->tif_dir.td_bitspersample != 4)
  ------------------
  |  Branch (73:9): [True: 0, False: 21]
  ------------------
   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|     21|    return (1);
   83|     21|}
tif_thunder.c:ThunderDecodeRow:
  175|  1.10k|{
  176|  1.10k|    static const char module[] = "ThunderDecodeRow";
  177|  1.10k|    uint8_t *row = buf;
  178|       |
  179|  1.10k|    (void)s;
  180|  1.10k|    if (occ % tif->tif_dir.td_scanlinesize)
  ------------------
  |  Branch (180:9): [True: 0, False: 1.10k]
  ------------------
  181|      0|    {
  182|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  183|      0|        return (0);
  184|      0|    }
  185|  2.52k|    while (occ > 0)
  ------------------
  |  Branch (185:12): [True: 2.29k, False: 224]
  ------------------
  186|  2.29k|    {
  187|  2.29k|        if (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth))
  ------------------
  |  Branch (187:13): [True: 882, False: 1.41k]
  ------------------
  188|    882|            return (0);
  189|  1.41k|        occ -= tif->tif_dir.td_scanlinesize;
  190|  1.41k|        row += tif->tif_dir.td_scanlinesize;
  191|  1.41k|    }
  192|    224|    return (1);
  193|  1.10k|}
tif_thunder.c:ThunderDecode:
   86|  2.29k|{
   87|  2.29k|    static const char module[] = "ThunderDecode";
   88|  2.29k|    unsigned char *bp;
   89|  2.29k|    tmsize_t cc;
   90|  2.29k|    unsigned int lastpixel;
   91|  2.29k|    tmsize_t npixels;
   92|  2.29k|    uint8_t *op = op0;
   93|       |
   94|  2.29k|    bp = (unsigned char *)tif->tif_rawcp;
   95|  2.29k|    cc = tif->tif_rawcc;
   96|  2.29k|    lastpixel = 0;
   97|  2.29k|    npixels = 0;
   98|  43.7k|    while (cc > 0 && npixels < maxpixels)
  ------------------
  |  Branch (98:12): [True: 43.2k, False: 587]
  |  Branch (98:22): [True: 41.4k, False: 1.71k]
  ------------------
   99|  41.4k|    {
  100|  41.4k|        int n, delta;
  101|       |
  102|  41.4k|        n = *bp++;
  103|  41.4k|        cc--;
  104|  41.4k|        switch (n & THUNDER_CODE)
  ------------------
  |  |   45|  41.4k|#define THUNDER_CODE 0xc0 /* mask for 2-bit code word */
  ------------------
  105|  41.4k|        {
  106|  19.6k|            case THUNDER_RUN: /* pixel run */
  ------------------
  |  |   47|  19.6k|#define THUNDER_RUN 0x00        /* run of pixels w/ encoded count */
  ------------------
  |  Branch (106:13): [True: 19.6k, False: 21.8k]
  ------------------
  107|       |                /*
  108|       |                 * Replicate the last pixel n times,
  109|       |                 * where n is the lower-order 6 bits.
  110|       |                 */
  111|  19.6k|                if (n == 0)
  ------------------
  |  Branch (111:21): [True: 8.55k, False: 11.1k]
  ------------------
  112|  8.55k|                    break;
  113|  11.1k|                if (npixels & 1)
  ------------------
  |  Branch (113:21): [True: 5.06k, False: 6.05k]
  ------------------
  114|  5.06k|                {
  115|  5.06k|                    op[0] |= (uint8_t)lastpixel;
  116|  5.06k|                    lastpixel = *op++;
  117|  5.06k|                    npixels++;
  118|  5.06k|                    n--;
  119|  5.06k|                }
  120|  6.05k|                else
  121|  6.05k|                    lastpixel |= lastpixel << 4;
  122|  11.1k|                npixels += n;
  123|  11.1k|                if (npixels > maxpixels)
  ------------------
  |  Branch (123:21): [True: 378, False: 10.7k]
  ------------------
  124|    378|                    break;
  125|  56.5k|                for (; n > 0; n -= 2)
  ------------------
  |  Branch (125:24): [True: 45.8k, False: 10.7k]
  ------------------
  126|  45.8k|                    *op++ = (uint8_t)lastpixel;
  127|  10.7k|                if (n == -1)
  ------------------
  |  Branch (127:21): [True: 5.19k, False: 5.54k]
  ------------------
  128|  5.19k|                    *--op &= 0xf0;
  129|  10.7k|                lastpixel &= 0xf;
  130|  10.7k|                break;
  131|  9.67k|            case THUNDER_2BITDELTAS: /* 2-bit deltas */
  ------------------
  |  |   48|  9.67k|#define THUNDER_2BITDELTAS 0x40 /* 3 pixels w/ encoded 2-bit deltas */
  ------------------
  |  Branch (131:13): [True: 9.67k, False: 31.8k]
  ------------------
  132|  9.67k|                if ((delta = ((n >> 4) & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  9.67k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (132:21): [True: 4.22k, False: 5.45k]
  ------------------
  133|  4.22k|                    SETPIXEL(op,
  ------------------
  |  |   58|  4.22k|    {                                                                          \
  |  |   59|  4.22k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  4.22k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 4.22k, False: 0]
  |  |  ------------------
  |  |   61|  4.22k|        {                                                                      \
  |  |   62|  4.22k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 1.45k, False: 2.76k]
  |  |  ------------------
  |  |   63|  4.22k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  4.22k|            else                                                               \
  |  |   65|  4.22k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  4.22k|        }                                                                      \
  |  |   67|  4.22k|    }
  ------------------
  134|  9.67k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  135|  9.67k|                if ((delta = ((n >> 2) & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  9.67k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (135:21): [True: 8.71k, False: 965]
  ------------------
  136|  8.71k|                    SETPIXEL(op,
  ------------------
  |  |   58|  8.71k|    {                                                                          \
  |  |   59|  8.71k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  8.71k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 7.99k, False: 712]
  |  |  ------------------
  |  |   61|  8.71k|        {                                                                      \
  |  |   62|  7.99k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 5.05k, False: 2.94k]
  |  |  ------------------
  |  |   63|  7.99k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  7.99k|            else                                                               \
  |  |   65|  7.99k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  7.99k|        }                                                                      \
  |  |   67|  8.71k|    }
  ------------------
  137|  9.67k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  138|  9.67k|                if ((delta = (n & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  9.67k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (138:21): [True: 8.11k, False: 1.56k]
  ------------------
  139|  8.11k|                    SETPIXEL(op,
  ------------------
  |  |   58|  8.11k|    {                                                                          \
  |  |   59|  8.11k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  8.11k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 7.23k, False: 880]
  |  |  ------------------
  |  |   61|  8.11k|        {                                                                      \
  |  |   62|  7.23k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 2.68k, False: 4.55k]
  |  |  ------------------
  |  |   63|  7.23k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  7.23k|            else                                                               \
  |  |   65|  7.23k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  7.23k|        }                                                                      \
  |  |   67|  8.11k|    }
  ------------------
  140|  9.67k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  141|  9.67k|                break;
  142|  10.2k|            case THUNDER_3BITDELTAS: /* 3-bit deltas */
  ------------------
  |  |   50|  10.2k|#define THUNDER_3BITDELTAS 0x80 /* 2 pixels w/ encoded 3-bit deltas */
  ------------------
  |  Branch (142:13): [True: 10.2k, False: 31.2k]
  ------------------
  143|  10.2k|                if ((delta = ((n >> 3) & 7)) != DELTA3_SKIP)
  ------------------
  |  |   51|  10.2k|#define DELTA3_SKIP 4           /* skip code for 3-bit deltas */
  ------------------
  |  Branch (143:21): [True: 9.45k, False: 753]
  ------------------
  144|  9.45k|                    SETPIXEL(
  ------------------
  |  |   58|  9.45k|    {                                                                          \
  |  |   59|  9.45k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  9.45k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 9.45k, False: 0]
  |  |  ------------------
  |  |   61|  9.45k|        {                                                                      \
  |  |   62|  9.45k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 4.52k, False: 4.92k]
  |  |  ------------------
  |  |   63|  9.45k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  9.45k|            else                                                               \
  |  |   65|  9.45k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  9.45k|        }                                                                      \
  |  |   67|  9.45k|    }
  ------------------
  145|  10.2k|                        op, (unsigned)((int)lastpixel + threebitdeltas[delta]));
  146|  10.2k|                if ((delta = (n & 7)) != DELTA3_SKIP)
  ------------------
  |  |   51|  10.2k|#define DELTA3_SKIP 4           /* skip code for 3-bit deltas */
  ------------------
  |  Branch (146:21): [True: 9.79k, False: 405]
  ------------------
  147|  9.79k|                    SETPIXEL(
  ------------------
  |  |   58|  9.79k|    {                                                                          \
  |  |   59|  9.79k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  9.79k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 9.52k, False: 275]
  |  |  ------------------
  |  |   61|  9.79k|        {                                                                      \
  |  |   62|  9.52k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 4.76k, False: 4.76k]
  |  |  ------------------
  |  |   63|  9.52k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  9.52k|            else                                                               \
  |  |   65|  9.52k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  9.52k|        }                                                                      \
  |  |   67|  9.79k|    }
  ------------------
  148|  10.2k|                        op, (unsigned)((int)lastpixel + threebitdeltas[delta]));
  149|  10.2k|                break;
  150|  1.93k|            case THUNDER_RAW: /* raw data */
  ------------------
  |  |   52|  1.93k|#define THUNDER_RAW 0xc0        /* raw data encoded */
  ------------------
  |  Branch (150:13): [True: 1.93k, False: 39.5k]
  ------------------
  151|  1.93k|                SETPIXEL(op, n);
  ------------------
  |  |   58|  1.93k|    {                                                                          \
  |  |   59|  1.93k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  1.93k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 1.93k, False: 0]
  |  |  ------------------
  |  |   61|  1.93k|        {                                                                      \
  |  |   62|  1.93k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 968, False: 966]
  |  |  ------------------
  |  |   63|  1.93k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  1.93k|            else                                                               \
  |  |   65|  1.93k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  1.93k|        }                                                                      \
  |  |   67|  1.93k|    }
  ------------------
  152|  1.93k|                break;
  153|      0|            default:
  ------------------
  |  Branch (153:13): [True: 0, False: 41.4k]
  ------------------
  154|      0|                break;
  155|  41.4k|        }
  156|  41.4k|    }
  157|  2.29k|    tif->tif_rawcp = (uint8_t *)bp;
  158|  2.29k|    tif->tif_rawcc = cc;
  159|  2.29k|    if (npixels != maxpixels)
  ------------------
  |  Branch (159:9): [True: 882, False: 1.41k]
  ------------------
  160|    882|    {
  161|    882|        uint8_t *op_end = op0 + (maxpixels + 1) / 2;
  162|    882|        memset(op, 0, (size_t)(op_end - op));
  163|    882|        TIFFErrorExtR(tif, module,
  164|    882|                      "%s data at scanline %lu (%" PRIu64 " != %" PRIu64 ")",
  165|    882|                      npixels < maxpixels ? "Not enough" : "Too much",
  ------------------
  |  Branch (165:23): [True: 504, False: 378]
  ------------------
  166|    882|                      (unsigned long)tif->tif_dir.td_row, (uint64_t)npixels,
  167|    882|                      (uint64_t)maxpixels);
  168|    882|        return (0);
  169|    882|    }
  170|       |
  171|  1.41k|    return (1);
  172|  2.29k|}

TIFFComputeTile:
   37|  1.74M|{
   38|  1.74M|    TIFFDirectory *td = &tif->tif_dir;
   39|  1.74M|    uint32_t dx = td->td_tilewidth;
   40|  1.74M|    uint32_t dy = td->td_tilelength;
   41|  1.74M|    uint32_t dz = td->td_tiledepth;
   42|  1.74M|    uint32_t tile = 1;
   43|       |
   44|  1.74M|    if (td->td_imagedepth == 1)
  ------------------
  |  Branch (44:9): [True: 1.74M, False: 47]
  ------------------
   45|  1.74M|        z = 0;
   46|  1.74M|    if (dx == (uint32_t)-1)
  ------------------
  |  Branch (46:9): [True: 0, False: 1.74M]
  ------------------
   47|      0|        dx = td->td_imagewidth;
   48|  1.74M|    if (dy == (uint32_t)-1)
  ------------------
  |  Branch (48:9): [True: 0, False: 1.74M]
  ------------------
   49|      0|        dy = td->td_imagelength;
   50|  1.74M|    if (dz == (uint32_t)-1)
  ------------------
  |  Branch (50:9): [True: 250, False: 1.74M]
  ------------------
   51|    250|        dz = td->td_imagedepth;
   52|  1.74M|    if (dx != 0 && dy != 0 && dz != 0)
  ------------------
  |  Branch (52:9): [True: 1.74M, False: 0]
  |  Branch (52:20): [True: 1.74M, False: 0]
  |  Branch (52:31): [True: 1.74M, False: 0]
  ------------------
   53|  1.74M|    {
   54|  1.74M|        uint32_t xpt = TIFFhowmany_32(td->td_imagewidth, dx);
  ------------------
  |  |  312|  1.74M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 1.74M, False: 0]
  |  |  ------------------
  |  |  313|  1.74M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  1.74M|         : 0U)
  ------------------
   55|  1.74M|        uint32_t ypt = TIFFhowmany_32(td->td_imagelength, dy);
  ------------------
  |  |  312|  1.74M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 1.74M, False: 0]
  |  |  ------------------
  |  |  313|  1.74M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  1.74M|         : 0U)
  ------------------
   56|  1.74M|        uint32_t zpt = TIFFhowmany_32(td->td_imagedepth, dz);
  ------------------
  |  |  312|  1.74M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 1.74M, False: 0]
  |  |  ------------------
  |  |  313|  1.74M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  1.74M|         : 0U)
  ------------------
   57|  1.74M|        uint32_t xpt_ypt = _TIFFMultiply32(tif, xpt, ypt, "TIFFComputeTile");
   58|  1.74M|        uint32_t xpt_ypt_zpt =
   59|  1.74M|            _TIFFMultiply32(tif, xpt_ypt, zpt, "TIFFComputeTile");
   60|  1.74M|        uint64_t z_offset;
   61|  1.74M|        uint64_t y_offset;
   62|  1.74M|        uint64_t tile64;
   63|       |
   64|  1.74M|        if ((xpt_ypt == 0 && xpt != 0 && ypt != 0) ||
  ------------------
  |  Branch (64:14): [True: 0, False: 1.74M]
  |  Branch (64:30): [True: 0, False: 0]
  |  Branch (64:42): [True: 0, False: 0]
  ------------------
   65|  1.74M|            (xpt_ypt_zpt == 0 && xpt_ypt != 0 && zpt != 0))
  ------------------
  |  Branch (65:14): [True: 0, False: 1.74M]
  |  Branch (65:34): [True: 0, False: 0]
  |  Branch (65:50): [True: 0, False: 0]
  ------------------
   66|      0|            return (0);
   67|       |
   68|  1.74M|        z_offset = _TIFFMultiply64(tif, xpt_ypt, z / dz, "TIFFComputeTile");
   69|  1.74M|        y_offset = _TIFFMultiply64(tif, xpt, y / dy, "TIFFComputeTile");
   70|  1.74M|        if ((z_offset == 0 && xpt_ypt != 0 && (z / dz) != 0) ||
  ------------------
  |  Branch (70:14): [True: 1.74M, False: 0]
  |  Branch (70:31): [True: 1.74M, False: 0]
  |  Branch (70:47): [True: 0, False: 1.74M]
  ------------------
   71|  1.74M|            (y_offset == 0 && xpt != 0 && (y / dy) != 0))
  ------------------
  |  Branch (71:14): [True: 922k, False: 824k]
  |  Branch (71:31): [True: 922k, False: 0]
  |  Branch (71:43): [True: 0, False: 922k]
  ------------------
   72|      0|            return (0);
   73|  1.74M|        tile64 = _TIFFAdd64(tif, z_offset, y_offset, "TIFFComputeTile");
   74|  1.74M|        if (tile64 == 0 && (z_offset != 0 || y_offset != 0))
  ------------------
  |  Branch (74:13): [True: 922k, False: 824k]
  |  Branch (74:29): [True: 0, False: 922k]
  |  Branch (74:46): [True: 0, False: 922k]
  ------------------
   75|      0|            return (0);
   76|  1.74M|        tile64 = _TIFFAdd64(tif, tile64, x / dx, "TIFFComputeTile");
   77|  1.74M|        if (tile64 == 0 && (z_offset != 0 || y_offset != 0 || (x / dx) != 0))
  ------------------
  |  Branch (77:13): [True: 3.72k, False: 1.74M]
  |  Branch (77:29): [True: 0, False: 3.72k]
  |  Branch (77:46): [True: 0, False: 3.72k]
  |  Branch (77:63): [True: 0, False: 3.72k]
  ------------------
   78|      0|            return (0);
   79|  1.74M|        if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.74M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (79:13): [True: 1.38M, False: 364k]
  ------------------
   80|  1.38M|        {
   81|  1.38M|            uint64_t sample_offset;
   82|  1.38M|            if (s >= td->td_samplesperpixel)
  ------------------
  |  Branch (82:17): [True: 0, False: 1.38M]
  ------------------
   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|  1.38M|            sample_offset =
   90|  1.38M|                _TIFFMultiply64(tif, xpt_ypt_zpt, s, "TIFFComputeTile");
   91|  1.38M|            if (sample_offset == 0 && xpt_ypt_zpt != 0 && s != 0)
  ------------------
  |  Branch (91:17): [True: 449k, False: 933k]
  |  Branch (91:39): [True: 449k, False: 0]
  |  Branch (91:59): [True: 0, False: 449k]
  ------------------
   92|      0|                return (0);
   93|  1.38M|            tile64 = _TIFFAdd64(tif, sample_offset, tile64, "TIFFComputeTile");
   94|  1.38M|            if (tile64 == 0 && (sample_offset != 0 || z_offset != 0 ||
  ------------------
  |  Branch (94:17): [True: 689, False: 1.38M]
  |  Branch (94:33): [True: 0, False: 689]
  |  Branch (94:55): [True: 0, False: 689]
  ------------------
   95|    689|                                y_offset != 0 || (x / dx) != 0))
  ------------------
  |  Branch (95:33): [True: 0, False: 689]
  |  Branch (95:50): [True: 0, False: 689]
  ------------------
   96|      0|                return (0);
   97|  1.38M|        }
   98|  1.74M|        tile = _TIFFCastUInt64ToUInt32(tif, tile64, "TIFFComputeTile");
   99|  1.74M|        if (tile == 0 && tile64 != 0)
  ------------------
  |  Branch (99:13): [True: 2.58k, False: 1.74M]
  |  Branch (99:26): [True: 0, False: 2.58k]
  ------------------
  100|      0|            return (0);
  101|  1.74M|    }
  102|  1.74M|    return (tile);
  103|  1.74M|}
TIFFCheckTile:
  110|  1.74M|{
  111|  1.74M|    TIFFDirectory *td = &tif->tif_dir;
  112|       |
  113|  1.74M|    if (x >= td->td_imagewidth)
  ------------------
  |  Branch (113:9): [True: 0, False: 1.74M]
  ------------------
  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.74M|    if (y >= td->td_imagelength)
  ------------------
  |  Branch (119:9): [True: 0, False: 1.74M]
  ------------------
  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.74M|    if (z >= td->td_imagedepth)
  ------------------
  |  Branch (126:9): [True: 0, False: 1.74M]
  ------------------
  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.74M|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  266|  3.49M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (132:9): [True: 1.38M, False: 364k]
  ------------------
  133|  1.38M|        s >= td->td_samplesperpixel)
  ------------------
  |  Branch (133:9): [True: 607, False: 1.38M]
  ------------------
  134|    607|    {
  135|    607|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Sample out of range, max %lu",
  136|    607|                      (unsigned long)s,
  137|    607|                      (unsigned long)(td->td_samplesperpixel - 1));
  138|    607|        return (0);
  139|    607|    }
  140|  1.74M|    return (1);
  141|  1.74M|}
TIFFNumberOfTiles:
  147|  2.72k|{
  148|  2.72k|    TIFFDirectory *td = &tif->tif_dir;
  149|  2.72k|    uint32_t dx = td->td_tilewidth;
  150|  2.72k|    uint32_t dy = td->td_tilelength;
  151|  2.72k|    uint32_t dz = td->td_tiledepth;
  152|  2.72k|    uint32_t ntiles;
  153|       |
  154|  2.72k|    if (dx == (uint32_t)-1)
  ------------------
  |  Branch (154:9): [True: 0, False: 2.72k]
  ------------------
  155|      0|        dx = td->td_imagewidth;
  156|  2.72k|    if (dy == (uint32_t)-1)
  ------------------
  |  Branch (156:9): [True: 0, False: 2.72k]
  ------------------
  157|      0|        dy = td->td_imagelength;
  158|  2.72k|    if (dz == (uint32_t)-1)
  ------------------
  |  Branch (158:9): [True: 4, False: 2.72k]
  ------------------
  159|      4|        dz = td->td_imagedepth;
  160|  2.72k|    ntiles =
  161|  2.72k|        (dx == 0 || dy == 0 || dz == 0)
  ------------------
  |  Branch (161:10): [True: 14, False: 2.71k]
  |  Branch (161:21): [True: 9, False: 2.70k]
  |  Branch (161:32): [True: 1, False: 2.70k]
  ------------------
  162|  2.72k|            ? 0
  163|  2.72k|            : _TIFFMultiply32(
  164|  2.70k|                  tif,
  165|  2.70k|                  _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),
  ------------------
  |  |  312|  2.70k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.70k, False: 0]
  |  |  ------------------
  |  |  313|  2.70k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.70k|         : 0U)
  ------------------
  166|  2.70k|                                  TIFFhowmany_32(td->td_imagelength, dy),
  ------------------
  |  |  312|  2.70k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.70k, False: 2]
  |  |  ------------------
  |  |  313|  2.70k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.70k|         : 0U)
  ------------------
  167|  2.70k|                                  "TIFFNumberOfTiles"),
  168|  2.70k|                  TIFFhowmany_32(td->td_imagedepth, dz), "TIFFNumberOfTiles");
  ------------------
  |  |  312|  2.70k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.70k, False: 2]
  |  |  ------------------
  |  |  313|  2.70k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.70k|         : 0U)
  ------------------
  169|  2.72k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  2.72k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (169:9): [True: 719, False: 2.00k]
  ------------------
  170|    719|        ntiles = _TIFFMultiply32(tif, ntiles, td->td_samplesperpixel,
  171|    719|                                 "TIFFNumberOfTiles");
  172|  2.72k|    return (ntiles);
  173|  2.72k|}
TIFFTileRowSize64:
  179|  1.08M|{
  180|  1.08M|    static const char module[] = "TIFFTileRowSize64";
  181|  1.08M|    TIFFDirectory *td = &tif->tif_dir;
  182|  1.08M|    uint64_t rowsize;
  183|  1.08M|    uint64_t tilerowsize;
  184|       |
  185|  1.08M|    if (td->td_tilelength == 0)
  ------------------
  |  Branch (185:9): [True: 0, False: 1.08M]
  ------------------
  186|      0|    {
  187|      0|        TIFFErrorExtR(tif, module, "Tile length is zero");
  188|      0|        return 0;
  189|      0|    }
  190|  1.08M|    if (td->td_tilewidth == 0)
  ------------------
  |  Branch (190:9): [True: 0, False: 1.08M]
  ------------------
  191|      0|    {
  192|      0|        TIFFErrorExtR(tif, module, "Tile width is zero");
  193|      0|        return (0);
  194|      0|    }
  195|  1.08M|    rowsize = _TIFFMultiply64(tif, td->td_bitspersample, td->td_tilewidth,
  196|  1.08M|                              "TIFFTileRowSize");
  197|  1.08M|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.08M|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (197:9): [True: 622k, False: 458k]
  ------------------
  198|   622k|    {
  199|   622k|        if (td->td_samplesperpixel == 0)
  ------------------
  |  Branch (199:13): [True: 0, False: 622k]
  ------------------
  200|      0|        {
  201|      0|            TIFFErrorExtR(tif, module, "Samples per pixel is zero");
  202|      0|            return 0;
  203|      0|        }
  204|   622k|        rowsize = _TIFFMultiply64(tif, rowsize, td->td_samplesperpixel,
  205|   622k|                                  "TIFFTileRowSize");
  206|   622k|    }
  207|  1.08M|    tilerowsize = TIFFhowmany8_64(rowsize);
  ------------------
  |  |  326|  1.08M|    (((x) & 0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
  |  |  ------------------
  |  |  |  Branch (326:6): [True: 104k, False: 976k]
  |  |  ------------------
  ------------------
  208|  1.08M|    if (tilerowsize == 0)
  ------------------
  |  Branch (208:9): [True: 0, False: 1.08M]
  ------------------
  209|      0|    {
  210|      0|        TIFFErrorExtR(tif, module, "Computed tile row size is zero");
  211|      0|        return 0;
  212|      0|    }
  213|  1.08M|    return (tilerowsize);
  214|  1.08M|}
TIFFTileRowSize:
  216|   857k|{
  217|   857k|    static const char module[] = "TIFFTileRowSize";
  218|   857k|    uint64_t m;
  219|   857k|    m = TIFFTileRowSize64(tif);
  220|   857k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  221|   857k|}
TIFFVTileSize64:
  227|   228k|{
  228|   228k|    return _TIFFStrileSize64(tif, nrows, /* isStrip = */ FALSE);
  ------------------
  |  |   72|   228k|#define FALSE 0
  ------------------
  229|   228k|}
TIFFTileSize64:
  243|   228k|{
  244|   228k|    return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength));
  245|   228k|}
TIFFTileSize:
  247|   218k|{
  248|   218k|    static const char module[] = "TIFFTileSize";
  249|   218k|    uint64_t m;
  250|   218k|    m = TIFFTileSize64(tif);
  251|   218k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  252|   218k|}

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

TIFFSetWarningHandler:
   33|  6.25k|{
   34|  6.25k|    TIFFErrorHandler prev = _TIFFwarningHandler;
   35|  6.25k|    _TIFFwarningHandler = handler;
   36|  6.25k|    return (prev);
   37|  6.25k|}
TIFFWarningExtR:
   81|  1.31M|{
   82|  1.31M|    va_list ap;
   83|  1.31M|    if (tif && tif->tif_warnhandler)
  ------------------
  |  Branch (83:9): [True: 1.31M, False: 0]
  |  Branch (83:16): [True: 0, False: 1.31M]
  ------------------
   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.31M|    if (_TIFFwarningHandler)
  ------------------
  |  Branch (92:9): [True: 1.31M, False: 0]
  ------------------
   93|  1.31M|    {
   94|  1.31M|        va_start(ap, fmt);
   95|  1.31M|        (*_TIFFwarningHandler)(module, fmt, ap);
   96|  1.31M|        va_end(ap);
   97|  1.31M|    }
   98|  1.31M|    if (_TIFFwarningHandlerExt)
  ------------------
  |  Branch (98:9): [True: 0, False: 1.31M]
  ------------------
   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.31M|}

TIFFInitZIP:
  711|    198|{
  712|    198|    static const char module[] = "TIFFInitZIP";
  713|    198|    ZIPState *sp;
  714|       |
  715|    198|    assert((scheme == COMPRESSION_DEFLATE) ||
  ------------------
  |  Branch (715:5): [True: 198, False: 0]
  |  Branch (715:5): [True: 0, False: 0]
  |  Branch (715:5): [True: 2, False: 196]
  |  Branch (715:5): [True: 196, False: 0]
  ------------------
  716|    198|           (scheme == COMPRESSION_ADOBE_DEFLATE));
  717|       |#ifdef NDEBUG
  718|       |    (void)scheme;
  719|       |#endif
  720|       |
  721|       |    /*
  722|       |     * Merge codec-specific tag information.
  723|       |     */
  724|    198|    if (!_TIFFMergeFields(tif, zipFields, TIFFArrayCount(zipFields)))
  ------------------
  |  |  339|    198|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (724:9): [True: 0, False: 198]
  ------------------
  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|    198|    tif->tif_data = (uint8_t *)_TIFFcallocExt(tif, sizeof(ZIPState), 1);
  735|    198|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (735:9): [True: 0, False: 198]
  ------------------
  736|      0|        goto bad;
  737|    198|    sp = GetZIPState(tif);
  ------------------
  |  |   88|    198|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  738|    198|    sp->stream.zalloc = TIFF_zalloc;
  739|    198|    sp->stream.zfree = TIFF_zfree;
  740|    198|    sp->stream.opaque = tif;
  741|    198|    sp->stream.data_type = Z_BINARY;
  742|       |
  743|       |    /*
  744|       |     * Override parent get/set field methods.
  745|       |     */
  746|    198|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  747|    198|    tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */
  748|    198|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  749|    198|    tif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */
  750|       |
  751|       |    /* Default values for codec-specific fields */
  752|    198|    sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */
  753|    198|    sp->state = 0;
  754|       |#if LIBDEFLATE_SUPPORT
  755|       |    sp->subcodec = DEFLATE_SUBCODEC_LIBDEFLATE;
  756|       |#else
  757|    198|    sp->subcodec = DEFLATE_SUBCODEC_ZLIB;
  ------------------
  |  |  767|    198|#define DEFLATE_SUBCODEC_ZLIB 0
  ------------------
  758|    198|#endif
  759|       |
  760|       |    /*
  761|       |     * Install codec methods.
  762|       |     */
  763|    198|    tif->tif_fixuptags = ZIPFixupTags;
  764|    198|    tif->tif_setupdecode = ZIPSetupDecode;
  765|    198|    tif->tif_predecode = ZIPPreDecode;
  766|    198|    tif->tif_decoderow = ZIPDecode;
  767|    198|    tif->tif_decodestrip = ZIPDecode;
  768|    198|    tif->tif_decodetile = ZIPDecode;
  769|    198|    tif->tif_setupencode = ZIPSetupEncode;
  770|    198|    tif->tif_preencode = ZIPPreEncode;
  771|    198|    tif->tif_postencode = ZIPPostEncode;
  772|    198|    tif->tif_encoderow = ZIPEncode;
  773|    198|    tif->tif_encodestrip = ZIPEncode;
  774|    198|    tif->tif_encodetile = ZIPEncode;
  775|    198|    tif->tif_cleanup = ZIPCleanup;
  776|    198|    tif->tif_getmaxcompressionratio = ZIPGetMaxCompressionRatio;
  777|       |    /*
  778|       |     * Setup predictor setup.
  779|       |     */
  780|    198|    (void)TIFFPredictorInit(tif);
  781|    198|    return (1);
  782|      0|bad:
  783|      0|    TIFFErrorExtR(tif, module, "No space for ZIP state block");
  784|      0|    return (0);
  785|    198|}
tif_zip.c:TIFF_zalloc:
  685|    316|{
  686|    316|    static const char module[] = "TIFF_zalloc";
  687|    316|    TIFF *tif = (TIFF *)opaque;
  688|       |
  689|    316|    if (items > ~(size_t)0 / size)
  ------------------
  |  Branch (689:9): [True: 0, False: 316]
  ------------------
  690|      0|    {
  691|      0|        TIFFErrorExtR(tif, module, "Overflow");
  692|      0|        return NULL;
  693|      0|    }
  694|       |
  695|    316|    return _TIFFmallocExt(tif, items * size);
  696|    316|}
tif_zip.c:TIFF_zfree:
  699|    316|{
  700|    316|    _TIFFfreeExt((TIFF *)opaque, ptr);
  701|    316|}
tif_zip.c:ZIPVGetField:
  658|  2.75k|{
  659|  2.75k|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|  2.75k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  660|       |
  661|  2.75k|    switch (tag)
  662|  2.75k|    {
  663|      0|        case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  739|      0|#define TIFFTAG_ZIPQUALITY 65557      /* compression quality level */
  ------------------
  |  Branch (663:9): [True: 0, False: 2.75k]
  ------------------
  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.75k]
  ------------------
  668|      0|            *va_arg(ap, int *) = sp->subcodec;
  669|      0|            break;
  670|       |
  671|  2.75k|        default:
  ------------------
  |  Branch (671:9): [True: 2.75k, False: 0]
  ------------------
  672|  2.75k|            return (*sp->vgetparent)(tif, tag, ap);
  673|  2.75k|    }
  674|      0|    return (1);
  675|  2.75k|}
tif_zip.c:ZIPVSetField:
  591|  1.72k|{
  592|  1.72k|    static const char module[] = "ZIPVSetField";
  593|  1.72k|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|  1.72k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  594|       |
  595|  1.72k|    switch (tag)
  596|  1.72k|    {
  597|      0|        case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  739|      0|#define TIFFTAG_ZIPQUALITY 65557      /* compression quality level */
  ------------------
  |  Branch (597:9): [True: 0, False: 1.72k]
  ------------------
  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: 1.72k]
  ------------------
  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|  1.72k|        default:
  ------------------
  |  Branch (651:9): [True: 1.72k, False: 0]
  ------------------
  652|  1.72k|            return (*sp->vsetparent)(tif, tag, ap);
  653|  1.72k|    }
  654|       |    /*NOTREACHED*/
  655|  1.72k|}
tif_zip.c:ZIPFixupTags:
   96|    186|{
   97|    186|    (void)tif;
   98|    186|    return (1);
   99|    186|}
tif_zip.c:ZIPSetupDecode:
  102|    180|{
  103|    180|    static const char module[] = "ZIPSetupDecode";
  104|    180|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|    180|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|    180|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  105|       |
  106|    180|    assert(sp != NULL);
  ------------------
  |  Branch (106:5): [True: 0, False: 180]
  |  Branch (106:5): [True: 180, False: 0]
  ------------------
  107|       |
  108|       |    /* if we were last encoding, terminate this mode */
  109|    180|    if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|    180|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (109:9): [True: 0, False: 180]
  ------------------
  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|    180|    if ((sp->state & ZSTATE_INIT_DECODE) == 0 &&
  ------------------
  |  |   81|    180|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (118:9): [True: 180, False: 0]
  ------------------
  119|    180|        inflateInit(&sp->stream) != Z_OK)
  ------------------
  |  Branch (119:9): [True: 0, False: 180]
  ------------------
  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|    180|    else
  125|    180|    {
  126|    180|        sp->state |= ZSTATE_INIT_DECODE;
  ------------------
  |  |   81|    180|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  127|    180|        return (1);
  128|    180|    }
  129|    180|}
tif_zip.c:ZIPPreDecode:
  145|  13.0k|{
  146|  13.0k|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|  13.0k|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|  13.0k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  147|       |
  148|  13.0k|    (void)s;
  149|  13.0k|    assert(sp != NULL);
  ------------------
  |  Branch (149:5): [True: 0, False: 13.0k]
  |  Branch (149:5): [True: 13.0k, False: 0]
  ------------------
  150|       |
  151|  13.0k|    if ((sp->state & ZSTATE_INIT_DECODE) == 0)
  ------------------
  |  |   81|  13.0k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (151:9): [True: 0, False: 13.0k]
  ------------------
  152|      0|        tif->tif_setupdecode(tif);
  153|       |
  154|       |#if LIBDEFLATE_SUPPORT
  155|       |    sp->libdeflate_state = -1;
  156|       |#endif
  157|  13.0k|    sp->stream.next_in = tif->tif_rawdata;
  158|  13.0k|    assert(sizeof(sp->stream.avail_in) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (158:5): [True: 0, Folded]
  |  Branch (158:5): [True: 13.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|  13.0k|    sp->stream.avail_in =
  163|  13.0k|        TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)tif->tif_rawcc);
  164|  13.0k|    if (inflateReset(&sp->stream) == Z_OK)
  ------------------
  |  Branch (164:9): [True: 13.0k, False: 0]
  ------------------
  165|  13.0k|    {
  166|  13.0k|        sp->read_error = 0;
  167|  13.0k|        return 1;
  168|  13.0k|    }
  169|      0|    return 0;
  170|  13.0k|}
tif_zip.c:TIFF_CLAMP_UINT64_TO_INT32_MAX:
  137|   124k|{
  138|       |    return (uInt)TIFF_MIN_UINT64(v, INT32_MAX);
  139|   124k|}
tif_zip.c:TIFF_MIN_UINT64:
  132|   124k|{
  133|   124k|    return a < b ? a : b;
  ------------------
  |  Branch (133:12): [True: 124k, False: 0]
  ------------------
  134|   124k|}
tif_zip.c:ZIPDecode:
  173|  52.6k|{
  174|  52.6k|    static const char module[] = "ZIPDecode";
  175|  52.6k|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|  52.6k|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|  52.6k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  176|       |
  177|  52.6k|    (void)s;
  178|  52.6k|    assert(sp != NULL);
  ------------------
  |  Branch (178:5): [True: 0, False: 52.6k]
  |  Branch (178:5): [True: 52.6k, False: 0]
  ------------------
  179|  52.6k|    assert(sp->state == ZSTATE_INIT_DECODE);
  ------------------
  |  Branch (179:5): [True: 0, False: 52.6k]
  |  Branch (179:5): [True: 52.6k, False: 0]
  ------------------
  180|       |
  181|  52.6k|    if (sp->read_error)
  ------------------
  |  Branch (181:9): [True: 2, False: 52.6k]
  ------------------
  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|  52.6k|    sp->stream.next_in = tif->tif_rawcp;
  270|       |
  271|  52.6k|    sp->stream.next_out = op;
  272|  52.6k|    assert(sizeof(sp->stream.avail_out) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (272:5): [True: 0, Folded]
  |  Branch (272:5): [True: 52.6k, 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|  52.6k|    do
  277|  55.7k|    {
  278|  55.7k|        int state;
  279|  55.7k|        uInt avail_in_before =
  280|  55.7k|            TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)tif->tif_rawcc);
  281|  55.7k|        uInt avail_out_before = TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)occ);
  282|  55.7k|        sp->stream.avail_in = avail_in_before;
  283|  55.7k|        sp->stream.avail_out = avail_out_before;
  284|  55.7k|        state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
  285|  55.7k|        tif->tif_rawcc -= (avail_in_before - sp->stream.avail_in);
  286|  55.7k|        occ -= (avail_out_before - sp->stream.avail_out);
  287|  55.7k|        if (state == Z_STREAM_END)
  ------------------
  |  Branch (287:13): [True: 189, False: 55.5k]
  ------------------
  288|    189|            break;
  289|  55.5k|        if (state == Z_DATA_ERROR)
  ------------------
  |  Branch (289:13): [True: 8.00k, False: 47.5k]
  ------------------
  290|  8.00k|        {
  291|  8.00k|            memset(sp->stream.next_out, 0, (size_t)occ);
  292|  8.00k|            TIFFErrorExtR(tif, module, "Decoding error at scanline %lu, %s",
  293|  8.00k|                          (unsigned long)tif->tif_dir.td_row, SAFE_MSG(sp));
  ------------------
  |  |   60|  8.00k|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 0, False: 8.00k]
  |  |  ------------------
  ------------------
  294|  8.00k|            sp->read_error = 1;
  295|  8.00k|            return (0);
  296|  8.00k|        }
  297|  47.5k|        if (state != Z_OK)
  ------------------
  |  Branch (297:13): [True: 3.30k, False: 44.2k]
  ------------------
  298|  3.30k|        {
  299|  3.30k|            memset(sp->stream.next_out, 0, (size_t)occ);
  300|  3.30k|            TIFFErrorExtR(tif, module, "ZLib error: %s", SAFE_MSG(sp));
  ------------------
  |  |   60|  3.30k|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 3.30k, False: 0]
  |  |  ------------------
  ------------------
  301|  3.30k|            sp->read_error = 1;
  302|  3.30k|            return (0);
  303|  3.30k|        }
  304|  47.5k|    } while (occ > 0);
  ------------------
  |  Branch (304:14): [True: 3.16k, False: 41.1k]
  ------------------
  305|  41.3k|    if (occ != 0)
  ------------------
  |  Branch (305:9): [True: 189, False: 41.1k]
  ------------------
  306|    189|    {
  307|    189|        TIFFErrorExtR(tif, module,
  308|    189|                      "Not enough data at scanline %lu (short %" PRIu64
  309|    189|                      " bytes)",
  310|    189|                      (unsigned long)tif->tif_dir.td_row, (uint64_t)occ);
  311|    189|        memset(sp->stream.next_out, 0, (size_t)occ);
  312|    189|        sp->read_error = 1;
  313|    189|        return (0);
  314|    189|    }
  315|       |
  316|  41.1k|    tif->tif_rawcp = sp->stream.next_in;
  317|       |
  318|  41.1k|    return (1);
  319|  41.3k|}
tif_zip.c:ZIPCleanup:
  556|    198|{
  557|    198|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|    198|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  558|       |
  559|    198|    assert(sp != 0);
  ------------------
  |  Branch (559:5): [True: 0, False: 198]
  |  Branch (559:5): [True: 198, False: 0]
  ------------------
  560|       |
  561|    198|    (void)TIFFPredictorCleanup(tif);
  562|       |
  563|    198|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
  564|    198|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
  565|       |
  566|    198|    if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|    198|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (566:9): [True: 0, False: 198]
  ------------------
  567|      0|    {
  568|      0|        deflateEnd(&sp->stream);
  569|      0|        sp->state = 0;
  570|      0|    }
  571|    198|    else if (sp->state & ZSTATE_INIT_DECODE)
  ------------------
  |  |   81|    198|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (571:14): [True: 180, False: 18]
  ------------------
  572|    180|    {
  573|    180|        inflateEnd(&sp->stream);
  574|    180|        sp->state = 0;
  575|    180|    }
  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|    198|    _TIFFfreeExt(tif, sp);
  585|    198|    tif->tif_data = NULL;
  586|       |
  587|    198|    _TIFFSetDefaultCompressionState(tif);
  588|    198|}
tif_zip.c:ZIPGetMaxCompressionRatio:
  704|     12|{
  705|     12|    (void)tif;
  706|       |    /* cf https://zlib.net/zlib_tech.html */
  707|     12|    return 1032;
  708|     12|}

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

inflate_fast:
   50|  49.8k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  49.8k|    struct inflate_state FAR *state;
   52|  49.8k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  49.8k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  49.8k|    unsigned char FAR *out;     /* local strm->next_out */
   55|  49.8k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  49.8k|    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|  49.8k|    unsigned wsize;             /* window size or zero if not using window */
   61|  49.8k|    unsigned whave;             /* valid bytes in the window */
   62|  49.8k|    unsigned wnext;             /* window write index */
   63|  49.8k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  49.8k|    unsigned long hold;         /* local strm->hold */
   65|  49.8k|    unsigned bits;              /* local strm->bits */
   66|  49.8k|    code const FAR *lcode;      /* local strm->lencode */
   67|  49.8k|    code const FAR *dcode;      /* local strm->distcode */
   68|  49.8k|    unsigned lmask;             /* mask for first level of length codes */
   69|  49.8k|    unsigned dmask;             /* mask for first level of distance codes */
   70|  49.8k|    code const *here;           /* retrieved table entry */
   71|  49.8k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  49.8k|    unsigned len;               /* match length, unused bytes */
   74|  49.8k|    unsigned dist;              /* match distance */
   75|  49.8k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  49.8k|    state = (struct inflate_state FAR *)strm->state;
   79|  49.8k|    in = strm->next_in;
   80|  49.8k|    last = in + (strm->avail_in - 5);
   81|  49.8k|    out = strm->next_out;
   82|  49.8k|    beg = out - (start - strm->avail_out);
   83|  49.8k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  49.8k|    wsize = state->wsize;
   88|  49.8k|    whave = state->whave;
   89|  49.8k|    wnext = state->wnext;
   90|  49.8k|    window = state->window;
   91|  49.8k|    hold = state->hold;
   92|  49.8k|    bits = state->bits;
   93|  49.8k|    lcode = state->lencode;
   94|  49.8k|    dcode = state->distcode;
   95|  49.8k|    lmask = (1U << state->lenbits) - 1;
   96|  49.8k|    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|  3.70M|    do {
  101|  3.70M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.52M, False: 2.17M]
  ------------------
  102|  1.52M|            hold += (unsigned long)(*in++) << bits;
  103|  1.52M|            bits += 8;
  104|  1.52M|            hold += (unsigned long)(*in++) << bits;
  105|  1.52M|            bits += 8;
  106|  1.52M|        }
  107|  3.70M|        here = lcode + (hold & lmask);
  108|  3.91M|      dolen:
  109|  3.91M|        op = (unsigned)(here->bits);
  110|  3.91M|        hold >>= op;
  111|  3.91M|        bits -= op;
  112|  3.91M|        op = (unsigned)(here->op);
  113|  3.91M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 3.11M, False: 799k]
  ------------------
  114|  3.11M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  3.11M|                    "inflate:         literal '%c'\n" :
  116|  3.11M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  3.11M|            *out++ = (unsigned char)(here->val);
  118|  3.11M|        }
  119|   799k|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 585k, False: 213k]
  ------------------
  120|   585k|            len = (unsigned)(here->val);
  121|   585k|            op &= 15;                           /* number of extra bits */
  122|   585k|            if (op) {
  ------------------
  |  Branch (122:17): [True: 239k, False: 345k]
  ------------------
  123|   239k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 28.1k, False: 211k]
  ------------------
  124|  28.1k|                    hold += (unsigned long)(*in++) << bits;
  125|  28.1k|                    bits += 8;
  126|  28.1k|                }
  127|   239k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   239k|                hold >>= op;
  129|   239k|                bits -= op;
  130|   239k|            }
  131|   585k|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|   585k|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 246k, False: 339k]
  ------------------
  133|   246k|                hold += (unsigned long)(*in++) << bits;
  134|   246k|                bits += 8;
  135|   246k|                hold += (unsigned long)(*in++) << bits;
  136|   246k|                bits += 8;
  137|   246k|            }
  138|   585k|            here = dcode + (hold & dmask);
  139|   675k|          dodist:
  140|   675k|            op = (unsigned)(here->bits);
  141|   675k|            hold >>= op;
  142|   675k|            bits -= op;
  143|   675k|            op = (unsigned)(here->op);
  144|   675k|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 585k, False: 89.9k]
  ------------------
  145|   585k|                dist = (unsigned)(here->val);
  146|   585k|                op &= 15;                       /* number of extra bits */
  147|   585k|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 31.2k, False: 554k]
  ------------------
  148|  31.2k|                    hold += (unsigned long)(*in++) << bits;
  149|  31.2k|                    bits += 8;
  150|  31.2k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 31.2k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  31.2k|                }
  155|   585k|                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|   585k|                hold >>= op;
  165|   585k|                bits -= op;
  166|   585k|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|   585k|                op = (unsigned)(out - beg);     /* max distance in output */
  168|   585k|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 1.13k, False: 584k]
  ------------------
  169|  1.13k|                    op = dist - op;             /* distance back in window */
  170|  1.13k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 185, False: 947]
  ------------------
  171|    185|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 185, False: 0]
  ------------------
  172|    185|                            strm->msg = (z_const char *)
  173|    185|                                "invalid distance too far back";
  174|    185|                            state->mode = BAD;
  175|    185|                            break;
  176|    185|                        }
  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|    185|                    }
  197|    947|                    from = window;
  198|    947|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 0, False: 947]
  ------------------
  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|    947|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 1, False: 946]
  ------------------
  209|      1|                        from += wsize + wnext - op;
  210|      1|                        op -= wnext;
  211|      1|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 0, False: 1]
  ------------------
  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|      1|                    }
  227|    946|                    else {                      /* contiguous in window */
  228|    946|                        from += wnext - op;
  229|    946|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 890, False: 56]
  ------------------
  230|    890|                            len -= op;
  231|  23.4k|                            do {
  232|  23.4k|                                *out++ = *from++;
  233|  23.4k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 22.5k, False: 890]
  ------------------
  234|    890|                            from = out - dist;  /* rest from output */
  235|    890|                        }
  236|    946|                    }
  237|  65.1k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 64.1k, False: 947]
  ------------------
  238|  64.1k|                        *out++ = *from++;
  239|  64.1k|                        *out++ = *from++;
  240|  64.1k|                        *out++ = *from++;
  241|  64.1k|                        len -= 3;
  242|  64.1k|                    }
  243|    947|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 645, False: 302]
  ------------------
  244|    645|                        *out++ = *from++;
  245|    645|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 431, False: 214]
  ------------------
  246|    431|                            *out++ = *from++;
  247|    645|                    }
  248|    947|                }
  249|   584k|                else {
  250|   584k|                    from = out - dist;          /* copy direct from output */
  251|  40.6M|                    do {                        /* minimum length is three */
  252|  40.6M|                        *out++ = *from++;
  253|  40.6M|                        *out++ = *from++;
  254|  40.6M|                        *out++ = *from++;
  255|  40.6M|                        len -= 3;
  256|  40.6M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 40.0M, False: 584k]
  ------------------
  257|   584k|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 107k, False: 477k]
  ------------------
  258|   107k|                        *out++ = *from++;
  259|   107k|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 64.7k, False: 42.5k]
  ------------------
  260|  64.7k|                            *out++ = *from++;
  261|   107k|                    }
  262|   584k|                }
  263|   585k|            }
  264|  89.9k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 89.6k, False: 211]
  ------------------
  265|  89.6k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  89.6k|                goto dodist;
  267|  89.6k|            }
  268|    211|            else {
  269|    211|                strm->msg = (z_const char *)"invalid distance code";
  270|    211|                state->mode = BAD;
  271|    211|                break;
  272|    211|            }
  273|   675k|        }
  274|   213k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 208k, False: 5.22k]
  ------------------
  275|   208k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|   208k|            goto dolen;
  277|   208k|        }
  278|  5.22k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 5.22k, False: 0]
  ------------------
  279|  5.22k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  5.22k|            state->mode = TYPE;
  281|  5.22k|            break;
  282|  5.22k|        }
  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|  3.91M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 3.69M, False: 2.67k]
  |  Branch (288:27): [True: 3.65M, False: 41.5k]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|  49.8k|    len = bits >> 3;
  292|  49.8k|    in -= len;
  293|  49.8k|    bits -= len << 3;
  294|  49.8k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|  49.8k|    strm->next_in = in;
  298|  49.8k|    strm->next_out = out;
  299|  49.8k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 48.3k, False: 1.48k]
  ------------------
  300|  49.8k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 8.24k, False: 41.5k]
  ------------------
  301|  41.5k|                                 257 + (end - out) : 257 - (out - end));
  302|  49.8k|    state->hold = hold;
  303|  49.8k|    state->bits = bits;
  304|  49.8k|    return;
  305|  49.8k|}

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

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

zcalloc:
  299|    270|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  300|    270|    (void)opaque;
  301|    270|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (301:12): [True: 270, Folded]
  ------------------
  302|    270|                              (voidpf)calloc(items, size);
  303|    270|}
zcfree:
  305|    270|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  306|    270|    (void)opaque;
  307|    270|    free(ptr);
  308|    270|}

