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

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

jpeg_CreateDecompress:
   40|  61.5k|{
   41|  61.5k|  int i;
   42|       |
   43|       |  /* Guard against version mismatches between library and caller. */
   44|  61.5k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   45|  61.5k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  61.5k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (45:7): [True: 0, False: 61.5k]
  ------------------
   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|  61.5k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (47:7): [True: 0, False: 61.5k]
  ------------------
   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|  61.5k|             (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|  61.5k|  {
   58|  61.5k|    struct jpeg_error_mgr *err = cinfo->err;
   59|  61.5k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   60|  61.5k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   61|  61.5k|    cinfo->err = err;
   62|  61.5k|    cinfo->client_data = client_data;
   63|  61.5k|  }
   64|  61.5k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  210|  61.5k|#define TRUE    1
  ------------------
   65|       |
   66|       |  /* Initialize a memory manager instance for this object */
   67|  61.5k|  jinit_memory_mgr((j_common_ptr)cinfo);
   68|       |
   69|       |  /* Zero out pointers to permanent structures. */
   70|  61.5k|  cinfo->progress = NULL;
   71|  61.5k|  cinfo->src = NULL;
   72|       |
   73|   307k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|   307k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 246k, False: 61.5k]
  ------------------
   74|   246k|    cinfo->quant_tbl_ptrs[i] = NULL;
   75|       |
   76|   307k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   307k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (76:15): [True: 246k, False: 61.5k]
  ------------------
   77|   246k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   78|   246k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   79|   246k|  }
   80|       |
   81|       |  /* Initialize marker processor so application can override methods
   82|       |   * for COM, APPn markers before calling jpeg_read_header.
   83|       |   */
   84|  61.5k|  cinfo->marker_list = NULL;
   85|  61.5k|  jinit_marker_reader(cinfo);
   86|       |
   87|       |  /* And initialize the overall input controller. */
   88|  61.5k|  jinit_input_controller(cinfo);
   89|       |
   90|  61.5k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  61.5k|#define BITS_IN_JSAMPLE  8
  ------------------
   91|       |
   92|       |  /* OK, I'm ready */
   93|  61.5k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  61.5k|#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|  61.5k|  cinfo->master = (struct jpeg_decomp_master *)
   99|  61.5k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  61.5k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  100|  61.5k|                                sizeof(my_decomp_master));
  101|  61.5k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
  102|  61.5k|#ifdef WITH_SIMD
  103|  61.5k|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|  61.5k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  61.5k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  104|  61.5k|#ifndef WITH_SIMDE
  105|  61.5k|  cinfo->master->simd_huffman = 1;
  106|  61.5k|#endif
  107|  61.5k|#endif
  108|  61.5k|}
jpeg_read_header:
  277|   242k|{
  278|   242k|  int retcode;
  279|       |
  280|   242k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|   484k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (280:7): [True: 1, False: 242k]
  ------------------
  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|   242k|  retcode = jpeg_consume_input(cinfo);
  285|       |
  286|   242k|  switch (retcode) {
  ------------------
  |  Branch (286:11): [True: 114k, False: 127k]
  ------------------
  287|   107k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1111|   107k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (287:3): [True: 107k, False: 134k]
  ------------------
  288|   107k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1066|   107k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  289|   107k|    break;
  290|  7.09k|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1112|  7.09k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (290:3): [True: 7.09k, False: 234k]
  ------------------
  291|  7.09k|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (291:9): [True: 6.58k, False: 507]
  ------------------
  292|  6.58k|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|  6.58k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  6.58k|   (*(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|  7.09k|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  298|  7.09k|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1067|  7.09k|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  299|  7.09k|    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: 242k]
  ------------------
  301|       |    /* no work */
  302|      0|    break;
  303|   242k|  }
  304|       |
  305|   108k|  return retcode;
  306|   242k|}
jpeg_consume_input:
  323|   242k|{
  324|   242k|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1065|   242k|#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|   242k|  switch (cinfo->global_state) {
  328|   242k|  case DSTATE_START:
  ------------------
  |  |   48|   242k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (328:3): [True: 242k, False: 0]
  ------------------
  329|       |    /* Start-of-datastream actions: reset appropriate modules */
  330|   242k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  331|       |    /* Initialize application's data source module */
  332|   242k|    (*cinfo->src->init_source) (cinfo);
  333|   242k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|   242k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  334|   242k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|   242k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  335|   242k|  case DSTATE_INHEADER:
  ------------------
  |  |   49|   242k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (335:3): [True: 0, False: 242k]
  ------------------
  336|   242k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  337|   242k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1111|   242k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (337:9): [True: 107k, False: 134k]
  ------------------
  338|       |      /* Set up default parameters based on header data */
  339|   107k|      default_decompress_parms(cinfo);
  340|       |      /* Set global state: ready for start_decompress */
  341|   107k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|   107k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  342|   107k|    }
  343|   242k|    break;
  344|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (344:3): [True: 0, False: 242k]
  ------------------
  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: 242k]
  ------------------
  349|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (349:3): [True: 0, False: 242k]
  ------------------
  350|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (350:3): [True: 0, False: 242k]
  ------------------
  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: 242k]
  ------------------
  352|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (352:3): [True: 0, False: 242k]
  ------------------
  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: 242k]
  ------------------
  354|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (354:3): [True: 0, False: 242k]
  ------------------
  355|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  356|      0|    break;
  357|      0|  default:
  ------------------
  |  Branch (357:3): [True: 0, False: 242k]
  ------------------
  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|   242k|  }
  360|   114k|  return retcode;
  361|   242k|}
jpeg_has_multiple_scans:
  385|  48.7k|{
  386|       |  /* Only valid after jpeg_read_header completes */
  387|  48.7k|  if (cinfo->global_state < DSTATE_READY ||
  ------------------
  |  |   50|  97.4k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (387:7): [True: 0, False: 48.7k]
  ------------------
  388|  48.7k|      cinfo->global_state > DSTATE_STOPPING)
  ------------------
  |  |   58|  48.7k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (388:7): [True: 0, False: 48.7k]
  ------------------
  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|  48.7k|  return cinfo->inputctl->has_multiple_scans;
  391|  48.7k|}
jpeg_finish_decompress:
  405|  38.7k|{
  406|  38.7k|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  77.5k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (406:8): [True: 38.7k, False: 0]
  ------------------
  407|  38.7k|       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: 38.7k, False: 0]
  ------------------
  408|       |    /* Terminate final pass of non-buffered mode */
  409|  38.7k|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (409:9): [True: 0, False: 38.7k]
  ------------------
  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|  38.7k|    (*cinfo->master->finish_output_pass) (cinfo);
  412|  38.7k|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|  38.7k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  413|  38.7k|  } 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|  56.4k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (421:10): [True: 17.6k, False: 38.7k]
  ------------------
  422|  17.6k|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  17.6k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (422:9): [True: 0, False: 17.6k]
  ------------------
  423|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  424|  17.6k|  }
  425|       |  /* Do final cleanup */
  426|  38.7k|  (*cinfo->src->term_source) (cinfo);
  427|       |  /* We can use jpeg_abort to release memory and reset global_state */
  428|  38.7k|  jpeg_abort((j_common_ptr)cinfo);
  429|  38.7k|  return TRUE;
  ------------------
  |  |  210|  38.7k|#define TRUE    1
  ------------------
  430|  38.7k|}
jdapimin.c:default_decompress_parms:
  140|   107k|{
  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|   107k|  switch (cinfo->num_components) {
  145|  85.0k|  case 1:
  ------------------
  |  Branch (145:3): [True: 85.0k, False: 22.8k]
  ------------------
  146|  85.0k|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  147|  85.0k|    cinfo->out_color_space = JCS_GRAYSCALE;
  148|  85.0k|    break;
  149|       |
  150|  21.8k|  case 3:
  ------------------
  |  Branch (150:3): [True: 21.8k, False: 86.0k]
  ------------------
  151|  21.8k|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (151:9): [True: 69, False: 21.7k]
  ------------------
  152|     69|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  153|  21.7k|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (153:16): [True: 656, False: 21.0k]
  ------------------
  154|    656|      switch (cinfo->Adobe_transform) {
  155|    231|      case 0:
  ------------------
  |  Branch (155:7): [True: 231, False: 425]
  ------------------
  156|    231|        cinfo->jpeg_color_space = JCS_RGB;
  157|    231|        break;
  158|    220|      case 1:
  ------------------
  |  Branch (158:7): [True: 220, False: 436]
  ------------------
  159|    220|        cinfo->jpeg_color_space = JCS_YCbCr;
  160|    220|        break;
  161|    205|      default:
  ------------------
  |  Branch (161:7): [True: 205, False: 451]
  ------------------
  162|    205|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|    205|  ((cinfo)->err->msg_code = (code), \
  |  |  287|    205|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|    205|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  163|    205|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  164|    205|        break;
  165|    656|      }
  166|  21.0k|    } else {
  167|       |      /* Saw no special markers, try to guess from the component IDs */
  168|  21.0k|      int cid0 = cinfo->comp_info[0].component_id;
  169|  21.0k|      int cid1 = cinfo->comp_info[1].component_id;
  170|  21.0k|      int cid2 = cinfo->comp_info[2].component_id;
  171|       |
  172|  21.0k|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (172:11): [True: 15.2k, False: 5.82k]
  |  Branch (172:24): [True: 2.62k, False: 12.6k]
  |  Branch (172:37): [True: 1.44k, False: 1.18k]
  ------------------
  173|  1.44k|#ifdef D_LOSSLESS_SUPPORTED
  174|  1.44k|        if (cinfo->master->lossless)
  ------------------
  |  Branch (174:13): [True: 238, False: 1.20k]
  ------------------
  175|    238|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  176|  1.20k|        else
  177|  1.20k|#endif
  178|  1.20k|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  179|  19.6k|      } else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (179:18): [True: 4.20k, False: 15.4k]
  |  Branch (179:32): [True: 3.92k, False: 286]
  |  Branch (179:46): [True: 3.69k, False: 222]
  ------------------
  180|  3.69k|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  181|  15.9k|      else {
  182|  15.9k|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|  15.9k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  15.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 15.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  15.9k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  15.9k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  15.9k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  183|  15.9k|#ifdef D_LOSSLESS_SUPPORTED
  184|  15.9k|        if (cinfo->master->lossless)
  ------------------
  |  Branch (184:13): [True: 358, False: 15.5k]
  ------------------
  185|    358|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  186|  15.5k|        else
  187|  15.5k|#endif
  188|  15.5k|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  189|  15.9k|      }
  190|  21.0k|    }
  191|       |    /* Always guess RGB is proper output colorspace. */
  192|  21.8k|    cinfo->out_color_space = JCS_RGB;
  193|  21.8k|    break;
  194|       |
  195|    937|  case 4:
  ------------------
  |  Branch (195:3): [True: 937, False: 106k]
  ------------------
  196|    937|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (196:9): [True: 710, False: 227]
  ------------------
  197|    710|      switch (cinfo->Adobe_transform) {
  198|    209|      case 0:
  ------------------
  |  Branch (198:7): [True: 209, False: 501]
  ------------------
  199|    209|        cinfo->jpeg_color_space = JCS_CMYK;
  200|    209|        break;
  201|    207|      case 2:
  ------------------
  |  Branch (201:7): [True: 207, False: 503]
  ------------------
  202|    207|        cinfo->jpeg_color_space = JCS_YCCK;
  203|    207|        break;
  204|    294|      default:
  ------------------
  |  Branch (204:7): [True: 294, False: 416]
  ------------------
  205|    294|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|    294|  ((cinfo)->err->msg_code = (code), \
  |  |  287|    294|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|    294|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  206|    294|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  207|    294|        break;
  208|    710|      }
  209|    710|    } else {
  210|       |      /* No special markers, assume straight CMYK. */
  211|    227|      cinfo->jpeg_color_space = JCS_CMYK;
  212|    227|    }
  213|    937|    cinfo->out_color_space = JCS_CMYK;
  214|    937|    break;
  215|       |
  216|     85|  default:
  ------------------
  |  Branch (216:3): [True: 85, False: 107k]
  ------------------
  217|     85|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  218|     85|    cinfo->out_color_space = JCS_UNKNOWN;
  219|     85|    break;
  220|   107k|  }
  221|       |
  222|       |  /* Set defaults for other decompression parameters. */
  223|   107k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  224|   107k|  cinfo->scale_denom = 1;
  225|   107k|  cinfo->output_gamma = 1.0;
  226|   107k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  207|   107k|#define FALSE   0               /* values of boolean */
  ------------------
  227|   107k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|   107k|#define FALSE   0               /* values of boolean */
  ------------------
  228|   107k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|   107k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  229|   107k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  210|   107k|#define TRUE    1
  ------------------
  230|   107k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  210|   107k|#define TRUE    1
  ------------------
  231|   107k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  207|   107k|#define FALSE   0               /* values of boolean */
  ------------------
  232|       |  /* We set these in case application only sets quantize_colors. */
  233|   107k|  cinfo->dither_mode = JDITHER_FS;
  234|   107k|#ifdef QUANT_2PASS_SUPPORTED
  235|   107k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  210|   107k|#define TRUE    1
  ------------------
  236|       |#else
  237|       |  cinfo->two_pass_quantize = FALSE;
  238|       |#endif
  239|   107k|  cinfo->desired_number_of_colors = 256;
  240|   107k|  cinfo->colormap = NULL;
  241|       |  /* Initialize for no mode change in buffered-image mode. */
  242|   107k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|   107k|#define FALSE   0               /* values of boolean */
  ------------------
  243|   107k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|   107k|#define FALSE   0               /* values of boolean */
  ------------------
  244|   107k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|   107k|#define FALSE   0               /* values of boolean */
  ------------------
  245|   107k|}

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

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|   324k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   324k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 305k, False: 19.0k]
  ------------------
  763|   305k|    entropy->dc_stats[i] = NULL;
  764|   305k|    entropy->ac_stats[i] = NULL;
  765|   305k|  }
  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: 10.7k, False: 8.33k]
  ------------------
  771|       |    /* Create progression status table */
  772|  10.7k|    int *coef_bit_ptr, ci;
  773|  10.7k|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|  10.7k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  10.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|  10.7k|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  10.7k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|  10.7k|                                  sizeof(int));
  777|  10.7k|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  32.9k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 22.1k, False: 10.7k]
  ------------------
  779|  1.44M|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  1.44M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 1.41M, False: 22.1k]
  ------------------
  780|  1.41M|        *coef_bit_ptr++ = -1;
  781|  10.7k|  }
  782|  19.0k|}
jdarith.c:start_pass:
  633|  22.6k|{
  634|  22.6k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  22.6k|  int ci, tbl;
  636|  22.6k|  jpeg_component_info *compptr;
  637|       |
  638|  22.6k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 13.7k, False: 8.88k]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  13.7k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 8.16k, False: 5.60k]
  ------------------
  641|  8.16k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 205, False: 7.96k]
  ------------------
  642|    205|        goto bad;
  643|  8.16k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|  5.60k|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|  5.39k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 213, False: 5.39k]
  |  Branch (645:36): [True: 233, False: 5.15k]
  ------------------
  646|    446|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|  5.15k|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 223, False: 4.93k]
  ------------------
  649|    223|        goto bad;
  650|  5.15k|    }
  651|  12.8k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 4.33k, False: 8.56k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|  4.33k|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 218, False: 4.11k]
  ------------------
  654|    218|        goto bad;
  655|  4.33k|    }
  656|  12.6k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 223, False: 12.4k]
  ------------------
  657|  1.31k|bad:
  658|  1.31k|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.31k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.31k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.31k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.31k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.31k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.31k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|  1.31k|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|  1.31k|    }
  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|  30.0k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 16.2k, False: 13.7k]
  ------------------
  666|  16.2k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  16.2k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  16.2k|      int *prev_coef_bit_ptr =
  669|  16.2k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  16.2k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 4.71k, False: 11.5k]
  |  Branch (670:24): [True: 3.71k, False: 1.00k]
  ------------------
  671|  3.71k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  3.71k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  3.71k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  3.71k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  3.71k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|   278k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  16.2k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 11.5k, False: 4.71k]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|   278k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 136k, False: 142k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 262k, False: 16.2k]
  ------------------
  673|   262k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 52.2k, False: 210k]
  ------------------
  674|  52.2k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|   210k|        else
  676|   210k|          prev_coef_bit_ptr[coefi] = 0;
  677|   262k|      }
  678|   133k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 117k, False: 16.2k]
  ------------------
  679|   117k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 106k, False: 10.0k]
  ------------------
  680|   117k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 37.2k, False: 79.8k]
  ------------------
  681|  37.2k|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  37.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  37.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  37.2k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  37.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|   117k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|   117k|      }
  684|  16.2k|    }
  685|       |    /* Select MCU decoding routine */
  686|  13.7k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 8.55k, False: 5.21k]
  ------------------
  687|  8.55k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 5.34k, False: 3.21k]
  ------------------
  688|  5.34k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|  3.21k|      else
  690|  3.21k|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  8.55k|    } else {
  692|  5.21k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 2.39k, False: 2.81k]
  ------------------
  693|  2.39k|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|  2.81k|      else
  695|  2.81k|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|  5.21k|    }
  697|  13.7k|  } 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|  8.88k|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  3.34k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 5.54k, False: 3.34k]
  |  Branch (701:27): [True: 2.40k, False: 942]
  ------------------
  702|    942|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 520, False: 422]
  |  Branch (702:27): [True: 211, False: 211]
  ------------------
  703|  8.67k|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  8.67k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  8.67k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|  8.88k|    entropy->pub.decode_mcu = decode_mcu;
  706|  8.88k|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  48.1k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 25.4k, False: 22.6k]
  ------------------
  710|  25.4k|    compptr = cinfo->cur_comp_info[ci];
  711|  25.4k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 9.22k, False: 16.2k]
  |  Branch (711:38): [True: 11.5k, False: 4.71k]
  |  Branch (711:56): [True: 8.66k, False: 2.86k]
  ------------------
  712|  17.8k|      tbl = compptr->dc_tbl_no;
  713|  17.8k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  17.8k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 17.8k]
  |  Branch (713:22): [True: 0, False: 17.8k]
  ------------------
  714|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  715|  17.8k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 14.3k, False: 3.49k]
  ------------------
  716|  14.3k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  14.3k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  14.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  14.3k|#define DC_STAT_BINS  64
  ------------------
  718|  17.8k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  17.8k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  17.8k|      entropy->last_dc_val[ci] = 0;
  721|  17.8k|      entropy->dc_context[ci] = 0;
  722|  17.8k|    }
  723|  25.4k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 9.22k, False: 16.2k]
  |  Branch (723:37): [True: 4.71k, False: 11.5k]
  ------------------
  724|  13.9k|      tbl = compptr->ac_tbl_no;
  725|  13.9k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  13.9k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 13.9k]
  |  Branch (725:22): [True: 0, False: 13.9k]
  ------------------
  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|  13.9k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 12.9k, False: 1.03k]
  ------------------
  728|  12.9k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|  12.9k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|  12.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  12.9k|#define AC_STAT_BINS  256
  ------------------
  730|  13.9k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  13.9k|#define AC_STAT_BINS  256
  ------------------
  731|  13.9k|    }
  732|  25.4k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  22.6k|  entropy->c = 0;
  736|  22.6k|  entropy->a = 0;
  737|  22.6k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  22.6k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  22.6k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  22.6k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  22.6k|}
jdarith.c:decode_mcu_DC_first:
  251|  35.5M|{
  252|  35.5M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  35.5M|  JBLOCKROW block;
  254|  35.5M|  unsigned char *st;
  255|  35.5M|  int blkn, ci, tbl, sign;
  256|  35.5M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  35.5M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 847k, False: 34.7M]
  ------------------
  260|   847k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 320k, False: 526k]
  ------------------
  261|   320k|      process_restart(cinfo);
  262|   847k|    entropy->restarts_to_go--;
  263|   847k|  }
  264|       |
  265|  35.5M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   859k|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 859k, False: 34.7M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  69.5M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 34.8M, False: 34.7M]
  ------------------
  270|  34.8M|    block = MCU_data[blkn];
  271|  34.8M|    ci = cinfo->MCU_membership[blkn];
  272|  34.8M|    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|  34.8M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  34.8M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 11.3M, False: 23.4M]
  ------------------
  281|  11.3M|      entropy->dc_context[ci] = 0;
  282|  23.4M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  23.4M|      sign = arith_decode(cinfo, st + 1);
  286|  23.4M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  23.4M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 13.2M, False: 10.2M]
  ------------------
  289|  13.2M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  31.6M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 18.3M, False: 13.2M]
  ------------------
  291|  18.3M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 234, False: 18.3M]
  ------------------
  292|    234|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    234|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    234|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|    234|            entropy->ct = -1;                   /* magnitude overflow */
  294|    234|            return TRUE;
  ------------------
  |  |  210|    234|#define TRUE    1
  ------------------
  295|    234|          }
  296|  18.3M|          st += 1;
  297|  18.3M|        }
  298|  13.2M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  23.4M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 1.55k, False: 23.4M]
  ------------------
  301|  1.55k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  23.4M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 7.39M, False: 16.0M]
  ------------------
  303|  7.39M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  16.0M|      else
  305|  16.0M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  23.4M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  23.4M|      st += 14;
  309|  41.8M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 18.3M, False: 23.4M]
  ------------------
  310|  18.3M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 11.2M, False: 7.17M]
  ------------------
  311|  23.4M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 12.8M, False: 10.6M]
  ------------------
  312|  23.4M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  23.4M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  34.8M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  34.8M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  34.8M|  }
  318|       |
  319|  34.7M|  return TRUE;
  ------------------
  |  |  210|  34.7M|#define TRUE    1
  ------------------
  320|  34.7M|}
jdarith.c:process_restart:
  200|   389k|{
  201|   389k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  202|   389k|  int ci;
  203|   389k|  jpeg_component_info *compptr;
  204|       |
  205|       |  /* Advance past the RSTn marker */
  206|   389k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (206:7): [True: 0, False: 389k]
  ------------------
  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|   801k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (210:16): [True: 412k, False: 389k]
  ------------------
  211|   412k|    compptr = cinfo->cur_comp_info[ci];
  212|   412k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (212:9): [True: 13.4k, False: 399k]
  |  Branch (212:38): [True: 348k, False: 50.7k]
  |  Branch (212:56): [True: 337k, False: 10.9k]
  ------------------
  213|   350k|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|   350k|#define DC_STAT_BINS  64
  ------------------
  214|       |      /* Reset DC predictions to 0 */
  215|   350k|      entropy->last_dc_val[ci] = 0;
  216|   350k|      entropy->dc_context[ci] = 0;
  217|   350k|    }
  218|   412k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (218:9): [True: 13.4k, False: 399k]
  |  Branch (218:37): [True: 50.7k, False: 348k]
  ------------------
  219|  64.1k|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  64.1k|#define AC_STAT_BINS  256
  ------------------
  220|  64.1k|    }
  221|   412k|  }
  222|       |
  223|       |  /* Reset arithmetic decoding variables */
  224|   389k|  entropy->c = 0;
  225|   389k|  entropy->a = 0;
  226|   389k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  227|       |
  228|       |  /* Reset restart counter */
  229|   389k|  entropy->restarts_to_go = cinfo->restart_interval;
  230|   389k|}
jdarith.c:arith_decode:
  116|  1.39G|{
  117|  1.39G|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|  1.39G|  register unsigned char nl, nm;
  119|  1.39G|  register JLONG qe, temp;
  120|  1.39G|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|  1.57G|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 181M, False: 1.39G]
  ------------------
  124|   181M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 23.4M, False: 157M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  23.4M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 23.1M, False: 303k]
  ------------------
  127|  23.1M|        data = 0;               /* stuff zero data */
  128|   303k|      else {
  129|   303k|        data = get_byte(cinfo); /* read next input byte */
  130|   303k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 16.3k, False: 287k]
  ------------------
  131|  34.0k|          do data = get_byte(cinfo);
  132|  34.0k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 17.6k, False: 16.3k]
  ------------------
  133|  16.3k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 2.48k, False: 13.8k]
  ------------------
  134|  2.48k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  13.8k|          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|  13.8k|            cinfo->unread_marker = data;
  143|  13.8k|            data = 0;
  144|  13.8k|          }
  145|  16.3k|        }
  146|   303k|      }
  147|  23.4M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  23.4M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 821k, False: 22.6M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|   821k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 410k, False: 410k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|   410k|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  23.4M|    }
  154|   181M|    e->a <<= 1;
  155|   181M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|  1.39G|  sv = *st;
  161|  1.39G|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|  1.39G|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|  1.39G|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|  1.39G|  temp = e->a - qe;
  167|  1.39G|  e->a = temp;
  168|  1.39G|  temp <<= e->ct;
  169|  1.39G|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 20.0M, False: 1.37G]
  ------------------
  170|  20.0M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  20.0M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 5.89M, False: 14.1M]
  ------------------
  173|  5.89M|      e->a = qe;
  174|  5.89M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  14.1M|    } else {
  176|  14.1M|      e->a = qe;
  177|  14.1M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  14.1M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  14.1M|    }
  180|  1.37G|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 107M, False: 1.26G]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|   107M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 65.7M, False: 41.4M]
  ------------------
  183|  65.7M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  65.7M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  65.7M|    } else {
  186|  41.4M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  41.4M|    }
  188|   107M|  }
  189|       |
  190|  1.39G|  return sv >> 7;
  191|  1.39G|}
jdarith.c:get_byte:
   76|   338k|{
   77|   338k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   338k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 5.31k, False: 332k]
  ------------------
   80|  5.31k|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 5.31k]
  ------------------
   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|   338k|  src->bytes_in_buffer--;
   83|   338k|  return *src->next_input_byte++;
   84|   338k|}
jdarith.c:decode_mcu_AC_first:
  330|  19.3M|{
  331|  19.3M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  19.3M|  JBLOCKROW block;
  333|  19.3M|  unsigned char *st;
  334|  19.3M|  int tbl, sign, k;
  335|  19.3M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  19.3M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 239k, False: 19.1M]
  ------------------
  339|   239k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 7.23k, False: 232k]
  ------------------
  340|  7.23k|      process_restart(cinfo);
  341|   239k|    entropy->restarts_to_go--;
  342|   239k|  }
  343|       |
  344|  19.3M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|  8.99M|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 8.99M, False: 10.3M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  10.3M|  block = MCU_data[0];
  348|  10.3M|  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|  26.3M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 26.3M, False: 4.47k]
  ------------------
  354|  26.3M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  26.3M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 10.3M, False: 15.9M]
  ------------------
  356|  33.0M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 17.0M, False: 15.9M]
  ------------------
  357|  17.0M|      st += 3;  k++;
  358|  17.0M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 618, False: 17.0M]
  ------------------
  359|    618|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    618|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    618|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|    618|        entropy->ct = -1;                       /* spectral overflow */
  361|    618|        return TRUE;
  ------------------
  |  |  210|    618|#define TRUE    1
  ------------------
  362|    618|      }
  363|  17.0M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  15.9M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  15.9M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  15.9M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 9.17M, False: 6.76M]
  ------------------
  370|  9.17M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 9.00M, False: 171k]
  ------------------
  371|  9.00M|        m <<= 1;
  372|  9.00M|        st = entropy->ac_stats[tbl] +
  373|  9.00M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 5.13M, False: 3.87M]
  ------------------
  374|  22.7M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 13.7M, False: 9.00M]
  ------------------
  375|  13.7M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 207, False: 13.7M]
  ------------------
  376|    207|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    207|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    207|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|    207|            entropy->ct = -1;                   /* magnitude overflow */
  378|    207|            return TRUE;
  ------------------
  |  |  210|    207|#define TRUE    1
  ------------------
  379|    207|          }
  380|  13.7M|          st += 1;
  381|  13.7M|        }
  382|  9.00M|      }
  383|  9.17M|    }
  384|  15.9M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  15.9M|    st += 14;
  387|  38.6M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 22.7M, False: 15.9M]
  ------------------
  388|  22.7M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 11.0M, False: 11.6M]
  ------------------
  389|  15.9M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 8.82M, False: 7.12M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  15.9M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  15.9M|  }
  393|       |
  394|  10.3M|  return TRUE;
  ------------------
  |  |  210|  10.3M|#define TRUE    1
  ------------------
  395|  10.3M|}
jdarith.c:decode_mcu_DC_refine:
  404|  2.12M|{
  405|  2.12M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  406|  2.12M|  unsigned char *st;
  407|  2.12M|  int p1, blkn;
  408|       |
  409|       |  /* Process restart marker if needed */
  410|  2.12M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (410:7): [True: 1.26M, False: 863k]
  ------------------
  411|  1.26M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (411:9): [True: 7.84k, False: 1.25M]
  ------------------
  412|  7.84k|      process_restart(cinfo);
  413|  1.26M|    entropy->restarts_to_go--;
  414|  1.26M|  }
  415|       |
  416|  2.12M|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  417|  2.12M|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  418|       |
  419|       |  /* Outer loop handles each block in the MCU */
  420|       |
  421|  4.27M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (421:18): [True: 2.15M, False: 2.12M]
  ------------------
  422|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  423|  2.15M|    if (arith_decode(cinfo, st))
  ------------------
  |  Branch (423:9): [True: 1.12M, False: 1.02M]
  ------------------
  424|  1.12M|      MCU_data[blkn][0][0] |= p1;
  425|  2.15M|  }
  426|       |
  427|  2.12M|  return TRUE;
  ------------------
  |  |  210|  2.12M|#define TRUE    1
  ------------------
  428|  2.12M|}
jdarith.c:decode_mcu_AC_refine:
  437|  2.45M|{
  438|  2.45M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|  2.45M|  JBLOCKROW block;
  440|  2.45M|  JCOEFPTR thiscoef;
  441|  2.45M|  unsigned char *st;
  442|  2.45M|  int tbl, k, kex;
  443|  2.45M|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|  2.45M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 890k, False: 1.56M]
  ------------------
  447|   890k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 43.4k, False: 846k]
  ------------------
  448|  43.4k|      process_restart(cinfo);
  449|   890k|    entropy->restarts_to_go--;
  450|   890k|  }
  451|       |
  452|  2.45M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   916k|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 916k, False: 1.53M]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|  1.53M|  block = MCU_data[0];
  456|  1.53M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|  1.53M|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|  1.53M|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|  1.53M|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|  43.7M|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 42.2M, False: 1.48M]
  ------------------
  463|  42.2M|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 51.6k, False: 42.1M]
  ------------------
  464|       |
  465|  2.50M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 2.48M, False: 16.2k]
  ------------------
  466|  2.48M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|  2.48M|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 2.26M, False: 225k]
  ------------------
  468|  2.26M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 1.51M, False: 742k]
  ------------------
  469|  1.50M|    for (;;) {
  470|  1.50M|      thiscoef = *block + jpeg_natural_order[k];
  471|  1.50M|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 159k, False: 1.35M]
  ------------------
  472|   159k|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 106k, False: 52.2k]
  ------------------
  473|   106k|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 53.2k, False: 53.5k]
  ------------------
  474|  53.2k|            *thiscoef += (JCOEF)m1;
  475|  53.5k|          else
  476|  53.5k|            *thiscoef += (JCOEF)p1;
  477|   106k|        }
  478|   159k|        break;
  479|   159k|      }
  480|  1.35M|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 808k, False: 542k]
  ------------------
  481|   808k|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 424k, False: 384k]
  ------------------
  482|   424k|          *thiscoef = (JCOEF)m1;
  483|   384k|        else
  484|   384k|          *thiscoef = (JCOEF)p1;
  485|   808k|        break;
  486|   808k|      }
  487|   542k|      st += 3;  k++;
  488|   542k|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 342, False: 541k]
  ------------------
  489|    342|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    342|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    342|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|    342|        entropy->ct = -1;                       /* spectral overflow */
  491|    342|        return TRUE;
  ------------------
  |  |  210|    342|#define TRUE    1
  ------------------
  492|    342|      }
  493|   542k|    }
  494|   967k|  }
  495|       |
  496|  1.53M|  return TRUE;
  ------------------
  |  |  210|  1.53M|#define TRUE    1
  ------------------
  497|  1.53M|}
jdarith.c:decode_mcu:
  506|  84.3M|{
  507|  84.3M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  84.3M|  jpeg_component_info *compptr;
  509|  84.3M|  JBLOCKROW block;
  510|  84.3M|  unsigned char *st;
  511|  84.3M|  int blkn, ci, tbl, sign, k;
  512|  84.3M|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  84.3M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 44.3k, False: 84.2M]
  ------------------
  516|  44.3k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 10.5k, False: 33.8k]
  ------------------
  517|  10.5k|      process_restart(cinfo);
  518|  44.3k|    entropy->restarts_to_go--;
  519|  44.3k|  }
  520|       |
  521|  84.3M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|  7.19M|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 7.19M, False: 77.1M]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|   154M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 77.1M, False: 77.1M]
  ------------------
  526|  77.1M|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 77.1M, False: 0]
  ------------------
  527|  77.1M|    ci = cinfo->MCU_membership[blkn];
  528|  77.1M|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|  77.1M|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|  77.1M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|  77.1M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 34.5M, False: 42.5M]
  ------------------
  539|  34.5M|      entropy->dc_context[ci] = 0;
  540|  42.5M|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|  42.5M|      sign = arith_decode(cinfo, st + 1);
  544|  42.5M|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|  42.5M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 23.6M, False: 18.8M]
  ------------------
  547|  23.6M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|  58.8M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 35.1M, False: 23.6M]
  ------------------
  549|  35.1M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 245, False: 35.1M]
  ------------------
  550|    245|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    245|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    245|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|    245|            entropy->ct = -1;                   /* magnitude overflow */
  552|    245|            return TRUE;
  ------------------
  |  |  210|    245|#define TRUE    1
  ------------------
  553|    245|          }
  554|  35.1M|          st += 1;
  555|  35.1M|        }
  556|  23.6M|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|  42.5M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 27.4k, False: 42.5M]
  ------------------
  559|  27.4k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|  42.5M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 10.6M, False: 31.9M]
  ------------------
  561|  10.6M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|  31.9M|      else
  563|  31.9M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|  42.5M|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|  42.5M|      st += 14;
  567|  77.7M|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 35.1M, False: 42.5M]
  ------------------
  568|  35.1M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 3.04M, False: 32.1M]
  ------------------
  569|  42.5M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 21.0M, False: 21.5M]
  ------------------
  570|  42.5M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|  42.5M|    }
  572|       |
  573|  77.1M|    if (block)
  ------------------
  |  Branch (573:9): [True: 77.1M, False: 0]
  ------------------
  574|  77.1M|      (*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|  77.1M|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|   181M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|   181M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 181M, False: 71]
  ------------------
  582|   181M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|   181M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 77.1M, False: 103M]
  ------------------
  584|   265M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 161M, False: 103M]
  ------------------
  585|   161M|        st += 3;  k++;
  586|   161M|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|   161M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 203, False: 161M]
  ------------------
  587|    203|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    203|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    203|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|    203|          entropy->ct = -1;                     /* spectral overflow */
  589|    203|          return TRUE;
  ------------------
  |  |  210|    203|#define TRUE    1
  ------------------
  590|    203|        }
  591|   161M|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|   103M|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|   103M|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|   103M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 53.1M, False: 50.7M]
  ------------------
  598|  53.1M|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 52.1M, False: 1.02M]
  ------------------
  599|  52.1M|          m <<= 1;
  600|  52.1M|          st = entropy->ac_stats[tbl] +
  601|  52.1M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 38.1M, False: 14.0M]
  ------------------
  602|  71.5M|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 19.4M, False: 52.1M]
  ------------------
  603|  19.4M|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 279, False: 19.4M]
  ------------------
  604|    279|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    279|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    279|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|    279|              entropy->ct = -1;                 /* magnitude overflow */
  606|    279|              return TRUE;
  ------------------
  |  |  210|    279|#define TRUE    1
  ------------------
  607|    279|            }
  608|  19.4M|            st += 1;
  609|  19.4M|          }
  610|  52.1M|        }
  611|  53.1M|      }
  612|   103M|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|   103M|      st += 14;
  615|   175M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 71.5M, False: 103M]
  ------------------
  616|  71.5M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 37.0M, False: 34.5M]
  ------------------
  617|   103M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 54.2M, False: 49.6M]
  ------------------
  618|   103M|      if (block)
  ------------------
  |  Branch (618:11): [True: 103M, False: 0]
  ------------------
  619|   103M|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|   103M|    }
  621|  77.1M|  }
  622|       |
  623|  77.1M|  return TRUE;
  ------------------
  |  |  210|  77.1M|#define TRUE    1
  ------------------
  624|  77.1M|}

jinit_d_coef_controller:
  869|  99.2k|{
  870|  99.2k|  my_coef_ptr coef;
  871|       |
  872|  99.2k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  99.2k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 99.2k]
  ------------------
  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|  99.2k|  coef = (my_coef_ptr)
  876|  99.2k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  99.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  99.2k|                                sizeof(my_coef_controller));
  878|  99.2k|  memset(coef, 0, sizeof(my_coef_controller));
  879|  99.2k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|  99.2k|  coef->pub.start_input_pass = start_input_pass;
  881|  99.2k|  coef->pub.start_output_pass = start_output_pass;
  882|  99.2k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|  99.2k|  coef->coef_bits_latch = NULL;
  884|  99.2k|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|  99.2k|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 27.2k, False: 72.0k]
  ------------------
  888|  27.2k|#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|  27.2k|    int ci, access_rows;
  893|  27.2k|    jpeg_component_info *compptr;
  894|       |
  895|  91.7k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 64.5k, False: 27.2k]
  ------------------
  896|  64.5k|         ci++, compptr++) {
  897|  64.5k|      access_rows = compptr->v_samp_factor;
  898|  64.5k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|  64.5k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 38.7k, False: 25.7k]
  ------------------
  901|  38.7k|        access_rows *= 5;
  902|  64.5k|#endif
  903|  64.5k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|  64.5k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  64.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  64.5k|#define TRUE    1
  ------------------
  905|  64.5k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|  64.5k|                               (long)compptr->h_samp_factor),
  907|  64.5k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|  64.5k|                               (long)compptr->v_samp_factor),
  909|  64.5k|         (JDIMENSION)access_rows);
  910|  64.5k|    }
  911|  27.2k|    coef->pub.consume_data = consume_data;
  912|  27.2k|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  27.2k|#define _decompress_data  decompress_data
  ------------------
  913|  27.2k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|  72.0k|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|  72.0k|    JBLOCKROW buffer;
  920|  72.0k|    int i;
  921|       |
  922|  72.0k|    buffer = (JBLOCKROW)
  923|  72.0k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  72.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|  72.0k|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|  72.0k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|   792k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|   792k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 720k, False: 72.0k]
  ------------------
  926|   720k|      coef->MCU_buffer[i] = buffer + i;
  927|   720k|    }
  928|  72.0k|    coef->pub.consume_data = dummy_consume_data;
  929|  72.0k|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|  72.0k|#define _decompress_data  decompress_data
  ------------------
  930|  72.0k|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|  72.0k|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|  99.2k|  coef->workspace = (JCOEF *)
  935|  99.2k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  99.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|  99.2k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  99.2k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|  99.2k|}
jdcoefct-8.c:start_input_pass:
   50|   102k|{
   51|   102k|  cinfo->input_iMCU_row = 0;
   52|   102k|  start_iMCU_row(cinfo);
   53|   102k|}
jdcoefct-8.c:start_output_pass:
   62|  92.4k|{
   63|  92.4k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|  92.4k|  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|  92.4k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 20.9k, False: 71.4k]
  ------------------
   68|  20.9k|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 20.9k, False: 0]
  |  Branch (68:38): [True: 2.17k, False: 18.7k]
  ------------------
   69|  2.17k|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|  2.17k|#define _decompress_data  decompress_data
  ------------------
   70|  18.7k|    else
   71|  18.7k|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  18.7k|#define _decompress_data  decompress_data
  ------------------
   72|  20.9k|  }
   73|  92.4k|#endif
   74|  92.4k|  cinfo->output_iMCU_row = 0;
   75|  92.4k|}
jdcoefct-8.c:smoothing_ok:
  405|  20.9k|{
  406|  20.9k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|  20.9k|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|  20.9k|#define FALSE   0               /* values of boolean */
  ------------------
  408|  20.9k|  int ci, coefi;
  409|  20.9k|  jpeg_component_info *compptr;
  410|  20.9k|  JQUANT_TBL *qtable;
  411|  20.9k|  int *coef_bits, *prev_coef_bits;
  412|  20.9k|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|  20.9k|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 7.12k, False: 13.8k]
  |  Branch (414:35): [True: 0, False: 13.8k]
  ------------------
  415|  7.12k|    return FALSE;
  ------------------
  |  |  207|  7.12k|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|  13.8k|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 13.8k, False: 0]
  ------------------
  419|  13.8k|    coef->coef_bits_latch = (int *)
  420|  13.8k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  13.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|  13.8k|                                  cinfo->num_components * 2 *
  422|  13.8k|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|  13.8k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|  13.8k|  coef_bits_latch = coef->coef_bits_latch;
  424|  13.8k|  prev_coef_bits_latch =
  425|  13.8k|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|  13.8k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|  19.1k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 16.6k, False: 2.59k]
  ------------------
  428|  16.6k|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|  16.6k|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 1.30k, False: 15.2k]
  ------------------
  431|  1.30k|      return FALSE;
  ------------------
  |  |  207|  1.30k|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|  15.2k|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 1.07k, False: 14.2k]
  ------------------
  434|  14.2k|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|  14.2k|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 771, False: 13.4k]
  ------------------
  435|  13.4k|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|  13.4k|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 858, False: 12.5k]
  ------------------
  436|  12.5k|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|  12.5k|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 1.64k, False: 10.9k]
  ------------------
  437|  10.9k|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|  10.9k|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 727, False: 10.2k]
  ------------------
  438|  10.2k|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|  10.2k|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 529, False: 9.69k]
  ------------------
  439|  9.69k|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|  9.69k|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 484, False: 9.20k]
  ------------------
  440|  9.20k|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|  9.20k|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 924, False: 8.28k]
  ------------------
  441|  8.28k|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|  8.28k|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 1.08k, False: 7.19k]
  ------------------
  442|  7.19k|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|  7.19k|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 719, False: 6.47k]
  ------------------
  443|  8.82k|      return FALSE;
  ------------------
  |  |  207|  8.82k|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|  6.47k|    coef_bits = cinfo->coef_bits[ci];
  446|  6.47k|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|  6.47k|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 1.10k, False: 5.37k]
  ------------------
  448|  1.10k|      return FALSE;
  ------------------
  |  |  207|  1.10k|#define FALSE   0               /* values of boolean */
  ------------------
  449|  5.37k|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  53.7k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  53.7k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 48.3k, False: 5.37k]
  ------------------
  452|  48.3k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 15.3k, False: 32.9k]
  ------------------
  453|  15.3k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  32.9k|      else
  455|  32.9k|        prev_coef_bits_latch[coefi] = -1;
  456|  48.3k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  48.3k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 43.0k, False: 5.35k]
  ------------------
  458|  43.0k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  43.0k|#define TRUE    1
  ------------------
  459|  48.3k|    }
  460|  5.37k|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  5.37k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|  5.37k|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  5.37k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|  5.37k|  }
  463|       |
  464|  2.59k|  return smoothing_useful;
  465|  13.8k|}
jdcoefct-8.c:decompress_smooth_data:
  474|   489k|{
  475|   489k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|   489k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|   489k|  JDIMENSION block_num, last_block_column;
  478|   489k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|   489k|    image_block_rows;
  480|   489k|  JBLOCKARRAY buffer;
  481|   489k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|   489k|  JBLOCKROW next_block_row, next_next_block_row;
  483|   489k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|   489k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  484|   489k|  JDIMENSION output_col;
  485|   489k|  jpeg_component_info *compptr;
  486|   489k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|   489k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  487|   489k|  boolean change_dc;
  488|   489k|  JCOEF *workspace;
  489|   489k|  int *coef_bits;
  490|   489k|  JQUANT_TBL *quanttbl;
  491|   489k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|   489k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|   489k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|   489k|      DC25;
  495|   489k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|   489k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|   489k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 489k, False: 0]
  ------------------
  502|   489k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 489k]
  ------------------
  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|   983k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 493k, False: 489k]
  ------------------
  519|   493k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|   493k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 493k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|   493k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 487k, False: 5.81k]
  ------------------
  525|   487k|      block_rows = compptr->v_samp_factor;
  526|   487k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|   487k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 1.97k, False: 3.84k]
  ------------------
  528|  1.97k|      block_rows = compptr->v_samp_factor;
  529|  1.97k|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|  3.84k|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|  3.84k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|  3.84k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 3.60k, False: 233]
  ------------------
  534|  3.84k|      access_rows = block_rows; /* this iMCU row only */
  535|  3.84k|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|   493k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 487k, False: 5.82k]
  ------------------
  538|   487k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|   487k|      buffer = (*cinfo->mem->access_virt_barray)
  540|   487k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|   487k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|   487k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|   487k|#define FALSE   0               /* values of boolean */
  ------------------
  543|   487k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|   487k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 1.98k, False: 3.84k]
  ------------------
  545|  1.98k|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|  1.98k|      buffer = (*cinfo->mem->access_virt_barray)
  547|  1.98k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|  1.98k|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|  1.98k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  1.98k|#define FALSE   0               /* values of boolean */
  ------------------
  550|  1.98k|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|  3.84k|    } else {
  552|  3.84k|      buffer = (*cinfo->mem->access_virt_barray)
  553|  3.84k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|  3.84k|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  3.84k|#define FALSE   0               /* values of boolean */
  ------------------
  555|  3.84k|    }
  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|   493k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 265k, False: 227k]
  ------------------
  561|   265k|      coef_bits =
  562|   265k|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|   265k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|   227k|    else
  564|   227k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|   227k|#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|   493k|    change_dc =
  568|   493k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 491k, False: 1.96k]
  |  Branch (568:29): [True: 490k, False: 1.61k]
  |  Branch (568:51): [True: 489k, False: 420]
  ------------------
  569|   489k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 489k, False: 273]
  |  Branch (569:29): [True: 488k, False: 762]
  |  Branch (569:51): [True: 488k, False: 222]
  ------------------
  570|   488k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 488k, False: 227]
  |  Branch (570:29): [True: 487k, False: 389]
  |  Branch (570:51): [True: 487k, False: 0]
  ------------------
  571|       |
  572|   493k|    quanttbl = compptr->quant_table;
  573|   493k|    Q00 = quanttbl->quantval[0];
  574|   493k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|   493k|#define Q01_POS  1
  ------------------
  575|   493k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|   493k|#define Q10_POS  8
  ------------------
  576|   493k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|   493k|#define Q20_POS  16
  ------------------
  577|   493k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|   493k|#define Q11_POS  9
  ------------------
  578|   493k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|   493k|#define Q02_POS  2
  ------------------
  579|   493k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 487k, False: 5.87k]
  ------------------
  580|   487k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|   487k|#define Q03_POS  3
  ------------------
  581|   487k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|   487k|#define Q12_POS  10
  ------------------
  582|   487k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|   487k|#define Q21_POS  17
  ------------------
  583|   487k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|   487k|#define Q30_POS  24
  ------------------
  584|   487k|    }
  585|   493k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|   493k|#define _inverse_DCT  inverse_DCT
  ------------------
  586|   493k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|   493k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|   987k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 494k, False: 493k]
  ------------------
  590|   494k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|   494k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|   494k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 490k, False: 3.84k]
  ------------------
  594|   490k|        prev_block_row =
  595|   490k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|  3.84k|      else
  597|  3.84k|        prev_block_row = buffer_ptr;
  598|       |
  599|   494k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 488k, False: 5.84k]
  ------------------
  600|   488k|        prev_prev_block_row =
  601|   488k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|  5.84k|      else
  603|  5.84k|        prev_prev_block_row = prev_block_row;
  604|       |
  605|   494k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 490k, False: 3.84k]
  ------------------
  606|   490k|        next_block_row =
  607|   490k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|  3.84k|      else
  609|  3.84k|        next_block_row = buffer_ptr;
  610|       |
  611|   494k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 488k, False: 5.81k]
  ------------------
  612|   488k|        next_next_block_row =
  613|   488k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|  5.81k|      else
  615|  5.81k|        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|   494k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|   494k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|   494k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|   494k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|   494k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|   494k|      output_col = 0;
  626|   494k|      last_block_column = compptr->width_in_blocks - 1;
  627|   494k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  27.8M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 27.3M, False: 494k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  27.3M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  27.3M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 494k, False: 26.8M]
  ------------------
  633|   494k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 489k, False: 4.76k]
  ------------------
  634|   489k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|   489k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|   489k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|   489k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|   489k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|   489k|        }
  640|  27.3M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 26.3M, False: 983k]
  ------------------
  641|  26.3M|          DC05 = (int)prev_prev_block_row[2][0];
  642|  26.3M|          DC10 = (int)prev_block_row[2][0];
  643|  26.3M|          DC15 = (int)buffer_ptr[2][0];
  644|  26.3M|          DC20 = (int)next_block_row[2][0];
  645|  26.3M|          DC25 = (int)next_next_block_row[2][0];
  646|  26.3M|        }
  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|  27.3M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 26.4M, False: 861k]
  |  Branch (658:41): [True: 23.2M, False: 3.20M]
  ------------------
  659|  23.2M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 16.5M, False: 6.77M]
  ------------------
  660|  16.5M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|  16.5M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|  16.5M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|  16.5M|                 DC21 - DC22 + DC24 + DC25) :
  664|  23.2M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  23.2M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 15.3M, False: 7.98M]
  ------------------
  666|  15.3M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|  15.3M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 2.21M, False: 13.0M]
  |  Branch (667:27): [True: 880k, False: 1.33M]
  ------------------
  668|   880k|              pred = (1 << Al) - 1;
  669|  15.3M|          } else {
  670|  7.98M|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|  7.98M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 1.22M, False: 6.76M]
  |  Branch (671:27): [True: 828k, False: 394k]
  ------------------
  672|   828k|              pred = (1 << Al) - 1;
  673|  7.98M|            pred = -pred;
  674|  7.98M|          }
  675|  23.2M|          workspace[1] = (JCOEF)pred;
  676|  23.2M|        }
  677|       |        /* AC10 */
  678|  27.3M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 26.3M, False: 1.03M]
  |  Branch (678:41): [True: 24.8M, False: 1.48M]
  ------------------
  679|  24.8M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 16.5M, False: 8.31M]
  ------------------
  680|  16.5M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|  16.5M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|  16.5M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|  16.5M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|  24.8M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|  24.8M|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 15.2M, False: 9.55M]
  ------------------
  686|  15.2M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|  15.2M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 3.05M, False: 12.2M]
  |  Branch (687:27): [True: 1.88M, False: 1.16M]
  ------------------
  688|  1.88M|              pred = (1 << Al) - 1;
  689|  15.2M|          } else {
  690|  9.55M|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|  9.55M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 2.36M, False: 7.18M]
  |  Branch (691:27): [True: 2.17M, False: 187k]
  ------------------
  692|  2.17M|              pred = (1 << Al) - 1;
  693|  9.55M|            pred = -pred;
  694|  9.55M|          }
  695|  24.8M|          workspace[8] = (JCOEF)pred;
  696|  24.8M|        }
  697|       |        /* AC20 */
  698|  27.3M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 26.1M, False: 1.20M]
  |  Branch (698:41): [True: 24.8M, False: 1.25M]
  ------------------
  699|  24.8M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 16.5M, False: 8.37M]
  ------------------
  700|  16.5M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|  16.5M|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|  24.8M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|  24.8M|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 15.2M, False: 9.69M]
  ------------------
  704|  15.2M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|  15.2M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 3.66M, False: 11.5M]
  |  Branch (705:27): [True: 1.78M, False: 1.87M]
  ------------------
  706|  1.78M|              pred = (1 << Al) - 1;
  707|  15.2M|          } else {
  708|  9.69M|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|  9.69M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 2.42M, False: 7.26M]
  |  Branch (709:27): [True: 1.91M, False: 516k]
  ------------------
  710|  1.91M|              pred = (1 << Al) - 1;
  711|  9.69M|            pred = -pred;
  712|  9.69M|          }
  713|  24.8M|          workspace[16] = (JCOEF)pred;
  714|  24.8M|        }
  715|       |        /* AC11 */
  716|  27.3M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 26.0M, False: 1.28M]
  |  Branch (716:41): [True: 25.4M, False: 626k]
  ------------------
  717|  25.4M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 16.5M, False: 8.92M]
  ------------------
  718|  16.5M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|  16.5M|                 9 * DC19 + DC21 - DC25) :
  720|  25.4M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|  8.92M|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|  25.4M|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 19.7M, False: 5.66M]
  ------------------
  723|  19.7M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|  19.7M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 5.12M, False: 14.6M]
  |  Branch (724:27): [True: 985k, False: 4.13M]
  ------------------
  725|   985k|              pred = (1 << Al) - 1;
  726|  19.7M|          } else {
  727|  5.66M|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|  5.66M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 1.61M, False: 4.05M]
  |  Branch (728:27): [True: 1.06M, False: 551k]
  ------------------
  729|  1.06M|              pred = (1 << Al) - 1;
  730|  5.66M|            pred = -pred;
  731|  5.66M|          }
  732|  25.4M|          workspace[9] = (JCOEF)pred;
  733|  25.4M|        }
  734|       |        /* AC02 */
  735|  27.3M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 26.2M, False: 1.07M]
  |  Branch (735:41): [True: 25.8M, False: 450k]
  ------------------
  736|  25.8M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 16.5M, False: 9.31M]
  ------------------
  737|  16.5M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|  16.5M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|  25.8M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|  25.8M|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 16.3M, False: 9.51M]
  ------------------
  741|  16.3M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|  16.3M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 4.82M, False: 11.4M]
  |  Branch (742:27): [True: 1.26M, False: 3.55M]
  ------------------
  743|  1.26M|              pred = (1 << Al) - 1;
  744|  16.3M|          } else {
  745|  9.51M|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|  9.51M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 2.27M, False: 7.23M]
  |  Branch (746:27): [True: 1.46M, False: 811k]
  ------------------
  747|  1.46M|              pred = (1 << Al) - 1;
  748|  9.51M|            pred = -pred;
  749|  9.51M|          }
  750|  25.8M|          workspace[2] = (JCOEF)pred;
  751|  25.8M|        }
  752|  27.3M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 16.5M, False: 10.8M]
  ------------------
  753|       |          /* AC03 */
  754|  16.5M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 16.5M, False: 0]
  |  Branch (754:43): [True: 16.5M, False: 0]
  ------------------
  755|  16.5M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|  16.5M|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 11.1M, False: 5.34M]
  ------------------
  757|  11.1M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|  11.1M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 11.1M]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|  11.1M|            } else {
  761|  5.34M|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|  5.34M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 5.34M]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|  5.34M|              pred = -pred;
  765|  5.34M|            }
  766|  16.5M|            workspace[3] = (JCOEF)pred;
  767|  16.5M|          }
  768|       |          /* AC12 */
  769|  16.5M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 16.5M, False: 0]
  |  Branch (769:43): [True: 16.5M, False: 0]
  ------------------
  770|  16.5M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|  16.5M|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 10.2M, False: 6.26M]
  ------------------
  772|  10.2M|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|  10.2M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 10.2M]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|  10.2M|            } else {
  776|  6.26M|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|  6.26M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 6.26M]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|  6.26M|              pred = -pred;
  780|  6.26M|            }
  781|  16.5M|            workspace[10] = (JCOEF)pred;
  782|  16.5M|          }
  783|       |          /* AC21 */
  784|  16.5M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 16.5M, False: 0]
  |  Branch (784:43): [True: 16.5M, False: 0]
  ------------------
  785|  16.5M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|  16.5M|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 9.79M, False: 6.71M]
  ------------------
  787|  9.79M|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|  9.79M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 9.79M]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|  9.79M|            } else {
  791|  6.71M|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|  6.71M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 6.71M]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|  6.71M|              pred = -pred;
  795|  6.71M|            }
  796|  16.5M|            workspace[17] = (JCOEF)pred;
  797|  16.5M|          }
  798|       |          /* AC30 */
  799|  16.5M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 16.5M, False: 0]
  |  Branch (799:43): [True: 16.5M, False: 0]
  ------------------
  800|  16.5M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|  16.5M|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 10.8M, False: 5.68M]
  ------------------
  802|  10.8M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|  10.8M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 10.8M]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|  10.8M|            } else {
  806|  5.68M|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|  5.68M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 5.68M]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|  5.68M|              pred = -pred;
  810|  5.68M|            }
  811|  16.5M|            workspace[24] = (JCOEF)pred;
  812|  16.5M|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|  16.5M|          num = Q00 *
  817|  16.5M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|  16.5M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|  16.5M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|  16.5M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|  16.5M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|  16.5M|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 9.79M, False: 6.72M]
  ------------------
  823|  9.79M|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|  9.79M|          } else {
  825|  6.72M|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|  6.72M|            pred = -pred;
  827|  6.72M|          }
  828|  16.5M|          workspace[0] = (JCOEF)pred;
  829|  16.5M|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  27.3M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  27.3M|                        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|  27.3M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  27.3M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  27.3M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  27.3M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  27.3M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  27.3M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  27.3M|          prev_prev_block_row++, next_next_block_row++;
  849|  27.3M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  27.3M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  27.3M|      }
  851|   494k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   494k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|   494k|    }
  853|   493k|  }
  854|       |
  855|   489k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 487k, False: 2.16k]
  ------------------
  856|   487k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   487k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|  2.16k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  2.16k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|   489k|}
jdcoefct-8.c:consume_data:
  218|  2.95M|{
  219|  2.95M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  2.95M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  2.95M|  int blkn, ci, xindex, yindex, yoffset;
  222|  2.95M|  JDIMENSION start_col;
  223|  2.95M|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  2.95M|  JBLOCKROW buffer_ptr;
  225|  2.95M|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  5.92M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 2.97M, False: 2.95M]
  ------------------
  229|  2.97M|    compptr = cinfo->cur_comp_info[ci];
  230|  2.97M|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  2.97M|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  2.97M|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  2.97M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  2.97M|#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|  2.97M|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  5.97M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 3.01M, False: 2.95M]
  ------------------
  242|  3.01M|       yoffset++) {
  243|  65.6M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 62.6M, False: 3.01M]
  ------------------
  244|  62.6M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  62.6M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|   125M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 62.8M, False: 62.6M]
  ------------------
  248|  62.8M|        compptr = cinfo->cur_comp_info[ci];
  249|  62.8M|        start_col = MCU_col_num * compptr->MCU_width;
  250|   125M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 62.8M, False: 62.8M]
  ------------------
  251|  62.8M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|   125M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 62.9M, False: 62.8M]
  ------------------
  253|  62.9M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  62.9M|          }
  255|  62.8M|        }
  256|  62.8M|      }
  257|  62.6M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 45.9M, False: 16.7M]
  ------------------
  258|  45.9M|        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|  62.6M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 62.6M]
  ------------------
  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|  62.6M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|  3.01M|    coef->MCU_ctr = 0;
  282|  3.01M|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  2.95M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 2.92M, False: 30.6k]
  ------------------
  285|  2.92M|    start_iMCU_row(cinfo);
  286|  2.92M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.92M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  2.92M|  }
  288|       |  /* Completed the scan */
  289|  30.6k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  30.6k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  30.6k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  2.95M|}
jdcoefct-8.c:decompress_data:
  304|  1.11M|{
  305|  1.11M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  1.11M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  1.11M|  JDIMENSION block_num;
  308|  1.11M|  int ci, block_row, block_rows;
  309|  1.11M|  JBLOCKARRAY buffer;
  310|  1.11M|  JBLOCKROW buffer_ptr;
  311|  1.11M|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  1.11M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  312|  1.11M|  JDIMENSION output_col;
  313|  1.11M|  jpeg_component_info *compptr;
  314|  1.11M|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  1.11M|#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|  1.11M|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 1.11M]
  ------------------
  318|  1.11M|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 1.11M, False: 0]
  ------------------
  319|  1.11M|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 1.11M]
  ------------------
  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|  2.37M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 1.26M, False: 1.11M]
  ------------------
  326|  1.26M|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  1.26M|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 1.26M]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  1.26M|    buffer = (*cinfo->mem->access_virt_barray)
  332|  1.26M|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  1.26M|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  1.26M|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  1.26M|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  1.26M|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 1.21M, False: 47.8k]
  ------------------
  337|  1.21M|      block_rows = compptr->v_samp_factor;
  338|  47.8k|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|  47.8k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|  47.8k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 41.7k, False: 6.17k]
  ------------------
  342|  47.8k|    }
  343|  1.26M|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  1.26M|#define _inverse_DCT  inverse_DCT
  ------------------
  344|  1.26M|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|  2.58M|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 1.31M, False: 1.26M]
  ------------------
  347|  1.31M|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  1.31M|      output_col = 0;
  349|  1.31M|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|  17.1M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 15.8M, False: 1.31M]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|  15.8M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|  15.8M|                        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|  15.8M|        buffer_ptr++;
  361|  15.8M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  15.8M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|  15.8M|      }
  363|  1.31M|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  1.31M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  1.31M|    }
  365|  1.26M|  }
  366|       |
  367|  1.11M|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 1.09M, False: 18.7k]
  ------------------
  368|  1.09M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  1.09M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|  18.7k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  18.7k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  1.11M|}
jdcoefct-8.c:decompress_onepass:
   90|  3.09M|{
   91|  3.09M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  3.09M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  3.09M|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  3.09M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  3.09M|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  3.09M|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  3.09M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  3.09M|  JDIMENSION start_col, output_col;
   98|  3.09M|  jpeg_component_info *compptr;
   99|  3.09M|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  3.09M|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  6.18M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 3.09M, False: 3.09M]
  ------------------
  103|  3.09M|       yoffset++) {
  104|  52.8M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 49.7M, False: 3.09M]
  ------------------
  105|  49.7M|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|  49.7M|      jzero_far((void *)coef->MCU_buffer[0],
  108|  49.7M|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|  49.7M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 21.5M, False: 28.2M]
  ------------------
  110|  21.5M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|  49.7M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 49.7M]
  ------------------
  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|  49.7M|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 49.7M, False: 27.5k]
  ------------------
  135|  49.7M|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 49.7M, 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|  49.7M|        blkn = 0;               /* index of current DCT block within MCU */
  142|   102M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 52.7M, False: 49.7M]
  ------------------
  143|  52.7M|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|  52.7M|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 52.7M]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|  52.7M|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|  52.7M|#define _inverse_DCT  inverse_DCT
  ------------------
  150|  52.7M|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 47.6M, False: 5.04M]
  ------------------
  151|  47.6M|                         compptr->MCU_width : compptr->last_col_width;
  152|  52.7M|          output_ptr = output_buf[compptr->component_index] +
  153|  52.7M|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  52.7M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|  52.7M|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|  52.7M|                      compptr->MCU_sample_width;
  156|   105M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 52.8M, False: 52.7M]
  ------------------
  157|  52.8M|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 49.4M, False: 3.39M]
  ------------------
  158|  52.7M|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 3.38M, False: 11.3k]
  ------------------
  159|  52.7M|              output_col = start_col;
  160|   106M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 53.3M, False: 52.7M]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|  53.3M|                (*inverse_DCT) (cinfo, compptr,
  165|  53.3M|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|  53.3M|                                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|  53.3M|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  53.3M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|  53.3M|              }
  174|  52.7M|            }
  175|  52.8M|            blkn += compptr->MCU_width;
  176|  52.8M|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  52.8M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|  52.8M|          }
  178|  52.7M|        }
  179|  49.7M|      }
  180|  49.7M|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  3.09M|    coef->MCU_ctr = 0;
  183|  3.09M|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  3.09M|  cinfo->output_iMCU_row++;
  186|  3.09M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 3.01M, False: 78.0k]
  ------------------
  187|  3.01M|    start_iMCU_row(cinfo);
  188|  3.01M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  3.01M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  3.01M|  }
  190|       |  /* Completed the scan */
  191|  78.0k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|  78.0k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  78.0k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  3.09M|}
j12init_d_coef_controller:
  869|    672|{
  870|    672|  my_coef_ptr coef;
  871|       |
  872|    672|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    672|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 672]
  ------------------
  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|    672|  coef = (my_coef_ptr)
  876|    672|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    672|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|    672|                                sizeof(my_coef_controller));
  878|    672|  memset(coef, 0, sizeof(my_coef_controller));
  879|    672|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|    672|  coef->pub.start_input_pass = start_input_pass;
  881|    672|  coef->pub.start_output_pass = start_output_pass;
  882|    672|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|    672|  coef->coef_bits_latch = NULL;
  884|    672|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|    672|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 630, False: 42]
  ------------------
  888|    630|#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|    630|    int ci, access_rows;
  893|    630|    jpeg_component_info *compptr;
  894|       |
  895|  1.84k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 1.21k, False: 630]
  ------------------
  896|  1.21k|         ci++, compptr++) {
  897|  1.21k|      access_rows = compptr->v_samp_factor;
  898|  1.21k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|  1.21k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 350, False: 864]
  ------------------
  901|    350|        access_rows *= 5;
  902|  1.21k|#endif
  903|  1.21k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|  1.21k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  1.21k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  1.21k|#define TRUE    1
  ------------------
  905|  1.21k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|  1.21k|                               (long)compptr->h_samp_factor),
  907|  1.21k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|  1.21k|                               (long)compptr->v_samp_factor),
  909|  1.21k|         (JDIMENSION)access_rows);
  910|  1.21k|    }
  911|    630|    coef->pub.consume_data = consume_data;
  912|    630|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    630|#define _decompress_data  decompress_data_12
  ------------------
  913|    630|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    630|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|     42|    JBLOCKROW buffer;
  920|     42|    int i;
  921|       |
  922|     42|    buffer = (JBLOCKROW)
  923|     42|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     42|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|     42|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|     42|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|    462|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|    462|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 420, False: 42]
  ------------------
  926|    420|      coef->MCU_buffer[i] = buffer + i;
  927|    420|    }
  928|     42|    coef->pub.consume_data = dummy_consume_data;
  929|     42|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|     42|#define _decompress_data  decompress_data_12
  ------------------
  930|     42|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|     42|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|    672|  coef->workspace = (JCOEF *)
  935|    672|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    672|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|    672|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|    672|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|    672|}
jdcoefct-12.c:start_input_pass:
   50|  1.01k|{
   51|  1.01k|  cinfo->input_iMCU_row = 0;
   52|  1.01k|  start_iMCU_row(cinfo);
   53|  1.01k|}
jdcoefct-12.c:start_output_pass:
   62|    665|{
   63|    665|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|    665|  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|    665|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 623, False: 42]
  ------------------
   68|    623|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 623, False: 0]
  |  Branch (68:38): [True: 255, False: 368]
  ------------------
   69|    255|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|    255|#define _decompress_data  decompress_data_12
  ------------------
   70|    368|    else
   71|    368|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    368|#define _decompress_data  decompress_data_12
  ------------------
   72|    623|  }
   73|    665|#endif
   74|    665|  cinfo->output_iMCU_row = 0;
   75|    665|}
jdcoefct-12.c:smoothing_ok:
  405|    623|{
  406|    623|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|    623|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|    623|#define FALSE   0               /* values of boolean */
  ------------------
  408|    623|  int ci, coefi;
  409|    623|  jpeg_component_info *compptr;
  410|    623|  JQUANT_TBL *qtable;
  411|    623|  int *coef_bits, *prev_coef_bits;
  412|    623|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|    623|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 284, False: 339]
  |  Branch (414:35): [True: 0, False: 339]
  ------------------
  415|    284|    return FALSE;
  ------------------
  |  |  207|    284|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|    339|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 339, False: 0]
  ------------------
  419|    339|    coef->coef_bits_latch = (int *)
  420|    339|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    339|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|    339|                                  cinfo->num_components * 2 *
  422|    339|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|    339|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|    339|  coef_bits_latch = coef->coef_bits_latch;
  424|    339|  prev_coef_bits_latch =
  425|    339|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|    339|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|    596|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 340, False: 256]
  ------------------
  428|    340|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    340|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 1, False: 339]
  ------------------
  431|      1|      return FALSE;
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|    339|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 6, False: 333]
  ------------------
  434|    333|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    333|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 8, False: 325]
  ------------------
  435|    325|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    325|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 7, False: 318]
  ------------------
  436|    318|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    318|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 6, False: 312]
  ------------------
  437|    312|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    312|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 7, False: 305]
  ------------------
  438|    305|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    305|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 7, False: 298]
  ------------------
  439|    298|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    298|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 7, False: 291]
  ------------------
  440|    291|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    291|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 6, False: 285]
  ------------------
  441|    285|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    285|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 11, False: 274]
  ------------------
  442|    274|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    274|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 7, False: 267]
  ------------------
  443|     72|      return FALSE;
  ------------------
  |  |  207|     72|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    267|    coef_bits = cinfo->coef_bits[ci];
  446|    267|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    267|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 10, False: 257]
  ------------------
  448|     10|      return FALSE;
  ------------------
  |  |  207|     10|#define FALSE   0               /* values of boolean */
  ------------------
  449|    257|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  2.57k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  2.57k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 2.31k, False: 257]
  ------------------
  452|  2.31k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 1.39k, False: 918]
  ------------------
  453|  1.39k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|    918|      else
  455|    918|        prev_coef_bits_latch[coefi] = -1;
  456|  2.31k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  2.31k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 2.15k, False: 162]
  ------------------
  458|  2.15k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  2.15k|#define TRUE    1
  ------------------
  459|  2.31k|    }
  460|    257|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    257|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    257|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    257|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    257|  }
  463|       |
  464|    256|  return smoothing_useful;
  465|    339|}
jdcoefct-12.c:decompress_smooth_data:
  474|  85.3k|{
  475|  85.3k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|  85.3k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|  85.3k|  JDIMENSION block_num, last_block_column;
  478|  85.3k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|  85.3k|    image_block_rows;
  480|  85.3k|  JBLOCKARRAY buffer;
  481|  85.3k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|  85.3k|  JBLOCKROW next_block_row, next_next_block_row;
  483|  85.3k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|  85.3k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  484|  85.3k|  JDIMENSION output_col;
  485|  85.3k|  jpeg_component_info *compptr;
  486|  85.3k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|  85.3k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  487|  85.3k|  boolean change_dc;
  488|  85.3k|  JCOEF *workspace;
  489|  85.3k|  int *coef_bits;
  490|  85.3k|  JQUANT_TBL *quanttbl;
  491|  85.3k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|  85.3k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|  85.3k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|  85.3k|      DC25;
  495|  85.3k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|  85.3k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|  85.3k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 85.3k, False: 0]
  ------------------
  502|  85.3k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 85.3k]
  ------------------
  503|      0|    if (cinfo->input_scan_number == cinfo->output_scan_number) {
  ------------------
  |  Branch (503:9): [True: 0, False: 0]
  ------------------
  504|       |      /* If input is working on current scan, we ordinarily want it to
  505|       |       * have completed the current row.  But if input scan is DC,
  506|       |       * we want it to keep two rows ahead so that next two block rows' DC
  507|       |       * values are up to date.
  508|       |       */
  509|      0|      JDIMENSION delta = (cinfo->Ss == 0) ? 2 : 0;
  ------------------
  |  Branch (509:26): [True: 0, False: 0]
  ------------------
  510|      0|      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
  ------------------
  |  Branch (510:11): [True: 0, False: 0]
  ------------------
  511|      0|        break;
  512|      0|    }
  513|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (513:9): [True: 0, False: 0]
  ------------------
  514|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  515|      0|  }
  516|       |
  517|       |  /* OK, output from the virtual arrays. */
  518|   170k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 85.3k, False: 85.3k]
  ------------------
  519|  85.3k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|  85.3k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 85.3k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|  85.3k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 85.2k, False: 107]
  ------------------
  525|  85.2k|      block_rows = compptr->v_samp_factor;
  526|  85.2k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|  85.2k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 50, False: 57]
  ------------------
  528|     50|      block_rows = compptr->v_samp_factor;
  529|     50|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|     57|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|     57|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|     57|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 57, False: 0]
  ------------------
  534|     57|      access_rows = block_rows; /* this iMCU row only */
  535|     57|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|  85.3k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 84.8k, False: 457]
  ------------------
  538|  84.8k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|  84.8k|      buffer = (*cinfo->mem->access_virt_barray)
  540|  84.8k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|  84.8k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|  84.8k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  84.8k|#define FALSE   0               /* values of boolean */
  ------------------
  543|  84.8k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|  84.8k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 202, False: 255]
  ------------------
  545|    202|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|    202|      buffer = (*cinfo->mem->access_virt_barray)
  547|    202|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|    202|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|    202|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    202|#define FALSE   0               /* values of boolean */
  ------------------
  550|    202|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|    255|    } else {
  552|    255|      buffer = (*cinfo->mem->access_virt_barray)
  553|    255|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|    255|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    255|#define FALSE   0               /* values of boolean */
  ------------------
  555|    255|    }
  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|  85.3k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 592, False: 84.7k]
  ------------------
  561|    592|      coef_bits =
  562|    592|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|    592|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|  84.7k|    else
  564|  84.7k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|  84.7k|#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|  85.3k|    change_dc =
  568|  85.3k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 68.5k, False: 16.7k]
  |  Branch (568:29): [True: 67.7k, False: 803]
  |  Branch (568:51): [True: 65.5k, False: 2.20k]
  ------------------
  569|  65.5k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 64.0k, False: 1.48k]
  |  Branch (569:29): [True: 62.9k, False: 1.07k]
  |  Branch (569:51): [True: 61.9k, False: 1.00k]
  ------------------
  570|  61.9k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 60.9k, False: 990]
  |  Branch (570:29): [True: 59.9k, False: 1.00k]
  |  Branch (570:51): [True: 59.2k, False: 676]
  ------------------
  571|       |
  572|  85.3k|    quanttbl = compptr->quant_table;
  573|  85.3k|    Q00 = quanttbl->quantval[0];
  574|  85.3k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|  85.3k|#define Q01_POS  1
  ------------------
  575|  85.3k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|  85.3k|#define Q10_POS  8
  ------------------
  576|  85.3k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|  85.3k|#define Q20_POS  16
  ------------------
  577|  85.3k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|  85.3k|#define Q11_POS  9
  ------------------
  578|  85.3k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|  85.3k|#define Q02_POS  2
  ------------------
  579|  85.3k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 59.2k, False: 26.0k]
  ------------------
  580|  59.2k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  59.2k|#define Q03_POS  3
  ------------------
  581|  59.2k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  59.2k|#define Q12_POS  10
  ------------------
  582|  59.2k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  59.2k|#define Q21_POS  17
  ------------------
  583|  59.2k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  59.2k|#define Q30_POS  24
  ------------------
  584|  59.2k|    }
  585|  85.3k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  147|  85.3k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  586|  85.3k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|  85.3k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|   170k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 85.3k, False: 85.3k]
  ------------------
  590|  85.3k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|  85.3k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|  85.3k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 85.0k, False: 255]
  ------------------
  594|  85.0k|        prev_block_row =
  595|  85.0k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|    255|      else
  597|    255|        prev_block_row = buffer_ptr;
  598|       |
  599|  85.3k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 84.8k, False: 457]
  ------------------
  600|  84.8k|        prev_prev_block_row =
  601|  84.8k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|    457|      else
  603|    457|        prev_prev_block_row = prev_block_row;
  604|       |
  605|  85.3k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 85.2k, False: 57]
  ------------------
  606|  85.2k|        next_block_row =
  607|  85.2k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|     57|      else
  609|     57|        next_block_row = buffer_ptr;
  610|       |
  611|  85.3k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 85.2k, False: 107]
  ------------------
  612|  85.2k|        next_next_block_row =
  613|  85.2k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|    107|      else
  615|    107|        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|  85.3k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|  85.3k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|  85.3k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|  85.3k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|  85.3k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|  85.3k|      output_col = 0;
  626|  85.3k|      last_block_column = compptr->width_in_blocks - 1;
  627|  85.3k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|   680k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 595k, False: 85.3k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|   595k|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|   595k|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 85.3k, False: 510k]
  ------------------
  633|  85.3k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 85.2k, False: 74]
  ------------------
  634|  85.2k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|  85.2k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|  85.2k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|  85.2k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|  85.2k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|  85.2k|        }
  640|   595k|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 424k, False: 170k]
  ------------------
  641|   424k|          DC05 = (int)prev_prev_block_row[2][0];
  642|   424k|          DC10 = (int)prev_block_row[2][0];
  643|   424k|          DC15 = (int)buffer_ptr[2][0];
  644|   424k|          DC20 = (int)next_block_row[2][0];
  645|   424k|          DC25 = (int)next_next_block_row[2][0];
  646|   424k|        }
  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|   595k|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 578k, False: 16.7k]
  |  Branch (658:41): [True: 553k, False: 24.8k]
  ------------------
  659|   553k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 413k, False: 140k]
  ------------------
  660|   413k|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|   413k|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|   413k|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|   413k|                 DC21 - DC22 + DC24 + DC25) :
  664|   553k|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|   553k|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 317k, False: 236k]
  ------------------
  666|   317k|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|   317k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 42.0k, False: 275k]
  |  Branch (667:27): [True: 31.6k, False: 10.3k]
  ------------------
  668|  31.6k|              pred = (1 << Al) - 1;
  669|   317k|          } else {
  670|   236k|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|   236k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 33.7k, False: 203k]
  |  Branch (671:27): [True: 26.4k, False: 7.26k]
  ------------------
  672|  26.4k|              pred = (1 << Al) - 1;
  673|   236k|            pred = -pred;
  674|   236k|          }
  675|   553k|          workspace[1] = (JCOEF)pred;
  676|   553k|        }
  677|       |        /* AC10 */
  678|   595k|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 578k, False: 16.7k]
  |  Branch (678:41): [True: 567k, False: 11.4k]
  ------------------
  679|   567k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 413k, False: 153k]
  ------------------
  680|   413k|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|   413k|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|   413k|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|   413k|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|   567k|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|   567k|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 326k, False: 240k]
  ------------------
  686|   326k|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|   326k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 51.8k, False: 274k]
  |  Branch (687:27): [True: 38.6k, False: 13.2k]
  ------------------
  688|  38.6k|              pred = (1 << Al) - 1;
  689|   326k|          } else {
  690|   240k|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|   240k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 42.7k, False: 198k]
  |  Branch (691:27): [True: 30.7k, False: 11.9k]
  ------------------
  692|  30.7k|              pred = (1 << Al) - 1;
  693|   240k|            pred = -pred;
  694|   240k|          }
  695|   567k|          workspace[8] = (JCOEF)pred;
  696|   567k|        }
  697|       |        /* AC20 */
  698|   595k|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 572k, False: 23.1k]
  |  Branch (698:41): [True: 554k, False: 17.7k]
  ------------------
  699|   554k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 413k, False: 140k]
  ------------------
  700|   413k|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|   413k|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|   554k|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|   554k|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 303k, False: 250k]
  ------------------
  704|   303k|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|   303k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 48.8k, False: 255k]
  |  Branch (705:27): [True: 26.9k, False: 21.9k]
  ------------------
  706|  26.9k|              pred = (1 << Al) - 1;
  707|   303k|          } else {
  708|   250k|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|   250k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 48.3k, False: 202k]
  |  Branch (709:27): [True: 27.6k, False: 20.7k]
  ------------------
  710|  27.6k|              pred = (1 << Al) - 1;
  711|   250k|            pred = -pred;
  712|   250k|          }
  713|   554k|          workspace[16] = (JCOEF)pred;
  714|   554k|        }
  715|       |        /* AC11 */
  716|   595k|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 578k, False: 16.9k]
  |  Branch (716:41): [True: 573k, False: 4.98k]
  ------------------
  717|   573k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 413k, False: 159k]
  ------------------
  718|   413k|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|   413k|                 9 * DC19 + DC21 - DC25) :
  720|   573k|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   159k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|   573k|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 368k, False: 205k]
  ------------------
  723|   368k|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|   368k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 66.1k, False: 302k]
  |  Branch (724:27): [True: 19.8k, False: 46.3k]
  ------------------
  725|  19.8k|              pred = (1 << Al) - 1;
  726|   368k|          } else {
  727|   205k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   205k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 54.0k, False: 151k]
  |  Branch (728:27): [True: 19.8k, False: 34.1k]
  ------------------
  729|  19.8k|              pred = (1 << Al) - 1;
  730|   205k|            pred = -pred;
  731|   205k|          }
  732|   573k|          workspace[9] = (JCOEF)pred;
  733|   573k|        }
  734|       |        /* AC02 */
  735|   595k|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 578k, False: 16.9k]
  |  Branch (735:41): [True: 562k, False: 15.6k]
  ------------------
  736|   562k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 413k, False: 148k]
  ------------------
  737|   413k|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|   413k|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|   562k|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|   562k|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 307k, False: 255k]
  ------------------
  741|   307k|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|   307k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 60.2k, False: 247k]
  |  Branch (742:27): [True: 12.6k, False: 47.6k]
  ------------------
  743|  12.6k|              pred = (1 << Al) - 1;
  744|   307k|          } else {
  745|   255k|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|   255k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 56.5k, False: 198k]
  |  Branch (746:27): [True: 13.9k, False: 42.5k]
  ------------------
  747|  13.9k|              pred = (1 << Al) - 1;
  748|   255k|            pred = -pred;
  749|   255k|          }
  750|   562k|          workspace[2] = (JCOEF)pred;
  751|   562k|        }
  752|   595k|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 413k, False: 181k]
  ------------------
  753|       |          /* AC03 */
  754|   413k|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 413k, False: 0]
  |  Branch (754:43): [True: 413k, False: 27]
  ------------------
  755|   413k|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|   413k|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 257k, False: 155k]
  ------------------
  757|   257k|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|   257k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 257k]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|   257k|            } else {
  761|   155k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|   155k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 155k]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|   155k|              pred = -pred;
  765|   155k|            }
  766|   413k|            workspace[3] = (JCOEF)pred;
  767|   413k|          }
  768|       |          /* AC12 */
  769|   413k|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 413k, False: 0]
  |  Branch (769:43): [True: 413k, False: 25]
  ------------------
  770|   413k|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|   413k|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 219k, False: 194k]
  ------------------
  772|   219k|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|   219k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 219k]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|   219k|            } else {
  776|   194k|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|   194k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 194k]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|   194k|              pred = -pred;
  780|   194k|            }
  781|   413k|            workspace[10] = (JCOEF)pred;
  782|   413k|          }
  783|       |          /* AC21 */
  784|   413k|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 413k, False: 0]
  |  Branch (784:43): [True: 413k, False: 27]
  ------------------
  785|   413k|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|   413k|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 231k, False: 181k]
  ------------------
  787|   231k|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|   231k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 231k]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|   231k|            } else {
  791|   181k|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|   181k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 181k]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|   181k|              pred = -pred;
  795|   181k|            }
  796|   413k|            workspace[17] = (JCOEF)pred;
  797|   413k|          }
  798|       |          /* AC30 */
  799|   413k|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 413k, False: 0]
  |  Branch (799:43): [True: 413k, False: 24]
  ------------------
  800|   413k|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|   413k|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 252k, False: 160k]
  ------------------
  802|   252k|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|   252k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 252k]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|   252k|            } else {
  806|   160k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|   160k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 160k]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|   160k|              pred = -pred;
  810|   160k|            }
  811|   413k|            workspace[24] = (JCOEF)pred;
  812|   413k|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|   413k|          num = Q00 *
  817|   413k|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|   413k|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|   413k|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|   413k|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|   413k|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|   413k|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 203k, False: 210k]
  ------------------
  823|   203k|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|   210k|          } else {
  825|   210k|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|   210k|            pred = -pred;
  827|   210k|          }
  828|   413k|          workspace[0] = (JCOEF)pred;
  829|   413k|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|   595k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|   595k|                        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|   595k|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|   595k|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|   595k|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|   595k|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|   595k|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|   595k|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|   595k|          prev_prev_block_row++, next_next_block_row++;
  849|   595k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   595k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|   595k|      }
  851|  85.3k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  85.3k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|  85.3k|    }
  853|  85.3k|  }
  854|       |
  855|  85.3k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 85.2k, False: 57]
  ------------------
  856|  85.2k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  85.2k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|     57|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     57|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|  85.3k|}
jdcoefct-12.c:consume_data:
  218|   867k|{
  219|   867k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|   867k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|   867k|  int blkn, ci, xindex, yindex, yoffset;
  222|   867k|  JDIMENSION start_col;
  223|   867k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|   867k|  JBLOCKROW buffer_ptr;
  225|   867k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  1.73M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 867k, False: 867k]
  ------------------
  229|   867k|    compptr = cinfo->cur_comp_info[ci];
  230|   867k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|   867k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|   867k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|   867k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   867k|#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|   867k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  1.73M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 871k, False: 867k]
  ------------------
  242|   871k|       yoffset++) {
  243|   393M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 392M, False: 871k]
  ------------------
  244|   392M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|   392M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|   784M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 392M, False: 392M]
  ------------------
  248|   392M|        compptr = cinfo->cur_comp_info[ci];
  249|   392M|        start_col = MCU_col_num * compptr->MCU_width;
  250|   784M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 392M, False: 392M]
  ------------------
  251|   392M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|   784M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 392M, False: 392M]
  ------------------
  253|   392M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|   392M|          }
  255|   392M|        }
  256|   392M|      }
  257|   392M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 77.1M, False: 315M]
  ------------------
  258|  77.1M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  259|       |      /* Try to fetch the MCU. */
  260|       |#ifdef WITH_PROFILE
  261|       |      cinfo->master->start = getTime();
  262|       |#endif
  263|   392M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 392M]
  ------------------
  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|   392M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|   871k|    coef->MCU_ctr = 0;
  282|   871k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|   867k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 866k, False: 977]
  ------------------
  285|   866k|    start_iMCU_row(cinfo);
  286|   866k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   866k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|   866k|  }
  288|       |  /* Completed the scan */
  289|    977|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|    977|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    977|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|   867k|}
jdcoefct-12.c:decompress_data:
  304|  6.51k|{
  305|  6.51k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  6.51k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  6.51k|  JDIMENSION block_num;
  308|  6.51k|  int ci, block_row, block_rows;
  309|  6.51k|  JBLOCKARRAY buffer;
  310|  6.51k|  JBLOCKROW buffer_ptr;
  311|  6.51k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|  6.51k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  312|  6.51k|  JDIMENSION output_col;
  313|  6.51k|  jpeg_component_info *compptr;
  314|  6.51k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|  6.51k|#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|  6.51k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 6.51k]
  ------------------
  318|  6.51k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 6.51k, False: 0]
  ------------------
  319|  6.51k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 6.51k]
  ------------------
  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|  17.8k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 11.3k, False: 6.51k]
  ------------------
  326|  11.3k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  11.3k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 11.3k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  11.3k|    buffer = (*cinfo->mem->access_virt_barray)
  332|  11.3k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  11.3k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  11.3k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  11.3k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  11.3k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 11.1k, False: 201]
  ------------------
  337|  11.1k|      block_rows = compptr->v_samp_factor;
  338|    201|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|    201|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|    201|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 201, False: 0]
  ------------------
  342|    201|    }
  343|  11.3k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  147|  11.3k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  344|  11.3k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|  22.7k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 11.3k, False: 11.3k]
  ------------------
  347|  11.3k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  11.3k|      output_col = 0;
  349|  11.3k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|  7.48M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 7.47M, False: 11.3k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|  7.47M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|  7.47M|                        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|  7.47M|        buffer_ptr++;
  361|  7.47M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  7.47M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|  7.47M|      }
  363|  11.3k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  11.3k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  11.3k|    }
  365|  11.3k|  }
  366|       |
  367|  6.51k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 6.40k, False: 107]
  ------------------
  368|  6.40k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  6.40k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|    107|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    107|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  6.51k|}
jdcoefct-12.c:decompress_onepass:
   90|  4.86k|{
   91|  4.86k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  4.86k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  4.86k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  4.86k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  4.86k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  4.86k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|  4.86k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
   97|  4.86k|  JDIMENSION start_col, output_col;
   98|  4.86k|  jpeg_component_info *compptr;
   99|  4.86k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|  4.86k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  9.72k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 4.86k, False: 4.86k]
  ------------------
  103|  4.86k|       yoffset++) {
  104|  48.9k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 44.1k, False: 4.86k]
  ------------------
  105|  44.1k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|  44.1k|      jzero_far((void *)coef->MCU_buffer[0],
  108|  44.1k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|  44.1k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 33.2k, False: 10.8k]
  ------------------
  110|  33.2k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|  44.1k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 44.1k]
  ------------------
  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|  44.1k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 44.1k, False: 0]
  ------------------
  135|  44.1k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 44.1k, 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|  44.1k|        blkn = 0;               /* index of current DCT block within MCU */
  142|  88.2k|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 44.1k, False: 44.1k]
  ------------------
  143|  44.1k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|  44.1k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 44.1k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|  44.1k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  147|  44.1k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  150|  44.1k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 39.2k, False: 4.86k]
  ------------------
  151|  39.2k|                         compptr->MCU_width : compptr->last_col_width;
  152|  44.1k|          output_ptr = output_buf[compptr->component_index] +
  153|  44.1k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  44.1k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|  44.1k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|  44.1k|                      compptr->MCU_sample_width;
  156|  88.2k|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 44.1k, False: 44.1k]
  ------------------
  157|  44.1k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 42.7k, False: 1.35k]
  ------------------
  158|  44.1k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 1.35k, False: 0]
  ------------------
  159|  44.1k|              output_col = start_col;
  160|  88.2k|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 44.1k, False: 44.1k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|  44.1k|                (*inverse_DCT) (cinfo, compptr,
  165|  44.1k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|  44.1k|                                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|  44.1k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  44.1k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|  44.1k|              }
  174|  44.1k|            }
  175|  44.1k|            blkn += compptr->MCU_width;
  176|  44.1k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  44.1k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|  44.1k|          }
  178|  44.1k|        }
  179|  44.1k|      }
  180|  44.1k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  4.86k|    coef->MCU_ctr = 0;
  183|  4.86k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  4.86k|  cinfo->output_iMCU_row++;
  186|  4.86k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 4.83k, False: 25]
  ------------------
  187|  4.83k|    start_iMCU_row(cinfo);
  188|  4.83k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  4.83k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  4.83k|  }
  190|       |  /* Completed the scan */
  191|     25|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|     25|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     25|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  4.86k|}

jdcoefct-8.c:start_iMCU_row:
   68|  6.03M|{
   69|  6.03M|  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|  6.03M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 998k, False: 5.03M]
  ------------------
   76|   998k|    coef->MCU_rows_per_iMCU_row = 1;
   77|  5.03M|  } else {
   78|  5.03M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 4.95M, False: 81.3k]
  ------------------
   79|  4.95M|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  81.3k|    else
   81|  81.3k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  5.03M|  }
   83|       |
   84|  6.03M|  coef->MCU_ctr = 0;
   85|  6.03M|  coef->MCU_vert_offset = 0;
   86|  6.03M|}
jdcoefct-12.c:start_iMCU_row:
   68|   872k|{
   69|   872k|  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|   872k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 0, False: 872k]
  ------------------
   76|      0|    coef->MCU_rows_per_iMCU_row = 1;
   77|   872k|  } else {
   78|   872k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 871k, False: 1.00k]
  ------------------
   79|   871k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  1.00k|    else
   81|  1.00k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|   872k|  }
   83|       |
   84|   872k|  coef->MCU_ctr = 0;
   85|   872k|  coef->MCU_vert_offset = 0;
   86|   872k|}

jinit_color_deconverter:
  625|   102k|{
  626|   102k|  my_cconvert_ptr cconvert;
  627|   102k|  int ci;
  628|       |
  629|   102k|#ifdef D_LOSSLESS_SUPPORTED
  630|   102k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 3.74k, False: 98.3k]
  ------------------
  631|  3.74k|#if BITS_IN_JSAMPLE == 8
  632|  3.74k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  7.49k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 3.74k]
  |  Branch (632:52): [True: 0, False: 3.74k]
  ------------------
  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.74k|  } else
  639|  98.3k|#endif
  640|  98.3k|  {
  641|  98.3k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  98.3k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 98.3k]
  ------------------
  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|  98.3k|  }
  644|       |
  645|   102k|  cconvert = (my_cconvert_ptr)
  646|   102k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   102k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|   102k|                                sizeof(my_color_deconverter));
  648|   102k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|   102k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|   102k|  switch (cinfo->jpeg_color_space) {
  653|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 0, False: 102k]
  ------------------
  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: 102k]
  ------------------
  659|  18.6k|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 18.6k, False: 83.4k]
  ------------------
  660|  18.6k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 18.6k]
  ------------------
  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|  18.6k|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 102k]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 102k]
  ------------------
  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|  83.4k|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 83.4k, False: 18.6k]
  ------------------
  671|  83.4k|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 83.4k]
  ------------------
  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|  83.4k|    break;
  674|   102k|  }
  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|   102k|  switch (cinfo->out_color_space) {
  684|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 0, False: 102k]
  ------------------
  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|  18.6k|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 18.6k, False: 83.4k]
  ------------------
  705|  18.6k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 102k]
  ------------------
  706|  18.6k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 102k]
  ------------------
  707|  18.6k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 102k]
  ------------------
  708|  18.6k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 102k]
  ------------------
  709|  18.6k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 102k]
  ------------------
  710|  18.6k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 102k]
  ------------------
  711|  18.6k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 102k]
  ------------------
  712|  18.6k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 102k]
  ------------------
  713|  18.6k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 102k]
  ------------------
  714|  18.6k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 102k]
  ------------------
  715|  18.6k|#ifdef D_LOSSLESS_SUPPORTED
  716|  18.6k|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 11, False: 18.6k]
  |  Branch (716:36): [True: 10, False: 1]
  ------------------
  717|     10|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|  18.6k|#endif
  719|  18.6k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|  18.6k|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 18.6k, False: 11]
  ------------------
  721|  18.6k|#ifdef WITH_SIMD
  722|  18.6k|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 18.6k, False: 0]
  ------------------
  723|  18.6k|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|  18.6k|#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|  18.6k|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 11]
  ------------------
  756|      0|      switch (cinfo->out_color_space) {
  757|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|        cconvert->pub._color_convert = gray_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  759|      0|        break;
  760|      0|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (760:7): [True: 0, False: 0]
  ------------------
  761|      0|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (761:7): [True: 0, False: 0]
  ------------------
  762|      0|        cconvert->pub._color_convert = gray_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  763|      0|        break;
  764|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (764:7): [True: 0, False: 0]
  ------------------
  765|      0|        cconvert->pub._color_convert = gray_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  766|      0|        break;
  767|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (767:7): [True: 0, False: 0]
  ------------------
  768|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (768:7): [True: 0, False: 0]
  ------------------
  769|      0|        cconvert->pub._color_convert = gray_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  770|      0|        break;
  771|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (771:7): [True: 0, False: 0]
  ------------------
  772|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|        cconvert->pub._color_convert = gray_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  774|      0|        break;
  775|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (775:7): [True: 0, False: 0]
  ------------------
  776|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|        cconvert->pub._color_convert = gray_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  778|      0|        break;
  779|      0|      default:
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|      0|        cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  781|      0|      }
  782|     11|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 1, False: 10]
  ------------------
  783|      1|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 1, False: 0]
  ------------------
  784|      1|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 1, False: 0]
  ------------------
  785|      1|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 1, False: 0]
  ------------------
  786|      1|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 1, False: 0]
  ------------------
  787|      1|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      1|#define _color_convert  color_convert
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  814|      0|        }
  815|      0|      }
  816|      1|    } else
  817|     10|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|  18.6k|    break;
  819|       |
  820|  18.6k|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 102k]
  ------------------
  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: 102k]
  ------------------
  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|  83.4k|  default:
  ------------------
  |  Branch (873:3): [True: 83.4k, False: 18.6k]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|  83.4k|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 83.4k, False: 0]
  ------------------
  876|  83.4k|      cinfo->out_color_components = cinfo->num_components;
  877|  83.4k|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|  83.4k|#define _color_convert  color_convert
  ------------------
  878|  83.4k|    } 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|  83.4k|    break;
  881|   102k|  }
  882|       |
  883|   102k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 102k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|   102k|  else
  886|   102k|    cinfo->output_components = cinfo->out_color_components;
  887|   102k|}
jdcolor-8.c:start_pass_dcolor:
  614|  93.3k|{
  615|       |  /* no work needed */
  616|  93.3k|}
jdcolor-8.c:null_convert:
  336|  28.8M|{
  337|  28.8M|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|  28.8M|  register JDIMENSION col;
  339|  28.8M|  register int num_components = cinfo->num_components;
  340|  28.8M|  JDIMENSION num_cols = cinfo->output_width;
  341|  28.8M|  int ci;
  342|       |
  343|  28.8M|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 78.9k, False: 28.7M]
  ------------------
  344|   157k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (344:12): [True: 78.9k, False: 78.9k]
  ------------------
  345|  78.9k|      inptr0 = input_buf[0][input_row];
  346|  78.9k|      inptr1 = input_buf[1][input_row];
  347|  78.9k|      inptr2 = input_buf[2][input_row];
  348|  78.9k|      input_row++;
  349|  78.9k|      outptr = *output_buf++;
  350|  2.23M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (350:21): [True: 2.15M, False: 78.9k]
  ------------------
  351|  2.15M|        *outptr++ = inptr0[col];
  352|  2.15M|        *outptr++ = inptr1[col];
  353|  2.15M|        *outptr++ = inptr2[col];
  354|  2.15M|      }
  355|  78.9k|    }
  356|  28.7M|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 254, False: 28.7M]
  ------------------
  357|    508|    while (--num_rows >= 0) {
  ------------------
  |  Branch (357:12): [True: 254, False: 254]
  ------------------
  358|    254|      inptr0 = input_buf[0][input_row];
  359|    254|      inptr1 = input_buf[1][input_row];
  360|    254|      inptr2 = input_buf[2][input_row];
  361|    254|      inptr3 = input_buf[3][input_row];
  362|    254|      input_row++;
  363|    254|      outptr = *output_buf++;
  364|  26.8k|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (364:21): [True: 26.6k, False: 254]
  ------------------
  365|  26.6k|        *outptr++ = inptr0[col];
  366|  26.6k|        *outptr++ = inptr1[col];
  367|  26.6k|        *outptr++ = inptr2[col];
  368|  26.6k|        *outptr++ = inptr3[col];
  369|  26.6k|      }
  370|    254|    }
  371|  28.7M|  } else {
  372|  57.5M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 28.7M, False: 28.7M]
  ------------------
  373|  57.5M|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 28.7M, False: 28.7M]
  ------------------
  374|  28.7M|        inptr = input_buf[ci][input_row];
  375|  28.7M|        outptr = *output_buf;
  376|  5.54G|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 5.51G, False: 28.7M]
  ------------------
  377|  5.51G|          outptr[ci] = inptr[col];
  378|  5.51G|          outptr += num_components;
  379|  5.51G|        }
  380|  28.7M|      }
  381|  28.7M|      output_buf++;
  382|  28.7M|      input_row++;
  383|  28.7M|    }
  384|  28.7M|  }
  385|  28.8M|}
j12init_color_deconverter:
  625|  1.04k|{
  626|  1.04k|  my_cconvert_ptr cconvert;
  627|  1.04k|  int ci;
  628|       |
  629|  1.04k|#ifdef D_LOSSLESS_SUPPORTED
  630|  1.04k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 387, False: 662]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|    387|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    774|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 387]
  ------------------
  635|    387|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    387|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 387]
  ------------------
  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|    387|  } else
  639|    662|#endif
  640|    662|  {
  641|    662|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    662|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 662]
  ------------------
  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|    662|  }
  644|       |
  645|  1.04k|  cconvert = (my_cconvert_ptr)
  646|  1.04k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.04k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|  1.04k|                                sizeof(my_color_deconverter));
  648|  1.04k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|  1.04k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|  1.04k|  switch (cinfo->jpeg_color_space) {
  653|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 0, False: 1.04k]
  ------------------
  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: 1.04k]
  ------------------
  659|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 0, False: 1.04k]
  ------------------
  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: 1.04k]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 1.04k]
  ------------------
  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|  1.04k|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 1.04k, False: 0]
  ------------------
  671|  1.04k|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 1.04k]
  ------------------
  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|  1.04k|    break;
  674|  1.04k|  }
  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|  1.04k|  switch (cinfo->out_color_space) {
  684|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 0, False: 1.04k]
  ------------------
  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: 1.04k]
  ------------------
  705|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 1.04k]
  ------------------
  706|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 1.04k]
  ------------------
  707|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 1.04k]
  ------------------
  708|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 1.04k]
  ------------------
  709|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 1.04k]
  ------------------
  710|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 1.04k]
  ------------------
  711|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 1.04k]
  ------------------
  712|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 1.04k]
  ------------------
  713|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 1.04k]
  ------------------
  714|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 1.04k]
  ------------------
  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: 1.04k]
  ------------------
  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: 1.04k]
  ------------------
  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|  1.04k|  default:
  ------------------
  |  Branch (873:3): [True: 1.04k, False: 0]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|  1.04k|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 1.04k, False: 0]
  ------------------
  876|  1.04k|      cinfo->out_color_components = cinfo->num_components;
  877|  1.04k|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|  1.04k|#define _color_convert  color_convert_12
  ------------------
  878|  1.04k|    } 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|  1.04k|    break;
  881|  1.04k|  }
  882|       |
  883|  1.04k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 1.04k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|  1.04k|  else
  886|  1.04k|    cinfo->output_components = cinfo->out_color_components;
  887|  1.04k|}
jdcolor-12.c:start_pass_dcolor:
  614|  1.01k|{
  615|       |  /* no work needed */
  616|  1.01k|}
jdcolor-12.c:null_convert:
  336|   822k|{
  337|   822k|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|   822k|  register JDIMENSION col;
  339|   822k|  register int num_components = cinfo->num_components;
  340|   822k|  JDIMENSION num_cols = cinfo->output_width;
  341|   822k|  int ci;
  342|       |
  343|   822k|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 18.0k, False: 804k]
  ------------------
  344|  36.0k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (344:12): [True: 18.0k, False: 18.0k]
  ------------------
  345|  18.0k|      inptr0 = input_buf[0][input_row];
  346|  18.0k|      inptr1 = input_buf[1][input_row];
  347|  18.0k|      inptr2 = input_buf[2][input_row];
  348|  18.0k|      input_row++;
  349|  18.0k|      outptr = *output_buf++;
  350|   147M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (350:21): [True: 147M, False: 18.0k]
  ------------------
  351|   147M|        *outptr++ = inptr0[col];
  352|   147M|        *outptr++ = inptr1[col];
  353|   147M|        *outptr++ = inptr2[col];
  354|   147M|      }
  355|  18.0k|    }
  356|   804k|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 0, False: 804k]
  ------------------
  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|   804k|  } else {
  372|  1.60M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 804k, False: 804k]
  ------------------
  373|  1.60M|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 804k, False: 804k]
  ------------------
  374|   804k|        inptr = input_buf[ci][input_row];
  375|   804k|        outptr = *output_buf;
  376|  40.0M|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 39.2M, False: 804k]
  ------------------
  377|  39.2M|          outptr[ci] = inptr[col];
  378|  39.2M|          outptr += num_components;
  379|  39.2M|        }
  380|   804k|      }
  381|   804k|      output_buf++;
  382|   804k|      input_row++;
  383|   804k|    }
  384|   804k|  }
  385|   822k|}

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

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

jpeg_make_d_derived_tbl:
  145|   166k|{
  146|   166k|  JHUFF_TBL *htbl;
  147|   166k|  d_derived_tbl *dtbl;
  148|   166k|  int p, i, l, si, numsymbols;
  149|   166k|  int lookbits, ctr;
  150|   166k|  char huffsize[257];
  151|   166k|  unsigned int huffcode[257];
  152|   166k|  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|   166k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|   166k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 166k]
  |  Branch (159:20): [True: 265, False: 165k]
  ------------------
  160|    265|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|    265|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    265|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    265|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|   166k|  htbl =
  162|   166k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 87.0k, False: 79.1k]
  ------------------
  163|   166k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 299, False: 165k]
  ------------------
  164|    299|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|    299|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    299|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    299|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|   166k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 153k, False: 12.8k]
  ------------------
  168|   153k|    *pdtbl = (d_derived_tbl *)
  169|   153k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   153k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|   153k|                                  sizeof(d_derived_tbl));
  171|   166k|  dtbl = *pdtbl;
  172|   166k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|   166k|  p = 0;
  177|  2.81M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 2.64M, False: 166k]
  ------------------
  178|  2.64M|    i = (int)htbl->bits[l];
  179|  2.64M|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 2.64M]
  |  Branch (179:18): [True: 0, False: 2.64M]
  ------------------
  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|  15.4M|    while (i--)
  ------------------
  |  Branch (181:12): [True: 12.7M, False: 2.64M]
  ------------------
  182|  12.7M|      huffsize[p++] = (char)l;
  183|  2.64M|  }
  184|   166k|  huffsize[p] = 0;
  185|   166k|  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|   166k|  code = 0;
  191|   166k|  si = huffsize[0];
  192|   166k|  p = 0;
  193|  1.98M|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 1.82M, False: 166k]
  ------------------
  194|  14.5M|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 12.7M, False: 1.82M]
  ------------------
  195|  12.7M|      huffcode[p++] = code;
  196|  12.7M|      code++;
  197|  12.7M|    }
  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.82M|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 271, False: 1.82M]
  ------------------
  202|    271|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    271|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    271|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  1.82M|    code <<= 1;
  204|  1.82M|    si++;
  205|  1.82M|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|   166k|  p = 0;
  210|  2.81M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 2.64M, False: 166k]
  ------------------
  211|  2.64M|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 1.25M, False: 1.39M]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|  1.25M|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|  1.25M|      p += htbl->bits[l];
  217|  1.25M|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|  1.39M|    } else {
  219|  1.39M|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  1.39M|    }
  221|  2.64M|  }
  222|   166k|  dtbl->valoffset[17] = 0;
  223|   166k|  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|  42.4M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|  42.4M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 42.3M, False: 166k]
  ------------------
  233|  42.3M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  42.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  42.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|   166k|  p = 0;
  236|  1.48M|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  1.48M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 1.32M, False: 166k]
  ------------------
  237|  3.73M|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 2.40M, False: 1.32M]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|  2.40M|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  2.40M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  25.7M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  2.40M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 23.3M, False: 2.40M]
  ------------------
  242|  23.3M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|  23.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|  23.3M|        lookbits++;
  244|  23.3M|      }
  245|  2.40M|    }
  246|  1.32M|  }
  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|   166k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 86.7k, False: 79.4k]
  ------------------
  255|  1.20M|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 1.11M, False: 86.7k]
  ------------------
  256|  1.11M|      int sym = htbl->huffval[i];
  257|  1.11M|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 1.11M]
  |  Branch (257:22): [True: 220, False: 1.11M]
  |  Branch (257:29): [True: 52.4k, False: 1.06M]
  ------------------
  258|    220|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    220|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    220|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  1.11M|    }
  260|  86.7k|  }
  261|   166k|}
jpeg_fill_bit_buffer:
  291|  1.19M|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|  1.19M|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|  1.19M|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|  1.19M|  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|  1.19M|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 319k, False: 870k]
  ------------------
  302|  2.32M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  2.32M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  2.32M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 2.07M, False: 248k]
  ------------------
  303|  2.07M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  2.07M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 72.3k, False: 2.00M]
  ------------------
  307|  72.3k|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 72.3k]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|  72.3k|        next_input_byte = cinfo->src->next_input_byte;
  310|  72.3k|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|  72.3k|      }
  312|  2.07M|      bytes_in_buffer--;
  313|  2.07M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  2.07M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 109k, False: 1.96M]
  ------------------
  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|   229k|        do {
  323|   229k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 2.97k, False: 226k]
  ------------------
  324|  2.97k|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 2.97k]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|  2.97k|            next_input_byte = cinfo->src->next_input_byte;
  327|  2.97k|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|  2.97k|          }
  329|   229k|          bytes_in_buffer--;
  330|   229k|          c = *next_input_byte++;
  331|   229k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 119k, False: 109k]
  ------------------
  332|       |
  333|   109k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 37.8k, False: 71.3k]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  37.8k|          c = 0xFF;
  336|  71.3k|        } 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|  71.3k|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|  71.3k|          goto no_more_bytes;
  348|  71.3k|        }
  349|   109k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  2.00M|      get_buffer = (get_buffer << 8) | c;
  353|  2.00M|      bits_left += 8;
  354|  2.00M|    } /* end while */
  355|   870k|  } else {
  356|   941k|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|   941k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 452k, False: 488k]
  ------------------
  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|   452k|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 70.6k, False: 382k]
  ------------------
  368|  70.6k|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|  70.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  70.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|  70.6k|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|  70.6k|#define TRUE    1
  ------------------
  370|  70.6k|      }
  371|       |      /* Fill the buffer with zero bits */
  372|   452k|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|   452k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   452k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|   452k|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|   452k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   452k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|   452k|    }
  375|   941k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|  1.19M|  state->next_input_byte = next_input_byte;
  379|  1.19M|  state->bytes_in_buffer = bytes_in_buffer;
  380|  1.19M|  state->get_buffer = get_buffer;
  381|  1.19M|  state->bits_left = bits_left;
  382|       |
  383|  1.19M|  return TRUE;
  ------------------
  |  |  210|  1.19M|#define TRUE    1
  ------------------
  384|  1.19M|}
jpeg_huff_decode:
  439|   825k|{
  440|   825k|  register int l = min_bits;
  441|   825k|  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|   825k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|   825k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   825k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 65.4k, False: 759k]
  |  |  ------------------
  |  |  162|  65.4k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 65.4k]
  |  |  ------------------
  |  |  163|  65.4k|      { action; } \
  |  |  164|  65.4k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  65.4k|  } \
  |  |  166|   825k|}
  ------------------
  447|   825k|  code = GET_BITS(l);
  ------------------
  |  |  169|   825k|  (((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|  4.43M|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 3.60M, False: 825k]
  ------------------
  453|  3.60M|    code <<= 1;
  454|  3.60M|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  3.60M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  3.60M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 204k, False: 3.40M]
  |  |  ------------------
  |  |  162|   204k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 204k]
  |  |  ------------------
  |  |  163|   204k|      { action; } \
  |  |  164|   204k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|   204k|  } \
  |  |  166|  3.60M|}
  ------------------
  455|  3.60M|    code |= GET_BITS(1);
  ------------------
  |  |  169|  3.60M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  3.60M|    l++;
  457|  3.60M|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|   825k|  state->get_buffer = get_buffer;
  461|   825k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|   825k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 253k, False: 572k]
  ------------------
  466|   253k|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|   253k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|   253k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|   253k|    return 0;                   /* fake a zero as the safest result */
  468|   253k|  }
  469|       |
  470|   572k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|   825k|}
jinit_huff_decoder:
  815|  72.6k|{
  816|  72.6k|  huff_entropy_ptr entropy;
  817|  72.6k|  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|  72.6k|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|  72.6k|  entropy = (huff_entropy_ptr)
  826|  72.6k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  72.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|  72.6k|                                sizeof(huff_entropy_decoder));
  828|  72.6k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|  72.6k|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|  72.6k|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|   363k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   363k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 290k, False: 72.6k]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|   290k|  }
  836|  72.6k|}
jdhuff.c:start_pass_huff_decoder:
   80|  73.9k|{
   81|  73.9k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|  73.9k|  int ci, blkn, dctbl, actbl;
   83|  73.9k|  d_derived_tbl **pdtbl;
   84|  73.9k|  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|  73.9k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  63.2k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 10.7k, False: 63.2k]
  |  Branch (90:25): [True: 6.31k, False: 56.9k]
  ------------------
   91|  56.9k|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 371, False: 56.5k]
  |  Branch (91:25): [True: 570, False: 56.0k]
  ------------------
   92|  17.9k|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  17.9k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  17.9k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|   150k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 76.4k, False: 73.9k]
  ------------------
   95|  76.4k|    compptr = cinfo->cur_comp_info[ci];
   96|  76.4k|    dctbl = compptr->dc_tbl_no;
   97|  76.4k|    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|  76.4k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  76.4k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|  76.4k|#define TRUE    1
  ------------------
  102|  76.4k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  76.4k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|  76.4k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  76.4k|    entropy->saved.last_dc_val[ci] = 0;
  106|  76.4k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|   150k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 76.2k, False: 73.9k]
  ------------------
  110|  76.2k|    ci = cinfo->MCU_membership[blkn];
  111|  76.2k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  76.2k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  76.2k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|  76.2k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 76.2k, False: 0]
  ------------------
  117|  76.2k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|  76.2k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  76.2k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  76.2k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  76.2k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  76.2k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|  73.9k|  entropy->bitstate.bits_left = 0;
  127|  73.9k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|  73.9k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  73.9k|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|  73.9k|  entropy->restarts_to_go = cinfo->restart_interval;
  132|  73.9k|}
jdhuff.c:decode_mcu:
  771|   344M|{
  772|   344M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   344M|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   344M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 4.48M, False: 339M]
  ------------------
  777|  4.48M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 30.3k, False: 4.45M]
  ------------------
  778|  30.3k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 30.3k]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|  4.48M|    usefast = 0;
  781|  4.48M|  }
  782|       |
  783|   344M|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   344M|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   344M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 241M, False: 103M]
  ------------------
  784|   103M|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 103M, False: 110k]
  ------------------
  785|   344M|    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|   344M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 599k, False: 343M]
  ------------------
  791|       |
  792|   599k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 109k, False: 489k]
  ------------------
  793|   109k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 8.59k, False: 101k]
  ------------------
  794|   489k|    } else {
  795|   498k|use_slow:
  796|   498k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 498k]
  ------------------
  797|   498k|    }
  798|       |
  799|   599k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   344M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 4.46M, False: 339M]
  ------------------
  803|  4.46M|    entropy->restarts_to_go--;
  804|       |
  805|   344M|  return TRUE;
  ------------------
  |  |  210|   344M|#define TRUE    1
  ------------------
  806|   344M|}
jdhuff.c:process_restart:
  513|  30.3k|{
  514|  30.3k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  515|  30.3k|  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|  30.3k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  520|  30.3k|  entropy->bitstate.bits_left = 0;
  521|       |
  522|       |  /* Advance past the RSTn marker */
  523|  30.3k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (523:7): [True: 0, False: 30.3k]
  ------------------
  524|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  525|       |
  526|       |  /* Re-initialize DC predictions to 0 */
  527|  39.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (527:16): [True: 9.29k, False: 30.3k]
  ------------------
  528|  9.29k|    entropy->saved.last_dc_val[ci] = 0;
  529|       |
  530|       |  /* Reset restart counter */
  531|  30.3k|  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|  30.3k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (538:7): [True: 4.96k, False: 25.3k]
  ------------------
  539|  4.96k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  4.96k|#define FALSE   0               /* values of boolean */
  ------------------
  540|       |
  541|  30.3k|  return TRUE;
  ------------------
  |  |  210|  30.3k|#define TRUE    1
  ------------------
  542|  30.3k|}
jdhuff.c:decode_mcu_fast:
  664|   109k|{
  665|   109k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   109k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   109k|  register bit_buf_type get_buffer; \
  |  |  126|   109k|  register int bits_left; \
  |  |  127|   109k|  bitread_working_state br_state
  ------------------
  667|   109k|  JOCTET *buffer;
  668|   109k|  int blkn;
  669|   109k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   109k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   109k|  br_state.cinfo = cinfop; \
  |  |  131|   109k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   109k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   109k|  get_buffer = permstate.get_buffer; \
  |  |  134|   109k|  bits_left = permstate.bits_left;
  ------------------
  674|   109k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   109k|  state = entropy->saved;
  676|       |
  677|   220k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 110k, False: 109k]
  ------------------
  678|   110k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 110k, False: 0]
  ------------------
  679|   110k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   110k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   110k|    register int s, k, r, l;
  682|       |
  683|   110k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   110k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   110k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 13.9k, False: 96.5k]
  |  |  |  |  ------------------
  |  |  |  |  416|  13.9k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  13.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  13.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  13.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  13.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  13.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  13.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  13.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  13.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.54k, False: 12.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.54k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.54k|    buffer++; \
  |  |  |  |  |  |  401|  1.54k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.03k, False: 510]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.03k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.03k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.03k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.03k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.03k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.03k|    } \
  |  |  |  |  |  |  408|  1.54k|  } \
  |  |  |  |  |  |  409|  13.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  13.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  13.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  13.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  13.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  13.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  13.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  13.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  13.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.49k, False: 11.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.49k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.49k|    buffer++; \
  |  |  |  |  |  |  401|  2.49k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.14k, False: 353]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.14k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.14k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.14k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.14k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.14k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.14k|    } \
  |  |  |  |  |  |  408|  2.49k|  } \
  |  |  |  |  |  |  409|  13.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  13.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  13.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  13.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  13.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  13.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  13.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  13.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  13.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.45k, False: 8.52k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.45k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.45k|    buffer++; \
  |  |  |  |  |  |  401|  5.45k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.83k, False: 1.61k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.83k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.83k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.83k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.83k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.83k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.83k|    } \
  |  |  |  |  |  |  408|  5.45k|  } \
  |  |  |  |  |  |  409|  13.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  13.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  13.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  13.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  13.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  13.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  13.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  13.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  13.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.12k, False: 9.85k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.12k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.12k|    buffer++; \
  |  |  |  |  |  |  401|  4.12k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.85k, False: 267]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.85k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.85k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.85k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.85k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.85k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.85k|    } \
  |  |  |  |  |  |  408|  4.12k|  } \
  |  |  |  |  |  |  409|  13.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  13.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  13.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  13.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  13.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  13.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  13.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  13.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  13.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.50k, False: 8.47k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.50k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.50k|    buffer++; \
  |  |  |  |  |  |  401|  5.50k|    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.50k|  } \
  |  |  |  |  |  |  409|  13.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  13.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  13.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  13.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  13.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  13.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  13.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  13.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  13.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.91k, False: 9.06k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.91k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.91k|    buffer++; \
  |  |  |  |  |  |  401|  4.91k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.26k, False: 647]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.26k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.26k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.26k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.26k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.26k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.26k|    } \
  |  |  |  |  |  |  408|  4.91k|  } \
  |  |  |  |  |  |  409|  13.9k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  13.9k|  }
  |  |  ------------------
  |  |  225|   110k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   110k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   110k|  s = htbl->lookup[s]; \
  |  |  227|   110k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   110k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   110k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   110k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   110k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   110k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   110k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   110k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   221k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 22.2k, False: 88.2k]
  |  |  ------------------
  |  |  232|  22.2k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  22.2k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  22.2k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   186k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 163k, False: 22.2k]
  |  |  ------------------
  |  |  236|   163k|      s <<= 1; \
  |  |  237|   163k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   163k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   163k|      nb++; \
  |  |  239|   163k|    } \
  |  |  240|  22.2k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 20.3k, False: 1.90k]
  |  |  ------------------
  |  |  241|  22.2k|      s = 0; \
  |  |  242|  22.2k|    else \
  |  |  243|  22.2k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  22.2k|  }
  ------------------
  684|   110k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 22.2k, False: 88.3k]
  ------------------
  685|  22.2k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  22.2k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 4.04k, False: 18.1k]
  |  |  ------------------
  |  |  416|  4.04k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.04k|#define GET_BYTE { \
  |  |  |  |  392|  4.04k|  register int c0, c1; \
  |  |  |  |  393|  4.04k|  c0 = *buffer++; \
  |  |  |  |  394|  4.04k|  c1 = *buffer; \
  |  |  |  |  395|  4.04k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.04k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.04k|  bits_left += 8; \
  |  |  |  |  398|  4.04k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.15k, False: 2.88k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.15k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.15k|    buffer++; \
  |  |  |  |  401|  1.15k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 264, False: 889]
  |  |  |  |  ------------------
  |  |  |  |  402|    264|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    264|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    264|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    264|      buffer -= 2; \
  |  |  |  |  406|    264|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    264|    } \
  |  |  |  |  408|  1.15k|  } \
  |  |  |  |  409|  4.04k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.04k|#define GET_BYTE { \
  |  |  |  |  392|  4.04k|  register int c0, c1; \
  |  |  |  |  393|  4.04k|  c0 = *buffer++; \
  |  |  |  |  394|  4.04k|  c1 = *buffer; \
  |  |  |  |  395|  4.04k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.04k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.04k|  bits_left += 8; \
  |  |  |  |  398|  4.04k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.11k, False: 2.92k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.11k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.11k|    buffer++; \
  |  |  |  |  401|  1.11k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 499, False: 614]
  |  |  |  |  ------------------
  |  |  |  |  402|    499|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    499|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    499|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    499|      buffer -= 2; \
  |  |  |  |  406|    499|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    499|    } \
  |  |  |  |  408|  1.11k|  } \
  |  |  |  |  409|  4.04k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.04k|#define GET_BYTE { \
  |  |  |  |  392|  4.04k|  register int c0, c1; \
  |  |  |  |  393|  4.04k|  c0 = *buffer++; \
  |  |  |  |  394|  4.04k|  c1 = *buffer; \
  |  |  |  |  395|  4.04k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.04k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.04k|  bits_left += 8; \
  |  |  |  |  398|  4.04k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.95k, False: 2.09k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.95k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.95k|    buffer++; \
  |  |  |  |  401|  1.95k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 509, False: 1.44k]
  |  |  |  |  ------------------
  |  |  |  |  402|    509|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    509|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    509|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    509|      buffer -= 2; \
  |  |  |  |  406|    509|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    509|    } \
  |  |  |  |  408|  1.95k|  } \
  |  |  |  |  409|  4.04k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.04k|#define GET_BYTE { \
  |  |  |  |  392|  4.04k|  register int c0, c1; \
  |  |  |  |  393|  4.04k|  c0 = *buffer++; \
  |  |  |  |  394|  4.04k|  c1 = *buffer; \
  |  |  |  |  395|  4.04k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.04k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.04k|  bits_left += 8; \
  |  |  |  |  398|  4.04k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 925, False: 3.11k]
  |  |  |  |  ------------------
  |  |  |  |  399|    925|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    925|    buffer++; \
  |  |  |  |  401|    925|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 669, False: 256]
  |  |  |  |  ------------------
  |  |  |  |  402|    669|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    669|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    669|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    669|      buffer -= 2; \
  |  |  |  |  406|    669|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    669|    } \
  |  |  |  |  408|    925|  } \
  |  |  |  |  409|  4.04k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.04k|#define GET_BYTE { \
  |  |  |  |  392|  4.04k|  register int c0, c1; \
  |  |  |  |  393|  4.04k|  c0 = *buffer++; \
  |  |  |  |  394|  4.04k|  c1 = *buffer; \
  |  |  |  |  395|  4.04k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.04k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.04k|  bits_left += 8; \
  |  |  |  |  398|  4.04k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.39k, False: 2.64k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.39k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.39k|    buffer++; \
  |  |  |  |  401|  1.39k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 673, False: 723]
  |  |  |  |  ------------------
  |  |  |  |  402|    673|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    673|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    673|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    673|      buffer -= 2; \
  |  |  |  |  406|    673|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    673|    } \
  |  |  |  |  408|  1.39k|  } \
  |  |  |  |  409|  4.04k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.04k|#define GET_BYTE { \
  |  |  |  |  392|  4.04k|  register int c0, c1; \
  |  |  |  |  393|  4.04k|  c0 = *buffer++; \
  |  |  |  |  394|  4.04k|  c1 = *buffer; \
  |  |  |  |  395|  4.04k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.04k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.04k|  bits_left += 8; \
  |  |  |  |  398|  4.04k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 969, False: 3.07k]
  |  |  |  |  ------------------
  |  |  |  |  399|    969|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    969|    buffer++; \
  |  |  |  |  401|    969|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 673, False: 296]
  |  |  |  |  ------------------
  |  |  |  |  402|    673|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    673|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    673|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    673|      buffer -= 2; \
  |  |  |  |  406|    673|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    673|    } \
  |  |  |  |  408|    969|  } \
  |  |  |  |  409|  4.04k|}
  |  |  ------------------
  |  |  417|  4.04k|  }
  ------------------
  686|  22.2k|      r = GET_BITS(s);
  ------------------
  |  |  169|  22.2k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|  22.2k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  22.2k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  22.2k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|  22.2k|    }
  689|       |
  690|   110k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 110k, False: 0]
  ------------------
  691|   110k|      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|   110k|      s += state.last_dc_val[ci];
  696|   110k|      state.last_dc_val[ci] = s;
  697|   110k|      if (block)
  ------------------
  |  Branch (697:11): [True: 110k, False: 0]
  ------------------
  698|   110k|        (*block)[0] = (JCOEF)s;
  699|   110k|    }
  700|       |
  701|   110k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 110k, False: 0]
  |  Branch (701:37): [True: 110k, False: 0]
  ------------------
  702|       |
  703|  1.16M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  1.16M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 1.14M, False: 22.1k]
  ------------------
  704|  1.14M|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  1.14M|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  1.14M|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 45.9k, False: 1.09M]
  |  |  |  |  ------------------
  |  |  |  |  416|  45.9k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  45.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  45.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  45.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  45.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  45.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  45.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  45.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  45.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 7.23k, False: 38.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  7.23k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  7.23k|    buffer++; \
  |  |  |  |  |  |  401|  7.23k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 6.44k, False: 795]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  6.44k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  6.44k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  6.44k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  6.44k|      buffer -= 2; \
  |  |  |  |  |  |  406|  6.44k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  6.44k|    } \
  |  |  |  |  |  |  408|  7.23k|  } \
  |  |  |  |  |  |  409|  45.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  45.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  45.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  45.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  45.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  45.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  45.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  45.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  45.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 8.57k, False: 37.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  8.57k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  8.57k|    buffer++; \
  |  |  |  |  |  |  401|  8.57k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 6.85k, False: 1.72k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  6.85k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  6.85k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  6.85k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  6.85k|      buffer -= 2; \
  |  |  |  |  |  |  406|  6.85k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  6.85k|    } \
  |  |  |  |  |  |  408|  8.57k|  } \
  |  |  |  |  |  |  409|  45.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  45.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  45.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  45.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  45.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  45.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  45.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  45.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  45.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 8.37k, False: 37.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  8.37k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  8.37k|    buffer++; \
  |  |  |  |  |  |  401|  8.37k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 7.34k, False: 1.03k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  7.34k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  7.34k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  7.34k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  7.34k|      buffer -= 2; \
  |  |  |  |  |  |  406|  7.34k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  7.34k|    } \
  |  |  |  |  |  |  408|  8.37k|  } \
  |  |  |  |  |  |  409|  45.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  45.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  45.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  45.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  45.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  45.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  45.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  45.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  45.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 7.90k, False: 38.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  7.90k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  7.90k|    buffer++; \
  |  |  |  |  |  |  401|  7.90k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 7.36k, False: 538]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  7.36k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  7.36k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  7.36k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  7.36k|      buffer -= 2; \
  |  |  |  |  |  |  406|  7.36k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  7.36k|    } \
  |  |  |  |  |  |  408|  7.90k|  } \
  |  |  |  |  |  |  409|  45.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  45.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  45.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  45.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  45.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  45.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  45.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  45.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  45.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 8.41k, False: 37.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  8.41k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  8.41k|    buffer++; \
  |  |  |  |  |  |  401|  8.41k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 7.44k, False: 968]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  7.44k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  7.44k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  7.44k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  7.44k|      buffer -= 2; \
  |  |  |  |  |  |  406|  7.44k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  7.44k|    } \
  |  |  |  |  |  |  408|  8.41k|  } \
  |  |  |  |  |  |  409|  45.9k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  45.9k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  45.9k|  register int c0, c1; \
  |  |  |  |  |  |  393|  45.9k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  45.9k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  45.9k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  45.9k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  45.9k|  bits_left += 8; \
  |  |  |  |  |  |  398|  45.9k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 8.53k, False: 37.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  8.53k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  8.53k|    buffer++; \
  |  |  |  |  |  |  401|  8.53k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 7.50k, False: 1.03k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  7.50k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  7.50k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  7.50k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  7.50k|      buffer -= 2; \
  |  |  |  |  |  |  406|  7.50k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  7.50k|    } \
  |  |  |  |  |  |  408|  8.53k|  } \
  |  |  |  |  |  |  409|  45.9k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  45.9k|  }
  |  |  ------------------
  |  |  225|  1.14M|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  1.14M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  1.14M|  s = htbl->lookup[s]; \
  |  |  227|  1.14M|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  1.14M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  1.14M|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  1.14M|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.14M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  1.14M|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.14M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  1.14M|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.28M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 54.9k, False: 1.08M]
  |  |  ------------------
  |  |  232|  54.9k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  54.9k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  54.9k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   304k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 249k, False: 54.9k]
  |  |  ------------------
  |  |  236|   249k|      s <<= 1; \
  |  |  237|   249k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   249k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   249k|      nb++; \
  |  |  239|   249k|    } \
  |  |  240|  54.9k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 30.3k, False: 24.5k]
  |  |  ------------------
  |  |  241|  54.9k|      s = 0; \
  |  |  242|  54.9k|    else \
  |  |  243|  54.9k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  54.9k|  }
  ------------------
  705|  1.14M|        r = s >> 4;
  706|  1.14M|        s &= 15;
  707|       |
  708|  1.14M|        if (s) {
  ------------------
  |  Branch (708:13): [True: 1.05M, False: 88.9k]
  ------------------
  709|  1.05M|          k += r;
  710|  1.05M|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  1.05M|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 74.5k, False: 979k]
  |  |  ------------------
  |  |  416|  74.5k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  74.5k|#define GET_BYTE { \
  |  |  |  |  392|  74.5k|  register int c0, c1; \
  |  |  |  |  393|  74.5k|  c0 = *buffer++; \
  |  |  |  |  394|  74.5k|  c1 = *buffer; \
  |  |  |  |  395|  74.5k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  74.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  74.5k|  bits_left += 8; \
  |  |  |  |  398|  74.5k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 11.5k, False: 62.9k]
  |  |  |  |  ------------------
  |  |  |  |  399|  11.5k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  11.5k|    buffer++; \
  |  |  |  |  401|  11.5k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 10.2k, False: 1.23k]
  |  |  |  |  ------------------
  |  |  |  |  402|  10.2k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  10.2k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  10.2k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  10.2k|      buffer -= 2; \
  |  |  |  |  406|  10.2k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  10.2k|    } \
  |  |  |  |  408|  11.5k|  } \
  |  |  |  |  409|  74.5k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  74.5k|#define GET_BYTE { \
  |  |  |  |  392|  74.5k|  register int c0, c1; \
  |  |  |  |  393|  74.5k|  c0 = *buffer++; \
  |  |  |  |  394|  74.5k|  c1 = *buffer; \
  |  |  |  |  395|  74.5k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  74.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  74.5k|  bits_left += 8; \
  |  |  |  |  398|  74.5k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 10.8k, False: 63.7k]
  |  |  |  |  ------------------
  |  |  |  |  399|  10.8k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  10.8k|    buffer++; \
  |  |  |  |  401|  10.8k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 10.3k, False: 519]
  |  |  |  |  ------------------
  |  |  |  |  402|  10.3k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  10.3k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  10.3k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  10.3k|      buffer -= 2; \
  |  |  |  |  406|  10.3k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  10.3k|    } \
  |  |  |  |  408|  10.8k|  } \
  |  |  |  |  409|  74.5k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  74.5k|#define GET_BYTE { \
  |  |  |  |  392|  74.5k|  register int c0, c1; \
  |  |  |  |  393|  74.5k|  c0 = *buffer++; \
  |  |  |  |  394|  74.5k|  c1 = *buffer; \
  |  |  |  |  395|  74.5k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  74.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  74.5k|  bits_left += 8; \
  |  |  |  |  398|  74.5k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 11.7k, False: 62.7k]
  |  |  |  |  ------------------
  |  |  |  |  399|  11.7k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  11.7k|    buffer++; \
  |  |  |  |  401|  11.7k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 10.5k, False: 1.17k]
  |  |  |  |  ------------------
  |  |  |  |  402|  10.5k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  10.5k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  10.5k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  10.5k|      buffer -= 2; \
  |  |  |  |  406|  10.5k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  10.5k|    } \
  |  |  |  |  408|  11.7k|  } \
  |  |  |  |  409|  74.5k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  74.5k|#define GET_BYTE { \
  |  |  |  |  392|  74.5k|  register int c0, c1; \
  |  |  |  |  393|  74.5k|  c0 = *buffer++; \
  |  |  |  |  394|  74.5k|  c1 = *buffer; \
  |  |  |  |  395|  74.5k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  74.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  74.5k|  bits_left += 8; \
  |  |  |  |  398|  74.5k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 11.3k, False: 63.1k]
  |  |  |  |  ------------------
  |  |  |  |  399|  11.3k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  11.3k|    buffer++; \
  |  |  |  |  401|  11.3k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 10.5k, False: 805]
  |  |  |  |  ------------------
  |  |  |  |  402|  10.5k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  10.5k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  10.5k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  10.5k|      buffer -= 2; \
  |  |  |  |  406|  10.5k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  10.5k|    } \
  |  |  |  |  408|  11.3k|  } \
  |  |  |  |  409|  74.5k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  74.5k|#define GET_BYTE { \
  |  |  |  |  392|  74.5k|  register int c0, c1; \
  |  |  |  |  393|  74.5k|  c0 = *buffer++; \
  |  |  |  |  394|  74.5k|  c1 = *buffer; \
  |  |  |  |  395|  74.5k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  74.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  74.5k|  bits_left += 8; \
  |  |  |  |  398|  74.5k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 11.5k, False: 63.0k]
  |  |  |  |  ------------------
  |  |  |  |  399|  11.5k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  11.5k|    buffer++; \
  |  |  |  |  401|  11.5k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 10.9k, False: 582]
  |  |  |  |  ------------------
  |  |  |  |  402|  10.9k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  10.9k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  10.9k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  10.9k|      buffer -= 2; \
  |  |  |  |  406|  10.9k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  10.9k|    } \
  |  |  |  |  408|  11.5k|  } \
  |  |  |  |  409|  74.5k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  74.5k|#define GET_BYTE { \
  |  |  |  |  392|  74.5k|  register int c0, c1; \
  |  |  |  |  393|  74.5k|  c0 = *buffer++; \
  |  |  |  |  394|  74.5k|  c1 = *buffer; \
  |  |  |  |  395|  74.5k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  74.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  74.5k|  bits_left += 8; \
  |  |  |  |  398|  74.5k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 12.9k, False: 61.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|  12.9k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  12.9k|    buffer++; \
  |  |  |  |  401|  12.9k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 12.3k, False: 613]
  |  |  |  |  ------------------
  |  |  |  |  402|  12.3k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  12.3k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  12.3k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  12.3k|      buffer -= 2; \
  |  |  |  |  406|  12.3k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  12.3k|    } \
  |  |  |  |  408|  12.9k|  } \
  |  |  |  |  409|  74.5k|}
  |  |  ------------------
  |  |  417|  74.5k|  }
  ------------------
  711|  1.05M|          r = GET_BITS(s);
  ------------------
  |  |  169|  1.05M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  1.05M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  1.05M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  1.05M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  1.05M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  1.05M|        } else {
  715|  88.9k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 88.4k, False: 507]
  ------------------
  716|    507|          k += 15;
  717|    507|        }
  718|  1.14M|      }
  719|       |
  720|   110k|    } 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|   110k|  }
  738|       |
  739|   109k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 8.59k, False: 101k]
  ------------------
  740|  8.59k|    cinfo->unread_marker = 0;
  741|  8.59k|    return FALSE;
  ------------------
  |  |  207|  8.59k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  8.59k|  }
  743|       |
  744|   101k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   101k|  br_state.next_input_byte = buffer;
  746|   101k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   101k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   101k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   101k|  permstate.get_buffer = get_buffer; \
  |  |  140|   101k|  permstate.bits_left = bits_left
  ------------------
  747|   101k|  entropy->saved = state;
  748|   101k|  return TRUE;
  ------------------
  |  |  210|   101k|#define TRUE    1
  ------------------
  749|   109k|}
jdhuff.c:decode_mcu_slow:
  553|   498k|{
  554|   498k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|   498k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   498k|  register bit_buf_type get_buffer; \
  |  |  126|   498k|  register int bits_left; \
  |  |  127|   498k|  bitread_working_state br_state
  ------------------
  556|   498k|  int blkn;
  557|   498k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|   498k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   498k|  br_state.cinfo = cinfop; \
  |  |  131|   498k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   498k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   498k|  get_buffer = permstate.get_buffer; \
  |  |  134|   498k|  bits_left = permstate.bits_left;
  ------------------
  562|   498k|  state = entropy->saved;
  563|       |
  564|  1.00M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 512k, False: 493k]
  ------------------
  565|   512k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 512k, False: 0]
  ------------------
  566|   512k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|   512k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|   512k|    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|   512k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|   512k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   512k|  register int nb, look; \
  |  |  202|   512k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   512k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 133k, False: 378k]
  |  |  ------------------
  |  |  203|   133k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 133k]
  |  |  ------------------
  |  |  204|   133k|      { failaction; } \
  |  |  205|   133k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   133k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   133k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 20.9k, False: 112k]
  |  |  ------------------
  |  |  207|  20.9k|      nb = 1;  goto slowlabel; \
  |  |  208|  20.9k|    } \
  |  |  209|   133k|  } \
  |  |  210|   512k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   491k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   491k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   491k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   491k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 403k, False: 88.2k]
  |  |  ------------------
  |  |  212|   403k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   403k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   403k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   403k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   403k|  } else { \
  |  |  215|   103k|slowlabel: \
  |  |  216|   103k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 103k]
  |  |  ------------------
  |  |  217|   103k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   103k|      { failaction; } \
  |  |  219|   103k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   103k|  } \
  |  |  221|   491k|}
  ------------------
  574|   507k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 123k, False: 384k]
  ------------------
  575|   123k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   123k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   123k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 6.74k, False: 116k]
  |  |  ------------------
  |  |  162|  6.74k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 6.74k]
  |  |  ------------------
  |  |  163|  6.74k|      { action; } \
  |  |  164|  6.74k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  6.74k|  } \
  |  |  166|   123k|}
  ------------------
  576|   123k|      r = GET_BITS(s);
  ------------------
  |  |  169|   123k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|   123k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   123k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   123k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|   123k|    }
  579|       |
  580|   507k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 507k, False: 4]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|   507k|      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|   507k|      s += state.last_dc_val[ci];
  592|   507k|      state.last_dc_val[ci] = s;
  593|   507k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 507k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|   507k|        (*block)[0] = (JCOEF)s;
  596|   507k|      }
  597|   507k|    }
  598|       |
  599|   507k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 507k, False: 4]
  |  Branch (599:37): [True: 507k, 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.99M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  2.99M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 2.95M, False: 42.7k]
  ------------------
  604|  2.95M|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  2.95M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  2.95M|  register int nb, look; \
  |  |  202|  2.95M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.95M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 330k, False: 2.62M]
  |  |  ------------------
  |  |  203|   330k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 330k]
  |  |  ------------------
  |  |  204|   330k|      { failaction; } \
  |  |  205|   330k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   330k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   330k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 229k, False: 100k]
  |  |  ------------------
  |  |  207|   229k|      nb = 1;  goto slowlabel; \
  |  |  208|   229k|    } \
  |  |  209|   330k|  } \
  |  |  210|  2.95M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  2.72M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  2.72M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.72M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.72M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 2.43M, False: 289k]
  |  |  ------------------
  |  |  212|  2.43M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  2.43M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  2.43M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  2.43M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  2.43M|  } else { \
  |  |  215|   518k|slowlabel: \
  |  |  216|   518k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 518k]
  |  |  ------------------
  |  |  217|   518k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   518k|      { failaction; } \
  |  |  219|   518k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   518k|  } \
  |  |  221|  2.72M|}
  ------------------
  605|       |
  606|  2.95M|        r = s >> 4;
  607|  2.95M|        s &= 15;
  608|       |
  609|  2.95M|        if (s) {
  ------------------
  |  Branch (609:13): [True: 2.48M, False: 468k]
  ------------------
  610|  2.48M|          k += r;
  611|  2.48M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  2.48M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  2.48M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 88.8k, False: 2.39M]
  |  |  ------------------
  |  |  162|  88.8k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 88.8k]
  |  |  ------------------
  |  |  163|  88.8k|      { action; } \
  |  |  164|  88.8k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  88.8k|  } \
  |  |  166|  2.48M|}
  ------------------
  612|  2.48M|          r = GET_BITS(s);
  ------------------
  |  |  169|  2.48M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  2.48M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  2.48M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  2.48M|#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.48M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  2.48M|        } else {
  620|   468k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 464k, False: 3.60k]
  ------------------
  621|   464k|            break;
  622|  3.60k|          k += 15;
  623|  3.60k|        }
  624|  2.95M|      }
  625|       |
  626|   507k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|      4|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|      4|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 4]
  ------------------
  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|      4|    }
  647|   507k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|   493k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   493k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   493k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   493k|  permstate.get_buffer = get_buffer; \
  |  |  140|   493k|  permstate.bits_left = bits_left
  ------------------
  651|   493k|  entropy->saved = state;
  652|   493k|  return TRUE;
  ------------------
  |  |  210|   493k|#define TRUE    1
  ------------------
  653|   498k|}

jinit_input_controller:
  405|  61.5k|{
  406|  61.5k|  my_inputctl_ptr inputctl;
  407|       |
  408|       |  /* Create subobject in permanent pool */
  409|  61.5k|  inputctl = (my_inputctl_ptr)
  410|  61.5k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  61.5k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  411|  61.5k|                                sizeof(my_input_controller));
  412|  61.5k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  413|       |  /* Initialize method pointers */
  414|  61.5k|  inputctl->pub.consume_input = consume_markers;
  415|  61.5k|  inputctl->pub.reset_input_controller = reset_input_controller;
  416|  61.5k|  inputctl->pub.start_input_pass = start_input_pass;
  417|  61.5k|  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|  61.5k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|  61.5k|#define FALSE   0               /* values of boolean */
  ------------------
  422|  61.5k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|  61.5k|#define FALSE   0               /* values of boolean */
  ------------------
  423|  61.5k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|  61.5k|#define TRUE    1
  ------------------
  424|  61.5k|}
jdinput.c:consume_markers:
  332|   292k|{
  333|   292k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  334|   292k|  int val;
  335|       |
  336|   292k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (336:7): [True: 0, False: 292k]
  ------------------
  337|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  338|       |
  339|   292k|  val = (*cinfo->marker->read_markers) (cinfo);
  340|       |
  341|   292k|  switch (val) {
  ------------------
  |  Branch (341:11): [True: 157k, False: 134k]
  ------------------
  342|   118k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1111|   118k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (342:3): [True: 118k, False: 173k]
  ------------------
  343|   118k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (343:9): [True: 109k, False: 8.51k]
  ------------------
  344|   109k|      initial_setup(cinfo);
  345|   109k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  207|   109k|#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|   109k|    } else {                    /* 2nd or later SOS marker */
  351|  8.51k|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (351:11): [True: 377, False: 8.14k]
  ------------------
  352|    377|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|    377|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    377|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  353|  8.51k|      start_input_pass(cinfo);
  354|  8.51k|    }
  355|   118k|    break;
  356|  39.4k|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1112|  39.4k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (356:3): [True: 39.4k, False: 252k]
  ------------------
  357|  39.4k|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  210|  39.4k|#define TRUE    1
  ------------------
  358|  39.4k|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (358:9): [True: 8.31k, False: 31.1k]
  ------------------
  359|  8.31k|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (359:11): [True: 1.21k, False: 7.09k]
  ------------------
  360|  1.21k|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  240|  1.21k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.21k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  361|  31.1k|    } 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|  31.1k|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (365:11): [True: 127, False: 31.0k]
  ------------------
  366|    127|        cinfo->output_scan_number = cinfo->input_scan_number;
  367|  31.1k|    }
  368|  39.4k|    break;
  369|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (369:3): [True: 0, False: 292k]
  ------------------
  370|      0|    break;
  371|   292k|  }
  372|       |
  373|   152k|  return val;
  374|   292k|}
jdinput.c:initial_setup:
   49|   109k|{
   50|   109k|  int ci;
   51|   109k|  jpeg_component_info *compptr;
   52|   109k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|   102k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 7.03k, False: 102k]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|   109k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|   219k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 206, False: 109k]
  ------------------
   56|   109k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|   109k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 206, False: 109k]
  ------------------
   57|    412|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|    412|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    412|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    412|   (*(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|   109k|#ifdef D_LOSSLESS_SUPPORTED
   63|   109k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (63:7): [True: 6.75k, False: 103k]
  ------------------
   64|  6.75k|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (64:9): [True: 209, False: 6.54k]
  |  Branch (64:38): [True: 239, False: 6.30k]
  ------------------
   65|    448|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|    448|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    448|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    448|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   66|  6.75k|  } else
   67|   103k|#endif
   68|   103k|  {
   69|   103k|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (69:9): [True: 1.16k, False: 102k]
  |  Branch (69:39): [True: 200, False: 966]
  ------------------
   70|    200|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|    200|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    200|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    200|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   71|   103k|  }
   72|       |
   73|       |  /* Check that number of components won't exceed internal array sizes */
   74|   109k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|   109k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (74:7): [True: 197, False: 109k]
  ------------------
   75|    197|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|    197|  ((cinfo)->err->msg_code = (code), \
  |  |  248|    197|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|    197|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|    197|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   76|   109k|             MAX_COMPONENTS);
   77|       |
   78|       |  /* Compute maximum sampling factors; check factor validity */
   79|   109k|  cinfo->max_h_samp_factor = 1;
   80|   109k|  cinfo->max_v_samp_factor = 1;
   81|   265k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (81:44): [True: 155k, False: 109k]
  ------------------
   82|   155k|       ci++, compptr++) {
   83|   155k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (83:9): [True: 209, False: 155k]
  ------------------
   84|   155k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|   310k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (84:9): [True: 208, False: 154k]
  ------------------
   85|   154k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (85:9): [True: 216, False: 154k]
  ------------------
   86|   154k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|   154k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (86:9): [True: 203, False: 154k]
  ------------------
   87|    836|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|    836|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    836|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   88|   155k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|   155k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 39.6k, False: 115k]
  |  |  ------------------
  ------------------
   89|   155k|                                   compptr->h_samp_factor);
   90|   155k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|   155k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 36.3k, False: 118k]
  |  |  ------------------
  ------------------
   91|   155k|                                   compptr->v_samp_factor);
   92|   155k|  }
   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|   109k|  cinfo->min_DCT_scaled_size = data_unit;
  108|   109k|#endif
  109|       |
  110|       |  /* Compute dimensions of components */
  111|   264k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (111:44): [True: 154k, False: 109k]
  ------------------
  112|   154k|       ci++, compptr++) {
  113|       |#if JPEG_LIB_VERSION >= 70
  114|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  115|       |#else
  116|   154k|    compptr->DCT_scaled_size = data_unit;
  117|   154k|#endif
  118|       |    /* Size in data units */
  119|   154k|    compptr->width_in_blocks = (JDIMENSION)
  120|   154k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  121|   154k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  122|   154k|    compptr->height_in_blocks = (JDIMENSION)
  123|   154k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  124|   154k|                    (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|   154k|    cinfo->master->first_MCU_col[ci] = 0;
  129|   154k|    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|   154k|    compptr->downsampled_width = (JDIMENSION)
  136|   154k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  137|   154k|                    (long)cinfo->max_h_samp_factor);
  138|   154k|    compptr->downsampled_height = (JDIMENSION)
  139|   154k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  140|   154k|                    (long)cinfo->max_v_samp_factor);
  141|       |    /* Mark component needed, until color conversion says otherwise */
  142|   154k|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|   154k|#define TRUE    1
  ------------------
  143|       |    /* Mark no quantization table yet saved for component */
  144|   154k|    compptr->quant_table = NULL;
  145|   154k|  }
  146|       |
  147|       |  /* Compute number of fully interleaved MCU rows. */
  148|   109k|  cinfo->total_iMCU_rows = (JDIMENSION)
  149|   109k|    jdiv_round_up((long)cinfo->image_height,
  150|   109k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  151|       |
  152|       |  /* Decide whether file contains multiple scans */
  153|   109k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (153:7): [True: 20.3k, False: 89.5k]
  |  Branch (153:55): [True: 12.3k, False: 77.2k]
  ------------------
  154|  30.6k|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  210|  30.6k|#define TRUE    1
  ------------------
  155|  79.3k|  else
  156|  79.3k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  207|  79.3k|#define FALSE   0               /* values of boolean */
  ------------------
  157|   109k|}
jdinput.c:reset_input_controller:
  383|   242k|{
  384|   242k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  385|       |
  386|   242k|  inputctl->pub.consume_input = consume_markers;
  387|   242k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|   242k|#define FALSE   0               /* values of boolean */
  ------------------
  388|   242k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|   242k|#define FALSE   0               /* values of boolean */
  ------------------
  389|   242k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|   242k|#define TRUE    1
  ------------------
  390|       |  /* Reset other modules */
  391|   242k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  392|   242k|  (*cinfo->marker->reset_marker_reader) (cinfo);
  393|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  394|       |  cinfo->coef_bits = NULL;
  395|   242k|}
jdinput.c:start_input_pass:
  297|   112k|{
  298|   112k|  per_scan_setup(cinfo);
  299|   112k|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (299:7): [True: 107k, False: 4.86k]
  ------------------
  300|   107k|    latch_quant_tables(cinfo);
  301|   112k|  (*cinfo->entropy->start_pass) (cinfo);
  302|   112k|  (*cinfo->coef->start_input_pass) (cinfo);
  303|   112k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  304|   112k|}
jdinput.c:per_scan_setup:
  164|   112k|{
  165|   112k|  int ci, mcublks, tmp;
  166|   112k|  jpeg_component_info *compptr;
  167|   112k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|   107k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (167:19): [True: 4.86k, False: 107k]
  ------------------
  168|       |
  169|   112k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (169:7): [True: 105k, False: 6.44k]
  ------------------
  170|       |
  171|       |    /* Noninterleaved (single-component) scan */
  172|   105k|    compptr = cinfo->cur_comp_info[0];
  173|       |
  174|       |    /* Overall image size in MCUs */
  175|   105k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  176|   105k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  177|       |
  178|       |    /* For noninterleaved scan, always one data unit per MCU */
  179|   105k|    compptr->MCU_width = 1;
  180|   105k|    compptr->MCU_height = 1;
  181|   105k|    compptr->MCU_blocks = 1;
  182|   105k|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   105k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  183|   105k|    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|   105k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  188|   105k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (188:9): [True: 98.3k, False: 7.18k]
  ------------------
  189|   105k|    compptr->last_row_height = tmp;
  190|       |
  191|       |    /* Prepare array describing MCU composition */
  192|   105k|    cinfo->blocks_in_MCU = 1;
  193|   105k|    cinfo->MCU_membership[0] = 0;
  194|       |
  195|   105k|  } else {
  196|       |
  197|       |    /* Interleaved (multi-component) scan */
  198|  6.44k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  6.44k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (198:9): [True: 0, False: 6.44k]
  |  Branch (198:38): [True: 0, False: 6.44k]
  ------------------
  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|  6.44k|               MAX_COMPS_IN_SCAN);
  201|       |
  202|       |    /* Overall image size in MCUs */
  203|  6.44k|    cinfo->MCUs_per_row = (JDIMENSION)
  204|  6.44k|      jdiv_round_up((long)cinfo->image_width,
  205|  6.44k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  206|  6.44k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  207|  6.44k|      jdiv_round_up((long)cinfo->image_height,
  208|  6.44k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  209|       |
  210|  6.44k|    cinfo->blocks_in_MCU = 0;
  211|       |
  212|  25.7k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (212:18): [True: 19.2k, False: 6.44k]
  ------------------
  213|  19.2k|      compptr = cinfo->cur_comp_info[ci];
  214|       |      /* Sampling factors give # of data units of component in each MCU */
  215|  19.2k|      compptr->MCU_width = compptr->h_samp_factor;
  216|  19.2k|      compptr->MCU_height = compptr->v_samp_factor;
  217|  19.2k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  218|  19.2k|      compptr->MCU_sample_width = compptr->MCU_width *
  219|  19.2k|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  19.2k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  220|       |      /* Figure number of non-dummy data units in last MCU column & row */
  221|  19.2k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  222|  19.2k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (222:11): [True: 17.0k, False: 2.16k]
  ------------------
  223|  19.2k|      compptr->last_col_width = tmp;
  224|  19.2k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  225|  19.2k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (225:11): [True: 18.0k, False: 1.22k]
  ------------------
  226|  19.2k|      compptr->last_row_height = tmp;
  227|       |      /* Prepare array describing MCU composition */
  228|  19.2k|      mcublks = compptr->MCU_blocks;
  229|  19.2k|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   82|  19.2k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (229:11): [True: 14, False: 19.2k]
  ------------------
  230|     14|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  231|  47.5k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (231:14): [True: 28.2k, False: 19.2k]
  ------------------
  232|  28.2k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  233|  28.2k|      }
  234|  19.2k|    }
  235|       |
  236|  6.44k|  }
  237|   112k|}
jdinput.c:latch_quant_tables:
  263|   107k|{
  264|   107k|  int ci, qtblno;
  265|   107k|  jpeg_component_info *compptr;
  266|   107k|  JQUANT_TBL *qtbl;
  267|       |
  268|   225k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (268:16): [True: 118k, False: 107k]
  ------------------
  269|   118k|    compptr = cinfo->cur_comp_info[ci];
  270|       |    /* No work if we already saved Q-table for this component */
  271|   118k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (271:9): [True: 9.30k, False: 109k]
  ------------------
  272|  9.30k|      continue;
  273|       |    /* Make sure specified quantization table is present */
  274|   109k|    qtblno = compptr->quant_tbl_no;
  275|   109k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|   218k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (275:9): [True: 0, False: 109k]
  |  Branch (275:23): [True: 227, False: 108k]
  ------------------
  276|   108k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (276:9): [True: 290, False: 108k]
  ------------------
  277|    517|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|    517|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    517|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    517|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |    /* OK, save away the quantization table */
  279|   109k|    qtbl = (JQUANT_TBL *)
  280|   109k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   109k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  281|   109k|                                  sizeof(JQUANT_TBL));
  282|   109k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  283|   109k|    compptr->quant_table = qtbl;
  284|   109k|  }
  285|   107k|}
jdinput.c:finish_input_pass:
  315|  85.2k|{
  316|  85.2k|  cinfo->inputctl->consume_input = consume_markers;
  317|  85.2k|}

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

jinit_lossless_decompressor:
  281|  3.73k|{
  282|  3.73k|  lossless_decomp_ptr losslessd;
  283|       |
  284|  3.73k|#if BITS_IN_JSAMPLE == 8
  285|  3.73k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  7.46k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 3.73k]
  |  Branch (285:50): [True: 0, False: 3.73k]
  ------------------
  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.73k|  losslessd = (lossless_decomp_ptr)
  294|  3.73k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  3.73k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|  3.73k|                                sizeof(jpeg_lossless_decompressor));
  296|  3.73k|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|  3.73k|  losslessd->pub.start_pass = start_pass_lossless;
  298|  3.73k|}
jdlossls-8.c:start_pass_lossless:
  243|   174k|{
  244|   174k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|   174k|  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|   174k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 232, False: 173k]
  |  Branch (257:24): [True: 237, False: 173k]
  ------------------
  258|   173k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 229, False: 173k]
  |  Branch (258:25): [True: 233, False: 173k]
  ------------------
  259|   173k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 173k]
  |  Branch (259:24): [True: 228, False: 172k]
  ------------------
  260|  1.15k|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.15k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.15k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.15k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.15k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.15k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.15k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|   174k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|   448k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 274k, False: 174k]
  ------------------
  265|   274k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|   174k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 73.0k, False: 101k]
  ------------------
  269|  73.0k|    losslessd->scaler_scale = simple_upscale;
  270|   101k|  else
  271|   101k|    losslessd->scaler_scale = noscale;
  272|   174k|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|   211k|{
  178|   211k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|   211k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|   211k|  int Ra; \
  |  |   60|   211k|  \
  |  |   61|   211k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|   211k|  *undiff_buf++ = Ra; \
  |  |   63|   211k|  \
  |  |   64|  31.6M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 31.3M, False: 211k]
  |  |  ------------------
  |  |   65|  31.3M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  31.3M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  31.3M|    *undiff_buf++ = Ra; \
  |  |   67|  31.3M|  }
  ------------------
  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|   211k|  switch (cinfo->Ss) {
  188|  24.2k|  case 1:
  ------------------
  |  Branch (188:3): [True: 24.2k, False: 186k]
  ------------------
  189|  24.2k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|  24.2k|    break;
  191|  9.07k|  case 2:
  ------------------
  |  Branch (191:3): [True: 9.07k, False: 201k]
  ------------------
  192|  9.07k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|  9.07k|    break;
  194|  17.0k|  case 3:
  ------------------
  |  Branch (194:3): [True: 17.0k, False: 194k]
  ------------------
  195|  17.0k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|  17.0k|    break;
  197|  66.8k|  case 4:
  ------------------
  |  Branch (197:3): [True: 66.8k, False: 144k]
  ------------------
  198|  66.8k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|  66.8k|    break;
  200|  14.2k|  case 5:
  ------------------
  |  Branch (200:3): [True: 14.2k, False: 196k]
  ------------------
  201|  14.2k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|  14.2k|    break;
  203|  22.2k|  case 6:
  ------------------
  |  Branch (203:3): [True: 22.2k, False: 188k]
  ------------------
  204|  22.2k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|  22.2k|    break;
  206|  57.3k|  case 7:
  ------------------
  |  Branch (206:3): [True: 57.3k, False: 153k]
  ------------------
  207|  57.3k|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  57.3k|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 211k]
  ------------------
  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|   211k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|   211k|  }
  213|   211k|}
jdlossls-8.c:jpeg_undifference1:
  111|  2.65k|{
  112|  2.65k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  2.65k|  int Ra; \
  |  |   60|  2.65k|  \
  |  |   61|  2.65k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  2.65k|  *undiff_buf++ = Ra; \
  |  |   63|  2.65k|  \
  |  |   64|  12.6k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 10.0k, False: 2.65k]
  |  |  ------------------
  |  |   65|  10.0k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  10.0k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  10.0k|    *undiff_buf++ = Ra; \
  |  |   67|  10.0k|  }
  ------------------
  113|  2.65k|}
jdlossls-8.c:jpeg_undifference2:
  119|  2.04k|{
  120|  2.04k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  2.04k|  int Ra, Rb, Rc; \
  |  |   87|  2.04k|  \
  |  |   88|  2.04k|  Rb = *prev_row++; \
  |  |   89|  2.04k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.04k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.04k|  *undiff_buf++ = Ra; \
  |  |   91|  2.04k|  \
  |  |   92|  13.0k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 10.9k, False: 2.04k]
  |  |  ------------------
  |  |   93|  10.9k|    Rc = Rb; \
  |  |   94|  10.9k|    Rb = *prev_row++; \
  |  |   95|  10.9k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  10.9k|    *undiff_buf++ = Ra; \
  |  |   97|  10.9k|  }
  ------------------
  121|  2.04k|  (void)(Rc);
  122|  2.04k|}
jdlossls-8.c:jpeg_undifference3:
  128|  5.94k|{
  129|  5.94k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  5.94k|  int Ra, Rb, Rc; \
  |  |   87|  5.94k|  \
  |  |   88|  5.94k|  Rb = *prev_row++; \
  |  |   89|  5.94k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  5.94k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  5.94k|  *undiff_buf++ = Ra; \
  |  |   91|  5.94k|  \
  |  |   92|  15.9k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 10.0k, False: 5.94k]
  |  |  ------------------
  |  |   93|  10.0k|    Rc = Rb; \
  |  |   94|  10.0k|    Rb = *prev_row++; \
  |  |   95|  10.0k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  10.0k|    *undiff_buf++ = Ra; \
  |  |   97|  10.0k|  }
  ------------------
  130|  5.94k|}
jdlossls-8.c:jpeg_undifference4:
  136|  12.1k|{
  137|  12.1k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  12.1k|  int Ra, Rb, Rc; \
  |  |   87|  12.1k|  \
  |  |   88|  12.1k|  Rb = *prev_row++; \
  |  |   89|  12.1k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  12.1k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  12.1k|  *undiff_buf++ = Ra; \
  |  |   91|  12.1k|  \
  |  |   92|  93.2k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 81.0k, False: 12.1k]
  |  |  ------------------
  |  |   93|  81.0k|    Rc = Rb; \
  |  |   94|  81.0k|    Rb = *prev_row++; \
  |  |   95|  81.0k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  81.0k|    *undiff_buf++ = Ra; \
  |  |   97|  81.0k|  }
  ------------------
  138|  12.1k|}
jdlossls-8.c:jpeg_undifference5:
  144|  1.12k|{
  145|  1.12k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   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|  5.30k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 4.17k, False: 1.12k]
  |  |  ------------------
  |  |   93|  4.17k|    Rc = Rb; \
  |  |   94|  4.17k|    Rb = *prev_row++; \
  |  |   95|  4.17k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  4.17k|    *undiff_buf++ = Ra; \
  |  |   97|  4.17k|  }
  ------------------
  146|  1.12k|}
jdlossls-8.c:jpeg_undifference6:
  152|  1.08k|{
  153|  1.08k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  1.08k|  int Ra, Rb, Rc; \
  |  |   87|  1.08k|  \
  |  |   88|  1.08k|  Rb = *prev_row++; \
  |  |   89|  1.08k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.08k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.08k|  *undiff_buf++ = Ra; \
  |  |   91|  1.08k|  \
  |  |   92|  11.0k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 9.99k, False: 1.08k]
  |  |  ------------------
  |  |   93|  9.99k|    Rc = Rb; \
  |  |   94|  9.99k|    Rb = *prev_row++; \
  |  |   95|  9.99k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  9.99k|    *undiff_buf++ = Ra; \
  |  |   97|  9.99k|  }
  ------------------
  154|  1.08k|}
jdlossls-8.c:jpeg_undifference7:
  160|  1.37k|{
  161|  1.37k|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|  1.37k|  int Ra, Rb, Rc; \
  |  |   87|  1.37k|  \
  |  |   88|  1.37k|  Rb = *prev_row++; \
  |  |   89|  1.37k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.37k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.37k|  *undiff_buf++ = Ra; \
  |  |   91|  1.37k|  \
  |  |   92|  4.20k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.83k, False: 1.37k]
  |  |  ------------------
  |  |   93|  2.83k|    Rc = Rb; \
  |  |   94|  2.83k|    Rb = *prev_row++; \
  |  |   95|  2.83k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.83k|    *undiff_buf++ = Ra; \
  |  |   97|  2.83k|  }
  ------------------
  162|  1.37k|  (void)(Rc);
  163|  1.37k|}
jdlossls-8.c:simple_upscale:
  221|   127k|{
  222|  4.50M|  do {
  223|  4.50M|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  4.50M|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 4.37M, False: 127k]
  ------------------
  225|   127k|}
jdlossls-8.c:noscale:
  230|   109k|{
  231|  27.2M|  do {
  232|  27.2M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  27.2M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 27.1M, False: 109k]
  ------------------
  234|   109k|}
j12init_lossless_decompressor:
  281|    387|{
  282|    387|  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|    387|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    774|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 387]
  ------------------
  288|    387|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    387|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 387]
  ------------------
  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|    387|  losslessd = (lossless_decomp_ptr)
  294|    387|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    387|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    387|                                sizeof(jpeg_lossless_decompressor));
  296|    387|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    387|  losslessd->pub.start_pass = start_pass_lossless;
  298|    387|}
jdlossls-12.c:start_pass_lossless:
  243|   298k|{
  244|   298k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|   298k|  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|   298k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 298k]
  |  Branch (257:24): [True: 1, False: 298k]
  ------------------
  258|   298k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 298k]
  |  Branch (258:25): [True: 1, False: 298k]
  ------------------
  259|   298k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 298k]
  |  Branch (259:24): [True: 1, False: 298k]
  ------------------
  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|   298k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  1.08M|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 790k, False: 298k]
  ------------------
  265|   790k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|   298k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 35.8k, False: 262k]
  ------------------
  269|  35.8k|    losslessd->scaler_scale = simple_upscale;
  270|   262k|  else
  271|   262k|    losslessd->scaler_scale = noscale;
  272|   298k|}
jdlossls-12.c:jpeg_undifference_first_row:
  177|   289k|{
  178|   289k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|   289k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|   289k|  int Ra; \
  |  |   60|   289k|  \
  |  |   61|   289k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|   289k|  *undiff_buf++ = Ra; \
  |  |   63|   289k|  \
  |  |   64|  2.02G|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 2.02G, False: 289k]
  |  |  ------------------
  |  |   65|  2.02G|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  2.02G|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  2.02G|    *undiff_buf++ = Ra; \
  |  |   67|  2.02G|  }
  ------------------
  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|   289k|  switch (cinfo->Ss) {
  188|  4.25k|  case 1:
  ------------------
  |  Branch (188:3): [True: 4.25k, False: 285k]
  ------------------
  189|  4.25k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|  4.25k|    break;
  191|  4.89k|  case 2:
  ------------------
  |  Branch (191:3): [True: 4.89k, False: 285k]
  ------------------
  192|  4.89k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|  4.89k|    break;
  194|  5.84k|  case 3:
  ------------------
  |  Branch (194:3): [True: 5.84k, False: 284k]
  ------------------
  195|  5.84k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|  5.84k|    break;
  197|   169k|  case 4:
  ------------------
  |  Branch (197:3): [True: 169k, False: 120k]
  ------------------
  198|   169k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|   169k|    break;
  200|  68.5k|  case 5:
  ------------------
  |  Branch (200:3): [True: 68.5k, False: 221k]
  ------------------
  201|  68.5k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|  68.5k|    break;
  203|  34.4k|  case 6:
  ------------------
  |  Branch (203:3): [True: 34.4k, False: 255k]
  ------------------
  204|  34.4k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|  34.4k|    break;
  206|  2.22k|  case 7:
  ------------------
  |  Branch (206:3): [True: 2.22k, False: 287k]
  ------------------
  207|  2.22k|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  2.22k|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 289k]
  ------------------
  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|   289k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|   289k|  }
  213|   289k|}
jdlossls-12.c:jpeg_undifference1:
  111|  1.52k|{
  112|  1.52k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  1.52k|  int Ra; \
  |  |   60|  1.52k|  \
  |  |   61|  1.52k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  1.52k|  *undiff_buf++ = Ra; \
  |  |   63|  1.52k|  \
  |  |   64|  5.90k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 4.37k, False: 1.52k]
  |  |  ------------------
  |  |   65|  4.37k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  4.37k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  4.37k|    *undiff_buf++ = Ra; \
  |  |   67|  4.37k|  }
  ------------------
  113|  1.52k|}
jdlossls-12.c:jpeg_undifference2:
  119|  1.13k|{
  120|  1.13k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  1.13k|  int Ra, Rb, Rc; \
  |  |   87|  1.13k|  \
  |  |   88|  1.13k|  Rb = *prev_row++; \
  |  |   89|  1.13k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.13k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.13k|  *undiff_buf++ = Ra; \
  |  |   91|  1.13k|  \
  |  |   92|  6.00k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 4.87k, False: 1.13k]
  |  |  ------------------
  |  |   93|  4.87k|    Rc = Rb; \
  |  |   94|  4.87k|    Rb = *prev_row++; \
  |  |   95|  4.87k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  4.87k|    *undiff_buf++ = Ra; \
  |  |   97|  4.87k|  }
  ------------------
  121|  1.13k|  (void)(Rc);
  122|  1.13k|}
jdlossls-12.c:jpeg_undifference3:
  128|  1.38k|{
  129|  1.38k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  1.38k|  int Ra, Rb, Rc; \
  |  |   87|  1.38k|  \
  |  |   88|  1.38k|  Rb = *prev_row++; \
  |  |   89|  1.38k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.38k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.38k|  *undiff_buf++ = Ra; \
  |  |   91|  1.38k|  \
  |  |   92|  6.69k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 5.31k, False: 1.38k]
  |  |  ------------------
  |  |   93|  5.31k|    Rc = Rb; \
  |  |   94|  5.31k|    Rb = *prev_row++; \
  |  |   95|  5.31k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  5.31k|    *undiff_buf++ = Ra; \
  |  |   97|  5.31k|  }
  ------------------
  130|  1.38k|}
jdlossls-12.c:jpeg_undifference4:
  136|  1.00k|{
  137|  1.00k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  1.00k|  int Ra, Rb, Rc; \
  |  |   87|  1.00k|  \
  |  |   88|  1.00k|  Rb = *prev_row++; \
  |  |   89|  1.00k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.00k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.00k|  *undiff_buf++ = Ra; \
  |  |   91|  1.00k|  \
  |  |   92|  4.39k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 3.38k, False: 1.00k]
  |  |  ------------------
  |  |   93|  3.38k|    Rc = Rb; \
  |  |   94|  3.38k|    Rb = *prev_row++; \
  |  |   95|  3.38k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  3.38k|    *undiff_buf++ = Ra; \
  |  |   97|  3.38k|  }
  ------------------
  138|  1.00k|}
jdlossls-12.c:jpeg_undifference5:
  144|  1.30k|{
  145|  1.30k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  1.30k|  int Ra, Rb, Rc; \
  |  |   87|  1.30k|  \
  |  |   88|  1.30k|  Rb = *prev_row++; \
  |  |   89|  1.30k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.30k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.30k|  *undiff_buf++ = Ra; \
  |  |   91|  1.30k|  \
  |  |   92|  3.63k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.33k, False: 1.30k]
  |  |  ------------------
  |  |   93|  2.33k|    Rc = Rb; \
  |  |   94|  2.33k|    Rb = *prev_row++; \
  |  |   95|  2.33k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.33k|    *undiff_buf++ = Ra; \
  |  |   97|  2.33k|  }
  ------------------
  146|  1.30k|}
jdlossls-12.c:jpeg_undifference6:
  152|    845|{
  153|    845|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|    845|  int Ra, Rb, Rc; \
  |  |   87|    845|  \
  |  |   88|    845|  Rb = *prev_row++; \
  |  |   89|    845|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    845|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    845|  *undiff_buf++ = Ra; \
  |  |   91|    845|  \
  |  |   92|  3.35k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.50k, False: 845]
  |  |  ------------------
  |  |   93|  2.50k|    Rc = Rb; \
  |  |   94|  2.50k|    Rb = *prev_row++; \
  |  |   95|  2.50k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.50k|    *undiff_buf++ = Ra; \
  |  |   97|  2.50k|  }
  ------------------
  154|    845|}
jdlossls-12.c:jpeg_undifference7:
  160|    915|{
  161|    915|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|    915|  int Ra, Rb, Rc; \
  |  |   87|    915|  \
  |  |   88|    915|  Rb = *prev_row++; \
  |  |   89|    915|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    915|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    915|  *undiff_buf++ = Ra; \
  |  |   91|    915|  \
  |  |   92|  2.56k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.64k, False: 915]
  |  |  ------------------
  |  |   93|  1.64k|    Rc = Rb; \
  |  |   94|  1.64k|    Rb = *prev_row++; \
  |  |   95|  1.64k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.64k|    *undiff_buf++ = Ra; \
  |  |   97|  1.64k|  }
  ------------------
  162|    915|  (void)(Rc);
  163|    915|}
jdlossls-12.c:simple_upscale:
  221|  31.0k|{
  222|  2.87M|  do {
  223|  2.87M|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  2.87M|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 2.84M, False: 31.0k]
  ------------------
  225|  31.0k|}
jdlossls-12.c:noscale:
  230|   266k|{
  231|  2.02G|  do {
  232|  2.02G|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  2.02G|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 2.02G, False: 266k]
  ------------------
  234|   266k|}

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

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

jpeg_resync_to_restart:
 1218|  1.49M|{
 1219|  1.49M|  int marker = cinfo->unread_marker;
 1220|  1.49M|  int action = 1;
 1221|       |
 1222|       |  /* Always put up a warning. */
 1223|  1.49M|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  290|  1.49M|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  1.49M|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  1.49M|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  1.49M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1224|       |
 1225|       |  /* Outer loop handles repeated decision after scanning forward. */
 1226|  1.49M|  for (;;) {
 1227|  1.49M|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1227:9): [True: 3.82k, False: 1.49M]
  ------------------
 1228|  3.82k|      action = 2;               /* invalid marker */
 1229|  1.49M|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1229:14): [True: 38.3k, False: 1.45M]
  |  Branch (1229:38): [True: 1.45M, False: 2.30k]
  ------------------
 1230|  1.48M|      action = 3;               /* valid non-restart marker */
 1231|  2.30k|    else {
 1232|  2.30k|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1232:11): [True: 498, False: 1.81k]
  ------------------
 1233|  1.81k|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1233:11): [True: 357, False: 1.45k]
  ------------------
 1234|    855|        action = 3;             /* one of the next two expected restarts */
 1235|  1.45k|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1235:16): [True: 238, False: 1.21k]
  ------------------
 1236|  1.21k|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1236:16): [True: 288, False: 928]
  ------------------
 1237|    526|        action = 2;             /* a prior restart, so advance */
 1238|    928|      else
 1239|    928|        action = 1;             /* desired restart or too far away */
 1240|  2.30k|    }
 1241|  1.49M|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  304|  1.49M|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  1.49M|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  1.49M|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  1.49M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1242|  1.49M|    switch (action) {
  ------------------
  |  Branch (1242:13): [True: 1.49M, False: 0]
  ------------------
 1243|    928|    case 1:
  ------------------
  |  Branch (1243:5): [True: 928, False: 1.49M]
  ------------------
 1244|       |      /* Discard marker and let entropy decoder resume processing. */
 1245|    928|      cinfo->unread_marker = 0;
 1246|    928|      return TRUE;
  ------------------
  |  |  210|    928|#define TRUE    1
  ------------------
 1247|  4.35k|    case 2:
  ------------------
  |  Branch (1247:5): [True: 4.35k, False: 1.49M]
  ------------------
 1248|       |      /* Scan to the next marker, and repeat the decision loop. */
 1249|  4.35k|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1249:11): [True: 0, False: 4.35k]
  ------------------
 1250|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1251|  4.35k|      marker = cinfo->unread_marker;
 1252|  4.35k|      break;
 1253|  1.48M|    case 3:
  ------------------
  |  Branch (1253:5): [True: 1.48M, False: 5.28k]
  ------------------
 1254|       |      /* Return without advancing past this marker. */
 1255|       |      /* Entropy decoder will be forced to process an empty segment. */
 1256|  1.48M|      return TRUE;
  ------------------
  |  |  210|  1.48M|#define TRUE    1
  ------------------
 1257|  1.49M|    }
 1258|  1.49M|  } /* end loop */
 1259|  1.49M|}
jinit_marker_reader:
 1288|  61.5k|{
 1289|  61.5k|  my_marker_ptr marker;
 1290|  61.5k|  int i;
 1291|       |
 1292|       |  /* Create subobject in permanent pool */
 1293|  61.5k|  marker = (my_marker_ptr)
 1294|  61.5k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  61.5k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1295|  61.5k|                                sizeof(my_marker_reader));
 1296|  61.5k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1297|       |  /* Initialize public method pointers */
 1298|  61.5k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1299|  61.5k|  marker->pub.read_markers = read_markers;
 1300|  61.5k|  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|  61.5k|  marker->process_COM = skip_variable;
 1306|  61.5k|  marker->length_limit_COM = 0;
 1307|  1.04M|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1307:15): [True: 984k, False: 61.5k]
  ------------------
 1308|   984k|    marker->process_APPn[i] = skip_variable;
 1309|   984k|    marker->length_limit_APPn[i] = 0;
 1310|   984k|  }
 1311|  61.5k|  marker->process_APPn[0] = get_interesting_appn;
 1312|  61.5k|  marker->process_APPn[14] = get_interesting_appn;
 1313|       |  /* Reset marker processing state */
 1314|  61.5k|  reset_marker_reader(cinfo);
 1315|  61.5k|}
jdmarker.c:next_marker:
  892|   689k|{
  893|   689k|  int c;
  894|   689k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   689k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   689k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   689k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  895|       |
  896|   708k|  for (;;) {
  897|   708k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   708k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.93M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 408k]
  |  |  |  |  |  Branch (279:38): [True: 408k, False: 299k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 708k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   708k|            bytes_in_buffer--; \
  |  |  156|   708k|            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|  73.8M|    while (c != 0xFF) {
  ------------------
  |  Branch (903:12): [True: 73.1M, False: 708k]
  ------------------
  904|  73.1M|      cinfo->marker->discarded_bytes++;
  905|  73.1M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  73.1M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  73.1M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  906|  73.1M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  73.1M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  73.2M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 38.4k]
  |  |  |  |  |  Branch (279:38): [True: 38.4k, False: 73.0M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 73.1M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  73.1M|            bytes_in_buffer--; \
  |  |  156|  73.1M|            V = *next_input_byte++; )
  ------------------
  907|  73.1M|    }
  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|   931k|    do {
  914|   931k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   931k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   935k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.53k]
  |  |  |  |  |  Branch (279:38): [True: 1.53k, False: 929k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 931k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   931k|            bytes_in_buffer--; \
  |  |  156|   931k|            V = *next_input_byte++; )
  ------------------
  915|   931k|    } while (c == 0xFF);
  ------------------
  |  Branch (915:14): [True: 222k, False: 708k]
  ------------------
  916|   708k|    if (c != 0)
  ------------------
  |  Branch (916:9): [True: 689k, False: 19.0k]
  ------------------
  917|   689k|      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|  19.0k|    cinfo->marker->discarded_bytes += 2;
  922|  19.0k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  19.0k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  19.0k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  923|  19.0k|  }
  924|       |
  925|   689k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (925:7): [True: 210k, False: 478k]
  ------------------
  926|   210k|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|   210k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   210k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   210k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   210k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  927|   210k|    cinfo->marker->discarded_bytes = 0;
  928|   210k|  }
  929|       |
  930|   689k|  cinfo->unread_marker = c;
  931|       |
  932|   689k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   689k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   689k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  933|   689k|  return TRUE;
  ------------------
  |  |  210|   689k|#define TRUE    1
  ------------------
  934|   689k|}
jdmarker.c:reset_marker_reader:
 1268|   303k|{
 1269|   303k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1270|       |
 1271|   303k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1272|   303k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1273|   303k|  cinfo->unread_marker = 0;             /* no pending marker */
 1274|   303k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  207|   303k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|   303k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  207|   303k|#define FALSE   0               /* values of boolean */
  ------------------
 1276|   303k|  marker->pub.discarded_bytes = 0;
 1277|       |  marker->cur_marker = NULL;
 1278|   303k|}
jdmarker.c:read_markers:
  970|   292k|{
  971|       |  /* Outer loop repeats once for each marker. */
  972|   961k|  for (;;) {
  973|       |    /* Collect the marker proper, unless we already did. */
  974|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  975|   961k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (975:9): [True: 923k, False: 38.8k]
  ------------------
  976|   923k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (976:11): [True: 242k, False: 680k]
  ------------------
  977|   242k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (977:13): [True: 0, False: 242k]
  ------------------
  978|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  979|   680k|      } else {
  980|   680k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (980:13): [True: 0, False: 680k]
  ------------------
  981|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  982|   680k|      }
  983|   923k|    }
  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|   961k|    switch (cinfo->unread_marker) {
  989|   123k|    case M_SOI:
  ------------------
  |  Branch (989:5): [True: 123k, False: 838k]
  ------------------
  990|   123k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (990:11): [True: 0, False: 123k]
  ------------------
  991|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  992|   123k|      break;
  993|       |
  994|   123k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (994:5): [True: 73.2k, False: 888k]
  ------------------
  995|  76.2k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (995:5): [True: 3.05k, False: 958k]
  ------------------
  996|  76.2k|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  76.2k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  76.2k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  76.2k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (996:11): [True: 0, False: 76.2k]
  ------------------
  997|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  998|  76.2k|      break;
  999|       |
 1000|  76.2k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (1000:5): [True: 10.0k, False: 951k]
  ------------------
 1001|  10.0k|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  210|  10.0k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  10.0k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  10.0k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1001:11): [True: 0, False: 10.0k]
  ------------------
 1002|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1003|  10.0k|      break;
 1004|       |
 1005|  10.0k|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1005:5): [True: 7.21k, False: 954k]
  ------------------
 1006|  7.21k|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  7.21k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  210|  7.21k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  7.21k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1006:11): [True: 0, False: 7.21k]
  ------------------
 1007|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1008|  7.21k|      break;
 1009|       |
 1010|  9.34k|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1010:5): [True: 9.34k, False: 952k]
  ------------------
 1011|  9.34k|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  9.34k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  9.34k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  210|  9.34k|#define TRUE    1
  ------------------
  |  Branch (1011:11): [True: 0, False: 9.34k]
  ------------------
 1012|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1013|  9.34k|      break;
 1014|       |
 1015|  11.0k|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1015:5): [True: 11.0k, False: 950k]
  ------------------
 1016|  11.0k|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  11.0k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  207|  11.0k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  11.0k|#define TRUE    1
  ------------------
  |  Branch (1016:11): [True: 0, False: 11.0k]
  ------------------
 1017|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1018|  11.0k|      break;
 1019|       |
 1020|  11.0k|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1020:5): [True: 1.06k, False: 960k]
  ------------------
 1021|  1.06k|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  207|  1.06k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|  1.06k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|  1.06k|#define TRUE    1
  ------------------
  |  Branch (1021:11): [True: 0, False: 1.06k]
  ------------------
 1022|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1023|  1.06k|      break;
 1024|       |
 1025|       |    /* Currently unsupported SOFn types */
 1026|  1.06k|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1026:5): [True: 204, False: 961k]
  ------------------
 1027|    538|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1027:5): [True: 334, False: 961k]
  ------------------
 1028|    802|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1028:5): [True: 264, False: 961k]
  ------------------
 1029|  1.19k|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1029:5): [True: 395, False: 961k]
  ------------------
 1030|  1.39k|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 202, False: 961k]
  ------------------
 1031|  1.76k|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 367, False: 961k]
  ------------------
 1032|  1.96k|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1032:5): [True: 198, False: 961k]
  ------------------
 1033|  1.96k|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|  1.96k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.96k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.96k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1034|  1.96k|      break;
 1035|       |
 1036|   121k|    case M_SOS:
  ------------------
  |  Branch (1036:5): [True: 121k, False: 840k]
  ------------------
 1037|   121k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1037:11): [True: 0, False: 121k]
  ------------------
 1038|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1039|   121k|      cinfo->unread_marker = 0; /* processed the marker */
 1040|   121k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1111|   121k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1041|       |
 1042|  39.4k|    case M_EOI:
  ------------------
  |  Branch (1042:5): [True: 39.4k, False: 922k]
  ------------------
 1043|  39.4k|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|  39.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  39.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1044|  39.4k|      cinfo->unread_marker = 0; /* processed the marker */
 1045|  39.4k|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|  39.4k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1046|       |
 1047|  1.57k|    case M_DAC:
  ------------------
  |  Branch (1047:5): [True: 1.57k, False: 960k]
  ------------------
 1048|  1.57k|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1048:11): [True: 0, False: 1.57k]
  ------------------
 1049|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1050|  1.57k|      break;
 1051|       |
 1052|   214k|    case M_DHT:
  ------------------
  |  Branch (1052:5): [True: 214k, False: 746k]
  ------------------
 1053|   214k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1053:11): [True: 0, False: 214k]
  ------------------
 1054|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1055|   214k|      break;
 1056|       |
 1057|   214k|    case M_DQT:
  ------------------
  |  Branch (1057:5): [True: 132k, False: 829k]
  ------------------
 1058|   132k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1058:11): [True: 0, False: 132k]
  ------------------
 1059|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1060|   132k|      break;
 1061|       |
 1062|   132k|    case M_DRI:
  ------------------
  |  Branch (1062:5): [True: 19.8k, False: 942k]
  ------------------
 1063|  19.8k|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1063:11): [True: 0, False: 19.8k]
  ------------------
 1064|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1065|  19.8k|      break;
 1066|       |
 1067|  19.8k|    case M_APP0:
  ------------------
  |  Branch (1067:5): [True: 14.4k, False: 947k]
  ------------------
 1068|  15.9k|    case M_APP1:
  ------------------
  |  Branch (1068:5): [True: 1.54k, False: 960k]
  ------------------
 1069|  42.6k|    case M_APP2:
  ------------------
  |  Branch (1069:5): [True: 26.6k, False: 935k]
  ------------------
 1070|  42.9k|    case M_APP3:
  ------------------
  |  Branch (1070:5): [True: 310, False: 961k]
  ------------------
 1071|  43.3k|    case M_APP4:
  ------------------
  |  Branch (1071:5): [True: 415, False: 961k]
  ------------------
 1072|  43.8k|    case M_APP5:
  ------------------
  |  Branch (1072:5): [True: 481, False: 961k]
  ------------------
 1073|  44.3k|    case M_APP6:
  ------------------
  |  Branch (1073:5): [True: 471, False: 961k]
  ------------------
 1074|  44.7k|    case M_APP7:
  ------------------
  |  Branch (1074:5): [True: 413, False: 961k]
  ------------------
 1075|  48.2k|    case M_APP8:
  ------------------
  |  Branch (1075:5): [True: 3.56k, False: 958k]
  ------------------
 1076|  48.6k|    case M_APP9:
  ------------------
  |  Branch (1076:5): [True: 400, False: 961k]
  ------------------
 1077|  49.8k|    case M_APP10:
  ------------------
  |  Branch (1077:5): [True: 1.11k, False: 960k]
  ------------------
 1078|  50.5k|    case M_APP11:
  ------------------
  |  Branch (1078:5): [True: 781, False: 961k]
  ------------------
 1079|  51.4k|    case M_APP12:
  ------------------
  |  Branch (1079:5): [True: 825, False: 961k]
  ------------------
 1080|  51.8k|    case M_APP13:
  ------------------
  |  Branch (1080:5): [True: 415, False: 961k]
  ------------------
 1081|  55.7k|    case M_APP14:
  ------------------
  |  Branch (1081:5): [True: 3.89k, False: 958k]
  ------------------
 1082|  57.5k|    case M_APP15:
  ------------------
  |  Branch (1082:5): [True: 1.78k, False: 960k]
  ------------------
 1083|  57.5k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1083:11): [True: 0, False: 57.5k]
  ------------------
 1084|  57.5k|               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|  57.5k|      break;
 1087|       |
 1088|  57.5k|    case M_COM:
  ------------------
  |  Branch (1088:5): [True: 2.07k, False: 959k]
  ------------------
 1089|  2.07k|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1089:11): [True: 0, False: 2.07k]
  ------------------
 1090|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1091|  2.07k|      break;
 1092|       |
 1093|  2.07k|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1093:5): [True: 330, False: 961k]
  ------------------
 1094|    858|    case M_RST1:
  ------------------
  |  Branch (1094:5): [True: 528, False: 961k]
  ------------------
 1095|  1.71k|    case M_RST2:
  ------------------
  |  Branch (1095:5): [True: 861, False: 961k]
  ------------------
 1096|  1.96k|    case M_RST3:
  ------------------
  |  Branch (1096:5): [True: 246, False: 961k]
  ------------------
 1097|  2.29k|    case M_RST4:
  ------------------
  |  Branch (1097:5): [True: 326, False: 961k]
  ------------------
 1098|  2.64k|    case M_RST5:
  ------------------
  |  Branch (1098:5): [True: 355, False: 961k]
  ------------------
 1099|  4.12k|    case M_RST6:
  ------------------
  |  Branch (1099:5): [True: 1.48k, False: 960k]
  ------------------
 1100|  5.03k|    case M_RST7:
  ------------------
  |  Branch (1100:5): [True: 911, False: 960k]
  ------------------
 1101|  9.93k|    case M_TEM:
  ------------------
  |  Branch (1101:5): [True: 4.89k, False: 957k]
  ------------------
 1102|  9.93k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|  9.93k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  9.93k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  9.93k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1103|  9.93k|      break;
 1104|       |
 1105|  1.13k|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1105:5): [True: 1.13k, False: 960k]
  ------------------
 1106|  1.13k|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1106:11): [True: 0, False: 1.13k]
  ------------------
 1107|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1108|  1.13k|      break;
 1109|       |
 1110|  2.09k|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1110:5): [True: 2.09k, False: 959k]
  ------------------
 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.09k|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|  2.09k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  2.09k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  2.09k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1117|  2.09k|      break;
 1118|   961k|    }
 1119|       |    /* Successfully processed marker, so reset state variable */
 1120|   669k|    cinfo->unread_marker = 0;
 1121|   669k|  } /* end loop */
 1122|   292k|}
jdmarker.c:first_marker:
  945|   242k|{
  946|   242k|  int c, c2;
  947|   242k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   242k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   242k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   242k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  948|       |
  949|   242k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   242k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   410k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 56.0k]
  |  |  |  |  |  Branch (279:38): [True: 56.0k, False: 185k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 242k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   242k|            bytes_in_buffer--; \
  |  |  156|   242k|            V = *next_input_byte++; )
  ------------------
  950|   242k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|   242k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   300k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 19.5k]
  |  |  |  |  |  Branch (279:38): [True: 19.5k, False: 222k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 242k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   242k|            bytes_in_buffer--; \
  |  |  156|   242k|            V = *next_input_byte++; )
  ------------------
  951|   242k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (951:7): [True: 112k, False: 129k]
  |  Branch (951:20): [True: 5.89k, False: 123k]
  ------------------
  952|   118k|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|   118k|  ((cinfo)->err->msg_code = (code), \
  |  |  248|   118k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|   118k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|   118k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  953|       |
  954|   242k|  cinfo->unread_marker = c2;
  955|       |
  956|   242k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   242k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   242k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  957|   242k|  return TRUE;
  ------------------
  |  |  210|   242k|#define TRUE    1
  ------------------
  958|   242k|}
jdmarker.c:get_soi:
  204|   123k|{
  205|   123k|  int i;
  206|       |
  207|   123k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|   123k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|   123k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|   123k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 341, False: 123k]
  ------------------
  210|    341|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|    341|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    341|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|  2.09M|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  2.09M|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 1.97M, False: 123k]
  ------------------
  215|  1.97M|    cinfo->arith_dc_L[i] = 0;
  216|  1.97M|    cinfo->arith_dc_U[i] = 1;
  217|  1.97M|    cinfo->arith_ac_K[i] = 5;
  218|  1.97M|  }
  219|   123k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|   123k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|   123k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  207|   123k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|   123k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  207|   123k|#define FALSE   0               /* values of boolean */
  ------------------
  227|   123k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|   123k|  cinfo->JFIF_minor_version = 1;
  229|   123k|  cinfo->density_unit = 0;
  230|   123k|  cinfo->X_density = 1;
  231|   123k|  cinfo->Y_density = 1;
  232|   123k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  207|   123k|#define FALSE   0               /* values of boolean */
  ------------------
  233|   123k|  cinfo->Adobe_transform = 0;
  234|       |
  235|   123k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  210|   123k|#define TRUE    1
  ------------------
  236|       |
  237|   123k|  return TRUE;
  ------------------
  |  |  210|   123k|#define TRUE    1
  ------------------
  238|   123k|}
jdmarker.c:get_sof:
  245|   115k|{
  246|   115k|  JLONG length;
  247|   115k|  int c, ci;
  248|   115k|  jpeg_component_info *compptr;
  249|   115k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   115k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   115k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   115k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|   115k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 446, False: 114k]
  ------------------
  252|    446|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|    446|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    446|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|   115k|  cinfo->progressive_mode = is_prog;
  255|   115k|  cinfo->master->lossless = is_lossless;
  256|   115k|  cinfo->arith_code = is_arith;
  257|       |
  258|   115k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   115k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   231k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 368]
  |  |  |  |  |  Branch (279:38): [True: 368, False: 114k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 246]
  |  |  |  |  |  Branch (279:38): [True: 246, False: 114k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   115k|            bytes_in_buffer--; \
  |  |  164|   115k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   115k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   115k|            bytes_in_buffer--; \
  |  |  167|   115k|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|   115k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|   115k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   116k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 417]
  |  |  |  |  |  Branch (279:38): [True: 417, False: 114k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   115k|            bytes_in_buffer--; \
  |  |  156|   115k|            V = *next_input_byte++; )
  ------------------
  261|   115k|  cinfo->master->jpeg_data_precision = cinfo->data_precision;
  262|   115k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|   115k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   232k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 325]
  |  |  |  |  |  Branch (279:38): [True: 325, False: 114k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 476]
  |  |  |  |  |  Branch (279:38): [True: 476, False: 114k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   115k|            bytes_in_buffer--; \
  |  |  164|   115k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   115k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   115k|            bytes_in_buffer--; \
  |  |  167|   115k|            V += *next_input_byte++; )
  ------------------
  263|   115k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|   115k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   232k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 382]
  |  |  |  |  |  Branch (279:38): [True: 382, False: 114k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 585]
  |  |  |  |  |  Branch (279:38): [True: 585, False: 114k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   115k|            bytes_in_buffer--; \
  |  |  164|   115k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   115k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   115k|            bytes_in_buffer--; \
  |  |  167|   115k|            V += *next_input_byte++; )
  ------------------
  264|   115k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|   115k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   116k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 414]
  |  |  |  |  |  Branch (279:38): [True: 414, False: 114k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   115k|            bytes_in_buffer--; \
  |  |  156|   115k|            V = *next_input_byte++; )
  ------------------
  265|       |
  266|   115k|  length -= 8;
  267|       |
  268|   115k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|   115k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   115k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|   115k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|   115k|           (cinfo)->err->msg_code = (code); \
  |  |  317|   115k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  269|   115k|           (int)cinfo->image_width, (int)cinfo->image_height,
  270|   115k|           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|   115k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (275:7): [True: 657, False: 114k]
  |  Branch (275:35): [True: 250, False: 114k]
  ------------------
  276|   114k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (276:7): [True: 206, False: 113k]
  ------------------
  277|    667|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|    667|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    667|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |
  279|   115k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (279:7): [True: 1.02k, False: 113k]
  ------------------
  280|  1.02k|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|  1.02k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.02k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|   115k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (282:7): [True: 112k, False: 2.13k]
  ------------------
  283|   112k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  284|   112k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   112k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  285|   112k|                         cinfo->num_components * sizeof(jpeg_component_info));
  286|       |
  287|   288k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:44): [True: 173k, False: 115k]
  ------------------
  288|   173k|       ci++, compptr++) {
  289|   173k|    compptr->component_index = ci;
  290|   173k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|   173k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   175k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 574]
  |  |  |  |  |  Branch (279:38): [True: 574, False: 172k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 173k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   173k|            bytes_in_buffer--; \
  |  |  156|   173k|            V = *next_input_byte++; )
  ------------------
  291|   173k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   173k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   175k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 647]
  |  |  |  |  |  Branch (279:38): [True: 647, False: 172k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 173k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   173k|            bytes_in_buffer--; \
  |  |  156|   173k|            V = *next_input_byte++; )
  ------------------
  292|   173k|    compptr->h_samp_factor = (c >> 4) & 15;
  293|   173k|    compptr->v_samp_factor = (c     ) & 15;
  294|   173k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|   173k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   175k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 816]
  |  |  |  |  |  Branch (279:38): [True: 816, False: 172k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 173k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   173k|            bytes_in_buffer--; \
  |  |  156|   173k|            V = *next_input_byte++; )
  ------------------
  295|       |
  296|   173k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|   173k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   173k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 173k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|   173k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|   173k|           (cinfo)->err->msg_code = (code); \
  |  |  317|   173k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  297|   173k|             compptr->component_id, compptr->h_samp_factor,
  298|   173k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  299|   173k|  }
  300|       |
  301|   115k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  210|   115k|#define TRUE    1
  ------------------
  302|       |
  303|   115k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   115k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   115k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  304|   115k|  return TRUE;
  ------------------
  |  |  210|   115k|#define TRUE    1
  ------------------
  305|   115k|}
jdmarker.c:get_sos:
  311|   121k|{
  312|   121k|  JLONG length;
  313|   121k|  int i, ci, n, c, cc, pi;
  314|   121k|  jpeg_component_info *compptr;
  315|   121k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   121k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   121k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   121k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  316|       |
  317|   121k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (317:7): [True: 225, False: 121k]
  ------------------
  318|    225|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|    225|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    225|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|   121k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   121k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   245k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 365]
  |  |  |  |  |  Branch (279:38): [True: 365, False: 121k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 284]
  |  |  |  |  |  Branch (279:38): [True: 284, False: 121k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 121k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   121k|            bytes_in_buffer--; \
  |  |  164|   121k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   121k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   121k|            bytes_in_buffer--; \
  |  |  167|   121k|            V += *next_input_byte++; )
  ------------------
  321|       |
  322|   121k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|   121k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   122k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 444]
  |  |  |  |  |  Branch (279:38): [True: 444, False: 121k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 121k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   121k|            bytes_in_buffer--; \
  |  |  156|   121k|            V = *next_input_byte++; )
  ------------------
  323|       |
  324|   121k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|   121k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|   121k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|   121k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  325|       |
  326|   121k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|   120k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (326:7): [True: 1.10k, False: 120k]
  |  Branch (326:32): [True: 231, False: 120k]
  |  Branch (326:41): [True: 108, False: 120k]
  ------------------
  327|  1.21k|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|  1.21k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.21k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  328|       |
  329|   121k|  cinfo->comps_in_scan = n;
  330|       |
  331|       |  /* Collect the component-spec parameters */
  332|       |
  333|   601k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|   601k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (333:15): [True: 480k, False: 121k]
  ------------------
  334|   480k|    cinfo->cur_comp_info[i] = NULL;
  335|       |
  336|   254k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (336:15): [True: 134k, False: 120k]
  ------------------
  337|   134k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|   134k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   135k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 293]
  |  |  |  |  |  Branch (279:38): [True: 293, False: 134k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 134k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   134k|            bytes_in_buffer--; \
  |  |  156|   134k|            V = *next_input_byte++; )
  ------------------
  338|   134k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   134k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   136k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 557]
  |  |  |  |  |  Branch (279:38): [True: 557, False: 133k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 134k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   134k|            bytes_in_buffer--; \
  |  |  156|   134k|            V = *next_input_byte++; )
  ------------------
  339|       |
  340|   134k|    for (ci = 0, compptr = cinfo->comp_info;
  341|   164k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|   163k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (341:10): [True: 163k, False: 1.22k]
  |  Branch (341:40): [True: 163k, False: 207]
  ------------------
  342|   163k|         ci++, compptr++) {
  343|   163k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (343:11): [True: 133k, False: 30.0k]
  |  Branch (343:42): [True: 132k, False: 511]
  ------------------
  344|   132k|        goto id_found;
  345|   163k|    }
  346|       |
  347|  1.43k|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|  1.43k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.43k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.43k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|       |
  349|   132k|id_found:
  350|       |
  351|   132k|    cinfo->cur_comp_info[i] = compptr;
  352|   132k|    compptr->dc_tbl_no = (c >> 4) & 15;
  353|   132k|    compptr->ac_tbl_no = (c     ) & 15;
  354|       |
  355|   132k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|   132k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   132k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 132k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|   132k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|   132k|           (cinfo)->err->msg_code = (code); \
  |  |  312|   132k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  356|   132k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  357|       |
  358|       |    /* This CSi (cc) should differ from the previous CSi */
  359|   153k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (359:18): [True: 20.1k, False: 132k]
  ------------------
  360|  20.1k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (360:11): [True: 214, False: 19.9k]
  ------------------
  361|    214|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|    214|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    214|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    214|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  362|    214|      }
  363|  20.1k|    }
  364|   132k|  }
  365|       |
  366|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  367|   120k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   120k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   122k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 930]
  |  |  |  |  |  Branch (279:38): [True: 930, False: 119k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 120k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   120k|            bytes_in_buffer--; \
  |  |  156|   120k|            V = *next_input_byte++; )
  ------------------
  368|   120k|  cinfo->Ss = c;
  369|   120k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   120k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   123k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.15k]
  |  |  |  |  |  Branch (279:38): [True: 1.15k, False: 118k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 120k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   120k|            bytes_in_buffer--; \
  |  |  156|   120k|            V = *next_input_byte++; )
  ------------------
  370|   120k|  cinfo->Se = c;
  371|   120k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   120k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   124k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.49k]
  |  |  |  |  |  Branch (279:38): [True: 1.49k, False: 118k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 120k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   120k|            bytes_in_buffer--; \
  |  |  156|   120k|            V = *next_input_byte++; )
  ------------------
  372|   120k|  cinfo->Ah = (c >> 4) & 15;
  373|   120k|  cinfo->Al = (c     ) & 15;
  374|       |
  375|   120k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|   120k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   120k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 120k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|   120k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|   120k|           (cinfo)->err->msg_code = (code); \
  |  |  317|   120k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  376|   120k|           cinfo->Ah, cinfo->Al);
  377|       |
  378|       |  /* Prepare to scan data & restart markers */
  379|   120k|  cinfo->marker->next_restart_num = 0;
  380|       |
  381|       |  /* Count another SOS marker */
  382|   120k|  cinfo->input_scan_number++;
  383|       |
  384|   120k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   120k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   120k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  385|   120k|  return TRUE;
  ------------------
  |  |  210|   120k|#define TRUE    1
  ------------------
  386|   120k|}
jdmarker.c:get_dac:
  394|  1.57k|{
  395|  1.57k|  JLONG length;
  396|  1.57k|  int index, val;
  397|  1.57k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  1.57k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  1.57k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  1.57k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  398|       |
  399|  1.57k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  1.57k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.38k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 205]
  |  |  |  |  |  Branch (279:38): [True: 205, False: 1.37k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 204]
  |  |  |  |  |  Branch (279:38): [True: 204, False: 1.37k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.57k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  1.57k|            bytes_in_buffer--; \
  |  |  164|  1.57k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  1.57k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  1.57k|            bytes_in_buffer--; \
  |  |  167|  1.57k|            V += *next_input_byte++; )
  ------------------
  400|  1.57k|  length -= 2;
  401|       |
  402|  3.89k|  while (length > 0) {
  ------------------
  |  Branch (402:10): [True: 2.31k, False: 1.57k]
  ------------------
  403|  2.31k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  2.31k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.01k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 232]
  |  |  |  |  |  Branch (279:38): [True: 232, False: 2.08k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.31k|            bytes_in_buffer--; \
  |  |  156|  2.31k|            V = *next_input_byte++; )
  ------------------
  404|  2.31k|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|  2.31k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.60k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 428]
  |  |  |  |  |  Branch (279:38): [True: 428, False: 1.88k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.31k|            bytes_in_buffer--; \
  |  |  156|  2.31k|            V = *next_input_byte++; )
  ------------------
  405|       |
  406|  2.31k|    length -= 2;
  407|       |
  408|  2.31k|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|  2.31k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  2.31k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  2.31k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  2.31k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  409|       |
  410|  2.31k|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|  2.31k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (410:9): [True: 0, False: 2.31k]
  |  Branch (410:22): [True: 794, False: 1.52k]
  ------------------
  411|    794|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|    794|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    794|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    794|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|       |
  413|  2.31k|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|  2.31k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (413:9): [True: 301, False: 2.01k]
  ------------------
  414|    301|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|    301|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  415|  2.01k|    } else {                    /* define DC table */
  416|  2.01k|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  417|  2.01k|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  418|  2.01k|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (418:11): [True: 230, False: 1.78k]
  ------------------
  419|    230|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  243|    230|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    230|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    230|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  420|  2.01k|    }
  421|  2.31k|  }
  422|       |
  423|  1.57k|  if (length != 0)
  ------------------
  |  Branch (423:7): [True: 227, False: 1.35k]
  ------------------
  424|    227|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    227|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    227|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  425|       |
  426|  1.57k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  1.57k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.57k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  427|  1.57k|  return TRUE;
  ------------------
  |  |  210|  1.57k|#define TRUE    1
  ------------------
  428|  1.57k|}
jdmarker.c:get_dht:
  440|   214k|{
  441|   214k|  JLONG length;
  442|   214k|  UINT8 bits[17];
  443|   214k|  UINT8 huffval[256];
  444|   214k|  int i, index, count;
  445|   214k|  JHUFF_TBL **htblptr;
  446|   214k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   214k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   214k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   214k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  447|       |
  448|   214k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   214k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   431k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 224]
  |  |  |  |  |  Branch (279:38): [True: 224, False: 214k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 247]
  |  |  |  |  |  Branch (279:38): [True: 247, False: 214k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 214k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   214k|            bytes_in_buffer--; \
  |  |  164|   214k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   214k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   214k|            bytes_in_buffer--; \
  |  |  167|   214k|            V += *next_input_byte++; )
  ------------------
  449|   214k|  length -= 2;
  450|       |
  451|   430k|  while (length > 16) {
  ------------------
  |  Branch (451:10): [True: 215k, False: 214k]
  ------------------
  452|   215k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|   215k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   215k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 283]
  |  |  |  |  |  Branch (279:38): [True: 283, False: 214k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 215k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   215k|            bytes_in_buffer--; \
  |  |  156|   215k|            V = *next_input_byte++; )
  ------------------
  453|       |
  454|   215k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|   215k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|   215k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|   215k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  455|       |
  456|   215k|    bits[0] = 0;
  457|   215k|    count = 0;
  458|  3.65M|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (458:17): [True: 3.44M, False: 215k]
  ------------------
  459|  3.44M|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|  3.44M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.46M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.32k]
  |  |  |  |  |  Branch (279:38): [True: 6.32k, False: 3.43M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.44M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.44M|            bytes_in_buffer--; \
  |  |  156|  3.44M|            V = *next_input_byte++; )
  ------------------
  460|  3.44M|      count += bits[i];
  461|  3.44M|    }
  462|       |
  463|   215k|    length -= 1 + 16;
  464|       |
  465|   215k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|   215k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   215k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 215k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|   215k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|   215k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|   215k|           (cinfo)->err->msg_code = (code); \
  |  |  329|   215k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  466|   215k|             bits[1], bits[2], bits[3], bits[4],
  467|   215k|             bits[5], bits[6], bits[7], bits[8]);
  468|   215k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|   215k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   215k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 215k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|   215k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|   215k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|   215k|           (cinfo)->err->msg_code = (code); \
  |  |  329|   215k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  469|   215k|             bits[9], bits[10], bits[11], bits[12],
  470|   215k|             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|   215k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (475:9): [True: 1.24k, False: 213k]
  |  Branch (475:24): [True: 212, False: 213k]
  ------------------
  476|  1.46k|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|  1.46k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.46k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  477|       |
  478|  19.1M|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (478:17): [True: 18.9M, False: 215k]
  ------------------
  479|  18.9M|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|  18.9M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  19.1M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 25.6k]
  |  |  |  |  |  Branch (279:38): [True: 25.6k, False: 18.9M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.9M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   215k|            bytes_in_buffer--; \
  |  |  156|   215k|            V = *next_input_byte++; )
  ------------------
  480|       |
  481|   215k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  482|       |
  483|   215k|    length -= count;
  484|       |
  485|   215k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (485:9): [True: 102k, False: 113k]
  ------------------
  486|   102k|      index -= 0x10;
  487|   102k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|   102k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (487:11): [True: 0, False: 102k]
  |  Branch (487:24): [True: 208, False: 101k]
  ------------------
  488|    208|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|    208|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    208|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    208|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  489|   102k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  490|   113k|    } else {                    /* DC table definition */
  491|   113k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|   111k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (491:11): [True: 1.46k, False: 111k]
  |  Branch (491:24): [True: 210, False: 111k]
  ------------------
  492|    210|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|    210|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    210|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    210|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  493|   113k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  494|   113k|    }
  495|       |
  496|   215k|    if (*htblptr == NULL)
  ------------------
  |  Branch (496:9): [True: 205k, False: 9.27k]
  ------------------
  497|   205k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  498|       |
  499|   215k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  500|   215k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  501|   215k|  }
  502|       |
  503|   214k|  if (length != 0)
  ------------------
  |  Branch (503:7): [True: 254, False: 214k]
  ------------------
  504|    254|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    254|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    254|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  505|       |
  506|   214k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   214k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   214k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  507|   214k|  return TRUE;
  ------------------
  |  |  210|   214k|#define TRUE    1
  ------------------
  508|   214k|}
jdmarker.c:get_dqt:
  514|   132k|{
  515|   132k|  JLONG length;
  516|   132k|  int n, i, prec;
  517|   132k|  unsigned int tmp;
  518|   132k|  JQUANT_TBL *quant_ptr;
  519|   132k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   132k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   132k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   132k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  520|       |
  521|   132k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   132k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   266k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 288]
  |  |  |  |  |  Branch (279:38): [True: 288, False: 132k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 265]
  |  |  |  |  |  Branch (279:38): [True: 265, False: 132k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 132k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   132k|            bytes_in_buffer--; \
  |  |  164|   132k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   132k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   132k|            bytes_in_buffer--; \
  |  |  167|   132k|            V += *next_input_byte++; )
  ------------------
  522|   132k|  length -= 2;
  523|       |
  524|   265k|  while (length > 0) {
  ------------------
  |  Branch (524:10): [True: 133k, False: 132k]
  ------------------
  525|   133k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|   133k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   135k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 626]
  |  |  |  |  |  Branch (279:38): [True: 626, False: 132k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 133k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   133k|            bytes_in_buffer--; \
  |  |  156|   133k|            V = *next_input_byte++; )
  ------------------
  526|   133k|    prec = n >> 4;
  527|   133k|    n &= 0x0F;
  528|       |
  529|   133k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|   133k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|   133k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|   133k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|   133k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  530|       |
  531|   133k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|   133k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (531:9): [True: 1.59k, False: 131k]
  ------------------
  532|  1.59k|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|  1.59k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.59k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.59k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  533|       |
  534|   133k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (534:9): [True: 77.3k, False: 55.9k]
  ------------------
  535|  77.3k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  536|   133k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  537|       |
  538|  8.56M|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  8.56M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (538:17): [True: 8.42M, False: 133k]
  ------------------
  539|  8.42M|      if (prec)
  ------------------
  |  Branch (539:11): [True: 55.3k, False: 8.37M]
  ------------------
  540|  8.42M|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  55.3k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   194k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 11.9k]
  |  |  |  |  |  Branch (279:38): [True: 11.9k, False: 43.3k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 15.8k]
  |  |  |  |  |  Branch (279:38): [True: 15.8k, False: 39.4k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 55.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  8.42M|            bytes_in_buffer--; \
  |  |  164|  8.42M|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  8.42M|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  8.42M|            bytes_in_buffer--; \
  |  |  167|  8.42M|            V += *next_input_byte++; )
  ------------------
  541|  8.37M|      else
  542|  8.42M|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|  8.37M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  8.62M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 82.5k]
  |  |  |  |  |  Branch (279:38): [True: 82.5k, False: 8.29M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 8.37M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  8.42M|            bytes_in_buffer--; \
  |  |  156|  8.42M|            V = *next_input_byte++; )
  ------------------
  543|       |      /* We convert the zigzag-order table to natural array order. */
  544|  8.42M|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  545|  8.42M|    }
  546|       |
  547|   133k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (547:9): [True: 0, False: 133k]
  ------------------
  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|   133k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|   133k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  558|   133k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|    865|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (558:9): [True: 865, False: 132k]
  ------------------
  559|   133k|  }
  560|       |
  561|   132k|  if (length != 0)
  ------------------
  |  Branch (561:7): [True: 596, False: 131k]
  ------------------
  562|    596|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    596|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    596|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|       |
  564|   132k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   132k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   132k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  565|   132k|  return TRUE;
  ------------------
  |  |  210|   132k|#define TRUE    1
  ------------------
  566|   132k|}
jdmarker.c:get_dri:
  572|  19.8k|{
  573|  19.8k|  JLONG length;
  574|  19.8k|  unsigned int tmp;
  575|  19.8k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  19.8k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  19.8k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  19.8k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  576|       |
  577|  19.8k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  19.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  41.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 224]
  |  |  |  |  |  Branch (279:38): [True: 224, False: 19.6k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 218]
  |  |  |  |  |  Branch (279:38): [True: 218, False: 19.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 19.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  19.8k|            bytes_in_buffer--; \
  |  |  164|  19.8k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  19.8k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  19.8k|            bytes_in_buffer--; \
  |  |  167|  19.8k|            V += *next_input_byte++; )
  ------------------
  578|       |
  579|  19.8k|  if (length != 4)
  ------------------
  |  Branch (579:7): [True: 757, False: 19.1k]
  ------------------
  580|    757|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    757|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    757|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  581|       |
  582|  19.8k|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  19.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  41.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 213]
  |  |  |  |  |  Branch (279:38): [True: 213, False: 19.6k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 207]
  |  |  |  |  |  Branch (279:38): [True: 207, False: 19.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 19.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  19.8k|            bytes_in_buffer--; \
  |  |  164|  19.8k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  19.8k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  19.8k|            bytes_in_buffer--; \
  |  |  167|  19.8k|            V += *next_input_byte++; )
  ------------------
  583|       |
  584|  19.8k|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|  19.8k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  19.8k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  19.8k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  585|       |
  586|  19.8k|  cinfo->restart_interval = tmp;
  587|       |
  588|  19.8k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  19.8k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  19.8k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  589|  19.8k|  return TRUE;
  ------------------
  |  |  210|  19.8k|#define TRUE    1
  ------------------
  590|  19.8k|}
jdmarker.c:read_restart_marker:
 1139|  1.51M|{
 1140|       |  /* Obtain a marker unless we already did. */
 1141|       |  /* Note that next_marker will complain if it skips any data. */
 1142|  1.51M|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1142:7): [True: 3.78k, False: 1.51M]
  ------------------
 1143|  3.78k|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1143:9): [True: 0, False: 3.78k]
  ------------------
 1144|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1145|  3.78k|  }
 1146|       |
 1147|  1.51M|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1147:7): [True: 5.44k, False: 1.51M]
  ------------------
 1148|  1.51M|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1149|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1150|  5.44k|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  300|  5.44k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  5.44k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  5.44k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1151|  5.44k|    cinfo->unread_marker = 0;
 1152|  1.51M|  } else {
 1153|       |    /* Uh-oh, the restart markers have been messed up. */
 1154|       |    /* Let the data source manager determine how to resync. */
 1155|  1.51M|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1155:9): [True: 0, False: 1.51M]
  ------------------
 1156|  1.51M|                                           cinfo->marker->next_restart_num))
 1157|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1158|  1.51M|  }
 1159|       |
 1160|       |  /* Update next-restart state */
 1161|  1.51M|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1162|       |
 1163|  1.51M|  return TRUE;
  ------------------
  |  |  210|  1.51M|#define TRUE    1
  ------------------
 1164|  1.51M|}
jdmarker.c:skip_variable:
  864|  42.3k|{
  865|  42.3k|  JLONG length;
  866|  42.3k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  42.3k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  42.3k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  42.3k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  867|       |
  868|  42.3k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  42.3k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  88.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 469]
  |  |  |  |  |  Branch (279:38): [True: 469, False: 41.9k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 767]
  |  |  |  |  |  Branch (279:38): [True: 767, False: 41.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 42.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  42.3k|            bytes_in_buffer--; \
  |  |  164|  42.3k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  42.3k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  42.3k|            bytes_in_buffer--; \
  |  |  167|  42.3k|            V += *next_input_byte++; )
  ------------------
  869|  42.3k|  length -= 2;
  870|       |
  871|  42.3k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  42.3k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  42.3k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  42.3k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  42.3k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  872|       |
  873|  42.3k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  42.3k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  42.3k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  874|  42.3k|  if (length > 0)
  ------------------
  |  Branch (874:7): [True: 38.5k, False: 3.84k]
  ------------------
  875|  38.5k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  876|       |
  877|  42.3k|  return TRUE;
  ------------------
  |  |  210|  42.3k|#define TRUE    1
  ------------------
  878|  42.3k|}
jdmarker.c:get_interesting_appn:
  712|  18.3k|{
  713|  18.3k|  JLONG length;
  714|  18.3k|  JOCTET b[APPN_DATA_LEN];
  715|  18.3k|  unsigned int i, numtoread;
  716|  18.3k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  18.3k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  18.3k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  18.3k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  717|       |
  718|  18.3k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  18.3k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  38.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 213]
  |  |  |  |  |  Branch (279:38): [True: 213, False: 18.1k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 258]
  |  |  |  |  |  Branch (279:38): [True: 258, False: 18.0k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  18.3k|            bytes_in_buffer--; \
  |  |  164|  18.3k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  18.3k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  18.3k|            bytes_in_buffer--; \
  |  |  167|  18.3k|            V += *next_input_byte++; )
  ------------------
  719|  18.3k|  length -= 2;
  720|       |
  721|       |  /* get the interesting part of the marker data */
  722|  18.3k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  602|  18.3k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (722:7): [True: 7.77k, False: 10.5k]
  ------------------
  723|  7.77k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  602|  7.77k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  724|  10.5k|  else if (length > 0)
  ------------------
  |  Branch (724:12): [True: 10.3k, False: 241]
  ------------------
  725|  10.3k|    numtoread = (unsigned int)length;
  726|    241|  else
  727|    241|    numtoread = 0;
  728|   141k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (728:15): [True: 123k, False: 18.3k]
  ------------------
  729|   123k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|   123k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   142k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.62k]
  |  |  |  |  |  Branch (279:38): [True: 6.62k, False: 116k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 123k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  18.3k|            bytes_in_buffer--; \
  |  |  156|  18.3k|            V = *next_input_byte++; )
  ------------------
  730|  18.3k|  length -= numtoread;
  731|       |
  732|       |  /* process it */
  733|  18.3k|  switch (cinfo->unread_marker) {
  734|  14.4k|  case M_APP0:
  ------------------
  |  Branch (734:3): [True: 14.4k, False: 3.89k]
  ------------------
  735|  14.4k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  736|  14.4k|    break;
  737|  3.89k|  case M_APP14:
  ------------------
  |  Branch (737:3): [True: 3.89k, False: 14.4k]
  ------------------
  738|  3.89k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  739|  3.89k|    break;
  740|      0|  default:
  ------------------
  |  Branch (740:3): [True: 0, False: 18.3k]
  ------------------
  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|  18.3k|  }
  745|       |
  746|       |  /* skip any remaining data -- could be lots */
  747|  18.3k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  18.3k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  18.3k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  748|  18.3k|  if (length > 0)
  ------------------
  |  Branch (748:7): [True: 6.47k, False: 11.8k]
  ------------------
  749|  6.47k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  750|       |
  751|  18.3k|  return TRUE;
  ------------------
  |  |  210|  18.3k|#define TRUE    1
  ------------------
  752|  18.3k|}
jdmarker.c:examine_app0:
  612|  14.4k|{
  613|  14.4k|  JLONG totallen = (JLONG)datalen + remaining;
  614|       |
  615|  14.4k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  600|  28.8k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (615:7): [True: 4.11k, False: 10.3k]
  ------------------
  616|  4.11k|      data[0] == 0x4A &&
  ------------------
  |  Branch (616:7): [True: 2.90k, False: 1.20k]
  ------------------
  617|  2.90k|      data[1] == 0x46 &&
  ------------------
  |  Branch (617:7): [True: 2.51k, False: 385]
  ------------------
  618|  2.51k|      data[2] == 0x49 &&
  ------------------
  |  Branch (618:7): [True: 1.00k, False: 1.51k]
  ------------------
  619|  1.00k|      data[3] == 0x46 &&
  ------------------
  |  Branch (619:7): [True: 755, False: 250]
  ------------------
  620|    755|      data[4] == 0) {
  ------------------
  |  Branch (620:7): [True: 505, False: 250]
  ------------------
  621|       |    /* Found JFIF APP0 marker: save info */
  622|    505|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  210|    505|#define TRUE    1
  ------------------
  623|    505|    cinfo->JFIF_major_version = data[5];
  624|    505|    cinfo->JFIF_minor_version = data[6];
  625|    505|    cinfo->density_unit = data[7];
  626|    505|    cinfo->X_density = (data[8] << 8) + data[9];
  627|    505|    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|    505|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (634:9): [True: 226, False: 279]
  ------------------
  635|    226|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|    226|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    226|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    226|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    226|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  636|    505|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  637|       |    /* Generate trace messages */
  638|    505|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|    505|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    505|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 505]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|    505|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|    505|           _mp[4] = (p5); \
  |  |  322|    505|           (cinfo)->err->msg_code = (code); \
  |  |  323|    505|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  639|    505|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  640|    505|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  641|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  642|    505|    if (data[12] | data[13])
  ------------------
  |  Branch (642:9): [True: 284, False: 221]
  ------------------
  643|    284|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|    284|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    284|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    284|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    284|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  644|    505|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  600|    505|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  645|    505|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (645:9): [True: 244, False: 261]
  ------------------
  646|    244|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|    244|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    244|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    244|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  647|  13.9k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (647:14): [True: 4.02k, False: 9.89k]
  ------------------
  648|  4.02k|             data[0] == 0x4A &&
  ------------------
  |  Branch (648:14): [True: 2.58k, False: 1.43k]
  ------------------
  649|  2.58k|             data[1] == 0x46 &&
  ------------------
  |  Branch (649:14): [True: 2.01k, False: 573]
  ------------------
  650|  2.01k|             data[2] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 1.34k, False: 670]
  ------------------
  651|  1.34k|             data[3] == 0x58 &&
  ------------------
  |  Branch (651:14): [True: 1.12k, False: 219]
  ------------------
  652|  1.12k|             data[4] == 0) {
  ------------------
  |  Branch (652:14): [True: 923, False: 201]
  ------------------
  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|    923|    switch (data[5]) {
  658|    290|    case 0x10:
  ------------------
  |  Branch (658:5): [True: 290, False: 633]
  ------------------
  659|    290|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  300|    290|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    290|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    290|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  660|    290|      break;
  661|    212|    case 0x11:
  ------------------
  |  Branch (661:5): [True: 212, False: 711]
  ------------------
  662|    212|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  300|    212|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    212|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    212|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  663|    212|      break;
  664|    209|    case 0x13:
  ------------------
  |  Branch (664:5): [True: 209, False: 714]
  ------------------
  665|    209|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
  ------------------
  |  |  300|    209|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    209|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    209|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  666|    209|      break;
  667|    212|    default:
  ------------------
  |  Branch (667:5): [True: 212, False: 711]
  ------------------
  668|    212|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|    212|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    212|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    212|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    212|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  669|    212|      break;
  670|    923|    }
  671|  12.9k|  } else {
  672|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  673|  12.9k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  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)))
  ------------------
  674|  12.9k|  }
  675|  14.4k|}
jdmarker.c:examine_app14:
  685|  3.89k|{
  686|  3.89k|  unsigned int version, flags0, flags1, transform;
  687|       |
  688|  3.89k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  601|  7.78k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (688:7): [True: 3.66k, False: 230]
  ------------------
  689|  3.66k|      data[0] == 0x41 &&
  ------------------
  |  Branch (689:7): [True: 3.20k, False: 459]
  ------------------
  690|  3.20k|      data[1] == 0x64 &&
  ------------------
  |  Branch (690:7): [True: 2.98k, False: 219]
  ------------------
  691|  2.98k|      data[2] == 0x6F &&
  ------------------
  |  Branch (691:7): [True: 2.78k, False: 206]
  ------------------
  692|  2.78k|      data[3] == 0x62 &&
  ------------------
  |  Branch (692:7): [True: 2.57k, False: 203]
  ------------------
  693|  2.57k|      data[4] == 0x65) {
  ------------------
  |  Branch (693:7): [True: 2.09k, False: 483]
  ------------------
  694|       |    /* Found Adobe APP14 marker */
  695|  2.09k|    version = (data[5] << 8) + data[6];
  696|  2.09k|    flags0 = (data[7] << 8) + data[8];
  697|  2.09k|    flags1 = (data[9] << 8) + data[10];
  698|  2.09k|    transform = data[11];
  699|  2.09k|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|  2.09k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.09k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.09k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  2.09k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  2.09k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  2.09k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  700|  2.09k|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  210|  2.09k|#define TRUE    1
  ------------------
  701|  2.09k|    cinfo->Adobe_transform = (UINT8)transform;
  702|  2.09k|  } else {
  703|       |    /* Start of APP14 does not match "Adobe", or too short */
  704|  1.80k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|  1.80k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.80k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.80k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  705|  1.80k|  }
  706|  3.89k|}

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

jinit_phuff_decoder:
  654|  8.21k|{
  655|  8.21k|  phuff_entropy_ptr entropy;
  656|  8.21k|  int *coef_bit_ptr;
  657|  8.21k|  int ci, i;
  658|       |
  659|  8.21k|  entropy = (phuff_entropy_ptr)
  660|  8.21k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  8.21k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|  8.21k|                                sizeof(phuff_entropy_decoder));
  662|  8.21k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|  8.21k|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|  41.0k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  41.0k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 32.8k, False: 8.21k]
  ------------------
  667|  32.8k|    entropy->derived_tbls[i] = NULL;
  668|  32.8k|  }
  669|       |
  670|       |  /* Create progression status table */
  671|  8.21k|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|  8.21k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  8.21k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|  8.21k|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  8.21k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|  8.21k|                                sizeof(int));
  675|  8.21k|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|  25.1k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 16.9k, False: 8.21k]
  ------------------
  677|  1.10M|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  1.10M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 1.08M, False: 16.9k]
  ------------------
  678|  1.08M|      *coef_bit_ptr++ = -1;
  679|  8.21k|}
jdphuff.c:start_pass_phuff_decoder:
   83|  9.97k|{
   84|  9.97k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|  9.97k|  boolean is_DC_band, bad;
   86|  9.97k|  int ci, coefi, tbl;
   87|  9.97k|  d_derived_tbl **pdtbl;
   88|  9.97k|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|  9.97k|  jpeg_component_info *compptr;
   90|       |
   91|  9.97k|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|  9.97k|  bad = FALSE;
  ------------------
  |  |  207|  9.97k|#define FALSE   0               /* values of boolean */
  ------------------
   95|  9.97k|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 6.06k, False: 3.90k]
  ------------------
   96|  6.06k|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 352, False: 5.71k]
  ------------------
   97|    352|      bad = TRUE;
  ------------------
  |  |  210|    352|#define TRUE    1
  ------------------
   98|  6.06k|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|  3.90k|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|  3.49k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 409, False: 3.49k]
  |  Branch (100:34): [True: 277, False: 3.22k]
  ------------------
  101|    686|      bad = TRUE;
  ------------------
  |  |  210|    686|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|  3.90k|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 202, False: 3.70k]
  ------------------
  104|    202|      bad = TRUE;
  ------------------
  |  |  210|    202|#define TRUE    1
  ------------------
  105|  3.90k|  }
  106|  9.97k|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 6.71k, False: 3.25k]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|  6.71k|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 479, False: 6.23k]
  ------------------
  109|    479|      bad = TRUE;
  ------------------
  |  |  210|    479|#define TRUE    1
  ------------------
  110|  6.71k|  }
  111|  9.97k|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 389, False: 9.58k]
  ------------------
  112|    389|    bad = TRUE;
  ------------------
  |  |  210|    389|#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|  9.97k|  if (bad)
  ------------------
  |  Branch (119:7): [True: 1.10k, False: 8.87k]
  ------------------
  120|  1.10k|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.10k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.10k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.10k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.10k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.10k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.10k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|  9.97k|             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|  22.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 12.6k, False: 9.97k]
  ------------------
  127|  12.6k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|  12.6k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|  12.6k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|  12.6k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 3.21k, False: 9.43k]
  |  Branch (130:24): [True: 3.07k, False: 143]
  ------------------
  131|  3.07k|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  3.07k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  3.07k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  3.07k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  3.07k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  132|   243k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  12.6k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 9.43k, False: 3.21k]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|   243k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 137k, False: 105k]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 230k, False: 12.6k]
  ------------------
  133|   230k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 58.0k, False: 172k]
  ------------------
  134|  58.0k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|   172k|      else
  136|   172k|        prev_coef_bit_ptr[coefi] = 0;
  137|   230k|    }
  138|   108k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 95.7k, False: 12.6k]
  ------------------
  139|  95.7k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 71.3k, False: 24.3k]
  ------------------
  140|  95.7k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 61.9k, False: 33.7k]
  ------------------
  141|  61.9k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  61.9k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  61.9k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  61.9k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  61.9k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  142|  95.7k|      coef_bit_ptr[coefi] = cinfo->Al;
  143|  95.7k|    }
  144|  12.6k|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|  9.97k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 3.00k, False: 6.97k]
  ------------------
  148|  3.00k|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 1.80k, False: 1.19k]
  ------------------
  149|  1.80k|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|  1.19k|    else
  151|  1.19k|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|  6.97k|  } else {
  153|  6.97k|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 3.85k, False: 3.12k]
  ------------------
  154|  3.85k|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|  3.12k|    else
  156|  3.12k|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|  6.97k|  }
  158|       |
  159|  22.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 12.6k, False: 9.97k]
  ------------------
  160|  12.6k|    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|  12.6k|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 9.42k, False: 3.21k]
  ------------------
  165|  9.42k|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 4.91k, False: 4.51k]
  ------------------
  166|  4.91k|        tbl = compptr->dc_tbl_no;
  167|  4.91k|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|  4.91k|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  210|  4.91k|#define TRUE    1
  ------------------
  169|  4.91k|      }
  170|  9.42k|    } else {
  171|  3.21k|      tbl = compptr->ac_tbl_no;
  172|  3.21k|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|  3.21k|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  207|  3.21k|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|  3.21k|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|  3.21k|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|  12.6k|    entropy->saved.last_dc_val[ci] = 0;
  179|  12.6k|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|  9.97k|  entropy->bitstate.bits_left = 0;
  183|  9.97k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|  9.97k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  9.97k|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|  9.97k|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|  9.97k|  entropy->restarts_to_go = cinfo->restart_interval;
  191|  9.97k|}
jdphuff.c:decode_mcu_DC_first:
  291|  1.83M|{
  292|  1.83M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  1.83M|  int Al = cinfo->Al;
  294|  1.83M|  register int s, r;
  295|  1.83M|  int blkn, ci;
  296|  1.83M|  JBLOCKROW block;
  297|  1.83M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  1.83M|  register bit_buf_type get_buffer; \
  |  |  126|  1.83M|  register int bits_left; \
  |  |  127|  1.83M|  bitread_working_state br_state
  ------------------
  298|  1.83M|  savable_state state;
  299|  1.83M|  d_derived_tbl *tbl;
  300|  1.83M|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  1.83M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 1.44M, False: 385k]
  ------------------
  304|  1.44M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (304:9): [True: 162k, False: 1.28M]
  ------------------
  305|   162k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (305:11): [True: 0, False: 162k]
  ------------------
  306|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  307|  1.44M|  }
  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|  1.83M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 12.4k, False: 1.82M]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  12.4k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  12.4k|  br_state.cinfo = cinfop; \
  |  |  131|  12.4k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  12.4k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  12.4k|  get_buffer = permstate.get_buffer; \
  |  |  134|  12.4k|  bits_left = permstate.bits_left;
  ------------------
  316|  12.4k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|  58.0k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 45.6k, False: 12.4k]
  ------------------
  321|  45.6k|      block = MCU_data[blkn];
  322|  45.6k|      ci = cinfo->MCU_membership[blkn];
  323|  45.6k|      compptr = cinfo->cur_comp_info[ci];
  324|  45.6k|      tbl = entropy->derived_tbls[compptr->dc_tbl_no];
  325|       |
  326|       |      /* Decode a single block's worth of coefficients */
  327|       |
  328|       |      /* Section F.2.2.1: decode the DC coefficient difference */
  329|  45.6k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|  45.6k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  45.6k|  register int nb, look; \
  |  |  202|  45.6k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  45.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 6.28k, False: 39.3k]
  |  |  ------------------
  |  |  203|  6.28k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 6.28k]
  |  |  ------------------
  |  |  204|  6.28k|      { failaction; } \
  |  |  205|  6.28k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  6.28k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  6.28k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1.38k, False: 4.90k]
  |  |  ------------------
  |  |  207|  1.38k|      nb = 1;  goto slowlabel; \
  |  |  208|  1.38k|    } \
  |  |  209|  6.28k|  } \
  |  |  210|  45.6k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  44.2k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  44.2k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  44.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  44.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 39.6k, False: 4.65k]
  |  |  ------------------
  |  |  212|  39.6k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  39.6k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  39.6k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  39.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  39.6k|  } else { \
  |  |  215|  6.04k|slowlabel: \
  |  |  216|  6.04k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 6.04k]
  |  |  ------------------
  |  |  217|  6.04k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  6.04k|      { failaction; } \
  |  |  219|  6.04k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  6.04k|  } \
  |  |  221|  44.2k|}
  ------------------
  330|  45.6k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 24.4k, False: 21.1k]
  ------------------
  331|  24.4k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  24.4k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  24.4k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 1.92k, False: 22.5k]
  |  |  ------------------
  |  |  162|  1.92k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 1.92k]
  |  |  ------------------
  |  |  163|  1.92k|      { action; } \
  |  |  164|  1.92k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  1.92k|  } \
  |  |  166|  24.4k|}
  ------------------
  332|  24.4k|        r = GET_BITS(s);
  ------------------
  |  |  169|  24.4k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|  24.4k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  24.4k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  15.2k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 15.2k, False: 9.24k]
  |  |  ------------------
  ------------------
  334|  24.4k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|  45.6k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 29.2k, False: 16.3k]
  ------------------
  338|  29.2k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 29.2k]
  ------------------
  339|  45.6k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 16.3k, False: 29.2k]
  |  Branch (339:41): [True: 0, False: 16.3k]
  ------------------
  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|  45.6k|      s += state.last_dc_val[ci];
  342|  45.6k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|  45.6k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  45.6k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  45.6k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  12.4k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  12.4k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  12.4k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  12.4k|  permstate.get_buffer = get_buffer; \
  |  |  140|  12.4k|  permstate.bits_left = bits_left
  ------------------
  349|  12.4k|    entropy->saved = state;
  350|  12.4k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  1.83M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 1.44M, False: 385k]
  ------------------
  354|  1.44M|    entropy->restarts_to_go--;
  355|       |
  356|  1.83M|  return TRUE;
  ------------------
  |  |  210|  1.83M|#define TRUE    1
  ------------------
  357|  1.83M|}
jdphuff.c:process_restart:
  233|  1.08M|{
  234|  1.08M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  235|  1.08M|  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|  1.08M|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  240|  1.08M|  entropy->bitstate.bits_left = 0;
  241|       |
  242|       |  /* Advance past the RSTn marker */
  243|  1.08M|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (243:7): [True: 0, False: 1.08M]
  ------------------
  244|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  245|       |
  246|       |  /* Re-initialize DC predictions to 0 */
  247|  2.17M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (247:16): [True: 1.08M, False: 1.08M]
  ------------------
  248|  1.08M|    entropy->saved.last_dc_val[ci] = 0;
  249|       |  /* Re-init EOB run count, too */
  250|  1.08M|  entropy->saved.EOBRUN = 0;
  251|       |
  252|       |  /* Reset restart counter */
  253|  1.08M|  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|  1.08M|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (260:7): [True: 1.06k, False: 1.08M]
  ------------------
  261|  1.06k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  1.06k|#define FALSE   0               /* values of boolean */
  ------------------
  262|       |
  263|  1.08M|  return TRUE;
  ------------------
  |  |  210|  1.08M|#define TRUE    1
  ------------------
  264|  1.08M|}
jdphuff.c:decode_mcu_AC_first:
  367|  3.14M|{
  368|  3.14M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  369|  3.14M|  int Se = cinfo->Se;
  370|  3.14M|  int Al = cinfo->Al;
  371|  3.14M|  register int s, k, r;
  372|  3.14M|  unsigned int EOBRUN;
  373|  3.14M|  JBLOCKROW block;
  374|  3.14M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  3.14M|  register bit_buf_type get_buffer; \
  |  |  126|  3.14M|  register int bits_left; \
  |  |  127|  3.14M|  bitread_working_state br_state
  ------------------
  375|  3.14M|  d_derived_tbl *tbl;
  376|       |
  377|       |  /* Process restart marker if needed; may have to suspend */
  378|  3.14M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 1.84M, False: 1.29M]
  ------------------
  379|  1.84M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (379:9): [True: 203k, False: 1.63M]
  ------------------
  380|   203k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (380:11): [True: 0, False: 203k]
  ------------------
  381|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  382|  1.84M|  }
  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|  3.14M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (387:7): [True: 17.5k, False: 3.12M]
  ------------------
  388|       |
  389|       |    /* Load up working state.
  390|       |     * We can avoid loading/saving bitread state if in an EOB run.
  391|       |     */
  392|  17.5k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  393|       |
  394|       |    /* There is always only one block per MCU */
  395|       |
  396|  17.5k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (396:9): [True: 12.3k, False: 5.17k]
  ------------------
  397|  12.3k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  398|  5.17k|    else {
  399|  5.17k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  5.17k|  br_state.cinfo = cinfop; \
  |  |  131|  5.17k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  5.17k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  5.17k|  get_buffer = permstate.get_buffer; \
  |  |  134|  5.17k|  bits_left = permstate.bits_left;
  ------------------
  400|  5.17k|      block = MCU_data[0];
  401|  5.17k|      tbl = entropy->ac_derived_tbl;
  402|       |
  403|  34.6k|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (403:27): [True: 32.8k, False: 1.86k]
  ------------------
  404|  32.8k|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  200|  32.8k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  32.8k|  register int nb, look; \
  |  |  202|  32.8k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  32.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 5.19k, False: 27.6k]
  |  |  ------------------
  |  |  203|  5.19k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 5.19k]
  |  |  ------------------
  |  |  204|  5.19k|      { failaction; } \
  |  |  205|  5.19k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  5.19k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  5.19k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 3.25k, False: 1.94k]
  |  |  ------------------
  |  |  207|  3.25k|      nb = 1;  goto slowlabel; \
  |  |  208|  3.25k|    } \
  |  |  209|  5.19k|  } \
  |  |  210|  32.8k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  29.5k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  29.5k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  29.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  29.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 28.4k, False: 1.10k]
  |  |  ------------------
  |  |  212|  28.4k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  28.4k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  28.4k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  28.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  28.4k|  } else { \
  |  |  215|  4.35k|slowlabel: \
  |  |  216|  4.35k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 4.35k]
  |  |  ------------------
  |  |  217|  4.35k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  4.35k|      { failaction; } \
  |  |  219|  4.35k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  4.35k|  } \
  |  |  221|  29.5k|}
  ------------------
  405|  32.8k|        r = s >> 4;
  406|  32.8k|        s &= 15;
  407|  32.8k|        if (s) {
  ------------------
  |  Branch (407:13): [True: 29.2k, False: 3.55k]
  ------------------
  408|  29.2k|          k += r;
  409|  29.2k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  29.2k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  29.2k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 2.78k, False: 26.4k]
  |  |  ------------------
  |  |  162|  2.78k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 2.78k]
  |  |  ------------------
  |  |  163|  2.78k|      { action; } \
  |  |  164|  2.78k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  2.78k|  } \
  |  |  166|  29.2k|}
  ------------------
  410|  29.2k|          r = GET_BITS(s);
  ------------------
  |  |  169|  29.2k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  411|  29.2k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  29.2k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  27.4k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 27.4k, False: 1.76k]
  |  |  ------------------
  ------------------
  412|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  413|  29.2k|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  29.2k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  414|  29.2k|        } else {
  415|  3.55k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (415:15): [True: 254, False: 3.30k]
  ------------------
  416|    254|            k += 15;            /* skip 15 zeroes in band */
  417|  3.30k|          } else {              /* EOBr, run length is 2^r + appended bits */
  418|  3.30k|            EOBRUN = 1 << r;
  419|  3.30k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (419:17): [True: 1.51k, False: 1.78k]
  ------------------
  420|  1.51k|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  160|  1.51k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.51k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 204, False: 1.31k]
  |  |  ------------------
  |  |  162|    204|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 204]
  |  |  ------------------
  |  |  163|    204|      { action; } \
  |  |  164|    204|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    204|  } \
  |  |  166|  1.51k|}
  ------------------
  421|  1.51k|              r = GET_BITS(r);
  ------------------
  |  |  169|  1.51k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  422|  1.51k|              EOBRUN += r;
  423|  1.51k|            }
  424|  3.30k|            EOBRUN--;           /* this band is processed at this moment */
  425|  3.30k|            break;              /* force end-of-band */
  426|  3.30k|          }
  427|  3.55k|        }
  428|  32.8k|      }
  429|       |
  430|  5.17k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  5.17k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  5.17k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  5.17k|  permstate.get_buffer = get_buffer; \
  |  |  140|  5.17k|  permstate.bits_left = bits_left
  ------------------
  431|  5.17k|    }
  432|       |
  433|       |    /* Completed MCU, so update state */
  434|  17.5k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  435|  17.5k|  }
  436|       |
  437|       |  /* Account for restart interval (no-op if not using restarts) */
  438|  3.14M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (438:7): [True: 1.84M, False: 1.29M]
  ------------------
  439|  1.84M|    entropy->restarts_to_go--;
  440|       |
  441|  3.14M|  return TRUE;
  ------------------
  |  |  210|  3.14M|#define TRUE    1
  ------------------
  442|  3.14M|}
jdphuff.c:decode_mcu_DC_refine:
  453|  1.57M|{
  454|  1.57M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  455|  1.57M|  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
  456|  1.57M|  int blkn;
  457|  1.57M|  JBLOCKROW block;
  458|  1.57M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  1.57M|  register bit_buf_type get_buffer; \
  |  |  126|  1.57M|  register int bits_left; \
  |  |  127|  1.57M|  bitread_working_state br_state
  ------------------
  459|       |
  460|       |  /* Process restart marker if needed; may have to suspend */
  461|  1.57M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (461:7): [True: 1.23M, False: 344k]
  ------------------
  462|  1.23M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (462:9): [True: 136k, False: 1.09M]
  ------------------
  463|   136k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (463:11): [True: 0, False: 136k]
  ------------------
  464|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  465|  1.23M|  }
  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|  1.57M|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  1.57M|  br_state.cinfo = cinfop; \
  |  |  131|  1.57M|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  1.57M|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  1.57M|  get_buffer = permstate.get_buffer; \
  |  |  134|  1.57M|  bits_left = permstate.bits_left;
  ------------------
  473|       |
  474|       |  /* Outer loop handles each block in the MCU */
  475|       |
  476|  3.18M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (476:18): [True: 1.60M, False: 1.57M]
  ------------------
  477|  1.60M|    block = MCU_data[blkn];
  478|       |
  479|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  480|  1.60M|    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
  ------------------
  |  |  160|  1.60M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.60M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 145k, False: 1.45M]
  |  |  ------------------
  |  |  162|   145k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 145k]
  |  |  ------------------
  |  |  163|   145k|      { action; } \
  |  |  164|   145k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|   145k|  } \
  |  |  166|  1.60M|}
  ------------------
  481|  1.60M|    if (GET_BITS(1))
  ------------------
  |  |  169|  1.60M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 40.8k, False: 1.56M]
  |  |  ------------------
  ------------------
  482|  40.8k|      (*block)[0] |= p1;
  483|       |    /* Note: since we use |=, repeating the assignment later is safe */
  484|  1.60M|  }
  485|       |
  486|       |  /* Completed MCU, so update state */
  487|  1.57M|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  1.57M|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  1.57M|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  1.57M|  permstate.get_buffer = get_buffer; \
  |  |  140|  1.57M|  permstate.bits_left = bits_left
  ------------------
  488|       |
  489|       |  /* Account for restart interval (no-op if not using restarts) */
  490|  1.57M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (490:7): [True: 1.23M, False: 344k]
  ------------------
  491|  1.23M|    entropy->restarts_to_go--;
  492|       |
  493|  1.57M|  return TRUE;
  ------------------
  |  |  210|  1.57M|#define TRUE    1
  ------------------
  494|  1.57M|}
jdphuff.c:decode_mcu_AC_refine:
  503|  10.1M|{
  504|  10.1M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  505|  10.1M|  int Se = cinfo->Se;
  506|  10.1M|  int p1 = 1 << cinfo->Al;        /* 1 in the bit position being coded */
  507|  10.1M|  int m1 = (NEG_1) << cinfo->Al;  /* -1 in the bit position being coded */
  ------------------
  |  |  202|  10.1M|#define NEG_1  ((unsigned)-1)
  ------------------
  508|  10.1M|  register int s, k, r;
  509|  10.1M|  unsigned int EOBRUN;
  510|  10.1M|  JBLOCKROW block;
  511|  10.1M|  JCOEFPTR thiscoef;
  512|  10.1M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  10.1M|  register bit_buf_type get_buffer; \
  |  |  126|  10.1M|  register int bits_left; \
  |  |  127|  10.1M|  bitread_working_state br_state
  ------------------
  513|  10.1M|  d_derived_tbl *tbl;
  514|  10.1M|  int num_newnz;
  515|  10.1M|  int newnz_pos[DCTSIZE2];
  516|       |
  517|       |  /* Process restart marker if needed; may have to suspend */
  518|  10.1M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (518:7): [True: 8.51M, False: 1.64M]
  ------------------
  519|  8.51M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (519:9): [True: 586k, False: 7.92M]
  ------------------
  520|   586k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (520:11): [True: 0, False: 586k]
  ------------------
  521|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  522|  8.51M|  }
  523|       |
  524|       |  /* If we've run out of data, don't modify the MCU.
  525|       |   */
  526|  10.1M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (526:7): [True: 42.1k, False: 10.1M]
  ------------------
  527|       |
  528|       |    /* Load up working state */
  529|  42.1k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  42.1k|  br_state.cinfo = cinfop; \
  |  |  131|  42.1k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  42.1k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  42.1k|  get_buffer = permstate.get_buffer; \
  |  |  134|  42.1k|  bits_left = permstate.bits_left;
  ------------------
  530|  42.1k|    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
  531|       |
  532|       |    /* There is always only one block per MCU */
  533|  42.1k|    block = MCU_data[0];
  534|  42.1k|    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|  42.1k|    num_newnz = 0;
  543|       |
  544|       |    /* initialize coefficient loop counter to start of band */
  545|  42.1k|    k = cinfo->Ss;
  546|       |
  547|  42.1k|    if (EOBRUN == 0) {
  ------------------
  |  Branch (547:9): [True: 9.81k, False: 32.3k]
  ------------------
  548|  81.3k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (548:14): [True: 77.0k, False: 4.24k]
  ------------------
  549|  77.0k|        HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
  ------------------
  |  |  200|  77.0k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  77.0k|  register int nb, look; \
  |  |  202|  77.0k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  77.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 10.7k, False: 66.3k]
  |  |  ------------------
  |  |  203|  10.7k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 10.7k]
  |  |  ------------------
  |  |  204|  10.7k|      { failaction; } \
  |  |  205|  10.7k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  10.7k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  10.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 6.48k, False: 4.29k]
  |  |  ------------------
  |  |  207|  6.48k|      nb = 1;  goto slowlabel; \
  |  |  208|  6.48k|    } \
  |  |  209|  10.7k|  } \
  |  |  210|  77.0k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  70.6k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  70.6k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  70.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  70.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 68.0k, False: 2.56k]
  |  |  ------------------
  |  |  212|  68.0k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  68.0k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  68.0k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  68.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  68.0k|  } else { \
  |  |  215|  9.04k|slowlabel: \
  |  |  216|  9.04k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 9.04k]
  |  |  ------------------
  |  |  217|  9.04k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  9.04k|      { failaction; } \
  |  |  219|  9.04k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  9.04k|  } \
  |  |  221|  70.6k|}
  ------------------
  550|  77.0k|        r = s >> 4;
  551|  77.0k|        s &= 15;
  552|  77.0k|        if (s) {
  ------------------
  |  Branch (552:13): [True: 71.2k, False: 5.83k]
  ------------------
  553|  71.2k|          if (s != 1)           /* size of new coef should always be 1 */
  ------------------
  |  Branch (553:15): [True: 45.2k, False: 26.0k]
  ------------------
  554|  45.2k|            WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|  45.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  45.2k|   (*(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: 481, False: 70.7k]
  |  |  ------------------
  |  |  162|    481|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 481]
  |  |  ------------------
  |  |  163|    481|      { action; } \
  |  |  164|    481|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    481|  } \
  |  |  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: 6.25k, False: 64.9k]
  |  |  ------------------
  ------------------
  557|  6.25k|            s = p1;             /* newly nonzero coef is positive */
  558|  64.9k|          else
  559|  64.9k|            s = m1;             /* newly nonzero coef is negative */
  560|  71.2k|        } else {
  561|  5.83k|          if (r != 15) {
  ------------------
  |  Branch (561:15): [True: 5.56k, False: 273]
  ------------------
  562|  5.56k|            EOBRUN = 1 << r;    /* EOBr, run length is 2^r + appended bits */
  563|  5.56k|            if (r) {
  ------------------
  |  Branch (563:17): [True: 1.27k, False: 4.28k]
  ------------------
  564|  1.27k|              CHECK_BIT_BUFFER(br_state, r, goto undoit);
  ------------------
  |  |  160|  1.27k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.27k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 359, False: 919]
  |  |  ------------------
  |  |  162|    359|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 359]
  |  |  ------------------
  |  |  163|    359|      { action; } \
  |  |  164|    359|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    359|  } \
  |  |  166|  1.27k|}
  ------------------
  565|  1.27k|              r = GET_BITS(r);
  ------------------
  |  |  169|  1.27k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  566|  1.27k|              EOBRUN += r;
  567|  1.27k|            }
  568|  5.56k|            break;              /* rest of block is handled by EOB logic */
  569|  5.56k|          }
  570|       |          /* note s = 0 for processing ZRL */
  571|  5.83k|        }
  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|   138k|        do {
  577|   138k|          thiscoef = *block + jpeg_natural_order[k];
  578|   138k|          if (*thiscoef != 0) {
  ------------------
  |  Branch (578:15): [True: 15.4k, False: 123k]
  ------------------
  579|  15.4k|            CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  15.4k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  15.4k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 335, False: 15.0k]
  |  |  ------------------
  |  |  162|    335|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 335]
  |  |  ------------------
  |  |  163|    335|      { action; } \
  |  |  164|    335|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    335|  } \
  |  |  166|  15.4k|}
  ------------------
  580|  15.4k|            if (GET_BITS(1)) {
  ------------------
  |  |  169|  15.4k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 3.29k, False: 12.1k]
  |  |  ------------------
  ------------------
  581|  3.29k|              if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
  ------------------
  |  Branch (581:19): [True: 586, False: 2.71k]
  ------------------
  582|    586|                if (*thiscoef >= 0)
  ------------------
  |  Branch (582:21): [True: 285, False: 301]
  ------------------
  583|    285|                  *thiscoef += (JCOEF)p1;
  584|    301|                else
  585|    301|                  *thiscoef += (JCOEF)m1;
  586|    586|              }
  587|  3.29k|            }
  588|   123k|          } else {
  589|   123k|            if (--r < 0)
  ------------------
  |  Branch (589:17): [True: 69.0k, False: 54.2k]
  ------------------
  590|  69.0k|              break;            /* reached target zero coefficient */
  591|   123k|          }
  592|  69.6k|          k++;
  593|  69.6k|        } while (k <= Se);
  ------------------
  |  Branch (593:18): [True: 67.2k, False: 2.42k]
  ------------------
  594|  71.5k|        if (s) {
  ------------------
  |  Branch (594:13): [True: 71.2k, False: 273]
  ------------------
  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|  9.81k|    }
  603|       |
  604|  42.1k|    if (EOBRUN > 0) {
  ------------------
  |  Branch (604:9): [True: 37.8k, False: 4.24k]
  ------------------
  605|       |      /* Scan any remaining coefficient positions after the end-of-band
  606|       |       * (the last newly nonzero coefficient, if any).  Append a correction
  607|       |       * bit to each already-nonzero coefficient.  A correction bit is 1
  608|       |       * if the absolute value of the coefficient must be increased.
  609|       |       */
  610|  1.10M|      for (; k <= Se; k++) {
  ------------------
  |  Branch (610:14): [True: 1.07M, False: 37.8k]
  ------------------
  611|  1.07M|        thiscoef = *block + jpeg_natural_order[k];
  612|  1.07M|        if (*thiscoef != 0) {
  ------------------
  |  Branch (612:13): [True: 5.49k, False: 1.06M]
  ------------------
  613|  5.49k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  5.49k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  5.49k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 243, False: 5.25k]
  |  |  ------------------
  |  |  162|    243|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 243]
  |  |  ------------------
  |  |  163|    243|      { action; } \
  |  |  164|    243|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    243|  } \
  |  |  166|  5.49k|}
  ------------------
  614|  5.49k|          if (GET_BITS(1)) {
  ------------------
  |  |  169|  5.49k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 1.43k, False: 4.06k]
  |  |  ------------------
  ------------------
  615|  1.43k|            if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
  ------------------
  |  Branch (615:17): [True: 573, False: 857]
  ------------------
  616|    573|              if (*thiscoef >= 0)
  ------------------
  |  Branch (616:19): [True: 274, False: 299]
  ------------------
  617|    274|                *thiscoef += (JCOEF)p1;
  618|    299|              else
  619|    299|                *thiscoef += (JCOEF)m1;
  620|    573|            }
  621|  1.43k|          }
  622|  5.49k|        }
  623|  1.07M|      }
  624|       |      /* Count one block completed in EOB run */
  625|  37.8k|      EOBRUN--;
  626|  37.8k|    }
  627|       |
  628|       |    /* Completed MCU, so update state */
  629|  42.1k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  42.1k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  42.1k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  42.1k|  permstate.get_buffer = get_buffer; \
  |  |  140|  42.1k|  permstate.bits_left = bits_left
  ------------------
  630|  42.1k|    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
  631|  42.1k|  }
  632|       |
  633|       |  /* Account for restart interval (no-op if not using restarts) */
  634|  10.1M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (634:7): [True: 8.51M, False: 1.64M]
  ------------------
  635|  8.51M|    entropy->restarts_to_go--;
  636|       |
  637|  10.1M|  return TRUE;
  ------------------
  |  |  210|  10.1M|#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|  10.1M|}

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

jinit_upsampler:
  438|   102k|{
  439|   102k|  my_upsample_ptr upsample;
  440|   102k|  int ci;
  441|   102k|  jpeg_component_info *compptr;
  442|   102k|  boolean need_buffer, do_fancy;
  443|   102k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|   102k|#ifdef D_LOSSLESS_SUPPORTED
  446|   102k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 3.73k, False: 98.3k]
  ------------------
  447|  3.73k|#if BITS_IN_JSAMPLE == 8
  448|  3.73k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  7.47k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (448:9): [True: 0, False: 3.73k]
  |  Branch (448:52): [True: 0, False: 3.73k]
  ------------------
  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.73k|  } else
  455|  98.3k|#endif
  456|  98.3k|  {
  457|  98.3k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  98.3k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (457:9): [True: 0, False: 98.3k]
  ------------------
  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|  98.3k|  }
  460|       |
  461|   102k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 102k, False: 0]
  ------------------
  462|   102k|    upsample = (my_upsample_ptr)
  463|   102k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|   102k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|   102k|                                  sizeof(my_upsampler));
  465|   102k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|   102k|    upsample->pub.start_pass = start_pass_upsample;
  467|   102k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  265|   102k|#define _upsample  upsample
  ------------------
  468|   102k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|   102k|#define FALSE   0               /* values of boolean */
  ------------------
  469|   102k|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|   102k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 102k]
  ------------------
  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|   102k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|   102k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 102k, False: 0]
  |  Branch (478:44): [True: 98.3k, False: 3.73k]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|   242k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 140k, False: 102k]
  ------------------
  484|   140k|       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|   140k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|   140k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|   140k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   140k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|   140k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|   140k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|   140k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   140k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|   140k|    h_out_group = cinfo->max_h_samp_factor;
  493|   140k|    v_out_group = cinfo->max_v_samp_factor;
  494|   140k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|   140k|    need_buffer = TRUE;
  ------------------
  |  |  210|   140k|#define TRUE    1
  ------------------
  496|   140k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 140k]
  ------------------
  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|   140k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 105k, False: 35.1k]
  |  Branch (500:45): [True: 103k, False: 2.14k]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|   103k|      upsample->methods[ci] = fullsize_upsample;
  503|   103k|      need_buffer = FALSE;
  ------------------
  |  |  207|   103k|#define FALSE   0               /* values of boolean */
  ------------------
  504|   103k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 34.1k, False: 3.21k]
  |  Branch (504:49): [True: 5.69k, False: 28.4k]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|  5.69k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 5.68k, False: 13]
  |  Branch (506:23): [True: 5.16k, False: 514]
  ------------------
  507|  5.16k|#ifdef WITH_SIMD
  508|  5.16k|        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  ------------------
  |  Branch (508:13): [True: 5.16k, False: 0]
  ------------------
  509|  5.16k|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|      0|        else
  511|      0|#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|  5.16k|      } else {
  514|    527|#ifdef WITH_SIMD
  515|    527|        if (jsimd_set_h2v1_upsample(cinfo))
  ------------------
  |  Branch (515:13): [True: 527, False: 0]
  ------------------
  516|    527|          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|      0|        else
  518|      0|#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|    527|      }
  521|  31.6k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 2.14k, False: 29.4k]
  ------------------
  522|  2.14k|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 1.35k, False: 792]
  |  Branch (522:49): [True: 1.34k, False: 10]
  ------------------
  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.34k|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|  1.34k|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  1.34k|#define TRUE    1
  ------------------
  531|  30.2k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 28.4k, False: 1.87k]
  ------------------
  532|  28.4k|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 27.4k, False: 944]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|  27.4k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 27.4k, False: 11]
  |  Branch (534:23): [True: 25.1k, False: 2.33k]
  ------------------
  535|  25.1k|#ifdef WITH_SIMD
  536|  25.1k|        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 25.1k, False: 0]
  ------------------
  537|  25.1k|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|      0|        else
  539|      0|#endif
  540|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|  25.1k|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  25.1k|#define TRUE    1
  ------------------
  542|  25.1k|      } else {
  543|  2.34k|#ifdef WITH_SIMD
  544|  2.34k|        if (jsimd_set_h2v2_upsample(cinfo))
  ------------------
  |  Branch (544:13): [True: 2.34k, False: 0]
  ------------------
  545|  2.34k|          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|      0|        else
  547|      0|#endif
  548|      0|          upsample->methods[ci] = h2v2_upsample;
  549|  2.34k|      }
  550|  27.4k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 2.81k, False: 4]
  ------------------
  551|  2.81k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 2.81k, False: 2]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|  2.81k|      upsample->methods[ci] = int_upsample;
  554|  2.81k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|  2.81k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|  2.81k|    } else
  557|      6|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|   140k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 37.3k, False: 103k]
  |  Branch (558:24): [True: 37.3k, False: 0]
  ------------------
  559|  37.3k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|  37.3k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  37.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|  37.3k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|  37.3k|                               (long)cinfo->max_h_samp_factor),
  563|  37.3k|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|  37.3k|    }
  565|   140k|  }
  566|   102k|}
jdsample-8.c:start_pass_upsample:
   47|  93.3k|{
   48|  93.3k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|  93.3k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|  93.3k|  upsample->rows_to_go = cinfo->output_height;
   54|  93.3k|}
jdsample-8.c:sep_upsample:
   70|  29.8M|{
   71|  29.8M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|  29.8M|  int ci;
   73|  29.8M|  jpeg_component_info *compptr;
   74|  29.8M|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|  29.8M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 29.3M, False: 462k]
  ------------------
   78|  59.9M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 30.5M, False: 29.3M]
  ------------------
   79|  30.5M|         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|  30.5M|      (*upsample->methods[ci]) (cinfo, compptr,
   87|  30.5M|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|  30.5M|        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|  30.5M|    }
   95|  29.3M|    upsample->next_row_out = 0;
   96|  29.3M|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|  29.8M|  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|  29.8M|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 7.69k, False: 29.8M]
  ------------------
  106|  7.69k|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|  29.8M|  out_rows_avail -= *out_row_ctr;
  109|  29.8M|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 462k, False: 29.3M]
  ------------------
  110|   462k|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|  29.8M|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  267|  29.8M|#define _color_convert  color_convert
  ------------------
  116|  29.8M|                                      (JDIMENSION)upsample->next_row_out,
  117|  29.8M|                                      output_buf + *out_row_ctr,
  118|  29.8M|                                      (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|  29.8M|  *out_row_ctr += num_rows;
  127|  29.8M|  upsample->rows_to_go -= num_rows;
  128|  29.8M|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|  29.8M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 29.3M, False: 470k]
  ------------------
  131|  29.3M|    (*in_row_group_ctr)++;
  132|  29.8M|}
jdsample-8.c:fullsize_upsample:
  151|  29.5M|{
  152|  29.5M|  *output_data_ptr = input_data;
  153|  29.5M|}
jdsample-8.c:h1v2_fancy_upsample:
  338|  65.3k|{
  339|  65.3k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  65.3k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  340|  65.3k|  _JSAMPROW inptr0, inptr1, outptr;
  ------------------
  |  |  229|  65.3k|#define _JSAMPROW  JSAMPROW
  ------------------
  341|  65.3k|#if BITS_IN_JSAMPLE == 8
  342|  65.3k|  int thiscolsum, bias;
  343|       |#else
  344|       |  JLONG thiscolsum, bias;
  345|       |#endif
  346|  65.3k|  JDIMENSION colctr;
  347|  65.3k|  int inrow, outrow, v;
  348|       |
  349|  65.3k|  inrow = outrow = 0;
  350|   130k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (350:10): [True: 65.3k, False: 65.3k]
  ------------------
  351|   195k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (351:17): [True: 130k, False: 65.3k]
  ------------------
  352|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  353|   130k|      inptr0 = input_data[inrow];
  354|   130k|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (354:11): [True: 65.3k, False: 65.3k]
  ------------------
  355|  65.3k|        inptr1 = input_data[inrow - 1];
  356|  65.3k|        bias = 1;
  357|  65.3k|      } else {                  /* next nearest is row below */
  358|  65.3k|        inptr1 = input_data[inrow + 1];
  359|  65.3k|        bias = 2;
  360|  65.3k|      }
  361|   130k|      outptr = output_data[outrow++];
  362|       |
  363|  2.78M|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (363:24): [True: 2.65M, False: 130k]
  ------------------
  364|  2.65M|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  365|  2.65M|        *outptr++ = (_JSAMPLE)((thiscolsum + bias) >> 2);
  366|  2.65M|      }
  367|   130k|    }
  368|  65.3k|    inrow++;
  369|  65.3k|  }
  370|  65.3k|}
jdsample-8.c:int_upsample:
  183|  35.7k|{
  184|  35.7k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  185|  35.7k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  35.7k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  186|  35.7k|  register _JSAMPROW inptr, outptr;
  187|  35.7k|  register _JSAMPLE invalue;
  188|  35.7k|  register int h;
  189|  35.7k|  _JSAMPROW outend;
  ------------------
  |  |  229|  35.7k|#define _JSAMPROW  JSAMPROW
  ------------------
  190|  35.7k|  int h_expand, v_expand;
  191|  35.7k|  int inrow, outrow;
  192|       |
  193|  35.7k|  h_expand = upsample->h_expand[compptr->component_index];
  194|  35.7k|  v_expand = upsample->v_expand[compptr->component_index];
  195|       |
  196|  35.7k|  inrow = outrow = 0;
  197|  71.5k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (197:10): [True: 35.7k, False: 35.7k]
  ------------------
  198|       |    /* Generate one output row with proper horizontal expansion */
  199|  35.7k|    inptr = input_data[inrow];
  200|  35.7k|    outptr = output_data[outrow];
  201|  35.7k|    outend = outptr + cinfo->output_width;
  202|   768k|    while (outptr < outend) {
  ------------------
  |  Branch (202:12): [True: 732k, False: 35.7k]
  ------------------
  203|   732k|      invalue = *inptr++;
  204|  2.83M|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (204:26): [True: 2.10M, False: 732k]
  ------------------
  205|  2.10M|        *outptr++ = invalue;
  206|  2.10M|      }
  207|   732k|    }
  208|       |    /* Generate any additional output rows by duplicating the first one */
  209|  35.7k|    if (v_expand > 1) {
  ------------------
  |  Branch (209:9): [True: 21.6k, False: 14.1k]
  ------------------
  210|  21.6k|      _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  ------------------
  |  |  297|  21.6k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  211|  21.6k|                         v_expand - 1, cinfo->output_width);
  212|  21.6k|    }
  213|  35.7k|    inrow++;
  214|  35.7k|    outrow += v_expand;
  215|  35.7k|  }
  216|  35.7k|}
j12init_upsampler:
  438|  1.04k|{
  439|  1.04k|  my_upsample_ptr upsample;
  440|  1.04k|  int ci;
  441|  1.04k|  jpeg_component_info *compptr;
  442|  1.04k|  boolean need_buffer, do_fancy;
  443|  1.04k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|  1.04k|#ifdef D_LOSSLESS_SUPPORTED
  446|  1.04k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 387, False: 662]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|    387|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    774|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (450:9): [True: 0, False: 387]
  ------------------
  451|    387|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    387|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (451:9): [True: 0, False: 387]
  ------------------
  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|    387|  } else
  455|    662|#endif
  456|    662|  {
  457|    662|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    662|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (457:9): [True: 0, False: 662]
  ------------------
  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|    662|  }
  460|       |
  461|  1.04k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 1.04k, False: 0]
  ------------------
  462|  1.04k|    upsample = (my_upsample_ptr)
  463|  1.04k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.04k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  1.04k|                                  sizeof(my_upsampler));
  465|  1.04k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|  1.04k|    upsample->pub.start_pass = start_pass_upsample;
  467|  1.04k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  149|  1.04k|#define _upsample  upsample_12
  ------------------
  468|  1.04k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  1.04k|#define FALSE   0               /* values of boolean */
  ------------------
  469|  1.04k|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|  1.04k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 1.04k]
  ------------------
  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|  1.04k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  1.04k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 1.04k, False: 0]
  |  Branch (478:44): [True: 662, False: 387]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  2.77k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 1.72k, False: 1.04k]
  ------------------
  484|  1.72k|       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|  1.72k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.72k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|  1.72k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.72k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|  1.72k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.72k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|  1.72k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.72k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|  1.72k|    h_out_group = cinfo->max_h_samp_factor;
  493|  1.72k|    v_out_group = cinfo->max_v_samp_factor;
  494|  1.72k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|  1.72k|    need_buffer = TRUE;
  ------------------
  |  |  210|  1.72k|#define TRUE    1
  ------------------
  496|  1.72k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 1.72k]
  ------------------
  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|  1.72k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 1.71k, False: 6]
  |  Branch (500:45): [True: 1.71k, False: 0]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|  1.71k|      upsample->methods[ci] = fullsize_upsample;
  503|  1.71k|      need_buffer = FALSE;
  ------------------
  |  |  207|  1.71k|#define FALSE   0               /* values of boolean */
  ------------------
  504|  1.71k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 6, False: 0]
  |  Branch (504:49): [True: 0, False: 6]
  ------------------
  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|      6|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 0, False: 6]
  ------------------
  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|      6|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 6, False: 0]
  ------------------
  532|      6|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 6, False: 0]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      6|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 6]
  |  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|      6|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      6|          upsample->methods[ci] = h2v2_upsample;
  549|      6|      }
  550|      6|    } 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|  1.72k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 6, False: 1.71k]
  |  Branch (558:24): [True: 6, False: 0]
  ------------------
  559|      6|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|      6|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      6|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|      6|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|      6|                               (long)cinfo->max_h_samp_factor),
  563|      6|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|      6|    }
  565|  1.72k|  }
  566|  1.04k|}
jdsample-12.c:start_pass_upsample:
   47|  1.01k|{
   48|  1.01k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|  1.01k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|  1.01k|  upsample->rows_to_go = cinfo->output_height;
   54|  1.01k|}
jdsample-12.c:sep_upsample:
   70|   822k|{
   71|   822k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|   822k|  int ci;
   73|   822k|  jpeg_component_info *compptr;
   74|   822k|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|   822k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 822k, False: 0]
  ------------------
   78|  1.68M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 858k, False: 822k]
  ------------------
   79|   858k|         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|   858k|      (*upsample->methods[ci]) (cinfo, compptr,
   87|   858k|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|   858k|        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|   858k|    }
   95|   822k|    upsample->next_row_out = 0;
   96|   822k|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|   822k|  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|   822k|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 0, False: 822k]
  ------------------
  106|      0|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|   822k|  out_rows_avail -= *out_row_ctr;
  109|   822k|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 0, False: 822k]
  ------------------
  110|      0|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|   822k|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  151|   822k|#define _color_convert  color_convert_12
  ------------------
  116|   822k|                                      (JDIMENSION)upsample->next_row_out,
  117|   822k|                                      output_buf + *out_row_ctr,
  118|   822k|                                      (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|   822k|  *out_row_ctr += num_rows;
  127|   822k|  upsample->rows_to_go -= num_rows;
  128|   822k|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|   822k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 822k, False: 0]
  ------------------
  131|   822k|    (*in_row_group_ctr)++;
  132|   822k|}
jdsample-12.c:fullsize_upsample:
  151|   858k|{
  152|   858k|  *output_data_ptr = input_data;
  153|   858k|}

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

jpeg12_idct_islow:
  198|  8.11M|{
  199|  8.11M|  JLONG tmp0, tmp1, tmp2, tmp3;
  200|  8.11M|  JLONG tmp10, tmp11, tmp12, tmp13;
  201|  8.11M|  JLONG z1, z2, z3, z4, z5;
  202|  8.11M|  JCOEFPTR inptr;
  203|  8.11M|  ISLOW_MULT_TYPE *quantptr;
  204|  8.11M|  int *wsptr;
  205|  8.11M|  _JSAMPROW outptr;
  ------------------
  |  |  113|  8.11M|#define _JSAMPROW  J12SAMPROW
  ------------------
  206|  8.11M|  _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |  108|  8.11M|#define _JSAMPLE  J12SAMPLE
  ------------------
                _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |   95|  8.11M|  ((_JSAMPLE *)((cinfo)->sample_range_limit) + _CENTERJSAMPLE)
  |  |  ------------------
  |  |  |  |  111|  8.11M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  8.11M|#define CENTERJ12SAMPLE  2048
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|  8.11M|  int ctr;
  208|  8.11M|  int workspace[DCTSIZE2];      /* buffers data between passes */
  209|  8.11M|  SHIFT_TEMPS
  210|  8.11M|  SCALING_FACTOR
  ------------------
  |  |  170|  8.11M|  JLONG scaling_factor = (cinfo->master->jpeg_data_precision == 8 && \
  |  |  ------------------
  |  |  |  Branch (170:27): [True: 0, False: 8.11M]
  |  |  ------------------
  |  |  171|  8.11M|                          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|  8.11M|  inptr = coef_block;
  217|  8.11M|  quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
  218|  8.11M|  wsptr = workspace;
  219|  73.0M|  for (ctr = DCTSIZE; ctr > 0; ctr--) {
  ------------------
  |  |   66|  8.11M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (219:23): [True: 64.9M, False: 8.11M]
  ------------------
  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|  64.9M|    if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  64.9M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  63.8M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (229:9): [True: 63.8M, False: 1.08M]
  |  Branch (229:36): [True: 63.6M, False: 123k]
  ------------------
  230|  63.6M|        inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (230:9): [True: 63.6M, False: 41.0k]
  |  Branch (230:36): [True: 63.6M, False: 21.6k]
  ------------------
  231|  63.6M|        inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (231:9): [True: 63.6M, False: 2.98k]
  |  Branch (231:36): [True: 63.6M, False: 2.88k]
  ------------------
  232|  63.6M|        inptr[DCTSIZE * 7] == 0) {
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (232:9): [True: 63.6M, False: 1.58k]
  ------------------
  233|       |      /* AC terms all zero */
  234|  63.6M|      int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
  ------------------
  |  |   85|  63.6M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  235|  63.6M|                             quantptr[DCTSIZE * 0]), PASS1_BITS);
  236|       |
  237|  63.6M|      wsptr[DCTSIZE * 0] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  238|  63.6M|      wsptr[DCTSIZE * 1] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  239|  63.6M|      wsptr[DCTSIZE * 2] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  240|  63.6M|      wsptr[DCTSIZE * 3] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  241|  63.6M|      wsptr[DCTSIZE * 4] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  242|  63.6M|      wsptr[DCTSIZE * 5] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  243|  63.6M|      wsptr[DCTSIZE * 6] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  244|  63.6M|      wsptr[DCTSIZE * 7] = dcval;
  ------------------
  |  |   66|  63.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  245|       |
  246|  63.6M|      inptr++;                  /* advance pointers to next column */
  247|  63.6M|      quantptr++;
  248|  63.6M|      wsptr++;
  249|  63.6M|      continue;
  250|  63.6M|    }
  251|       |
  252|       |    /* Even part: reverse the even part of the forward DCT. */
  253|       |    /* The rotator is sqrt(2)*c(-6). */
  254|       |
  255|  1.27M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  256|  1.27M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  257|       |
  258|  1.27M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  259|  1.27M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  260|  1.27M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  261|       |
  262|  1.27M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  263|  1.27M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  264|       |
  265|  1.27M|    tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
  ------------------
  |  |   85|  1.27M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  266|  1.27M|    tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
  ------------------
  |  |   85|  1.27M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  267|       |
  268|  1.27M|    tmp10 = tmp0 + tmp3;
  269|  1.27M|    tmp13 = tmp0 - tmp3;
  270|  1.27M|    tmp11 = tmp1 + tmp2;
  271|  1.27M|    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.27M|    tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  278|  1.27M|    tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  279|  1.27M|    tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  280|  1.27M|    tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
  ------------------
  |  |  186|  1.27M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  281|       |
  282|  1.27M|    z1 = tmp0 + tmp3;
  283|  1.27M|    z2 = tmp1 + tmp2;
  284|  1.27M|    z3 = tmp0 + tmp2;
  285|  1.27M|    z4 = tmp1 + tmp3;
  286|  1.27M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  287|       |
  288|  1.27M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  289|  1.27M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  290|  1.27M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  291|  1.27M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  292|  1.27M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  293|  1.27M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  294|  1.27M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  295|  1.27M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  156|  1.27M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  296|       |
  297|  1.27M|    z3 += z5;
  298|  1.27M|    z4 += z5;
  299|       |
  300|  1.27M|    tmp0 += z1 + z3;
  301|  1.27M|    tmp1 += z2 + z4;
  302|  1.27M|    tmp2 += z2 + z3;
  303|  1.27M|    tmp3 += z1 + z4;
  304|       |
  305|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  306|       |
  307|  1.27M|    wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  308|  1.27M|    wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  309|  1.27M|    wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  310|  1.27M|    wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  311|  1.27M|    wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  312|  1.27M|    wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  313|  1.27M|    wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  314|  1.27M|    wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.27M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.27M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.27M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  315|       |
  316|  1.27M|    inptr++;                    /* advance pointers to next column */
  317|  1.27M|    quantptr++;
  318|  1.27M|    wsptr++;
  319|  1.27M|  }
  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|  8.11M|  wsptr = workspace;
  326|  73.0M|  for (ctr = 0; ctr < DCTSIZE; ctr++) {
  ------------------
  |  |   66|  73.0M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (326:17): [True: 64.9M, False: 8.11M]
  ------------------
  327|  64.9M|    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|  64.9M|#ifndef NO_ZERO_ROW_TEST
  337|  64.9M|    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
  ------------------
  |  Branch (337:9): [True: 60.1M, False: 4.78M]
  |  Branch (337:26): [True: 59.9M, False: 208k]
  |  Branch (337:43): [True: 59.8M, False: 89.9k]
  |  Branch (337:60): [True: 59.8M, False: 13.7k]
  ------------------
  338|  59.8M|        wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
  ------------------
  |  Branch (338:9): [True: 59.8M, False: 3.78k]
  |  Branch (338:26): [True: 59.7M, False: 6.18k]
  |  Branch (338:43): [True: 59.7M, False: 931]
  ------------------
  339|       |      /* AC terms all zero */
  340|  59.7M|      _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  108|  59.7M|#define _JSAMPLE  J12SAMPLE
  ------------------
                    _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  216|  59.7M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  59.7M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  341|  59.7M|                                                PASS1_BITS + 3) & RANGE_MASK];
  ------------------
  |  |   97|  59.7M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  59.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  59.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  342|       |
  343|  59.7M|      outptr[0] = dcval;
  344|  59.7M|      outptr[1] = dcval;
  345|  59.7M|      outptr[2] = dcval;
  346|  59.7M|      outptr[3] = dcval;
  347|  59.7M|      outptr[4] = dcval;
  348|  59.7M|      outptr[5] = dcval;
  349|  59.7M|      outptr[6] = dcval;
  350|  59.7M|      outptr[7] = dcval;
  351|       |
  352|  59.7M|      wsptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|  59.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  353|  59.7M|      continue;
  354|  59.7M|    }
  355|  5.11M|#endif
  356|       |
  357|       |    /* Even part: reverse the even part of the forward DCT. */
  358|       |    /* The rotator is sqrt(2)*c(-6). */
  359|       |
  360|  5.11M|    z2 = (JLONG)wsptr[2];
  361|  5.11M|    z3 = (JLONG)wsptr[6];
  362|       |
  363|  5.11M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  364|  5.11M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  365|  5.11M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  366|       |
  367|  5.11M|    tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  5.11M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  368|  5.11M|    tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  5.11M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  369|       |
  370|  5.11M|    tmp10 = tmp0 + tmp3;
  371|  5.11M|    tmp13 = tmp0 - tmp3;
  372|  5.11M|    tmp11 = tmp1 + tmp2;
  373|  5.11M|    tmp12 = tmp1 - tmp2;
  374|       |
  375|       |    /* Odd part per figure 8; the matrix is unitary and hence its
  376|       |     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
  377|       |     */
  378|       |
  379|  5.11M|    tmp0 = (JLONG)wsptr[7];
  380|  5.11M|    tmp1 = (JLONG)wsptr[5];
  381|  5.11M|    tmp2 = (JLONG)wsptr[3];
  382|  5.11M|    tmp3 = (JLONG)wsptr[1];
  383|       |
  384|  5.11M|    z1 = tmp0 + tmp3;
  385|  5.11M|    z2 = tmp1 + tmp2;
  386|  5.11M|    z3 = tmp0 + tmp2;
  387|  5.11M|    z4 = tmp1 + tmp3;
  388|  5.11M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  389|       |
  390|  5.11M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  391|  5.11M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  392|  5.11M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  393|  5.11M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  394|  5.11M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  395|  5.11M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  396|  5.11M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  397|  5.11M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  156|  5.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  398|       |
  399|  5.11M|    z3 += z5;
  400|  5.11M|    z4 += z5;
  401|       |
  402|  5.11M|    tmp0 += z1 + z3;
  403|  5.11M|    tmp1 += z2 + z4;
  404|  5.11M|    tmp2 += z2 + z3;
  405|  5.11M|    tmp3 += z1 + z4;
  406|       |
  407|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  408|       |
  409|  5.11M|    outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  410|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  411|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|  5.11M|    outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  413|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  414|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  415|  5.11M|    outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  416|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  417|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  418|  5.11M|    outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  419|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  420|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  421|  5.11M|    outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  422|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  423|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  424|  5.11M|    outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  425|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  426|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|  5.11M|    outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  428|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  429|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  430|  5.11M|    outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
  ------------------
  |  |  216|  5.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  5.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  431|  5.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  432|  5.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  5.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  5.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  5.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|       |
  434|  5.11M|    wsptr += DCTSIZE;           /* advance pointer to next row */
  ------------------
  |  |   66|  5.11M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  435|  5.11M|  }
  436|  8.11M|}

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

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

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

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

tiff_read_rgba_fuzzer.cc:_ZL14TIFFOpenMemoryPKcPKhmP16TIFFMemoryReader:
   91|  27.6k|{
   92|  27.6k|    TIFFOpenOptions *options = TIFFOpenOptionsAlloc();
   93|  27.6k|    if (options == nullptr)
  ------------------
  |  Branch (93:9): [True: 0, False: 27.6k]
  ------------------
   94|      0|    {
   95|      0|        return nullptr;
   96|      0|    }
   97|       |
   98|  27.6k|    reader->data = data;
   99|  27.6k|    reader->size = static_cast<toff_t>(size);
  100|  27.6k|    reader->offset = 0;
  101|       |
  102|  27.6k|    TIFFOpenOptionsSetMaxSingleMemAlloc(options, TIFF_FUZZ_MAX_ALLOC);
  ------------------
  |  |   23|  27.6k|#define TIFF_FUZZ_MAX_ALLOC (64 * 1024 * 1024)
  ------------------
  103|  27.6k|    TIFFOpenOptionsSetMaxCumulatedMemAlloc(options, TIFF_FUZZ_MAX_ALLOC);
  ------------------
  |  |   23|  27.6k|#define TIFF_FUZZ_MAX_ALLOC (64 * 1024 * 1024)
  ------------------
  104|  27.6k|    TIFF *tif = TIFFClientOpenExt(
  105|  27.6k|        name, "r", static_cast<thandle_t>(reader), TIFFMemoryRead,
  106|  27.6k|        TIFFMemoryWrite, TIFFMemorySeek, TIFFMemoryClose, TIFFMemorySize,
  107|  27.6k|        nullptr, nullptr, options);
  108|  27.6k|    TIFFOpenOptionsFree(options);
  109|  27.6k|    return tif;
  110|  27.6k|}
tiff_read_rgba_fuzzer.cc:_ZL14TIFFMemoryReadPvS_l:
   33|  1.02M|{
   34|  1.02M|    TIFFMemoryReader *reader = static_cast<TIFFMemoryReader *>(handle);
   35|  1.02M|    if (size < 0 || reader->offset >= reader->size)
  ------------------
  |  Branch (35:9): [True: 0, False: 1.02M]
  |  Branch (35:21): [True: 25.2k, False: 1.00M]
  ------------------
   36|  25.2k|    {
   37|  25.2k|        return 0;
   38|  25.2k|    }
   39|       |
   40|  1.00M|    toff_t available = reader->size - reader->offset;
   41|  1.00M|    if (static_cast<toff_t>(size) > available)
  ------------------
  |  Branch (41:9): [True: 85.3k, False: 916k]
  ------------------
   42|  85.3k|    {
   43|  85.3k|        size = static_cast<tmsize_t>(available);
   44|  85.3k|    }
   45|       |
   46|  1.00M|    memcpy(buffer, reader->data + reader->offset, static_cast<size_t>(size));
   47|  1.00M|    reader->offset += static_cast<toff_t>(size);
   48|  1.00M|    return size;
   49|  1.02M|}
tiff_read_rgba_fuzzer.cc:_ZL14TIFFMemorySeekPvmi:
   54|   915k|{
   55|   915k|    TIFFMemoryReader *reader = static_cast<TIFFMemoryReader *>(handle);
   56|   915k|    toff_t base;
   57|       |
   58|   915k|    switch (whence)
   59|   915k|    {
   60|   915k|        case SEEK_SET:
  ------------------
  |  Branch (60:9): [True: 915k, False: 0]
  ------------------
   61|   915k|            base = 0;
   62|   915k|            break;
   63|      0|        case SEEK_CUR:
  ------------------
  |  Branch (63:9): [True: 0, False: 915k]
  ------------------
   64|      0|            base = reader->offset;
   65|      0|            break;
   66|      0|        case SEEK_END:
  ------------------
  |  Branch (66:9): [True: 0, False: 915k]
  ------------------
   67|      0|            base = reader->size;
   68|      0|            break;
   69|      0|        default:
  ------------------
  |  Branch (69:9): [True: 0, False: 915k]
  ------------------
   70|      0|            return static_cast<toff_t>(-1);
   71|   915k|    }
   72|       |
   73|   915k|    if (offset > static_cast<toff_t>(-1) - base)
  ------------------
  |  Branch (73:9): [True: 0, False: 915k]
  ------------------
   74|      0|    {
   75|      0|        return static_cast<toff_t>(-1);
   76|      0|    }
   77|       |
   78|   915k|    reader->offset = base + offset;
   79|   915k|    return reader->offset;
   80|   915k|}
tiff_read_rgba_fuzzer.cc:_ZL15TIFFMemoryClosePv:
   82|  15.9k|static int TIFFMemoryClose(thandle_t) { return 0; }
tiff_read_rgba_fuzzer.cc:_ZL14TIFFMemorySizePv:
   85|  10.4k|{
   86|  10.4k|    return static_cast<TIFFMemoryReader *>(handle)->size;
   87|  10.4k|}

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

_TIFFMultiply32:
   37|   840k|{
   38|       |    return _TIFFMultiply32Ext(tif, first, second, where, NULL);
   39|   840k|}
_TIFFMultiply64:
   43|  5.41M|{
   44|  5.41M|    if (second && first > UINT64_MAX / second)
  ------------------
  |  Branch (44:9): [True: 5.41M, False: 2.33k]
  |  Branch (44:19): [True: 80, False: 5.41M]
  ------------------
   45|     80|    {
   46|     80|        TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   47|     80|        return 0;
   48|     80|    }
   49|       |
   50|  5.41M|    return first * second;
   51|  5.41M|}
_TIFFAdd64:
   82|   124k|{
   83|       |    return _TIFFAdd64Ext(tif, first, second, where, NULL);
   84|   124k|}
_TIFFMultiplySSize:
   88|   467k|{
   89|   467k|    if (first <= 0 || second <= 0)
  ------------------
  |  Branch (89:9): [True: 3, False: 467k]
  |  Branch (89:23): [True: 0, False: 467k]
  ------------------
   90|      3|    {
   91|      3|        if (tif != NULL && where != NULL)
  ------------------
  |  Branch (91:13): [True: 3, False: 0]
  |  Branch (91:28): [True: 0, False: 3]
  ------------------
   92|      0|        {
   93|      0|            TIFFErrorExtR(tif, where,
   94|      0|                          "Invalid argument to _TIFFMultiplySSize() in %s",
   95|      0|                          where);
   96|      0|        }
   97|      3|        return 0;
   98|      3|    }
   99|       |
  100|   467k|    if (first > TIFF_TMSIZE_T_MAX / second)
  ------------------
  |  |   68|   467k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (100:9): [True: 0, False: 467k]
  ------------------
  101|      0|    {
  102|      0|        if (tif != NULL && where != NULL)
  ------------------
  |  Branch (102:13): [True: 0, False: 0]
  |  Branch (102:28): [True: 0, False: 0]
  ------------------
  103|      0|        {
  104|      0|            TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
  105|      0|        }
  106|      0|        return 0;
  107|      0|    }
  108|   467k|    return first * second;
  109|   467k|}
_TIFFCastUInt64ToSSize:
  136|  2.06M|{
  137|  2.06M|    if (val > (uint64_t)TIFF_TMSIZE_T_MAX)
  ------------------
  |  |   68|  2.06M|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (137:9): [True: 38, False: 2.06M]
  ------------------
  138|     38|    {
  139|     38|        if (tif != NULL && module != NULL)
  ------------------
  |  Branch (139:13): [True: 38, False: 0]
  |  Branch (139:28): [True: 38, False: 0]
  ------------------
  140|     38|        {
  141|     38|            TIFFErrorExtR(tif, module, "Integer overflow");
  142|     38|        }
  143|     38|        return 0;
  144|     38|    }
  145|  2.06M|    return (tmsize_t)val;
  146|  2.06M|}
_TIFFCastUInt64ToUInt32:
  149|   124k|{
  150|       |    return _TIFFCastUInt64ToUInt32Ext(tif, val, module, NULL);
  151|   124k|}
_TIFFMultiply32Ext:
  163|  3.73M|{
  164|  3.73M|    if (second && first > UINT32_MAX / second)
  ------------------
  |  Branch (164:9): [True: 3.73M, False: 49]
  |  Branch (164:19): [True: 626, False: 3.73M]
  ------------------
  165|    626|    {
  166|    626|        TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
  167|    626|        if (pOverflowed != NULL)
  ------------------
  |  Branch (167:13): [True: 0, False: 626]
  ------------------
  168|      0|            *pOverflowed = true;
  169|    626|        return 0;
  170|    626|    }
  171|       |
  172|  3.73M|    return first * second;
  173|  3.73M|}
_TIFFAdd64Ext:
  177|  3.42M|{
  178|  3.42M|    if (first > UINT64_MAX - second)
  ------------------
  |  Branch (178:9): [True: 0, False: 3.42M]
  ------------------
  179|      0|    {
  180|      0|        if (tif != NULL && where != NULL)
  ------------------
  |  Branch (180:13): [True: 0, False: 0]
  |  Branch (180:28): [True: 0, False: 0]
  ------------------
  181|      0|        {
  182|      0|            TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
  183|      0|        }
  184|      0|        if (pOverflowed != NULL)
  ------------------
  |  Branch (184:13): [True: 0, False: 0]
  ------------------
  185|      0|            *pOverflowed = true;
  186|      0|        return 0;
  187|      0|    }
  188|       |
  189|  3.42M|    return first + second;
  190|  3.42M|}
_TIFFCastUInt64ToUInt32Ext:
  194|  1.57M|{
  195|  1.57M|    if (val > UINT32_MAX)
  ------------------
  |  Branch (195:9): [True: 0, False: 1.57M]
  ------------------
  196|      0|    {
  197|      0|        if (tif != NULL && module != NULL)
  ------------------
  |  Branch (197:13): [True: 0, False: 0]
  |  Branch (197:28): [True: 0, False: 0]
  ------------------
  198|      0|        {
  199|      0|            TIFFErrorExtR(tif, module, "Integer overflow");
  200|      0|        }
  201|      0|        if (pOverflowed != NULL)
  ------------------
  |  Branch (201:13): [True: 0, False: 0]
  ------------------
  202|      0|            *pOverflowed = true;
  203|      0|        return 0;
  204|      0|    }
  205|  1.57M|    return (uint32_t)val;
  206|  1.57M|}
_TIFFCheckRealloc:
  246|   434k|{
  247|   434k|    void *cp = NULL;
  248|   434k|    tmsize_t count = _TIFFMultiplySSize(tif, nmemb, elem_size, NULL);
  249|       |    /*
  250|       |     * Check for integer overflow.
  251|       |     */
  252|   434k|    if (count != 0)
  ------------------
  |  Branch (252:9): [True: 434k, False: 3]
  ------------------
  253|   434k|    {
  254|   434k|        cp = _TIFFreallocExt(tif, buffer, count);
  255|   434k|    }
  256|       |
  257|   434k|    if (cp == NULL)
  ------------------
  |  Branch (257:9): [True: 1.45k, False: 432k]
  ------------------
  258|  1.45k|    {
  259|  1.45k|        TIFFErrorExtR(tif, tif->tif_name,
  260|  1.45k|                      "Failed to allocate memory for %s "
  261|  1.45k|                      "(%" TIFF_SSIZE_FORMAT " elements of %" TIFF_SSIZE_FORMAT
  262|  1.45k|                      " bytes each)",
  263|  1.45k|                      what, nmemb, elem_size);
  264|  1.45k|    }
  265|       |
  266|   434k|    return cp;
  267|   434k|}
_TIFFCheckMalloc:
  271|   164k|{
  272|       |    return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);
  273|   164k|}
TIFFVGetFieldDefaulted:
  379|   398k|{
  380|   398k|    TIFFDirectory *td = &tif->tif_dir;
  381|       |
  382|   398k|    if (TIFFVGetField(tif, tag, ap))
  ------------------
  |  Branch (382:9): [True: 341k, False: 57.5k]
  ------------------
  383|   341k|        return (1);
  384|  57.5k|    switch (tag)
  385|  57.5k|    {
  386|      0|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (386:9): [True: 0, False: 57.5k]
  ------------------
  387|      0|            *va_arg(ap, uint32_t *) = td->td_subfiletype;
  388|      0|            return (1);
  389|  4.85k|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  4.85k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (389:9): [True: 4.85k, False: 52.6k]
  ------------------
  390|  4.85k|            *va_arg(ap, uint16_t *) = td->td_bitspersample;
  391|  4.85k|            return (1);
  392|      0|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      0|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (392:9): [True: 0, False: 57.5k]
  ------------------
  393|      0|            *va_arg(ap, uint16_t *) = td->td_threshholding;
  394|      0|            return (1);
  395|      0|        case TIFFTAG_FILLORDER:
  ------------------
  |  |  240|      0|#define TIFFTAG_FILLORDER 266              /* data order within a byte */
  ------------------
  |  Branch (395:9): [True: 0, False: 57.5k]
  ------------------
  396|      0|            *va_arg(ap, uint16_t *) = td->td_fillorder;
  397|      0|            return (1);
  398|  12.8k|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|  12.8k|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (398:9): [True: 12.8k, False: 44.6k]
  ------------------
  399|  12.8k|            *va_arg(ap, uint16_t *) = td->td_orientation;
  400|  12.8k|            return (1);
  401|  7.73k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  7.73k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (401:9): [True: 7.73k, False: 49.7k]
  ------------------
  402|  7.73k|            *va_arg(ap, uint16_t *) = td->td_samplesperpixel;
  403|  7.73k|            return (1);
  404|      0|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|      0|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (404:9): [True: 0, False: 57.5k]
  ------------------
  405|      0|            *va_arg(ap, uint32_t *) = td->td_rowsperstrip;
  406|      0|            return (1);
  407|      0|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|      0|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (407:9): [True: 0, False: 57.5k]
  ------------------
  408|      0|            *va_arg(ap, uint16_t *) = td->td_minsamplevalue;
  409|      0|            return (1);
  410|      0|        case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|      0|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (410:9): [True: 0, False: 57.5k]
  ------------------
  411|      0|        {
  412|      0|            uint16_t maxsamplevalue;
  413|       |            /* td_bitspersample=1 is always set in TIFFDefaultDirectory().
  414|       |             * Therefore, td_maxsamplevalue has to be re-calculated in
  415|       |             * TIFFGetFieldDefaulted(). */
  416|      0|            if (td->td_bitspersample > 0)
  ------------------
  |  Branch (416:17): [True: 0, False: 0]
  ------------------
  417|      0|            {
  418|       |                /* This shift operation into a uint16_t limits the value to
  419|       |                 * 65535 even if td_bitspersamle is > 16 */
  420|      0|                if (td->td_bitspersample <= 16)
  ------------------
  |  Branch (420:21): [True: 0, False: 0]
  ------------------
  421|      0|                {
  422|      0|                    maxsamplevalue = (uint16_t)((1U << td->td_bitspersample) -
  423|      0|                                                1); /* 2**(BitsPerSample) - 1 */
  424|      0|                }
  425|      0|                else
  426|      0|                {
  427|      0|                    maxsamplevalue = 65535;
  428|      0|                }
  429|      0|            }
  430|      0|            else
  431|      0|            {
  432|      0|                maxsamplevalue = 0;
  433|      0|            }
  434|      0|            *va_arg(ap, uint16_t *) = maxsamplevalue;
  435|      0|            return (1);
  436|      0|        }
  437|      0|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|      0|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (437:9): [True: 0, False: 57.5k]
  ------------------
  438|      0|            *va_arg(ap, uint16_t *) = td->td_planarconfig;
  439|      0|            return (1);
  440|      0|        case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  287|      0|#define TIFFTAG_RESOLUTIONUNIT 296         /* units of resolutions */
  ------------------
  |  Branch (440:9): [True: 0, False: 57.5k]
  ------------------
  441|      0|            *va_arg(ap, uint16_t *) = td->td_resolutionunit;
  442|      0|            return (1);
  443|      0|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|      0|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (443:9): [True: 0, False: 57.5k]
  ------------------
  444|      0|        {
  445|      0|            TIFFPredictorState *sp = (TIFFPredictorState *)tif->tif_data;
  446|      0|            if (sp == NULL)
  ------------------
  |  Branch (446:17): [True: 0, False: 0]
  ------------------
  447|      0|            {
  448|      0|                TIFFErrorExtR(
  449|      0|                    tif, tif->tif_name,
  450|      0|                    "Cannot get \"Predictor\" tag as plugin is not configured");
  451|      0|                *va_arg(ap, uint16_t *) = 0;
  452|      0|                return 0;
  453|      0|            }
  454|      0|            *va_arg(ap, uint16_t *) = (uint16_t)sp->predictor;
  455|      0|            return 1;
  456|      0|        }
  457|      0|        case TIFFTAG_DOTRANGE:
  ------------------
  |  |  327|      0|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (457:9): [True: 0, False: 57.5k]
  ------------------
  458|      0|            *va_arg(ap, uint16_t *) = 0;
  459|      0|            if (td->td_bitspersample <= 16)
  ------------------
  |  Branch (459:17): [True: 0, False: 0]
  ------------------
  460|      0|                *va_arg(ap, uint16_t *) =
  461|      0|                    (uint16_t)((1U << td->td_bitspersample) - 1);
  462|      0|            else
  463|      0|                *va_arg(ap, uint16_t *) = 65535;
  464|      0|            return (1);
  465|    293|        case TIFFTAG_INKSET:
  ------------------
  |  |  322|    293|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  |  Branch (465:9): [True: 293, False: 57.2k]
  ------------------
  466|    293|            *va_arg(ap, uint16_t *) = INKSET_CMYK;
  ------------------
  |  |  323|    293|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  467|    293|            return 1;
  468|      0|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|      0|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (468:9): [True: 0, False: 57.5k]
  ------------------
  469|      0|            *va_arg(ap, uint16_t *) = 4;
  470|      0|            return (1);
  471|  12.9k|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|  12.9k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (471:9): [True: 12.9k, False: 44.5k]
  ------------------
  472|  12.9k|            *va_arg(ap, uint16_t *) = td->td_extrasamples;
  473|  12.9k|            *va_arg(ap, const uint16_t **) = td->td_sampleinfo;
  474|  12.9k|            return (1);
  475|      0|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|      0|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (475:9): [True: 0, False: 57.5k]
  ------------------
  476|      0|            *va_arg(ap, uint16_t *) =
  477|      0|                (td->td_extrasamples == 1 && td->td_sampleinfo &&
  ------------------
  |  Branch (477:18): [True: 0, False: 0]
  |  Branch (477:46): [True: 0, False: 0]
  ------------------
  478|      0|                 td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
  ------------------
  |  |  331|      0|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (478:18): [True: 0, False: 0]
  ------------------
  479|      0|            return (1);
  480|      0|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|      0|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (480:9): [True: 0, False: 57.5k]
  ------------------
  481|      0|            *va_arg(ap, uint32_t *) = td->td_tiledepth;
  482|      0|            return (1);
  483|      0|        case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|      0|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (483:9): [True: 0, False: 57.5k]
  ------------------
  484|      0|            *va_arg(ap, uint16_t *) = (uint16_t)(td->td_sampleformat - 1);
  485|      0|            return (1);
  486|      0|        case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (486:9): [True: 0, False: 57.5k]
  ------------------
  487|      0|            *va_arg(ap, uint16_t *) = td->td_sampleformat;
  488|      0|            return (1);
  489|      0|        case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|      0|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (489:9): [True: 0, False: 57.5k]
  ------------------
  490|      0|            *va_arg(ap, uint32_t *) = td->td_imagedepth;
  491|      0|            return (1);
  492|  2.08k|        case TIFFTAG_YCBCRCOEFFICIENTS:
  ------------------
  |  |  387|  2.08k|#define TIFFTAG_YCBCRCOEFFICIENTS 529      /* !RGB -> YCbCr transform */
  ------------------
  |  Branch (492:9): [True: 2.08k, False: 55.4k]
  ------------------
  493|  2.08k|        {
  494|       |            /* defaults are from CCIR Recommendation 601-1 */
  495|  2.08k|            static const float ycbcrcoeffs[] = {0.299f, 0.587f, 0.114f};
  496|  2.08k|            *va_arg(ap, const float **) = ycbcrcoeffs;
  497|  2.08k|            return 1;
  498|      0|        }
  499|  14.6k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  14.6k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (499:9): [True: 14.6k, False: 42.8k]
  ------------------
  500|  14.6k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
  501|  14.6k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
  502|  14.6k|            return (1);
  503|      0|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      0|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (503:9): [True: 0, False: 57.5k]
  ------------------
  504|      0|            *va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
  505|      0|            return (1);
  506|     81|        case TIFFTAG_WHITEPOINT:
  ------------------
  |  |  307|     81|#define TIFFTAG_WHITEPOINT 318             /* image white point */
  ------------------
  |  Branch (506:9): [True: 81, False: 57.4k]
  ------------------
  507|     81|        {
  508|       |            /* TIFF 6.0 specification tells that it is no default
  509|       |               value for the WhitePoint, but AdobePhotoshop TIFF
  510|       |               Technical Note tells that it should be CIE D50. */
  511|     81|            static const float whitepoint[] = {
  512|     81|                D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|     81|#define D50_X0 (96.4250f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|     81|#define D50_X0 (96.4250f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  133|     81|#define D50_Y0 (100.0f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  134|     81|#define D50_Z0 (82.4680f)
  ------------------
  513|     81|                D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  133|     81|#define D50_Y0 (100.0f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  132|     81|#define D50_X0 (96.4250f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  133|     81|#define D50_Y0 (100.0f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  134|     81|#define D50_Z0 (82.4680f)
  ------------------
  514|     81|            *va_arg(ap, const float **) = whitepoint;
  515|     81|            return 1;
  516|      0|        }
  517|      0|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      0|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (517:9): [True: 0, False: 57.5k]
  ------------------
  518|      0|            if (!td->td_transferfunction[0] &&
  ------------------
  |  Branch (518:17): [True: 0, False: 0]
  ------------------
  519|      0|                !TIFFDefaultTransferFunction(tif, td))
  ------------------
  |  Branch (519:17): [True: 0, False: 0]
  ------------------
  520|      0|            {
  521|      0|                TIFFErrorExtR(tif, tif->tif_name,
  522|      0|                              "No space for \"TransferFunction\" tag");
  523|      0|                return (0);
  524|      0|            }
  525|      0|            *va_arg(ap, const uint16_t **) = td->td_transferfunction[0];
  526|      0|            if (td->td_samplesperpixel - td->td_extrasamples > 1)
  ------------------
  |  Branch (526:17): [True: 0, False: 0]
  ------------------
  527|      0|            {
  528|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[1];
  529|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[2];
  530|      0|            }
  531|      0|            return (1);
  532|  2.04k|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|  2.04k|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (532:9): [True: 2.04k, False: 55.4k]
  ------------------
  533|  2.04k|            if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(tif, td))
  ------------------
  |  Branch (533:17): [True: 2.04k, False: 0]
  |  Branch (533:42): [True: 0, False: 2.04k]
  ------------------
  534|      0|                return (0);
  535|  2.04k|            *va_arg(ap, const float **) = td->td_refblackwhite;
  536|  2.04k|            return (1);
  537|      0|        default:
  ------------------
  |  Branch (537:9): [True: 0, False: 57.5k]
  ------------------
  538|      0|            break;
  539|  57.5k|    }
  540|      0|    return 0;
  541|  57.5k|}
TIFFGetFieldDefaulted:
  548|   398k|{
  549|   398k|    int ok;
  550|   398k|    va_list ap;
  551|       |
  552|   398k|    va_start(ap, tag);
  553|   398k|    ok = TIFFVGetFieldDefaulted(tif, tag, ap);
  554|       |    va_end(ap);
  555|   398k|    return (ok);
  556|   398k|}
_TIFFClampDoubleToFloat:
  559|    721|{
  560|    721|    if (val > (double)FLT_MAX)
  ------------------
  |  Branch (560:9): [True: 13, False: 708]
  ------------------
  561|     13|        return FLT_MAX;
  562|    708|    if (val < -(double)FLT_MAX)
  ------------------
  |  Branch (562:9): [True: 3, False: 705]
  ------------------
  563|      3|        return -FLT_MAX;
  564|    705|    return (float)val;
  565|    708|}
_TIFFSeekOK:
  577|   656k|{
  578|       |    /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
  579|       |    /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
  580|   656k|    return off <= (~(uint64_t)0) / 2 && TIFFSeekFile(tif, off, SEEK_SET) == off;
  ------------------
  |  |  291|   656k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
  |  Branch (580:12): [True: 656k, False: 879]
  |  Branch (580:41): [True: 656k, False: 0]
  ------------------
  581|   656k|}
tif_aux.c:TIFFDefaultRefBlackWhite:
  335|  2.04k|{
  336|  2.04k|    int i;
  337|       |
  338|  2.04k|    td->td_refblackwhite = (float *)_TIFFmallocExt(tif, 6 * sizeof(float));
  339|  2.04k|    if (td->td_refblackwhite == NULL)
  ------------------
  |  Branch (339:9): [True: 0, False: 2.04k]
  ------------------
  340|      0|        return 0;
  341|  2.04k|    if (td->td_photometric == PHOTOMETRIC_YCBCR)
  ------------------
  |  |  227|  2.04k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (341:9): [True: 2.04k, False: 0]
  ------------------
  342|  2.04k|    {
  343|       |        /*
  344|       |         * YCbCr (Class Y) images must have the ReferenceBlackWhite
  345|       |         * tag set. Fix the broken images, which lacks that tag.
  346|       |         */
  347|  2.04k|        td->td_refblackwhite[0] = 0.0f;
  348|  2.04k|        td->td_refblackwhite[1] = td->td_refblackwhite[3] =
  349|  2.04k|            td->td_refblackwhite[5] = 255.0f;
  350|  2.04k|        td->td_refblackwhite[2] = td->td_refblackwhite[4] = 128.0f;
  351|  2.04k|    }
  352|      0|    else
  353|      0|    {
  354|       |        /*
  355|       |         * Assume RGB (Class R)
  356|       |         */
  357|      0|        for (i = 0; i < 3; i++)
  ------------------
  |  Branch (357:21): [True: 0, False: 0]
  ------------------
  358|      0|        {
  359|      0|            td->td_refblackwhite[2 * i + 0] = 0;
  360|      0|            if (td->td_bitspersample < 64)
  ------------------
  |  Branch (360:17): [True: 0, False: 0]
  ------------------
  361|      0|                td->td_refblackwhite[2 * i + 1] =
  362|      0|                    (float)((1ULL << td->td_bitspersample) - 1ULL);
  363|      0|            else
  364|      0|                td->td_refblackwhite[2 * i + 1] = (float)UINT64_MAX;
  365|      0|        }
  366|      0|    }
  367|  2.04k|    return 1;
  368|  2.04k|}

tif_packbits.c:_TIFFByteCursorGetU8:
   71|   401k|{
   72|   401k|    if (c->left <= 0)
  ------------------
  |  Branch (72:9): [True: 399, False: 400k]
  ------------------
   73|    399|        return 0;
   74|   400k|    *out = *c->p++;
   75|   400k|    c->left--;
   76|   400k|    return 1;
   77|   401k|}
tif_packbits.c:_TIFFByteCursorFill:
   93|  90.0k|{
   94|  90.0k|    if (n < 0 || n > dst->left)
  ------------------
  |  Branch (94:9): [True: 0, False: 90.0k]
  |  Branch (94:18): [True: 0, False: 90.0k]
  ------------------
   95|      0|        return 0;
   96|  90.0k|    _TIFFmemset(dst->p, value, n);
   97|  90.0k|    dst->p += n;
   98|  90.0k|    dst->left -= n;
   99|  90.0k|    return 1;
  100|  90.0k|}
tif_packbits.c:_TIFFByteCursorCopy:
  117|   213k|{
  118|   213k|    if (n < 0 || n > dst->left || n > src->left)
  ------------------
  |  Branch (118:9): [True: 0, False: 213k]
  |  Branch (118:18): [True: 0, False: 213k]
  |  Branch (118:35): [True: 0, False: 213k]
  ------------------
  119|      0|        return 0;
  120|   213k|    _TIFFmemcpy(dst->p, src->p, n);
  121|   213k|    dst->p += n;
  122|   213k|    dst->left -= n;
  123|   213k|    src->p += n;
  124|   213k|    src->left -= n;
  125|   213k|    return 1;
  126|   213k|}

TIFFCleanup:
   45|  27.6k|{
   46|       |    /*
   47|       |     * Flush buffered data and directory (if dirty).
   48|       |     */
   49|  27.6k|    if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (49:9): [True: 0, False: 27.6k]
  ------------------
   50|      0|        TIFFFlush(tif);
   51|  27.6k|    TIFFFreeDirectory(tif);
   52|       |
   53|  27.6k|    _TIFFCleanupIFDOffsetAndNumberMaps(tif);
   54|       |
   55|       |    /*
   56|       |     * Clean up client info links.
   57|       |     */
   58|  27.6k|    while (tif->tif_clientinfo)
  ------------------
  |  Branch (58:12): [True: 0, False: 27.6k]
  ------------------
   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|  27.6k|    if (tif->tif_rawdata && (tif->tif_flags & TIFF_MYBUFFER))
  ------------------
  |  |  131|  12.8k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (67:9): [True: 12.8k, False: 14.8k]
  |  Branch (67:29): [True: 12.8k, False: 0]
  ------------------
   68|  12.8k|    {
   69|  12.8k|        _TIFFfreeExt(tif, tif->tif_rawdata);
   70|  12.8k|        tif->tif_rawdata = NULL;
   71|  12.8k|        tif->tif_rawdatasize = 0;
   72|  12.8k|    }
   73|  27.6k|    if (isMapped(tif))
  ------------------
  |  |  283|  27.6k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  27.6k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 121, False: 27.5k]
  |  |  ------------------
  ------------------
   74|    121|        TIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size);
  ------------------
  |  |  297|    121|    ((*(tif)->tif_unmapproc)((tif)->tif_clientdata, (addr), (size)))
  ------------------
   75|       |
   76|       |    /*
   77|       |     * Clean up custom fields.
   78|       |     */
   79|  27.6k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (79:9): [True: 27.2k, False: 470]
  |  Branch (79:28): [True: 27.2k, False: 0]
  ------------------
   80|  27.2k|    {
   81|  27.2k|        uint32_t i;
   82|       |
   83|  4.51M|        for (i = 0; i < tif->tif_nfields; i++)
  ------------------
  |  Branch (83:21): [True: 4.48M, False: 27.2k]
  ------------------
   84|  4.48M|        {
   85|  4.48M|            TIFFField *fld = tif->tif_fields[i];
   86|  4.48M|            if (fld->field_name != NULL)
  ------------------
  |  Branch (86:17): [True: 4.48M, False: 0]
  ------------------
   87|  4.48M|            {
   88|  4.48M|                if (fld->field_bit == FIELD_CUSTOM &&
  ------------------
  |  |  394|  8.96M|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (88:21): [True: 3.05M, False: 1.43M]
  ------------------
   89|       |                    /* caution: tif_fields[i] must not be the beginning of a
   90|       |                     * fields-array. Otherwise the following tags are also freed
   91|       |                     * with the first free().
   92|       |                     */
   93|  3.05M|                    TIFFFieldIsAnonymous(fld))
  ------------------
  |  Branch (93:21): [True: 250k, False: 2.80M]
  ------------------
   94|   250k|                {
   95|   250k|                    _TIFFfreeExt(tif, (void *)fld->field_name);
   96|   250k|                    _TIFFfreeExt(tif, fld);
   97|   250k|                }
   98|  4.48M|            }
   99|  4.48M|        }
  100|       |
  101|  27.2k|        _TIFFfreeExt(tif, tif->tif_fields);
  102|  27.2k|    }
  103|       |
  104|  27.6k|    if (tif->tif_nfieldscompat > 0)
  ------------------
  |  Branch (104:9): [True: 0, False: 27.6k]
  ------------------
  105|      0|    {
  106|      0|        uint32_t i;
  107|       |
  108|      0|        for (i = 0; i < tif->tif_nfieldscompat; i++)
  ------------------
  |  Branch (108:21): [True: 0, False: 0]
  ------------------
  109|      0|        {
  110|      0|            if (tif->tif_fieldscompat[i].allocated_size)
  ------------------
  |  Branch (110:17): [True: 0, False: 0]
  ------------------
  111|      0|                _TIFFfreeExt(tif, tif->tif_fieldscompat[i].fields);
  112|      0|        }
  113|      0|        _TIFFfreeExt(tif, tif->tif_fieldscompat);
  114|      0|    }
  115|       |
  116|  27.6k|    if (tif->tif_cur_cumulated_mem_alloc != 0)
  ------------------
  |  Branch (116:9): [True: 0, False: 27.6k]
  ------------------
  117|      0|    {
  118|      0|        TIFFErrorExtR(tif, "TIFFCleanup",
  119|      0|                      "tif_cur_cumulated_mem_alloc = %" PRIu64 " whereas it "
  120|      0|                      "should be 0",
  121|      0|                      (uint64_t)tif->tif_cur_cumulated_mem_alloc);
  122|      0|    }
  123|       |
  124|       |    _TIFFfreeExt(NULL, tif);
  125|  27.6k|}
_TIFFCleanupIFDOffsetAndNumberMaps:
  132|  27.6k|{
  133|  27.6k|    if (tif->tif_map_dir_offset_to_number)
  ------------------
  |  Branch (133:9): [True: 27.5k, False: 122]
  ------------------
  134|  27.5k|    {
  135|  27.5k|        TIFFHashSetDestroy(tif->tif_map_dir_offset_to_number);
  136|  27.5k|        tif->tif_map_dir_offset_to_number = NULL;
  137|  27.5k|    }
  138|  27.6k|    if (tif->tif_map_dir_number_to_offset)
  ------------------
  |  Branch (138:9): [True: 27.5k, False: 122]
  ------------------
  139|  27.5k|    {
  140|  27.5k|        TIFFHashSetDestroy(tif->tif_map_dir_number_to_offset);
  141|       |        tif->tif_map_dir_number_to_offset = NULL;
  142|  27.5k|    }
  143|  27.6k|}
TIFFClose:
  160|  15.9k|{
  161|  15.9k|    if (tif != NULL)
  ------------------
  |  Branch (161:9): [True: 15.9k, False: 0]
  ------------------
  162|  15.9k|    {
  163|  15.9k|        TIFFCloseProc closeproc = tif->tif_closeproc;
  164|  15.9k|        thandle_t fd = tif->tif_clientdata;
  165|       |
  166|  15.9k|        TIFFCleanup(tif);
  167|  15.9k|        (void)(*closeproc)(fd);
  168|  15.9k|    }
  169|  15.9k|}

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

TIFFCIELabToXYZ:
   46|  7.66M|{
   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|  7.66M|    TIFFCIELab16ToXYZ(cielab, l * 257U, a * 256, b * 256, X, Y, Z);
   54|  7.66M|}
TIFFCIELab16ToXYZ:
   64|  15.2M|{
   65|  15.2M|    float L = (float)l * 100.0f / 65535.0f;
   66|  15.2M|    float cby, tmp;
   67|       |
   68|  15.2M|    if (L < 8.856f)
  ------------------
  |  Branch (68:9): [True: 15.0M, False: 210k]
  ------------------
   69|  15.0M|    {
   70|  15.0M|        *Y = (L * cielab->Y0) / 903.292f;
   71|  15.0M|        cby = 7.787f * (*Y / cielab->Y0) + 16.0f / 116.0f;
   72|  15.0M|    }
   73|   210k|    else
   74|   210k|    {
   75|   210k|        cby = (L + 16.0f) / 116.0f;
   76|   210k|        *Y = cielab->Y0 * cby * cby * cby;
   77|   210k|    }
   78|       |
   79|  15.2M|    tmp = (float)a / 256.0f / 500.0f + cby;
   80|  15.2M|    if (tmp < 0.2069f)
  ------------------
  |  Branch (80:9): [True: 15.0M, False: 211k]
  ------------------
   81|  15.0M|        *X = cielab->X0 * (tmp - 0.13793f) / 7.787f;
   82|   211k|    else
   83|   211k|        *X = cielab->X0 * tmp * tmp * tmp;
   84|       |
   85|  15.2M|    tmp = cby - (float)b / 256.0f / 200.0f;
   86|  15.2M|    if (tmp < 0.2069f)
  ------------------
  |  Branch (86:9): [True: 15.0M, False: 206k]
  ------------------
   87|  15.0M|        *Z = cielab->Z0 * (tmp - 0.13793f) / 7.787f;
   88|   206k|    else
   89|   206k|        *Z = cielab->Z0 * tmp * tmp * tmp;
   90|  15.2M|}
TIFFXYZToRGB:
   98|  15.2M|{
   99|  15.2M|    size_t i;
  100|  15.2M|    float Yr, Yg, Yb;
  101|  15.2M|    float *matrix = &cielab->display.d_mat[0][0];
  102|       |
  103|       |    /* Multiply through the matrix to get luminosity values. */
  104|  15.2M|    Yr = matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
  105|  15.2M|    Yg = matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
  106|  15.2M|    Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
  107|       |
  108|       |    /* Clip input */
  109|  15.2M|    Yr = TIFFmax(Yr, cielab->display.d_Y0R);
  ------------------
  |  |  351|  15.2M|#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (351:24): [True: 189k, False: 15.0M]
  |  |  ------------------
  ------------------
  110|  15.2M|    Yg = TIFFmax(Yg, cielab->display.d_Y0G);
  ------------------
  |  |  351|  15.2M|#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (351:24): [True: 206k, False: 15.0M]
  |  |  ------------------
  ------------------
  111|  15.2M|    Yb = TIFFmax(Yb, cielab->display.d_Y0B);
  ------------------
  |  |  351|  15.2M|#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (351:24): [True: 206k, False: 15.0M]
  |  |  ------------------
  ------------------
  112|       |
  113|       |    /* Avoid overflow in case of wrong input values */
  114|  15.2M|    Yr = TIFFmin(Yr, cielab->display.d_YCR);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 15.0M, False: 178k]
  |  |  ------------------
  ------------------
  115|  15.2M|    Yg = TIFFmin(Yg, cielab->display.d_YCG);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 15.2M, False: 520]
  |  |  ------------------
  ------------------
  116|  15.2M|    Yb = TIFFmin(Yb, cielab->display.d_YCB);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 15.2M, False: 20.0k]
  |  |  ------------------
  ------------------
  117|       |
  118|       |    /* Turn luminosity to colour value. */
  119|  15.2M|    i = (size_t)((Yr - cielab->display.d_Y0R) / cielab->rstep);
  120|  15.2M|    i = TIFFmin((size_t)cielab->range, i);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 0, False: 15.2M]
  |  |  ------------------
  ------------------
  121|  15.2M|    *r = RINT(cielab->Yr2r[i]);
  ------------------
  |  |   92|  15.2M|#define RINT(R) ((uint32_t)((R) > 0 ? ((R) + 0.5f) : ((R) - 0.5f)))
  |  |  ------------------
  |  |  |  Branch (92:29): [True: 189k, False: 15.0M]
  |  |  ------------------
  ------------------
  122|       |
  123|  15.2M|    i = (size_t)((Yg - cielab->display.d_Y0G) / cielab->gstep);
  124|  15.2M|    i = TIFFmin((size_t)cielab->range, i);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 0, False: 15.2M]
  |  |  ------------------
  ------------------
  125|  15.2M|    *g = RINT(cielab->Yg2g[i]);
  ------------------
  |  |   92|  15.2M|#define RINT(R) ((uint32_t)((R) > 0 ? ((R) + 0.5f) : ((R) - 0.5f)))
  |  |  ------------------
  |  |  |  Branch (92:29): [True: 206k, False: 15.0M]
  |  |  ------------------
  ------------------
  126|       |
  127|  15.2M|    i = (size_t)((Yb - cielab->display.d_Y0B) / cielab->bstep);
  128|  15.2M|    i = TIFFmin((size_t)cielab->range, i);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 0, False: 15.2M]
  |  |  ------------------
  ------------------
  129|  15.2M|    *b = RINT(cielab->Yb2b[i]);
  ------------------
  |  |   92|  15.2M|#define RINT(R) ((uint32_t)((R) > 0 ? ((R) + 0.5f) : ((R) - 0.5f)))
  |  |  ------------------
  |  |  |  Branch (92:29): [True: 206k, False: 15.0M]
  |  |  ------------------
  ------------------
  130|       |
  131|       |    /* Clip output. */
  132|  15.2M|    *r = TIFFmin(*r, cielab->display.d_Vrwr);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 15.0M, False: 178k]
  |  |  ------------------
  ------------------
  133|  15.2M|    *g = TIFFmin(*g, cielab->display.d_Vrwg);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 15.2M, False: 531]
  |  |  ------------------
  ------------------
  134|  15.2M|    *b = TIFFmin(*b, cielab->display.d_Vrwb);
  ------------------
  |  |  352|  15.2M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 15.2M, False: 20.1k]
  |  |  ------------------
  ------------------
  135|  15.2M|}
TIFFCIELabToRGBInit:
  144|     81|{
  145|     81|    size_t i;
  146|     81|    double dfGamma;
  147|       |
  148|     81|    cielab->range = CIELABTORGB_TABLE_RANGE;
  ------------------
  |  |  182|     81|#define CIELABTORGB_TABLE_RANGE 1500
  ------------------
  149|       |
  150|     81|    _TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
  151|       |
  152|       |    /* Red */
  153|     81|    dfGamma = 1.0 / (double)cielab->display.d_gammaR;
  154|     81|    cielab->rstep =
  155|     81|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  156|   121k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (156:17): [True: 121k, False: 81]
  ------------------
  157|   121k|    {
  158|   121k|        cielab->Yr2r[i] = (float)cielab->display.d_Vrwr *
  159|   121k|                          ((float)pow((double)i / cielab->range, dfGamma));
  160|   121k|    }
  161|       |
  162|       |    /* Green */
  163|     81|    dfGamma = 1.0 / (double)cielab->display.d_gammaG;
  164|     81|    cielab->gstep =
  165|     81|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  166|   121k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (166:17): [True: 121k, False: 81]
  ------------------
  167|   121k|    {
  168|   121k|        cielab->Yg2g[i] = (float)cielab->display.d_Vrwg *
  169|   121k|                          ((float)pow((double)i / cielab->range, dfGamma));
  170|   121k|    }
  171|       |
  172|       |    /* Blue */
  173|     81|    dfGamma = 1.0 / (double)cielab->display.d_gammaB;
  174|     81|    cielab->bstep =
  175|     81|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  176|   121k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (176:17): [True: 121k, False: 81]
  ------------------
  177|   121k|    {
  178|   121k|        cielab->Yb2b[i] = (float)cielab->display.d_Vrwb *
  179|   121k|                          ((float)pow((double)i / cielab->range, dfGamma));
  180|   121k|    }
  181|       |
  182|       |    /* Init reference white point */
  183|     81|    cielab->X0 = refWhite[0];
  184|     81|    cielab->Y0 = refWhite[1];
  185|     81|    cielab->Z0 = refWhite[2];
  186|       |
  187|     81|    return 0;
  188|     81|}
TIFFYCbCrtoRGB:
  208|   385M|{
  209|   385M|    int32_t i;
  210|       |
  211|       |    /* XXX: Only 8-bit YCbCr input supported for now */
  212|   385M|    Y = HICLAMP(Y, 255);
  ------------------
  |  |  204|   385M|#define HICLAMP(f, max) ((f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (204:26): [True: 0, False: 385M]
  |  |  ------------------
  ------------------
  213|   385M|    Cb = CLAMP(Cb, 0, 255);
  ------------------
  |  |  203|   385M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 0, False: 385M]
  |  |  |  Branch (203:34): [True: 0, False: 385M]
  |  |  ------------------
  ------------------
  214|   385M|    Cr = CLAMP(Cr, 0, 255);
  ------------------
  |  |  203|   385M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 0, False: 385M]
  |  |  |  Branch (203:34): [True: 0, False: 385M]
  |  |  ------------------
  ------------------
  215|       |
  216|   385M|    i = ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr];
  217|   385M|    *r = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   385M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 377M, False: 7.55M]
  |  |  |  Branch (203:34): [True: 390k, False: 7.16M]
  |  |  ------------------
  ------------------
  218|   385M|    i = ycbcr->Y_tab[Y] +
  219|   385M|        ((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT);
  ------------------
  |  |  195|   385M|#define SHIFT 16
  ------------------
  220|   385M|    *g = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   385M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 57.0k, False: 385M]
  |  |  |  Branch (203:34): [True: 24.1M, False: 361M]
  |  |  ------------------
  ------------------
  221|   385M|    i = ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb];
  222|   385M|    *b = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   385M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 366M, False: 18.5M]
  |  |  |  Branch (203:34): [True: 495k, False: 18.0M]
  |  |  ------------------
  ------------------
  223|   385M|}
TIFFYCbCrToRGBInit:
  259|  2.08k|{
  260|  2.08k|    TIFFRGBValue *clamptab;
  261|  2.08k|    int i;
  262|       |
  263|  2.08k|#define LumaRed luma[0]
  264|  2.08k|#define LumaGreen luma[1]
  265|  2.08k|#define LumaBlue luma[2]
  266|       |
  267|  2.08k|    clamptab =
  268|  2.08k|        (uint8_t *)ycbcr + TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long));
  ------------------
  |  |  326|  2.08k|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  316|  2.08k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (316:6): [True: 2.08k, Folded]
  |  |  |  |  ------------------
  |  |  |  |  317|  2.08k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  318|  2.08k|         : 0U)
  |  |  ------------------
  ------------------
  269|  2.08k|    _TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
  270|  2.08k|    ycbcr->clamptab = (clamptab += 256);
  271|   535k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (271:17): [True: 533k, False: 2.08k]
  ------------------
  272|   533k|        clamptab[i] = (TIFFRGBValue)i;
  273|  2.08k|    _TIFFmemset(clamptab + 256, 255, 2 * 256); /* v > 255 => 255 */
  274|  2.08k|    ycbcr->Cr_r_tab = (int *)(clamptab + 3 * 256);
  275|  2.08k|    ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
  276|  2.08k|    ycbcr->Cr_g_tab = (int32_t *)(ycbcr->Cb_b_tab + 256);
  277|  2.08k|    ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
  278|  2.08k|    ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
  279|       |
  280|  2.08k|    {
  281|  2.08k|        float f1 = 2 - 2 * LumaRed;
  ------------------
  |  |  263|  2.08k|#define LumaRed luma[0]
  ------------------
  282|  2.08k|        int32_t D1 = FIX(CLAMP(f1, 0.0f, 2.0f));
  ------------------
  |  |  196|  8.33k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  2.08k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 1, False: 2.08k]
  |  |  |  Branch (196:36): [True: 2, False: 2.08k]
  |  |  ------------------
  ------------------
  283|  2.08k|        float f2 = LumaRed * f1 / LumaGreen;
  ------------------
  |  |  263|  2.08k|#define LumaRed luma[0]
  ------------------
                      float f2 = LumaRed * f1 / LumaGreen;
  ------------------
  |  |  264|  2.08k|#define LumaGreen luma[1]
  ------------------
  284|  2.08k|        int32_t D2 = -FIX(CLAMP(f2, 0.0f, 2.0f));
  ------------------
  |  |  196|  8.33k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  2.08k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 1, False: 2.08k]
  |  |  |  Branch (196:36): [True: 2, False: 2.08k]
  |  |  ------------------
  ------------------
  285|  2.08k|        float f3 = 2 - 2 * LumaBlue;
  ------------------
  |  |  265|  2.08k|#define LumaBlue luma[2]
  ------------------
  286|  2.08k|        int32_t D3 = FIX(CLAMP(f3, 0.0f, 2.0f));
  ------------------
  |  |  196|  8.33k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  2.08k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 1, False: 2.08k]
  |  |  |  Branch (196:36): [True: 2, False: 2.08k]
  |  |  ------------------
  ------------------
  287|  2.08k|        float f4 = LumaBlue * f3 / LumaGreen;
  ------------------
  |  |  265|  2.08k|#define LumaBlue luma[2]
  ------------------
                      float f4 = LumaBlue * f3 / LumaGreen;
  ------------------
  |  |  264|  2.08k|#define LumaGreen luma[1]
  ------------------
  288|  2.08k|        int32_t D4 = -FIX(CLAMP(f4, 0.0f, 2.0f));
  ------------------
  |  |  196|  8.33k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  2.08k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 1, False: 2.08k]
  |  |  |  Branch (196:36): [True: 2, False: 2.08k]
  |  |  ------------------
  ------------------
  289|  2.08k|        int x;
  290|       |
  291|  2.08k|#undef LumaBlue
  292|  2.08k|#undef LumaGreen
  293|  2.08k|#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|   535k|        for (i = 0, x = -128; i < 256; i++, x++)
  ------------------
  |  Branch (302:31): [True: 533k, False: 2.08k]
  ------------------
  303|   533k|        {
  304|   533k|            int32_t Cr = (int32_t)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0f,
  ------------------
  |  |  199|   533k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   533k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  357|   533k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 533k, False: 256]
  |  |  ------------------
  ------------------
  305|   533k|                                                refBlackWhite[5] - 128.0f, 127),
  306|   533k|                                         -128.0f * 32, 128.0f * 32);
  307|   533k|            int32_t Cb = (int32_t)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0f,
  ------------------
  |  |  199|   533k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   533k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  357|   533k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 533k, False: 512]
  |  |  ------------------
  ------------------
  308|   533k|                                                refBlackWhite[3] - 128.0f, 127),
  309|   533k|                                         -128.0f * 32, 128.0f * 32);
  310|       |
  311|   533k|            ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  197|   533k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   533k|#define SHIFT 16
  |  |  ------------------
  ------------------
                          ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  195|   533k|#define SHIFT 16
  ------------------
  312|   533k|            ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  197|   533k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   533k|#define SHIFT 16
  |  |  ------------------
  ------------------
                          ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  195|   533k|#define SHIFT 16
  ------------------
  313|   533k|            ycbcr->Cr_g_tab[i] = D2 * Cr;
  314|   533k|            ycbcr->Cb_g_tab[i] = D4 * Cb + ONE_HALF;
  ------------------
  |  |  197|   533k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   533k|#define SHIFT 16
  |  |  ------------------
  ------------------
  315|   533k|            ycbcr->Y_tab[i] = (int32_t)CLAMPw(
  316|   533k|                Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
  ------------------
  |  |  199|   533k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   533k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  357|   533k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 533k, False: 256]
  |  |  ------------------
  ------------------
  317|   533k|                -128.0f * 32, 128.0f * 32);
  318|   533k|        }
  319|  2.08k|    }
  320|       |
  321|  2.08k|    return 0;
  322|  2.08k|}
tif_color.c:CLAMPw:
  228|  1.60M|{
  229|  1.60M|    if (v < vmin)
  ------------------
  |  Branch (229:9): [True: 8.65k, False: 1.59M]
  ------------------
  230|  8.65k|    {
  231|       |        /* printf("%f clamped to %f\n", v, vmin); */
  232|  8.65k|        return vmin;
  233|  8.65k|    }
  234|  1.59M|    if (v > vmax)
  ------------------
  |  Branch (234:9): [True: 6.92k, False: 1.58M]
  ------------------
  235|  6.92k|    {
  236|       |        /* printf("%f clamped to %f\n", v, vmax); */
  237|  6.92k|        return vmax;
  238|  6.92k|    }
  239|  1.58M|    return v;
  240|  1.59M|}

_TIFFNoRowDecode:
   97|     81|{
   98|     81|    (void)pp;
   99|     81|    (void)cc;
  100|     81|    (void)s;
  101|     81|    return (TIFFNoDecode(tif, "scanline"));
  102|     81|}
_TIFFNoStripDecode:
  105|  12.6k|{
  106|  12.6k|    (void)pp;
  107|  12.6k|    (void)cc;
  108|  12.6k|    (void)s;
  109|  12.6k|    return (TIFFNoDecode(tif, "strip"));
  110|  12.6k|}
_TIFFNoTileDecode:
  113|  3.18k|{
  114|  3.18k|    (void)pp;
  115|  3.18k|    (void)cc;
  116|  3.18k|    (void)s;
  117|  3.18k|    return (TIFFNoDecode(tif, "tile"));
  118|  3.18k|}
_TIFFNoPreCode:
  129|  29.1k|{
  130|  29.1k|    (void)tif;
  131|  29.1k|    (void)s;
  132|  29.1k|    return (1);
  133|  29.1k|}
_TIFFSetDefaultCompressionState:
  155|  88.0k|{
  156|  88.0k|    tif->tif_fixuptags = _TIFFNoFixupTags;
  157|  88.0k|    tif->tif_decodestatus = TRUE;
  ------------------
  |  |   74|  88.0k|#define TRUE 1
  ------------------
  158|  88.0k|    tif->tif_setupdecode = _TIFFtrue;
  159|  88.0k|    tif->tif_predecode = _TIFFNoPreCode;
  160|  88.0k|    tif->tif_decoderow = _TIFFNoRowDecode;
  161|  88.0k|    tif->tif_decodestrip = _TIFFNoStripDecode;
  162|  88.0k|    tif->tif_decodetile = _TIFFNoTileDecode;
  163|  88.0k|    tif->tif_encodestatus = TRUE;
  ------------------
  |  |   74|  88.0k|#define TRUE 1
  ------------------
  164|  88.0k|    tif->tif_setupencode = _TIFFtrue;
  165|  88.0k|    tif->tif_preencode = _TIFFNoPreCode;
  166|  88.0k|    tif->tif_postencode = _TIFFtrue;
  167|  88.0k|    tif->tif_encoderow = _TIFFNoRowEncode;
  168|  88.0k|    tif->tif_encodestrip = _TIFFNoStripEncode;
  169|  88.0k|    tif->tif_encodetile = _TIFFNoTileEncode;
  170|  88.0k|    tif->tif_close = _TIFFvoid;
  171|  88.0k|    tif->tif_seek = _TIFFNoSeek;
  172|  88.0k|    tif->tif_cleanup = _TIFFvoid;
  173|  88.0k|    tif->tif_defstripsize = _TIFFDefaultStripSize;
  174|  88.0k|    tif->tif_deftilesize = _TIFFDefaultTileSize;
  175|  88.0k|    tif->tif_getmaxcompressionratio = _TIFFDefaultGetMaxCompressionRatio;
  176|  88.0k|    tif->tif_flags &= ~(TIFF_NOBITREV | TIFF_NOREADRAW | TIFF_UPSAMPLED);
  ------------------
  |  |  130|  88.0k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
                  tif->tif_flags &= ~(TIFF_NOBITREV | TIFF_NOREADRAW | TIFF_UPSAMPLED);
  ------------------
  |  |  141|  88.0k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
                  tif->tif_flags &= ~(TIFF_NOBITREV | TIFF_NOREADRAW | TIFF_UPSAMPLED);
  ------------------
  |  |  136|  88.0k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  ------------------
  177|  88.0k|}
TIFFSetCompressionScheme:
  180|  44.6k|{
  181|  44.6k|    const TIFFCodec *c = TIFFFindCODEC((uint16_t)scheme);
  182|       |
  183|  44.6k|    _TIFFSetDefaultCompressionState(tif);
  184|  44.6k|    if (scheme == COMPRESSION_NONE)
  ------------------
  |  |  182|  44.6k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (184:9): [True: 27.2k, False: 17.4k]
  ------------------
  185|  27.2k|        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|  44.6k|    return (c ? (*c->init)(tif, scheme) : 1);
  ------------------
  |  Branch (192:13): [True: 43.4k, False: 1.22k]
  ------------------
  193|  44.6k|}
TIFFGetMaxCompressionRatio:
  196|     26|{
  197|     26|    if (tif->tif_getmaxcompressionratio)
  ------------------
  |  Branch (197:9): [True: 26, False: 0]
  ------------------
  198|     26|        return tif->tif_getmaxcompressionratio(tif);
  199|      0|    return 0;
  200|     26|}
TIFFFindCODEC:
  215|  71.4k|{
  216|  71.4k|    const TIFFCodec *c;
  217|  71.4k|    codec_t *cd;
  218|       |
  219|  71.4k|    for (cd = registeredCODECS; cd; cd = cd->next)
  ------------------
  |  Branch (219:33): [True: 0, False: 71.4k]
  ------------------
  220|      0|        if (cd->info->scheme == scheme)
  ------------------
  |  Branch (220:13): [True: 0, False: 0]
  ------------------
  221|      0|            return ((const TIFFCodec *)cd->info);
  222|   607k|    for (c = _TIFFBuiltinCODECS; c->name; c++)
  ------------------
  |  Branch (222:34): [True: 590k, False: 16.8k]
  ------------------
  223|   590k|        if (c->scheme == scheme)
  ------------------
  |  Branch (223:13): [True: 54.5k, False: 536k]
  ------------------
  224|  54.5k|            return (c);
  225|  16.8k|    return NULL;
  226|  71.4k|}
tif_compress.c:TIFFNoDecode:
   76|  15.9k|{
   77|  15.9k|    const TIFFCodec *c = TIFFFindCODEC(tif->tif_dir.td_compression);
   78|       |
   79|  15.9k|    if (c)
  ------------------
  |  Branch (79:9): [True: 448, False: 15.4k]
  ------------------
   80|    448|        TIFFErrorExtR(tif, tif->tif_name, "%s %s decoding is not implemented",
   81|    448|                      c->name, method);
   82|  15.4k|    else
   83|  15.4k|        TIFFErrorExtR(tif, tif->tif_name,
   84|  15.4k|                      "Compression scheme %" PRIu16
   85|  15.4k|                      " %s decoding is not implemented",
   86|  15.4k|                      tif->tif_dir.td_compression, method);
   87|  15.9k|    return (0);
   88|  15.9k|}
tif_compress.c:_TIFFNoFixupTags:
   91|  1.57k|{
   92|  1.57k|    (void)tif;
   93|  1.57k|    return (1);
   94|  1.57k|}
tif_compress.c:_TIFFtrue:
  136|  1.65k|{
  137|  1.65k|    (void)tif;
  138|  1.65k|    return (1);
  139|  1.65k|}
tif_compress.c:_TIFFvoid:
  140|  56.6k|static void _TIFFvoid(TIFF *tif) { (void)tif; }
tif_compress.c:_TIFFDefaultGetMaxCompressionRatio:
  143|     11|{
  144|     11|    (void)tif;
  145|     11|    return 0; /* unknown */
  146|     11|}

_TIFFsetByteArrayExt:
   66|    514|{
   67|    514|    setByteArray(tif, vpp, vp, n, 1);
   68|    514|}
_TIFFsetShortArrayExt:
   81|  2.53k|{
   82|  2.53k|    setByteArray(tif, (void **)wpp, wp, n, sizeof(uint16_t));
   83|  2.53k|}
_TIFFsetFloatArrayExt:
  106|     58|{
  107|     58|    setByteArray(tif, (void **)fpp, fp, n, sizeof(float));
  108|     58|}
_TIFFsetDoubleArrayExt:
  116|    451|{
  117|    451|    setByteArray(tif, (void **)dpp, dp, n, sizeof(double));
  118|    451|}
TIFFSetField:
 1413|   246k|{
 1414|   246k|    va_list ap;
 1415|   246k|    int status;
 1416|       |
 1417|   246k|    va_start(ap, tag);
 1418|   246k|    status = TIFFVSetField(tif, tag, ap);
 1419|       |    va_end(ap);
 1420|   246k|    return (status);
 1421|   246k|}
TIFFVSetField:
 1472|   246k|{
 1473|   246k|    return OkToChangeTag(tif, tag)
  ------------------
  |  Branch (1473:12): [True: 246k, False: 0]
  ------------------
 1474|   246k|               ? (*tif->tif_tagmethods.vsetfield)(tif, tag, ap)
 1475|   246k|               : 0;
 1476|   246k|}
TIFFGetField:
 1858|   152k|{
 1859|   152k|    int status;
 1860|   152k|    va_list ap;
 1861|       |
 1862|   152k|    va_start(ap, tag);
 1863|   152k|    status = TIFFVGetField(tif, tag, ap);
 1864|       |    va_end(ap);
 1865|   152k|    return (status);
 1866|   152k|}
TIFFVGetField:
 1875|   551k|{
 1876|   551k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  389|   551k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1877|   551k|    return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit))
  ------------------
  |  |  280|  1.10M|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (280:24): [True: 0, False: 551k]
  |  |  ------------------
  ------------------
                  return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit))
  ------------------
  |  |  267|   551k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|   551k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|   551k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 469k, False: 81.9k]
  |  |  ------------------
  ------------------
  |  Branch (1877:13): [True: 551k, False: 0]
  ------------------
 1878|   551k|                ? (*tif->tif_tagmethods.vgetfield)(tif, tag, ap)
 1879|   551k|                : 0);
 1880|   551k|}
_TIFFResetTifDirAndInitStrileCounters:
 1896|  54.8k|{
 1897|  54.8k|    _TIFFmemset(td, 0, sizeof(*td));
 1898|  54.8k|    td->td_curstrip = NOSTRIP;      /* invalid strip = NOSTRIP */
  ------------------
  |  |  123|  54.8k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
 1899|  54.8k|    td->td_row = (uint32_t)-1;      /* read/write pre-increment */
 1900|  54.8k|    td->td_col = (uint32_t)-1;      /* read/write pre-increment */
 1901|  54.8k|    td->td_scanlinesize = 0;        /* initialize to zero */
 1902|  54.8k|    td->td_curtile = NOTILE;        /* invalid tile = NOTILE */
  ------------------
  |  |  128|  54.8k|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1903|  54.8k|    td->td_tilesize = (tmsize_t)-1; /* invalidate tilezize */
 1904|  54.8k|}
TIFFFreeDirectory:
 1910|  54.8k|{
 1911|  54.8k|    TIFFDirectory *td = &tif->tif_dir;
 1912|  54.8k|    int i;
 1913|       |
 1914|  54.8k|    (*tif->tif_cleanup)(tif);
 1915|  54.8k|    _TIFFmemset(td->td_fieldsset, 0, sizeof(td->td_fieldsset));
 1916|  54.8k|    CleanupField(td_sminsamplevalue);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 326, False: 54.5k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|    326|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|    326|            td->member = 0;                                                    \
  |  | 1888|    326|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1917|  54.8k|    CleanupField(td_smaxsamplevalue);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 123, False: 54.7k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|    123|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|    123|            td->member = 0;                                                    \
  |  | 1888|    123|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1918|  54.8k|    CleanupField(td_colormap[0]);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 137, False: 54.7k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|    137|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|    137|            td->member = 0;                                                    \
  |  | 1888|    137|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1919|  54.8k|    CleanupField(td_colormap[1]);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 137, False: 54.7k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|    137|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|    137|            td->member = 0;                                                    \
  |  | 1888|    137|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1920|  54.8k|    CleanupField(td_colormap[2]);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 137, False: 54.7k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|    137|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|    137|            td->member = 0;                                                    \
  |  | 1888|    137|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1921|  54.8k|    td->td_colormap_count = 0;
 1922|  54.8k|    CleanupField(td_sampleinfo);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 2.02k, False: 52.8k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|  2.02k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|  2.02k|            td->member = 0;                                                    \
  |  | 1888|  2.02k|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1923|  54.8k|    CleanupField(td_subifd);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 5, False: 54.8k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|      5|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|      5|            td->member = 0;                                                    \
  |  | 1888|      5|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1924|  54.8k|    CleanupField(td_inknames);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 50, False: 54.8k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|     50|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|     50|            td->member = 0;                                                    \
  |  | 1888|     50|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1925|  54.8k|    CleanupField(td_refblackwhite);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 2.09k, False: 52.7k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|  2.09k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|  2.09k|            td->member = 0;                                                    \
  |  | 1888|  2.09k|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1926|  54.8k|    CleanupField(td_transferfunction[0]);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 6, False: 54.8k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|      6|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|      6|            td->member = 0;                                                    \
  |  | 1888|      6|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1927|  54.8k|    CleanupField(td_transferfunction[1]);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 1, False: 54.8k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|      1|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|      1|            td->member = 0;                                                    \
  |  | 1888|      1|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1928|  54.8k|    CleanupField(td_transferfunction[2]);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 1, False: 54.8k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|      1|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|      1|            td->member = 0;                                                    \
  |  | 1888|      1|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1929|  54.8k|    td->td_transferfunction_count = 0;
 1930|  54.8k|    CleanupField(td_stripoffset_p);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 18.9k, False: 35.9k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|  18.9k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|  18.9k|            td->member = 0;                                                    \
  |  | 1888|  18.9k|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1931|  54.8k|    CleanupField(td_stripbytecount_p);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 18.2k, False: 36.6k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|  18.2k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|  18.2k|            td->member = 0;                                                    \
  |  | 1888|  18.2k|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1932|  54.8k|    td->td_stripoffsetbyteallocsize = 0;
 1933|  54.8k|    TIFFClrFieldBit(tif, FIELD_YCBCRSUBSAMPLING);
  ------------------
  |  |  269|  54.8k|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  266|  54.8k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  265|  54.8k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1934|  54.8k|    TIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING);
  ------------------
  |  |  269|  54.8k|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  266|  54.8k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  265|  54.8k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1935|       |
 1936|       |    /* Cleanup custom tag values */
 1937|  94.9k|    for (i = 0; i < td->td_customValueCount; i++)
  ------------------
  |  Branch (1937:17): [True: 40.0k, False: 54.8k]
  ------------------
 1938|  40.0k|    {
 1939|  40.0k|        if (td->td_customValues[i].value)
  ------------------
  |  Branch (1939:13): [True: 37.5k, False: 2.47k]
  ------------------
 1940|  37.5k|            _TIFFfreeExt(tif, td->td_customValues[i].value);
 1941|  40.0k|    }
 1942|       |
 1943|  54.8k|    td->td_customValueCount = 0;
 1944|  54.8k|    CleanupField(td_customValues);
  ------------------
  |  | 1883|  54.8k|    {                                                                          \
  |  | 1884|  54.8k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1884:13): [True: 5.02k, False: 49.8k]
  |  |  ------------------
  |  | 1885|  54.8k|        {                                                                      \
  |  | 1886|  5.02k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1887|  5.02k|            td->member = 0;                                                    \
  |  | 1888|  5.02k|        }                                                                      \
  |  | 1889|  54.8k|    }
  ------------------
 1945|       |
 1946|  54.8k|    _TIFFmemset(&(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
 1947|  54.8k|    _TIFFmemset(&(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
 1948|       |
 1949|       |    /* Reset some internal parameters for IFD data size checking. */
 1950|  54.8k|    tif->tif_dir.td_dirdatasize_read = 0;
 1951|  54.8k|    tif->tif_dir.td_dirdatasize_write = 0;
 1952|  54.8k|    if (tif->tif_dir.td_dirdatasize_offsets != NULL)
  ------------------
  |  Branch (1952:9): [True: 27.2k, False: 27.6k]
  ------------------
 1953|  27.2k|    {
 1954|  27.2k|        _TIFFfreeExt(tif, tif->tif_dir.td_dirdatasize_offsets);
 1955|  27.2k|        tif->tif_dir.td_dirdatasize_offsets = NULL;
 1956|  27.2k|        tif->tif_dir.td_dirdatasize_Noffsets = 0;
 1957|  27.2k|    }
 1958|  54.8k|    tif->tif_dir.td_iswrittentofile = FALSE;
  ------------------
  |  |   75|  54.8k|#define FALSE 0
  ------------------
 1959|       |    /* Note: tif->tif_dir structure is set to zero in TIFFDefaultDirectory() */
 1960|  54.8k|}
TIFFDefaultDirectory:
 2053|  27.2k|{
 2054|  27.2k|    TIFFDirectory *td = &tif->tif_dir;
 2055|  27.2k|    const TIFFFieldArray *tiffFieldArray;
 2056|       |
 2057|  27.2k|    tiffFieldArray = _TIFFGetFields();
 2058|  27.2k|    _TIFFSetupFields(tif, tiffFieldArray);
 2059|       |    /* Reset tif->tif_dir structure to zero and
 2060|       |     * initialize some IFD strile counter and index parameters. */
 2061|  27.2k|    _TIFFResetTifDirAndInitStrileCounters(td);
 2062|  27.2k|    td->td_fillorder = FILLORDER_MSB2LSB;
  ------------------
  |  |  241|  27.2k|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
 2063|  27.2k|    td->td_bitspersample = 1;
 2064|  27.2k|    td->td_threshholding = THRESHHOLD_BILEVEL;
  ------------------
  |  |  235|  27.2k|#define THRESHHOLD_BILEVEL 1               /* b&w art scan */
  ------------------
 2065|  27.2k|    td->td_orientation = ORIENTATION_TOPLEFT;
  ------------------
  |  |  249|  27.2k|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
 2066|  27.2k|    td->td_samplesperpixel = 1;
 2067|  27.2k|    td->td_rowsperstrip = (uint32_t)-1;
 2068|  27.2k|    td->td_tilewidth = 0;
 2069|  27.2k|    td->td_tilelength = 0;
 2070|  27.2k|    td->td_tiledepth = 1;
 2071|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 2072|       |    td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */
 2073|       |#endif
 2074|  27.2k|    td->td_resolutionunit = RESUNIT_INCH;
  ------------------
  |  |  289|  27.2k|#define RESUNIT_INCH 2                     /* english */
  ------------------
 2075|  27.2k|    td->td_sampleformat = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|  27.2k|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 2076|  27.2k|    td->td_imagedepth = 1;
 2077|  27.2k|    td->td_ycbcrsubsampling[0] = 2;
 2078|  27.2k|    td->td_ycbcrsubsampling[1] = 2;
 2079|  27.2k|    td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
  ------------------
  |  |  390|  27.2k|#define YCBCRPOSITION_CENTERED 1           /* !as in PostScript Level 2 */
  ------------------
 2080|  27.2k|    tif->tif_postdecode = _TIFFNoPostDecode;
 2081|  27.2k|    tif->tif_foundfield = NULL;
 2082|  27.2k|    tif->tif_tagmethods.vsetfield = _TIFFVSetField;
 2083|  27.2k|    tif->tif_tagmethods.vgetfield = _TIFFVGetField;
 2084|  27.2k|    tif->tif_tagmethods.printdir = NULL;
 2085|       |    /* additional default values */
 2086|  27.2k|    td->td_planarconfig = PLANARCONFIG_CONTIG;
  ------------------
  |  |  265|  27.2k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 2087|  27.2k|    td->td_compression = COMPRESSION_NONE;
  ------------------
  |  |  182|  27.2k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
 2088|  27.2k|    td->td_subfiletype = 0;
 2089|  27.2k|    td->td_minsamplevalue = 0;
 2090|       |    /* td_bitspersample=1 is always set in TIFFDefaultDirectory().
 2091|       |     * Therefore, td_maxsamplevalue has to be re-calculated in
 2092|       |     * TIFFGetFieldDefaulted(). */
 2093|  27.2k|    td->td_maxsamplevalue = 1; /* Default for td_bitspersample=1 */
 2094|  27.2k|    td->td_extrasamples = 0;
 2095|  27.2k|    td->td_sampleinfo = NULL;
 2096|       |
 2097|       |    /*
 2098|       |     *  Give client code a chance to install their own
 2099|       |     *  tag extensions & methods, prior to compression overloads,
 2100|       |     *  but do some prior cleanup first.
 2101|       |     * (http://trac.osgeo.org/gdal/ticket/5054)
 2102|       |     */
 2103|  27.2k|    if (tif->tif_nfieldscompat > 0)
  ------------------
  |  Branch (2103:9): [True: 0, False: 27.2k]
  ------------------
 2104|      0|    {
 2105|      0|        uint32_t i;
 2106|       |
 2107|      0|        for (i = 0; i < tif->tif_nfieldscompat; i++)
  ------------------
  |  Branch (2107:21): [True: 0, False: 0]
  ------------------
 2108|      0|        {
 2109|      0|            if (tif->tif_fieldscompat[i].allocated_size)
  ------------------
  |  Branch (2109:17): [True: 0, False: 0]
  ------------------
 2110|      0|                _TIFFfreeExt(tif, tif->tif_fieldscompat[i].fields);
 2111|      0|        }
 2112|      0|        _TIFFfreeExt(tif, tif->tif_fieldscompat);
 2113|      0|        tif->tif_nfieldscompat = 0;
 2114|      0|        tif->tif_fieldscompat = NULL;
 2115|      0|    }
 2116|  27.2k|    if (_TIFFextender)
  ------------------
  |  Branch (2116:9): [True: 0, False: 27.2k]
  ------------------
 2117|      0|        (*_TIFFextender)(tif);
 2118|  27.2k|    (void)TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  181|  27.2k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
                  (void)TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  182|  27.2k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
 2119|       |    /*
 2120|       |     * NB: The directory is marked dirty as a result of setting
 2121|       |     * up the default compression scheme.  However, this really
 2122|       |     * isn't correct -- we want TIFF_DIRTYDIRECT to be set only
 2123|       |     * if the user does something.  We could just do the setup
 2124|       |     * by hand, but it seems better to use the normal mechanism
 2125|       |     * (i.e. TIFFSetField).
 2126|       |     */
 2127|  27.2k|    tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |  125|  27.2k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 2128|       |
 2129|       |    /*
 2130|       |     * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19
 2131|       |     * we clear the ISTILED flag when setting up a new directory.
 2132|       |     * Should we also be clearing stuff like INSUBIFD?
 2133|       |     */
 2134|  27.2k|    tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  132|  27.2k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 2135|       |
 2136|  27.2k|    return (1);
 2137|  27.2k|}
tif_dir.c:setByteArray:
   46|  29.6k|{
   47|  29.6k|    void *old = *vpp;
   48|  29.6k|    *vpp = NULL;
   49|  29.6k|    if (vp)
  ------------------
  |  Branch (49:9): [True: 29.5k, False: 79]
  ------------------
   50|  29.5k|    {
   51|  29.5k|        tmsize_t bytes = _TIFFMultiplySSize(NULL, (tmsize_t)nmemb,
   52|  29.5k|                                            (tmsize_t)elem_size, NULL);
   53|  29.5k|        if (bytes)
  ------------------
  |  Branch (53:13): [True: 29.5k, False: 0]
  ------------------
   54|  29.5k|            *vpp = (void *)_TIFFmallocExt(tif, bytes);
   55|  29.5k|        if (*vpp)
  ------------------
  |  Branch (55:13): [True: 29.1k, False: 408]
  ------------------
   56|  29.1k|            _TIFFmemcpy(*vpp, vp, bytes);
   57|  29.5k|    }
   58|  29.6k|    if (old)
  ------------------
  |  Branch (58:9): [True: 83, False: 29.5k]
  ------------------
   59|     83|        _TIFFfreeExt(tif, old);
   60|  29.6k|}
tif_dir.c:OkToChangeTag:
 1380|   246k|{
 1381|   246k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  389|   246k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1382|   246k|    if (!fip)
  ------------------
  |  Branch (1382:9): [True: 0, False: 246k]
  ------------------
 1383|      0|    { /* unknown tag */
 1384|      0|        TIFFErrorExtR(tif, "TIFFSetField", "%s: Unknown %stag %" PRIu32,
 1385|      0|                      tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", tag);
  ------------------
  |  |  280|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (280:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1386|      0|        return (0);
 1387|      0|    }
 1388|   246k|    if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |  179|   493k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
                  if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |  128|   226k|#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
  |  Branch (1388:9): [True: 226k, False: 20.4k]
  |  Branch (1388:39): [True: 0, False: 226k]
  ------------------
 1389|      0|        !fip->field_oktochange)
  ------------------
  |  Branch (1389:9): [True: 0, False: 0]
  ------------------
 1390|      0|    {
 1391|       |        /*
 1392|       |         * Consult info table to see if tag can be changed
 1393|       |         * after we've started writing.  We only allow changes
 1394|       |         * to those tags that don't/shouldn't affect the
 1395|       |         * compression and/or format of the data.
 1396|       |         */
 1397|      0|        TIFFErrorExtR(tif, "TIFFSetField",
 1398|      0|                      "%s: Cannot modify tag \"%s\" while writing",
 1399|      0|                      tif->tif_name, fip->field_name);
 1400|      0|        return (0);
 1401|      0|    }
 1402|   246k|    return (1);
 1403|   246k|}
tif_dir.c:_TIFFVSetField:
  410|   232k|{
  411|   232k|    static const char module[] = "_TIFFVSetField";
  412|       |
  413|   232k|    TIFFDirectory *td = &tif->tif_dir;
  414|   232k|    int status = 1;
  415|   232k|    uint32_t v32, v;
  416|   232k|    double dblval;
  417|   232k|    char *s;
  418|   232k|    void *old_custom_value = NULL;
  419|   232k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  389|   232k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  420|   232k|    uint32_t standard_tag = tag;
  421|   232k|    if (fip == NULL) /* cannot happen since OkToChangeTag() already checks it */
  ------------------
  |  Branch (421:9): [True: 0, False: 232k]
  ------------------
  422|      0|        return 0;
  423|       |    /*
  424|       |     * We want to force the custom code to be used for custom
  425|       |     * fields even if the tag happens to match a well known
  426|       |     * one - important for reinterpreted handling of standard
  427|       |     * tag values in custom directories (i.e. EXIF)
  428|       |     */
  429|   232k|    if (fip->field_bit == FIELD_CUSTOM)
  ------------------
  |  |  394|   232k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (429:9): [True: 42.4k, False: 189k]
  ------------------
  430|  42.4k|    {
  431|  42.4k|        standard_tag = 0;
  432|  42.4k|    }
  433|       |
  434|   232k|    switch (standard_tag)
  435|   232k|    {
  436|     82|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|     82|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (436:9): [True: 82, False: 232k]
  ------------------
  437|     82|            td->td_subfiletype = (uint32_t)va_arg(ap, uint32_t);
  438|     82|            break;
  439|  21.1k|        case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  21.1k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (439:9): [True: 21.1k, False: 211k]
  ------------------
  440|  21.1k|            td->td_imagewidth = (uint32_t)va_arg(ap, uint32_t);
  441|  21.1k|            break;
  442|  20.4k|        case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  20.4k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (442:9): [True: 20.4k, False: 211k]
  ------------------
  443|  20.4k|            td->td_imagelength = (uint32_t)va_arg(ap, uint32_t);
  444|  20.4k|            break;
  445|  12.1k|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  12.1k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (445:9): [True: 12.1k, False: 220k]
  ------------------
  446|  12.1k|            v = (uint16_t)va_arg(ap, uint16_vap);
  447|       |            /*
  448|       |             * ColorMap and TransferFunction were allocated with
  449|       |             * 2**BitsPerSample entries per plane, for the BitsPerSample in
  450|       |             * effect when they were set.  A different BitsPerSample leaves
  451|       |             * them the wrong length for the tag they describe, so cancel
  452|       |             * them, as SamplesPerPixel already does for SMinSampleValue and
  453|       |             * SMaxSampleValue (see
  454|       |             * http://bugzilla.maptools.org/show_bug.cgi?id=2500), and as
  455|       |             * SamplesPerPixel and ExtraSamples already do for the number of
  456|       |             * TransferFunction curves (see
  457|       |             * http://bugzilla.maptools.org/show_bug.cgi?id=2820).
  458|       |             *
  459|       |             * Only a tag the caller actually set is cancelled: the default
  460|       |             * TransferFunction built by TIFFGetFieldDefaulted() does not set
  461|       |             * FIELD_TRANSFERFUNCTION and is not the caller's to lose.
  462|       |             */
  463|  12.1k|            if (v != td->td_bitspersample)
  ------------------
  |  Branch (463:17): [True: 12.0k, False: 68]
  ------------------
  464|  12.0k|            {
  465|  12.0k|                if (TIFFFieldSet(tif, FIELD_COLORMAP))
  ------------------
  |  |  267|  12.0k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  12.0k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  12.0k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 0, False: 12.0k]
  |  |  ------------------
  ------------------
  466|      0|                {
  467|       |                    /*
  468|       |                     * A narrower BitsPerSample needs fewer entries than are
  469|       |                     * already allocated, so the planes still describe the
  470|       |                     * directory and only the recorded length has to follow.
  471|       |                     * Discarding them would write a Palette image with no
  472|       |                     * ColorMap, which cannot be read back.
  473|       |                     */
  474|      0|                    uint64_t newcount =
  475|      0|                        v < 32 ? (uint64_t)1 << v : (uint64_t)0;
  ------------------
  |  Branch (475:25): [True: 0, False: 0]
  ------------------
  476|       |
  477|      0|                    if (newcount != 0 && newcount <= td->td_colormap_count)
  ------------------
  |  Branch (477:25): [True: 0, False: 0]
  |  Branch (477:42): [True: 0, False: 0]
  ------------------
  478|      0|                        td->td_colormap_count = (uint32_t)newcount;
  479|      0|                    else
  480|      0|                    {
  481|      0|                        TIFFWarningExtR(tif, module,
  482|      0|                                        "BitsPerSample tag value is changing, "
  483|      0|                                        "but ColorMap was read with a "
  484|      0|                                        "different value. Canceling it");
  485|      0|                        cancelColorMap(tif);
  486|      0|                    }
  487|      0|                }
  488|  12.0k|                if (TIFFFieldSet(tif, FIELD_TRANSFERFUNCTION))
  ------------------
  |  |  267|  12.0k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  12.0k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  12.0k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 0, False: 12.0k]
  |  |  ------------------
  ------------------
  489|      0|                {
  490|      0|                    TIFFWarningExtR(tif, module,
  491|      0|                                    "BitsPerSample tag value is changing, "
  492|      0|                                    "but TransferFunction was read with a "
  493|      0|                                    "different value. Canceling it");
  494|      0|                    cancelTransferFunction(tif);
  495|      0|                }
  496|  12.0k|            }
  497|  12.1k|            td->td_bitspersample = (uint16_t)v;
  498|       |            /*
  499|       |             * If the data require post-decoding processing to byte-swap
  500|       |             * samples, set it up here.  Note that since tags are required
  501|       |             * to be ordered, compression code can override this behavior
  502|       |             * in the setup method if it wants to roll the post decoding
  503|       |             * work in with its normal work.
  504|       |             */
  505|  12.1k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  12.1k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (505:17): [True: 326, False: 11.7k]
  ------------------
  506|    326|            {
  507|    326|                if (td->td_bitspersample == 8)
  ------------------
  |  Branch (507:21): [True: 21, False: 305]
  ------------------
  508|     21|                    tif->tif_postdecode = _TIFFNoPostDecode;
  509|    305|                else if (td->td_bitspersample == 16)
  ------------------
  |  Branch (509:26): [True: 59, False: 246]
  ------------------
  510|     59|                    tif->tif_postdecode = _TIFFSwab16BitData;
  511|    246|                else if (td->td_bitspersample == 24)
  ------------------
  |  Branch (511:26): [True: 14, False: 232]
  ------------------
  512|     14|                    tif->tif_postdecode = _TIFFSwab24BitData;
  513|    232|                else if (td->td_bitspersample == 32)
  ------------------
  |  Branch (513:26): [True: 57, False: 175]
  ------------------
  514|     57|                    tif->tif_postdecode = _TIFFSwab32BitData;
  515|    175|                else if (td->td_bitspersample == 64)
  ------------------
  |  Branch (515:26): [True: 85, False: 90]
  ------------------
  516|     85|                    tif->tif_postdecode = _TIFFSwab64BitData;
  517|     90|                else if (td->td_bitspersample == 128) /* two 64's */
  ------------------
  |  Branch (517:26): [True: 1, False: 89]
  ------------------
  518|      1|                    tif->tif_postdecode = _TIFFSwab64BitData;
  519|    326|            }
  520|  12.1k|            break;
  521|  53.8k|        case TIFFTAG_COMPRESSION:
  ------------------
  |  |  181|  53.8k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (521:9): [True: 53.8k, False: 178k]
  ------------------
  522|  53.8k|            v = (uint16_t)va_arg(ap, uint16_vap);
  523|       |            /*
  524|       |             * If we're changing the compression scheme, notify the
  525|       |             * previous module so that it can cleanup any state it's
  526|       |             * setup.
  527|       |             */
  528|  53.8k|            if (TIFFFieldSet(tif, FIELD_COMPRESSION))
  ------------------
  |  |  267|  53.8k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  53.8k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  53.8k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 26.6k, False: 27.2k]
  |  |  ------------------
  ------------------
  529|  26.6k|            {
  530|  26.6k|                if ((uint32_t)td->td_compression == v)
  ------------------
  |  Branch (530:21): [True: 9.16k, False: 17.4k]
  ------------------
  531|  9.16k|                    break;
  532|  17.4k|                (*tif->tif_cleanup)(tif);
  533|  17.4k|                tif->tif_flags &= ~TIFF_CODERSETUP;
  ------------------
  |  |  127|  17.4k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  534|  17.4k|            }
  535|       |            /*
  536|       |             * Setup new compression routine state.
  537|       |             */
  538|  44.6k|            if ((status = TIFFSetCompressionScheme(tif, (int)v)) != 0)
  ------------------
  |  Branch (538:17): [True: 44.6k, False: 0]
  ------------------
  539|  44.6k|                td->td_compression = (uint16_t)v;
  540|      0|            else
  541|      0|                status = 0;
  542|  44.6k|            break;
  543|  8.09k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  8.09k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (543:9): [True: 8.09k, False: 224k]
  ------------------
  544|  8.09k|            td->td_photometric = (uint16_t)va_arg(ap, uint16_vap);
  545|  8.09k|            break;
  546|     29|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|     29|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (546:9): [True: 29, False: 232k]
  ------------------
  547|     29|            td->td_threshholding = (uint16_t)va_arg(ap, uint16_vap);
  548|     29|            break;
  549|    298|        case TIFFTAG_FILLORDER:
  ------------------
  |  |  240|    298|#define TIFFTAG_FILLORDER 266              /* data order within a byte */
  ------------------
  |  Branch (549:9): [True: 298, False: 231k]
  ------------------
  550|    298|            v = (uint16_t)va_arg(ap, uint16_vap);
  551|    298|            if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  242|    596|#define FILLORDER_LSB2MSB 2                /* least significant -> most */
  ------------------
                          if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  241|    230|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
  |  Branch (551:17): [True: 230, False: 68]
  |  Branch (551:43): [True: 45, False: 185]
  ------------------
  552|     45|                goto badvalue;
  553|    253|            td->td_fillorder = (uint16_t)v;
  554|    253|            break;
  555|    512|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|    512|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (555:9): [True: 512, False: 231k]
  ------------------
  556|    512|            v = (uint16_t)va_arg(ap, uint16_vap);
  557|    512|            if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  249|  1.02k|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
                          if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  256|    502|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (557:17): [True: 10, False: 502]
  |  Branch (557:44): [True: 36, False: 466]
  ------------------
  558|     46|                goto badvalue;
  559|    466|            else
  560|    466|                td->td_orientation = (uint16_t)v;
  561|    466|            break;
  562|  9.29k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  9.29k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (562:9): [True: 9.29k, False: 222k]
  ------------------
  563|  9.29k|            v = (uint16_t)va_arg(ap, uint16_vap);
  564|  9.29k|            if (v == 0)
  ------------------
  |  Branch (564:17): [True: 1, False: 9.29k]
  ------------------
  565|      1|                goto badvalue;
  566|  9.29k|            if (v != td->td_samplesperpixel)
  ------------------
  |  Branch (566:17): [True: 9.05k, False: 232]
  ------------------
  567|  9.05k|            {
  568|       |                /* See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */
  569|  9.05k|                if (td->td_sminsamplevalue != NULL)
  ------------------
  |  Branch (569:21): [True: 1, False: 9.05k]
  ------------------
  570|      1|                {
  571|      1|                    TIFFWarningExtR(tif, module,
  572|      1|                                    "SamplesPerPixel tag value is changing, "
  573|      1|                                    "but SMinSampleValue tag was read with a "
  574|      1|                                    "different value. Canceling it");
  575|      1|                    TIFFClrFieldBit(tif, FIELD_SMINSAMPLEVALUE);
  ------------------
  |  |  269|      1|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  266|      1|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  265|      1|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  576|      1|                    _TIFFfreeExt(tif, td->td_sminsamplevalue);
  577|      1|                    td->td_sminsamplevalue = NULL;
  578|      1|                }
  579|  9.05k|                if (td->td_smaxsamplevalue != NULL)
  ------------------
  |  Branch (579:21): [True: 1, False: 9.05k]
  ------------------
  580|      1|                {
  581|      1|                    TIFFWarningExtR(tif, module,
  582|      1|                                    "SamplesPerPixel tag value is changing, "
  583|      1|                                    "but SMaxSampleValue tag was read with a "
  584|      1|                                    "different value. Canceling it");
  585|      1|                    TIFFClrFieldBit(tif, FIELD_SMAXSAMPLEVALUE);
  ------------------
  |  |  269|      1|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  266|      1|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  265|      1|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  586|      1|                    _TIFFfreeExt(tif, td->td_smaxsamplevalue);
  587|      1|                    td->td_smaxsamplevalue = NULL;
  588|      1|                }
  589|       |                /* Test if 3 transfer functions instead of just one are now
  590|       |                   needed See http://bugzilla.maptools.org/show_bug.cgi?id=2820
  591|       |                 */
  592|  9.05k|                if (td->td_transferfunction[0] != NULL &&
  ------------------
  |  Branch (592:21): [True: 1, False: 9.05k]
  ------------------
  593|      1|                    (v - td->td_extrasamples > 1) &&
  ------------------
  |  Branch (593:21): [True: 1, False: 0]
  ------------------
  594|      1|                    !(td->td_samplesperpixel - td->td_extrasamples > 1))
  ------------------
  |  Branch (594:21): [True: 1, False: 0]
  ------------------
  595|      1|                {
  596|      1|                    TIFFWarningExtR(tif, module,
  597|      1|                                    "SamplesPerPixel tag value is changing, "
  598|      1|                                    "but TransferFunction was read with a "
  599|      1|                                    "different value. Canceling it");
  600|      1|                    cancelTransferFunction(tif);
  601|      1|                }
  602|  9.05k|            }
  603|  9.29k|            td->td_samplesperpixel = (uint16_t)v;
  604|  9.29k|            break;
  605|  11.1k|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  11.1k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (605:9): [True: 11.1k, False: 221k]
  ------------------
  606|  11.1k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  607|  11.1k|            if (v32 == 0)
  ------------------
  |  Branch (607:17): [True: 1, False: 11.1k]
  ------------------
  608|      1|                goto badvalue32;
  609|  11.1k|            td->td_rowsperstrip = v32;
  610|  11.1k|            if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS))
  ------------------
  |  |  267|  11.1k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  11.1k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  11.1k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (610:17): [True: 11.0k, False: 33]
  ------------------
  611|  11.0k|            {
  612|  11.0k|                td->td_tilelength = v32;
  613|  11.0k|                td->td_tilewidth = td->td_imagewidth;
  614|  11.0k|            }
  615|  11.1k|            break;
  616|     17|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|     17|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (616:9): [True: 17, False: 232k]
  ------------------
  617|     17|            td->td_minsamplevalue = (uint16_t)va_arg(ap, uint16_vap);
  618|     17|            break;
  619|     24|        case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|     24|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (619:9): [True: 24, False: 232k]
  ------------------
  620|     24|            td->td_maxsamplevalue = (uint16_t)va_arg(ap, uint16_vap);
  621|     24|            break;
  622|    327|        case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|    327|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (622:9): [True: 327, False: 231k]
  ------------------
  623|    327|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  146|    327|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (623:17): [True: 327, False: 0]
  ------------------
  624|    327|                _TIFFsetDoubleArrayExt(tif, &td->td_sminsamplevalue,
  625|    327|                                       va_arg(ap, double *),
  626|    327|                                       td->td_samplesperpixel);
  627|      0|            else
  628|      0|                setDoubleArrayOneValue(tif, &td->td_sminsamplevalue,
  629|      0|                                       va_arg(ap, double),
  630|      0|                                       td->td_samplesperpixel);
  631|    327|            break;
  632|    124|        case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|    124|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (632:9): [True: 124, False: 232k]
  ------------------
  633|    124|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  146|    124|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (633:17): [True: 124, False: 0]
  ------------------
  634|    124|                _TIFFsetDoubleArrayExt(tif, &td->td_smaxsamplevalue,
  635|    124|                                       va_arg(ap, double *),
  636|    124|                                       td->td_samplesperpixel);
  637|      0|            else
  638|      0|                setDoubleArrayOneValue(tif, &td->td_smaxsamplevalue,
  639|      0|                                       va_arg(ap, double),
  640|      0|                                       td->td_samplesperpixel);
  641|    124|            break;
  642|    281|        case TIFFTAG_XRESOLUTION:
  ------------------
  |  |  262|    281|#define TIFFTAG_XRESOLUTION 282            /* pixels/resolution in x */
  ------------------
  |  Branch (642:9): [True: 281, False: 231k]
  ------------------
  643|    281|            dblval = va_arg(ap, double);
  644|    281|            if (isnan(dblval) || dblval < 0)
  ------------------
  |  Branch (644:17): [True: 2, False: 279]
  |  Branch (644:34): [True: 11, False: 268]
  ------------------
  645|     13|                goto badvaluedouble;
  646|    268|            td->td_xresolution = _TIFFClampDoubleToFloat(dblval);
  647|    268|            break;
  648|    225|        case TIFFTAG_YRESOLUTION:
  ------------------
  |  |  263|    225|#define TIFFTAG_YRESOLUTION 283            /* pixels/resolution in y */
  ------------------
  |  Branch (648:9): [True: 225, False: 231k]
  ------------------
  649|    225|            dblval = va_arg(ap, double);
  650|    225|            if (isnan(dblval) || dblval < 0)
  ------------------
  |  Branch (650:17): [True: 2, False: 223]
  |  Branch (650:34): [True: 36, False: 187]
  ------------------
  651|     38|                goto badvaluedouble;
  652|    187|            td->td_yresolution = _TIFFClampDoubleToFloat(dblval);
  653|    187|            break;
  654|  29.3k|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  29.3k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (654:9): [True: 29.3k, False: 202k]
  ------------------
  655|  29.3k|            v = (uint16_t)va_arg(ap, uint16_vap);
  656|  29.3k|            if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  265|  58.6k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
                          if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.62k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (656:17): [True: 1.62k, False: 27.7k]
  |  Branch (656:45): [True: 25, False: 1.60k]
  ------------------
  657|     25|                goto badvalue;
  658|  29.3k|            td->td_planarconfig = (uint16_t)v;
  659|  29.3k|            break;
  660|    136|        case TIFFTAG_XPOSITION:
  ------------------
  |  |  268|    136|#define TIFFTAG_XPOSITION 286              /* x page offset of image lhs */
  ------------------
  |  Branch (660:9): [True: 136, False: 232k]
  ------------------
  661|    136|            td->td_xposition = _TIFFClampDoubleToFloat(va_arg(ap, double));
  662|    136|            break;
  663|    129|        case TIFFTAG_YPOSITION:
  ------------------
  |  |  269|    129|#define TIFFTAG_YPOSITION 287              /* y page offset of image lhs */
  ------------------
  |  Branch (663:9): [True: 129, False: 232k]
  ------------------
  664|    129|            td->td_yposition = _TIFFClampDoubleToFloat(va_arg(ap, double));
  665|    129|            break;
  666|    172|        case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  287|    172|#define TIFFTAG_RESOLUTIONUNIT 296         /* units of resolutions */
  ------------------
  |  Branch (666:9): [True: 172, False: 231k]
  ------------------
  667|    172|            v = (uint16_t)va_arg(ap, uint16_vap);
  668|    172|            if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  288|    344|#define RESUNIT_NONE 1                     /* no meaningful units */
  ------------------
                          if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  290|    164|#define RESUNIT_CENTIMETER 3               /* metric */
  ------------------
  |  Branch (668:17): [True: 8, False: 164]
  |  Branch (668:37): [True: 55, False: 109]
  ------------------
  669|     63|                goto badvalue;
  670|    109|            td->td_resolutionunit = (uint16_t)v;
  671|    109|            break;
  672|     89|        case TIFFTAG_PAGENUMBER:
  ------------------
  |  |  291|     89|#define TIFFTAG_PAGENUMBER 297             /* page numbers of multi-page */
  ------------------
  |  Branch (672:9): [True: 89, False: 232k]
  ------------------
  673|     89|            td->td_pagenumber[0] = (uint16_t)va_arg(ap, uint16_vap);
  674|     89|            td->td_pagenumber[1] = (uint16_t)va_arg(ap, uint16_vap);
  675|     89|            break;
  676|      4|        case TIFFTAG_HALFTONEHINTS:
  ------------------
  |  |  310|      4|#define TIFFTAG_HALFTONEHINTS 321          /* !highlight+shadow info */
  ------------------
  |  Branch (676:9): [True: 4, False: 232k]
  ------------------
  677|      4|            td->td_halftonehints[0] = (uint16_t)va_arg(ap, uint16_vap);
  678|      4|            td->td_halftonehints[1] = (uint16_t)va_arg(ap, uint16_vap);
  679|      4|            break;
  680|    137|        case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|    137|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (680:9): [True: 137, False: 232k]
  ------------------
  681|    137|            if (td->td_bitspersample >= 32)
  ------------------
  |  Branch (681:17): [True: 0, False: 137]
  ------------------
  682|      0|            {
  683|      0|                v = td->td_bitspersample;
  684|      0|                goto badvalue;
  685|      0|            }
  686|    137|            v32 = 1U << td->td_bitspersample;
  687|    137|            if (!setColorMap(tif, ap, v32))
  ------------------
  |  Branch (687:17): [True: 0, False: 137]
  ------------------
  688|      0|                status = 0;
  689|    137|            break;
  690|    307|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|    307|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (690:9): [True: 307, False: 231k]
  ------------------
  691|    307|            if (!setExtraSamples(tif, ap, &v))
  ------------------
  |  Branch (691:17): [True: 95, False: 212]
  ------------------
  692|     95|                goto badvalue;
  693|    212|            break;
  694|    212|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|     72|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (694:9): [True: 72, False: 232k]
  ------------------
  695|     72|            td->td_extrasamples = (((uint16_t)va_arg(ap, uint16_vap)) != 0);
  696|     72|            if (td->td_extrasamples)
  ------------------
  |  Branch (696:17): [True: 70, False: 2]
  ------------------
  697|     70|            {
  698|     70|                uint16_t sv = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|     70|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  699|     70|                _TIFFsetShortArrayExt(tif, &td->td_sampleinfo, &sv, 1);
  700|     70|            }
  701|     72|            break;
  702|  10.4k|        case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  10.4k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (702:9): [True: 10.4k, False: 221k]
  ------------------
  703|  10.4k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  704|  10.4k|            if (v32 % 16)
  ------------------
  |  Branch (704:17): [True: 9.46k, False: 993]
  ------------------
  705|  9.46k|            {
  706|  9.46k|                if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (706:21): [True: 0, False: 9.46k]
  ------------------
  707|      0|                    goto badvalue32;
  708|  9.46k|                TIFFWarningExtR(
  709|  9.46k|                    tif, tif->tif_name,
  710|  9.46k|                    "Nonstandard tile width %" PRIu32 ", convert file", v32);
  711|  9.46k|            }
  712|  10.4k|            td->td_tilewidth = v32;
  713|  10.4k|            tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  132|  10.4k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  714|  10.4k|            break;
  715|  5.93k|        case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  5.93k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (715:9): [True: 5.93k, False: 226k]
  ------------------
  716|  5.93k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  717|  5.93k|            if (v32 % 16)
  ------------------
  |  Branch (717:17): [True: 5.38k, False: 551]
  ------------------
  718|  5.38k|            {
  719|  5.38k|                if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (719:21): [True: 0, False: 5.38k]
  ------------------
  720|      0|                    goto badvalue32;
  721|  5.38k|                TIFFWarningExtR(
  722|  5.38k|                    tif, tif->tif_name,
  723|  5.38k|                    "Nonstandard tile length %" PRIu32 ", convert file", v32);
  724|  5.38k|            }
  725|  5.93k|            td->td_tilelength = v32;
  726|  5.93k|            tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  132|  5.93k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  727|  5.93k|            break;
  728|    122|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|    122|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (728:9): [True: 122, False: 232k]
  ------------------
  729|    122|            v32 = (uint32_t)va_arg(ap, uint32_t);
  730|    122|            if (v32 == 0)
  ------------------
  |  Branch (730:17): [True: 2, False: 120]
  ------------------
  731|      2|                goto badvalue32;
  732|    120|            td->td_tiledepth = v32;
  733|    120|            break;
  734|    107|        case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|    107|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (734:9): [True: 107, False: 232k]
  ------------------
  735|    107|            v = (uint16_t)va_arg(ap, uint16_vap);
  736|    107|            switch (v)
  737|    107|            {
  738|     12|                case DATATYPE_VOID:
  ------------------
  |  |   39|     12|#define DATATYPE_VOID 0   /* !untyped data */
  ------------------
  |  Branch (738:17): [True: 12, False: 95]
  ------------------
  739|     12|                    v = SAMPLEFORMAT_VOID;
  ------------------
  |  |  337|     12|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
  740|     12|                    break;
  741|      4|                case DATATYPE_INT:
  ------------------
  |  |   40|      4|#define DATATYPE_INT 1    /* !signed integer data */
  ------------------
  |  Branch (741:17): [True: 4, False: 103]
  ------------------
  742|      4|                    v = SAMPLEFORMAT_INT;
  ------------------
  |  |  335|      4|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
  743|      4|                    break;
  744|      1|                case DATATYPE_UINT:
  ------------------
  |  |   41|      1|#define DATATYPE_UINT 2   /* !unsigned integer data */
  ------------------
  |  Branch (744:17): [True: 1, False: 106]
  ------------------
  745|      1|                    v = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|      1|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  746|      1|                    break;
  747|     83|                case DATATYPE_IEEEFP:
  ------------------
  |  |   42|     83|#define DATATYPE_IEEEFP 3 /* !IEEE floating point data */
  ------------------
  |  Branch (747:17): [True: 83, False: 24]
  ------------------
  748|     83|                    v = SAMPLEFORMAT_IEEEFP;
  ------------------
  |  |  336|     83|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  749|     83|                    break;
  750|      7|                default:
  ------------------
  |  Branch (750:17): [True: 7, False: 100]
  ------------------
  751|      7|                    goto badvalue;
  752|    107|            }
  753|    100|            td->td_sampleformat = (uint16_t)v;
  754|    100|            break;
  755|  1.05k|        case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|  1.05k|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (755:9): [True: 1.05k, False: 231k]
  ------------------
  756|  1.05k|            v = (uint16_t)va_arg(ap, uint16_vap);
  757|  1.05k|            if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  334|  2.10k|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
                          if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  339|  1.05k|#define SAMPLEFORMAT_COMPLEXIEEEFP 6       /* !complex ieee floating */
  ------------------
  |  Branch (757:17): [True: 2, False: 1.05k]
  |  Branch (757:42): [True: 4, False: 1.04k]
  ------------------
  758|      6|                goto badvalue;
  759|  1.04k|            td->td_sampleformat = (uint16_t)v;
  760|       |
  761|       |            /*  Try to fix up the SWAB function for complex data. */
  762|  1.04k|            if (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT &&
  ------------------
  |  |  338|  2.09k|#define SAMPLEFORMAT_COMPLEXINT 5          /* !complex signed int */
  ------------------
  |  Branch (762:17): [True: 5, False: 1.04k]
  ------------------
  763|      5|                td->td_bitspersample == 32 &&
  ------------------
  |  Branch (763:17): [True: 2, False: 3]
  ------------------
  764|      2|                tif->tif_postdecode == _TIFFSwab32BitData)
  ------------------
  |  Branch (764:17): [True: 1, False: 1]
  ------------------
  765|      1|                tif->tif_postdecode = _TIFFSwab16BitData;
  766|  1.04k|            else if ((td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT ||
  ------------------
  |  |  338|  2.09k|#define SAMPLEFORMAT_COMPLEXINT 5          /* !complex signed int */
  ------------------
  |  Branch (766:23): [True: 4, False: 1.04k]
  ------------------
  767|  1.04k|                      td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP) &&
  ------------------
  |  |  339|  1.04k|#define SAMPLEFORMAT_COMPLEXIEEEFP 6       /* !complex ieee floating */
  ------------------
  |  Branch (767:23): [True: 4, False: 1.03k]
  ------------------
  768|      8|                     td->td_bitspersample == 64 &&
  ------------------
  |  Branch (768:22): [True: 3, False: 5]
  ------------------
  769|      3|                     tif->tif_postdecode == _TIFFSwab64BitData)
  ------------------
  |  Branch (769:22): [True: 2, False: 1]
  ------------------
  770|      2|                tif->tif_postdecode = _TIFFSwab32BitData;
  771|  1.04k|            break;
  772|     51|        case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|     51|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (772:9): [True: 51, False: 232k]
  ------------------
  773|     51|            td->td_imagedepth = (uint32_t)va_arg(ap, uint32_t);
  774|     51|            break;
  775|      6|        case TIFFTAG_SUBIFD:
  ------------------
  |  |  321|      6|#define TIFFTAG_SUBIFD 330                 /* subimage descriptors */
  ------------------
  |  Branch (775:9): [True: 6, False: 232k]
  ------------------
  776|      6|            if ((tif->tif_flags & TIFF_INSUBIFD) == 0)
  ------------------
  |  |  135|      6|#define TIFF_INSUBIFD 0x02000U    /* currently writing a subifd */
  ------------------
  |  Branch (776:17): [True: 6, False: 0]
  ------------------
  777|      6|            {
  778|      6|                td->td_nsubifd = (uint16_t)va_arg(ap, uint16_vap);
  779|      6|                _TIFFsetLong8Array(tif, &td->td_subifd,
  780|      6|                                   (uint64_t *)va_arg(ap, uint64_t *),
  781|      6|                                   (uint32_t)td->td_nsubifd);
  782|      6|            }
  783|      0|            else
  784|      0|            {
  785|      0|                TIFFErrorExtR(tif, module, "%s: Sorry, cannot nest SubIFDs",
  786|      0|                              tif->tif_name);
  787|      0|                status = 0;
  788|      0|            }
  789|      6|            break;
  790|      2|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      2|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (790:9): [True: 2, False: 232k]
  ------------------
  791|      2|            td->td_ycbcrpositioning = (uint16_t)va_arg(ap, uint16_vap);
  792|      2|            break;
  793|  3.50k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  3.50k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (793:9): [True: 3.50k, False: 228k]
  ------------------
  794|  3.50k|            td->td_ycbcrsubsampling[0] = (uint16_t)va_arg(ap, uint16_vap);
  795|  3.50k|            td->td_ycbcrsubsampling[1] = (uint16_t)va_arg(ap, uint16_vap);
  796|  3.50k|            break;
  797|      7|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      7|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (797:9): [True: 7, False: 232k]
  ------------------
  798|      7|            if (td->td_bitspersample >= 32)
  ------------------
  |  Branch (798:17): [True: 0, False: 7]
  ------------------
  799|      0|            {
  800|      0|                v = td->td_bitspersample;
  801|      0|                goto badvalue;
  802|      0|            }
  803|      7|            if (!setTransferFunction(tif, ap, 1U << td->td_bitspersample))
  ------------------
  |  Branch (803:17): [True: 0, False: 7]
  ------------------
  804|      0|                status = 0;
  805|      7|            break;
  806|     58|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|     58|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (806:9): [True: 58, False: 232k]
  ------------------
  807|       |            /* XXX should check for null range */
  808|     58|            _TIFFsetFloatArrayExt(tif, &td->td_refblackwhite,
  809|     58|                                  va_arg(ap, float *), 6);
  810|     58|            break;
  811|     51|        case TIFFTAG_INKNAMES:
  ------------------
  |  |  325|     51|#define TIFFTAG_INKNAMES 333               /* !ascii names of inks */
  ------------------
  |  Branch (811:9): [True: 51, False: 232k]
  ------------------
  812|     51|        {
  813|     51|            v = (uint16_t)va_arg(ap, uint16_vap);
  814|     51|            s = va_arg(ap, char *);
  815|     51|            uint16_t ninksinstring;
  816|     51|            ninksinstring = countInkNamesString(tif, v, s);
  817|     51|            status = ninksinstring > 0;
  818|     51|            if (ninksinstring > 0)
  ------------------
  |  Branch (818:17): [True: 50, False: 1]
  ------------------
  819|     50|            {
  820|     50|                _TIFFsetNString(tif, &td->td_inknames, s, v);
  821|     50|                td->td_inknameslen = (int)v;
  822|       |                /* Set NumberOfInks to the value ninksinstring */
  823|     50|                if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS))
  ------------------
  |  |  267|     50|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|     50|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|     50|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 15, False: 35]
  |  |  ------------------
  ------------------
  824|     15|                {
  825|     15|                    if (td->td_numberofinks != ninksinstring)
  ------------------
  |  Branch (825:25): [True: 14, False: 1]
  ------------------
  826|     14|                    {
  827|     14|                        TIFFErrorExtR(
  828|     14|                            tif, module,
  829|     14|                            "Warning %s; Tag %s:\n  Value %" PRIu16
  830|     14|                            " of NumberOfInks is different from the number of "
  831|     14|                            "inks %" PRIu16
  832|     14|                            ".\n  -> NumberOfInks value adapted to %" PRIu16 "",
  833|     14|                            tif->tif_name, fip->field_name, td->td_numberofinks,
  834|     14|                            ninksinstring, ninksinstring);
  835|     14|                        td->td_numberofinks = ninksinstring;
  836|     14|                    }
  837|     15|                }
  838|     35|                else
  839|     35|                {
  840|     35|                    td->td_numberofinks = ninksinstring;
  841|     35|                    TIFFSetFieldBit(tif, FIELD_NUMBEROFINKS);
  ------------------
  |  |  268|     35|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|     35|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|     35|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  842|     35|                }
  843|     50|                if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  267|     50|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|     50|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|     50|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 8, False: 42]
  |  |  ------------------
  ------------------
  844|      8|                {
  845|      8|                    if (td->td_numberofinks != td->td_samplesperpixel)
  ------------------
  |  Branch (845:25): [True: 7, False: 1]
  ------------------
  846|      7|                    {
  847|      7|                        TIFFErrorExtR(tif, module,
  848|      7|                                      "Warning %s; Tag %s:\n  Value %" PRIu16
  849|      7|                                      " of NumberOfInks is different from the "
  850|      7|                                      "SamplesPerPixel value %" PRIu16 "",
  851|      7|                                      tif->tif_name, fip->field_name,
  852|      7|                                      td->td_numberofinks,
  853|      7|                                      td->td_samplesperpixel);
  854|      7|                    }
  855|      8|                }
  856|     50|            }
  857|     51|        }
  858|     51|        break;
  859|     41|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|     41|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (859:9): [True: 41, False: 232k]
  ------------------
  860|     41|            v = (uint16_t)va_arg(ap, uint16_vap);
  861|       |            /* If InkNames already set also NumberOfInks is set accordingly and
  862|       |             * should be equal */
  863|     41|            if (TIFFFieldSet(tif, FIELD_INKNAMES))
  ------------------
  |  |  267|     41|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|     41|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|     41|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 2, False: 39]
  |  |  ------------------
  ------------------
  864|      2|            {
  865|      2|                if (v != td->td_numberofinks)
  ------------------
  |  Branch (865:21): [True: 1, False: 1]
  ------------------
  866|      1|                {
  867|      1|                    TIFFErrorExtR(
  868|      1|                        tif, module,
  869|      1|                        "Error %s; Tag %s:\n  It is not possible to set the "
  870|      1|                        "value %" PRIu32
  871|      1|                        " for NumberOfInks\n  which is different from the "
  872|      1|                        "number of inks in the InkNames tag (%" PRIu16 ")",
  873|      1|                        tif->tif_name, fip->field_name, v, td->td_numberofinks);
  874|       |                    /* Do not set / overwrite number of inks already set by
  875|       |                     * InkNames case accordingly. */
  876|      1|                    status = 0;
  877|      1|                }
  878|      2|            }
  879|     39|            else
  880|     39|            {
  881|     39|                td->td_numberofinks = (uint16_t)v;
  882|     39|                if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  267|     39|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|     39|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|     39|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 20, False: 19]
  |  |  ------------------
  ------------------
  883|     20|                {
  884|     20|                    if (td->td_numberofinks != td->td_samplesperpixel)
  ------------------
  |  Branch (884:25): [True: 19, False: 1]
  ------------------
  885|     19|                    {
  886|     19|                        TIFFErrorExtR(tif, module,
  887|     19|                                      "Warning %s; Tag %s:\n  Value %" PRIu32
  888|     19|                                      " of NumberOfInks is different from the "
  889|     19|                                      "SamplesPerPixel value %" PRIu16 "",
  890|     19|                                      tif->tif_name, fip->field_name, v,
  891|     19|                                      td->td_samplesperpixel);
  892|     19|                    }
  893|     20|                }
  894|     39|            }
  895|     41|            break;
  896|      0|        case TIFFTAG_PERSAMPLE:
  ------------------
  |  |  752|      0|#define TIFFTAG_PERSAMPLE 65563        /* interface for per sample tags */
  ------------------
  |  Branch (896:9): [True: 0, False: 232k]
  ------------------
  897|      0|            v = (uint16_t)va_arg(ap, uint16_vap);
  898|      0|            if (v == PERSAMPLE_MULTI)
  ------------------
  |  |  754|      0|#define PERSAMPLE_MULTI 1              /* present as multiple values */
  ------------------
  |  Branch (898:17): [True: 0, False: 0]
  ------------------
  899|      0|                tif->tif_flags |= TIFF_PERSAMPLE;
  ------------------
  |  |  146|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  900|      0|            else
  901|      0|                tif->tif_flags &= ~TIFF_PERSAMPLE;
  ------------------
  |  |  146|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  902|      0|            break;
  903|  42.4k|        default:
  ------------------
  |  Branch (903:9): [True: 42.4k, False: 189k]
  ------------------
  904|  42.4k|        {
  905|  42.4k|            TIFFTagValue *tv;
  906|  42.4k|            int tv_size, iCustom;
  907|       |
  908|       |            /*
  909|       |             * This can happen if multiple images are open with different
  910|       |             * codecs which have private tags.  The global tag information
  911|       |             * table may then have tags that are valid for one file but not
  912|       |             * the other. If the client tries to set a tag that is not valid
  913|       |             * for the image's codec then we'll arrive here.  This
  914|       |             * happens, for example, when tiffcp is used to convert between
  915|       |             * compression schemes and codec-specific tags are blindly copied.
  916|       |             *
  917|       |             * This also happens when a FIELD_IGNORE tag is written.
  918|       |             */
  919|  42.4k|            if (fip->field_bit == FIELD_IGNORE)
  ------------------
  |  |  209|  42.4k|#define FIELD_IGNORE 0
  ------------------
  |  Branch (919:17): [True: 0, False: 42.4k]
  ------------------
  920|      0|            {
  921|      0|                TIFFErrorExtR(
  922|      0|                    tif, module,
  923|      0|                    "%s: Ignored %stag \"%s\" (not supported by libtiff)",
  924|      0|                    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  280|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (280:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  925|      0|                    fip->field_name);
  926|      0|                status = 0;
  927|      0|                break;
  928|      0|            }
  929|  42.4k|            if (fip->field_bit != FIELD_CUSTOM)
  ------------------
  |  |  394|  42.4k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (929:17): [True: 0, False: 42.4k]
  ------------------
  930|      0|            {
  931|      0|                TIFFErrorExtR(
  932|      0|                    tif, module,
  933|      0|                    "%s: Invalid %stag \"%s\" (not supported by codec)",
  934|      0|                    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  280|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (280:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  935|      0|                    fip->field_name);
  936|      0|                status = 0;
  937|      0|                break;
  938|      0|            }
  939|       |
  940|       |            /*
  941|       |             * Find the existing entry for this custom value.
  942|       |             */
  943|  42.4k|            tv = NULL;
  944|  5.39M|            for (iCustom = 0; iCustom < td->td_customValueCount; iCustom++)
  ------------------
  |  Branch (944:31): [True: 5.34M, False: 42.4k]
  ------------------
  945|  5.34M|            {
  946|  5.34M|                if (td->td_customValues[iCustom].info->field_tag == tag)
  ------------------
  |  Branch (946:21): [True: 0, False: 5.34M]
  ------------------
  947|      0|                {
  948|      0|                    tv = td->td_customValues + iCustom;
  949|      0|                    old_custom_value = tv->value;
  950|      0|                    tv->value = NULL;
  951|      0|                    break;
  952|      0|                }
  953|  5.34M|            }
  954|       |
  955|       |            /*
  956|       |             * Grow the custom list if the entry was not found.
  957|       |             */
  958|  42.4k|            if (tv == NULL)
  ------------------
  |  Branch (958:17): [True: 42.4k, False: 0]
  ------------------
  959|  42.4k|            {
  960|  42.4k|                TIFFTagValue *new_customValues;
  961|       |
  962|  42.4k|                new_customValues = (TIFFTagValue *)_TIFFreallocExt(
  963|  42.4k|                    tif, td->td_customValues,
  964|  42.4k|                    (tmsize_t)(sizeof(TIFFTagValue) *
  965|  42.4k|                               (size_t)(td->td_customValueCount + 1)));
  966|  42.4k|                if (!new_customValues)
  ------------------
  |  Branch (966:21): [True: 0, False: 42.4k]
  ------------------
  967|      0|                {
  968|      0|                    TIFFErrorExtR(tif, module,
  969|      0|                                  "%s: Failed to allocate space for list of "
  970|      0|                                  "custom values",
  971|      0|                                  tif->tif_name);
  972|      0|                    status = 0;
  973|      0|                    goto end;
  974|      0|                }
  975|       |
  976|  42.4k|                td->td_customValueCount++;
  977|  42.4k|                td->td_customValues = new_customValues;
  978|       |
  979|  42.4k|                tv = td->td_customValues + (td->td_customValueCount - 1);
  980|  42.4k|                tv->info = fip;
  981|  42.4k|                tv->value = NULL;
  982|  42.4k|                tv->count = 0;
  983|  42.4k|            }
  984|       |
  985|       |            /*
  986|       |             * Set custom value ... save a copy of the custom tag value.
  987|       |             */
  988|       |            /*--: Rational2Double: For Rationals evaluate "set_get_field_type"
  989|       |             * to determine internal storage size. */
  990|  42.4k|            tv_size = TIFFFieldSetGetSize(fip);
  991|  42.4k|            if (tv_size == 0)
  ------------------
  |  Branch (991:17): [True: 0, False: 42.4k]
  ------------------
  992|      0|            {
  993|      0|                status = 0;
  994|      0|                TIFFErrorExtR(tif, module, "%s: Bad field type %u for \"%s\"",
  995|      0|                              tif->tif_name, fip->field_type, fip->field_name);
  996|      0|                removeCustomValue(td, iCustom);
  997|      0|                goto end;
  998|      0|            }
  999|       |
 1000|  42.4k|            if (fip->field_type == TIFF_ASCII)
  ------------------
  |  Branch (1000:17): [True: 26.0k, False: 16.3k]
  ------------------
 1001|  26.0k|            {
 1002|  26.0k|                uint32_t ma;
 1003|  26.0k|                const char *mb;
 1004|  26.0k|                if (fip->field_passcount)
  ------------------
  |  Branch (1004:21): [True: 25.2k, False: 773]
  ------------------
 1005|  25.2k|                {
 1006|  25.2k|                    assert(fip->field_writecount == TIFF_VARIABLE2);
  ------------------
  |  Branch (1006:21): [True: 0, False: 25.2k]
  |  Branch (1006:21): [True: 25.2k, False: 0]
  ------------------
 1007|  25.2k|                    ma = (uint32_t)va_arg(ap, uint32_t);
 1008|  25.2k|                    mb = (const char *)va_arg(ap, const char *);
 1009|  25.2k|                }
 1010|    773|                else
 1011|    773|                {
 1012|    773|                    mb = (const char *)va_arg(ap, const char *);
 1013|    773|                    size_t len = strlen(mb) + 1;
 1014|    773|                    if (len >= 0x80000000U)
  ------------------
  |  Branch (1014:25): [True: 0, False: 773]
  ------------------
 1015|      0|                    {
 1016|      0|                        status = 0;
 1017|      0|                        TIFFErrorExtR(tif, module,
 1018|      0|                                      "%s: Too long string value for \"%s\". "
 1019|      0|                                      "Maximum supported is 2147483647 bytes",
 1020|      0|                                      tif->tif_name, fip->field_name);
 1021|      0|                        removeCustomValue(td, iCustom);
 1022|      0|                        goto end;
 1023|      0|                    }
 1024|    773|                    ma = (uint32_t)len;
 1025|    773|                }
 1026|  26.0k|                tv->count = (int)ma;
 1027|  26.0k|                setByteArray(tif, &tv->value, mb, ma, 1);
 1028|  26.0k|                if (!tv->value && ma != 0)
  ------------------
  |  Branch (1028:21): [True: 474, False: 25.5k]
  |  Branch (1028:35): [True: 405, False: 69]
  ------------------
 1029|    405|                {
 1030|    405|                    removeCustomValue(td, iCustom);
 1031|    405|                    status = 0;
 1032|    405|                    goto end;
 1033|    405|                }
 1034|  26.0k|            }
 1035|  16.3k|            else
 1036|  16.3k|            {
 1037|  16.3k|                if (fip->field_passcount)
  ------------------
  |  Branch (1037:21): [True: 15.6k, False: 660]
  ------------------
 1038|  15.6k|                {
 1039|  15.6k|                    if (fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  392|  15.6k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1039:25): [True: 15.1k, False: 503]
  ------------------
 1040|  15.1k|                        tv->count = (int)va_arg(ap, uint32_t);
 1041|    503|                    else
 1042|    503|                        tv->count = va_arg(ap, int);
 1043|  15.6k|                }
 1044|    660|                else if (fip->field_writecount == TIFF_VARIABLE ||
  ------------------
  |  |  390|  1.32k|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (1044:26): [True: 0, False: 660]
  ------------------
 1045|    660|                         fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  392|    660|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1045:26): [True: 0, False: 660]
  ------------------
 1046|      0|                    tv->count = 1;
 1047|    660|                else if (fip->field_writecount == TIFF_SPP)
  ------------------
  |  |  391|    660|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (1047:26): [True: 0, False: 660]
  ------------------
 1048|      0|                    tv->count = td->td_samplesperpixel;
 1049|    660|                else
 1050|    660|                    tv->count = fip->field_writecount;
 1051|       |
 1052|  16.3k|                if (tv->count == 0)
  ------------------
  |  Branch (1052:21): [True: 2.41k, False: 13.9k]
  ------------------
 1053|  2.41k|                {
 1054|  2.41k|                    TIFFWarningExtR(tif, module,
 1055|  2.41k|                                    "%s: Null count for \"%s\" (type "
 1056|  2.41k|                                    "%u, writecount %d, passcount %d)",
 1057|  2.41k|                                    tif->tif_name, fip->field_name,
 1058|  2.41k|                                    fip->field_type, fip->field_writecount,
 1059|  2.41k|                                    fip->field_passcount);
 1060|  2.41k|                    break;
 1061|  2.41k|                }
 1062|       |
 1063|  13.9k|                tv->value = _TIFFCheckMalloc(tif, tv->count, tv_size,
 1064|  13.9k|                                             "custom tag binary object");
 1065|  13.9k|                if (!tv->value)
  ------------------
  |  Branch (1065:21): [True: 1.42k, False: 12.5k]
  ------------------
 1066|  1.42k|                {
 1067|  1.42k|                    removeCustomValue(td, iCustom);
 1068|  1.42k|                    status = 0;
 1069|  1.42k|                    goto end;
 1070|  1.42k|                }
 1071|       |
 1072|  12.5k|                if (fip->field_tag == TIFFTAG_DOTRANGE &&
  ------------------
  |  |  327|  25.0k|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (1072:21): [True: 4, False: 12.5k]
  ------------------
 1073|      4|                    strcmp(fip->field_name, "DotRange") == 0)
  ------------------
  |  Branch (1073:21): [True: 4, False: 0]
  ------------------
 1074|      4|                {
 1075|       |                    /* TODO: This is an evil exception and should not have been
 1076|       |                       handled this way ... likely best if we move it into
 1077|       |                       the directory structure with an explicit field in
 1078|       |                       libtiff 4.1 and assign it a FIELD_ value */
 1079|      4|                    uint16_t v2[2];
 1080|      4|                    v2[0] = (uint16_t)va_arg(ap, int);
 1081|      4|                    v2[1] = (uint16_t)va_arg(ap, int);
 1082|      4|                    _TIFFmemcpy(tv->value, &v2, 4);
 1083|      4|                }
 1084|       |
 1085|  12.5k|                else if (fip->field_passcount ||
  ------------------
  |  Branch (1085:26): [True: 11.8k, False: 656]
  ------------------
 1086|    656|                         fip->field_writecount == TIFF_VARIABLE ||
  ------------------
  |  |  390|  13.1k|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (1086:26): [True: 0, False: 656]
  ------------------
 1087|    656|                         fip->field_writecount == TIFF_VARIABLE2 ||
  ------------------
  |  |  392|  13.1k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1087:26): [True: 0, False: 656]
  ------------------
 1088|    656|                         fip->field_writecount == TIFF_SPP || tv->count > 1)
  ------------------
  |  |  391|  13.1k|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (1088:26): [True: 0, False: 656]
  |  Branch (1088:63): [True: 78, False: 578]
  ------------------
 1089|  11.9k|                {
 1090|       |                    /*--: Rational2Double: For Rationals tv_size is set above to
 1091|       |                     * 4 or 8 according to fip->set_get_field_type! */
 1092|       |                    /* The size must be computed in tmsize_t: tv->count and
 1093|       |                     * tv_size are int, and their int product can overflow
 1094|       |                     * (and wrap to a bogus memcpy size) for counts that
 1095|       |                     * _TIFFCheckMalloc() above accepted, since it allows
 1096|       |                     * sizes up to TIFF_TMSIZE_T_MAX. */
 1097|  11.9k|                    _TIFFmemcpy(tv->value, va_arg(ap, void *),
 1098|  11.9k|                                (tmsize_t)tv->count * (tmsize_t)tv_size);
 1099|       |                    /* Test here for too big values for LONG8, IFD8, SLONG8 in
 1100|       |                     * ClassicTIFF and delete custom field from custom list */
 1101|  11.9k|                    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|  11.9k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1101:25): [True: 11.8k, False: 64]
  ------------------
 1102|  11.8k|                    {
 1103|  11.8k|                        if (tv->info->field_type == TIFF_LONG8 ||
  ------------------
  |  Branch (1103:29): [True: 166, False: 11.6k]
  ------------------
 1104|  11.6k|                            tv->info->field_type == TIFF_IFD8)
  ------------------
  |  Branch (1104:29): [True: 66, False: 11.6k]
  ------------------
 1105|    232|                        {
 1106|    232|                            uint64_t *pui64 = (uint64_t *)tv->value;
 1107|    504|                            for (int i = 0; i < tv->count; i++)
  ------------------
  |  Branch (1107:45): [True: 458, False: 46]
  ------------------
 1108|    458|                            {
 1109|    458|                                if (pui64[i] > 0xffffffffu)
  ------------------
  |  Branch (1109:37): [True: 186, False: 272]
  ------------------
 1110|    186|                                {
 1111|    186|                                    TIFFErrorExtR(
 1112|    186|                                        tif, module,
 1113|    186|                                        "%s: Bad %s value %" PRIu64
 1114|    186|                                        " at %d. array position for \"%s\" tag "
 1115|    186|                                        "%u in ClassicTIFF. Tag won't be "
 1116|    186|                                        "written to file",
 1117|    186|                                        tif->tif_name,
 1118|    186|                                        (tv->info->field_type == TIFF_LONG8
  ------------------
  |  Branch (1118:42): [True: 140, False: 46]
  ------------------
 1119|    186|                                             ? "LONG8"
 1120|    186|                                             : "IFD8"),
 1121|    186|                                        pui64[i], i, fip->field_name, tag);
 1122|    186|                                    goto badvalueifd8long8;
 1123|    186|                                }
 1124|    458|                            }
 1125|    232|                        }
 1126|  11.6k|                        else if (tv->info->field_type == TIFF_SLONG8)
  ------------------
  |  Branch (1126:34): [True: 306, False: 11.3k]
  ------------------
 1127|    306|                        {
 1128|    306|                            int64_t *pi64 = (int64_t *)tv->value;
 1129|    648|                            for (int i = 0; i < tv->count; i++)
  ------------------
  |  Branch (1129:45): [True: 587, False: 61]
  ------------------
 1130|    587|                            {
 1131|    587|                                if (pi64[i] > 2147483647 ||
  ------------------
  |  Branch (1131:37): [True: 151, False: 436]
  ------------------
 1132|    436|                                    pi64[i] < (-2147483647 - 1))
  ------------------
  |  Branch (1132:37): [True: 94, False: 342]
  ------------------
 1133|    245|                                {
 1134|    245|                                    TIFFErrorExtR(
 1135|    245|                                        tif, module,
 1136|    245|                                        "%s: Bad SLONG8 value %" PRIi64
 1137|    245|                                        " at %d. array position for \"%s\" tag "
 1138|    245|                                        "%u in ClassicTIFF. Tag won't be "
 1139|    245|                                        "written to file",
 1140|    245|                                        tif->tif_name, pi64[i], i,
 1141|    245|                                        fip->field_name, tag);
 1142|    245|                                    goto badvalueifd8long8;
 1143|    245|                                }
 1144|    587|                            }
 1145|    306|                        }
 1146|  11.8k|                    }
 1147|  11.9k|                }
 1148|    578|                else
 1149|    578|                {
 1150|    578|                    char *val = (char *)tv->value;
 1151|    578|                    assert(tv->count == 1);
  ------------------
  |  Branch (1151:21): [True: 0, False: 578]
  |  Branch (1151:21): [True: 578, False: 0]
  ------------------
 1152|       |
 1153|    578|                    switch (fip->field_type)
 1154|    578|                    {
 1155|     63|                        case TIFF_BYTE:
  ------------------
  |  Branch (1155:25): [True: 63, False: 515]
  ------------------
 1156|     63|                        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1156:25): [True: 0, False: 578]
  ------------------
 1157|     63|                        {
 1158|     63|                            uint8_t v2 = (uint8_t)va_arg(ap, int);
 1159|     63|                            _TIFFmemcpy(val, &v2, tv_size);
 1160|     63|                        }
 1161|     63|                        break;
 1162|      0|                        case TIFF_SBYTE:
  ------------------
  |  Branch (1162:25): [True: 0, False: 578]
  ------------------
 1163|      0|                        {
 1164|      0|                            int8_t v2 = (int8_t)va_arg(ap, int);
 1165|      0|                            _TIFFmemcpy(val, &v2, tv_size);
 1166|      0|                        }
 1167|      0|                        break;
 1168|    119|                        case TIFF_SHORT:
  ------------------
  |  Branch (1168:25): [True: 119, False: 459]
  ------------------
 1169|    119|                        {
 1170|    119|                            uint16_t v2 = (uint16_t)va_arg(ap, int);
 1171|    119|                            _TIFFmemcpy(val, &v2, tv_size);
 1172|    119|                        }
 1173|    119|                        break;
 1174|      0|                        case TIFF_SSHORT:
  ------------------
  |  Branch (1174:25): [True: 0, False: 578]
  ------------------
 1175|      0|                        {
 1176|      0|                            int16_t v2 = (int16_t)va_arg(ap, int);
 1177|      0|                            _TIFFmemcpy(val, &v2, tv_size);
 1178|      0|                        }
 1179|      0|                        break;
 1180|     80|                        case TIFF_LONG:
  ------------------
  |  Branch (1180:25): [True: 80, False: 498]
  ------------------
 1181|     80|                        case TIFF_IFD:
  ------------------
  |  Branch (1181:25): [True: 0, False: 578]
  ------------------
 1182|     80|                        {
 1183|     80|                            uint32_t v2 = va_arg(ap, uint32_t);
 1184|     80|                            _TIFFmemcpy(val, &v2, tv_size);
 1185|     80|                        }
 1186|     80|                        break;
 1187|      0|                        case TIFF_SLONG:
  ------------------
  |  Branch (1187:25): [True: 0, False: 578]
  ------------------
 1188|      0|                        {
 1189|      0|                            int32_t v2 = va_arg(ap, int32_t);
 1190|      0|                            _TIFFmemcpy(val, &v2, tv_size);
 1191|      0|                        }
 1192|      0|                        break;
 1193|    141|                        case TIFF_LONG8:
  ------------------
  |  Branch (1193:25): [True: 141, False: 437]
  ------------------
 1194|    207|                        case TIFF_IFD8:
  ------------------
  |  Branch (1194:25): [True: 66, False: 512]
  ------------------
 1195|    207|                        {
 1196|    207|                            uint64_t v2 = va_arg(ap, uint64_t);
 1197|    207|                            _TIFFmemcpy(val, &v2, tv_size);
 1198|       |                            /* Test here for too big values for ClassicTIFF and
 1199|       |                             * delete custom field from custom list */
 1200|    207|                            if (!(tif->tif_flags & TIFF_BIGTIFF) &&
  ------------------
  |  |  143|    207|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1200:33): [True: 204, False: 3]
  ------------------
 1201|    204|                                (v2 > 0xffffffffu))
  ------------------
  |  Branch (1201:33): [True: 72, False: 132]
  ------------------
 1202|     72|                            {
 1203|     72|                                TIFFErrorExtR(
 1204|     72|                                    tif, module,
 1205|     72|                                    "%s: Bad LONG8 or IFD8 value %" PRIu64
 1206|     72|                                    " for \"%s\" tag %u in ClassicTIFF. Tag "
 1207|     72|                                    "won't be written to file",
 1208|     72|                                    tif->tif_name, v2, fip->field_name, tag);
 1209|     72|                                goto badvalueifd8long8;
 1210|     72|                            }
 1211|    207|                        }
 1212|    135|                        break;
 1213|    135|                        case TIFF_SLONG8:
  ------------------
  |  Branch (1213:25): [True: 0, False: 578]
  ------------------
 1214|      0|                        {
 1215|      0|                            int64_t v2 = va_arg(ap, int64_t);
 1216|      0|                            _TIFFmemcpy(val, &v2, tv_size);
 1217|       |                            /* Test here for too big values for ClassicTIFF and
 1218|       |                             * delete custom field from custom list */
 1219|      0|                            if (!(tif->tif_flags & TIFF_BIGTIFF) &&
  ------------------
  |  |  143|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1219:33): [True: 0, False: 0]
  ------------------
 1220|      0|                                ((v2 > 2147483647) || (v2 < (-2147483647 - 1))))
  ------------------
  |  Branch (1220:34): [True: 0, False: 0]
  |  Branch (1220:55): [True: 0, False: 0]
  ------------------
 1221|      0|                            {
 1222|      0|                                TIFFErrorExtR(
 1223|      0|                                    tif, module,
 1224|      0|                                    "%s: Bad SLONG8 value %" PRIi64
 1225|      0|                                    " for \"%s\" tag %u in ClassicTIFF. Tag "
 1226|      0|                                    "won't be written to file",
 1227|      0|                                    tif->tif_name, v2, fip->field_name, tag);
 1228|      0|                                goto badvalueifd8long8;
 1229|      0|                            }
 1230|      0|                        }
 1231|      0|                        break;
 1232|     68|                        case TIFF_RATIONAL:
  ------------------
  |  Branch (1232:25): [True: 68, False: 510]
  ------------------
 1233|     93|                        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1233:25): [True: 25, False: 553]
  ------------------
 1234|       |                            /*-- Rational2Double: For Rationals tv_size is set
 1235|       |                             * above to 4 or 8 according to
 1236|       |                             * fip->set_get_field_type!
 1237|       |                             */
 1238|     93|                            {
 1239|     93|                                if (tv_size == 8)
  ------------------
  |  Branch (1239:37): [True: 0, False: 93]
  ------------------
 1240|      0|                                {
 1241|      0|                                    double v2 = va_arg(ap, double);
 1242|      0|                                    _TIFFmemcpy(val, &v2, tv_size);
 1243|      0|                                }
 1244|     93|                                else
 1245|     93|                                {
 1246|       |                                    /*-- default should be tv_size == 4 */
 1247|     93|                                    float v3 = (float)va_arg(ap, double);
 1248|     93|                                    _TIFFmemcpy(val, &v3, tv_size);
 1249|       |                                    /*-- ToDo: After Testing, this should be
 1250|       |                                     * removed and tv_size==4 should be set as
 1251|       |                                     * default. */
 1252|     93|                                    if (tv_size != 4)
  ------------------
  |  Branch (1252:41): [True: 0, False: 93]
  ------------------
 1253|      0|                                    {
 1254|      0|                                        TIFFErrorExtR(tif, module,
 1255|      0|                                                      "Rational2Double: "
 1256|      0|                                                      ".set_get_field_type "
 1257|      0|                                                      "in not 4 but %d",
 1258|      0|                                                      tv_size);
 1259|      0|                                    }
 1260|     93|                                }
 1261|     93|                            }
 1262|     93|                            break;
 1263|      1|                        case TIFF_FLOAT:
  ------------------
  |  Branch (1263:25): [True: 1, False: 577]
  ------------------
 1264|      1|                        {
 1265|      1|                            float v2 =
 1266|      1|                                _TIFFClampDoubleToFloat(va_arg(ap, double));
 1267|      1|                            _TIFFmemcpy(val, &v2, tv_size);
 1268|      1|                        }
 1269|      1|                        break;
 1270|     15|                        case TIFF_DOUBLE:
  ------------------
  |  Branch (1270:25): [True: 15, False: 563]
  ------------------
 1271|     15|                        {
 1272|     15|                            double v2 = va_arg(ap, double);
 1273|     15|                            _TIFFmemcpy(val, &v2, tv_size);
 1274|     15|                        }
 1275|     15|                        break;
 1276|      0|                        case TIFF_NOTYPE:
  ------------------
  |  Branch (1276:25): [True: 0, False: 578]
  ------------------
 1277|      0|                        case TIFF_ASCII:
  ------------------
  |  Branch (1277:25): [True: 0, False: 578]
  ------------------
 1278|      0|                        default:
  ------------------
  |  Branch (1278:25): [True: 0, False: 578]
  ------------------
 1279|      0|                            _TIFFmemset(val, 0, tv_size);
 1280|      0|                            status = 0;
 1281|      0|                            break;
 1282|    578|                    }
 1283|    578|                }
 1284|  12.5k|            }
 1285|  37.6k|            if (old_custom_value)
  ------------------
  |  Branch (1285:17): [True: 0, False: 37.6k]
  ------------------
 1286|      0|            {
 1287|      0|                _TIFFfreeExt(tif, old_custom_value);
 1288|      0|                old_custom_value = NULL;
 1289|      0|            }
 1290|  37.6k|        }
 1291|   232k|    }
 1292|   229k|    if (status)
  ------------------
  |  Branch (1292:9): [True: 229k, False: 2]
  ------------------
 1293|   229k|    {
 1294|   229k|        const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1295|   229k|        if (fip2)
  ------------------
  |  Branch (1295:13): [True: 229k, False: 0]
  ------------------
 1296|   229k|            TIFFSetFieldBit(tif, fip2->field_bit);
  ------------------
  |  |  268|   229k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|   229k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|   229k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1297|   229k|        tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  125|   229k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1298|   229k|    }
 1299|       |
 1300|   231k|end:
 1301|   231k|    if (old_custom_value)
  ------------------
  |  Branch (1301:9): [True: 0, False: 231k]
  ------------------
 1302|      0|        _TIFFfreeExt(tif, old_custom_value);
 1303|   231k|    va_end(ap);
 1304|   231k|    return (status);
 1305|    288|badvalue:
 1306|    288|{
 1307|    288|    const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1308|    288|    TIFFErrorExtR(tif, module, "%s: Bad value %" PRIu32 " for \"%s\" tag",
 1309|    288|                  tif->tif_name, v, fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (1309:37): [True: 288, False: 0]
  ------------------
 1310|    288|    va_end(ap);
 1311|    288|}
 1312|    288|    return (0);
 1313|      3|badvalue32:
 1314|      3|{
 1315|      3|    const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1316|      3|    TIFFErrorExtR(tif, module, "%s: Bad value %" PRIu32 " for \"%s\" tag",
 1317|      3|                  tif->tif_name, v32, fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (1317:39): [True: 3, False: 0]
  ------------------
 1318|      3|    va_end(ap);
 1319|      3|}
 1320|      3|    return (0);
 1321|     51|badvaluedouble:
 1322|     51|{
 1323|     51|    const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1324|     51|    TIFFErrorExtR(tif, module, "%s: Bad value %f for \"%s\" tag", tif->tif_name,
 1325|     51|                  dblval, fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (1325:27): [True: 51, False: 0]
  ------------------
 1326|     51|    va_end(ap);
 1327|     51|}
 1328|     51|    return (0);
 1329|    503|badvalueifd8long8:
 1330|    503|{
 1331|       |    /* Error message issued already above. */
 1332|    503|    TIFFTagValue *tv2 = NULL;
 1333|    503|    int iCustom2, iC2;
 1334|       |    /* Find the existing entry for this custom value. */
 1335|  2.56k|    for (iCustom2 = 0; iCustom2 < td->td_customValueCount; iCustom2++)
  ------------------
  |  Branch (1335:24): [True: 2.56k, False: 0]
  ------------------
 1336|  2.56k|    {
 1337|  2.56k|        if (td->td_customValues[iCustom2].info->field_tag == tag)
  ------------------
  |  Branch (1337:13): [True: 503, False: 2.05k]
  ------------------
 1338|    503|        {
 1339|    503|            tv2 = td->td_customValues + (iCustom2);
 1340|    503|            break;
 1341|    503|        }
 1342|  2.56k|    }
 1343|    503|    if (tv2 != NULL)
  ------------------
  |  Branch (1343:9): [True: 503, False: 0]
  ------------------
 1344|    503|    {
 1345|       |        /* Remove custom field from custom list */
 1346|    503|        if (tv2->value != NULL)
  ------------------
  |  Branch (1346:13): [True: 503, False: 0]
  ------------------
 1347|    503|        {
 1348|    503|            _TIFFfreeExt(tif, tv2->value);
 1349|    503|            tv2->value = NULL;
 1350|    503|        }
 1351|       |        /* Shorten list and close gap in customValues list.
 1352|       |         * Re-allocation of td_customValues not necessary here. */
 1353|    503|        td->td_customValueCount--;
 1354|    503|        for (iC2 = iCustom2; iC2 < td->td_customValueCount; iC2++)
  ------------------
  |  Branch (1354:30): [True: 0, False: 503]
  ------------------
 1355|      0|        {
 1356|      0|            td->td_customValues[iC2] = td->td_customValues[iC2 + 1];
 1357|      0|        }
 1358|    503|    }
 1359|      0|    else
 1360|      0|    {
 1361|      0|        assert(0);
  ------------------
  |  Branch (1361:9): [Folded, False: 0]
  |  Branch (1361:9): [Folded, False: 0]
  ------------------
 1362|      0|    }
 1363|    503|    if (old_custom_value)
  ------------------
  |  Branch (1363:9): [True: 0, False: 503]
  ------------------
 1364|      0|        _TIFFfreeExt(tif, old_custom_value);
 1365|       |    va_end(ap);
 1366|    503|}
 1367|    503|    return (0);
 1368|    503|} /*-- _TIFFVSetField() --*/
tif_dir.c:cancelTransferFunction:
  200|      1|{
  201|      1|    TIFFDirectory *td = &tif->tif_dir;
  202|      1|    int i;
  203|       |
  204|      4|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (204:17): [True: 3, False: 1]
  ------------------
  205|      3|    {
  206|      3|        if (td->td_transferfunction[i] != NULL)
  ------------------
  |  Branch (206:13): [True: 1, False: 2]
  ------------------
  207|      1|        {
  208|      1|            _TIFFfreeExt(tif, td->td_transferfunction[i]);
  209|      1|            td->td_transferfunction[i] = NULL;
  210|      1|        }
  211|      3|    }
  212|      1|    td->td_transferfunction_count = 0;
  213|      1|    TIFFClrFieldBit(tif, FIELD_TRANSFERFUNCTION);
  ------------------
  |  |  269|      1|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  266|      1|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  265|      1|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  214|      1|}
tif_dir.c:setColorMap:
  232|    137|{
  233|    137|    TIFFDirectory *td = &tif->tif_dir;
  234|    137|    static const char module[] = "setColorMap";
  235|    137|    uint16_t *cm[3];
  236|    137|    int i;
  237|       |
  238|    548|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (238:17): [True: 411, False: 137]
  ------------------
  239|    411|    {
  240|    411|        cm[i] = va_arg(ap, uint16_t *);
  241|    411|        if (cm[i] == NULL) /* typically missing param */
  ------------------
  |  Branch (241:13): [True: 0, False: 411]
  ------------------
  242|      0|        {
  243|      0|            TIFFErrorExtR(tif, module,
  244|      0|                          "%s: ColorMap requires three arrays of %" PRIu32
  245|      0|                          " values each",
  246|      0|                          tif->tif_name, count);
  247|      0|            return 0; /* nothing installed yet, leave the old value alone */
  248|      0|        }
  249|    411|    }
  250|    548|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (250:17): [True: 411, False: 137]
  ------------------
  251|    411|    {
  252|    411|        if (!setShortArrayWithCount(tif, &td->td_colormap[i],
  ------------------
  |  Branch (252:13): [True: 0, False: 411]
  ------------------
  253|    411|                                    &td->td_colormap_count, cm[i], count))
  254|      0|        {
  255|      0|            cancelColorMap(tif);
  256|      0|            return 0;
  257|      0|        }
  258|    411|    }
  259|    137|    return 1;
  260|    137|}
tif_dir.c:setShortArrayWithCount:
  151|    420|{
  152|    420|    _TIFFsetShortArrayExt(tif, wpp, wp, n);
  153|    420|    if (*wpp == NULL)
  ------------------
  |  Branch (153:9): [True: 0, False: 420]
  ------------------
  154|      0|    {
  155|      0|        *countp = 0;
  156|      0|        return 0;
  157|      0|    }
  158|    420|    *countp = n;
  159|    420|    return 1;
  160|    420|}
tif_dir.c:setExtraSamples:
  315|    307|{
  316|       |/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
  317|    307|#define EXTRASAMPLE_COREL_UNASSALPHA 999
  318|       |
  319|    307|    uint16_t *va;
  320|    307|    uint32_t i;
  321|    307|    TIFFDirectory *td = &tif->tif_dir;
  322|    307|    static const char module[] = "setExtraSamples";
  323|       |
  324|    307|    *v = (uint16_t)va_arg(ap, uint16_vap);
  325|    307|    if ((uint16_t)*v > td->td_samplesperpixel)
  ------------------
  |  Branch (325:9): [True: 21, False: 286]
  ------------------
  326|     21|        return 0;
  327|    286|    va = va_arg(ap, uint16_t *);
  328|    286|    if (*v > 0 && va == NULL) /* typically missing param */
  ------------------
  |  Branch (328:9): [True: 277, False: 9]
  |  Branch (328:19): [True: 0, False: 277]
  ------------------
  329|      0|        return 0;
  330|    587|    for (i = 0; i < *v; i++)
  ------------------
  |  Branch (330:17): [True: 375, False: 212]
  ------------------
  331|    375|    {
  332|    375|        if (va[i] > EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|    375|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (332:13): [True: 75, False: 300]
  ------------------
  333|     75|        {
  334|       |            /*
  335|       |             * XXX: Corel Draw is known to produce incorrect
  336|       |             * ExtraSamples tags which must be patched here if we
  337|       |             * want to be able to open some of the damaged TIFF
  338|       |             * files:
  339|       |             */
  340|     75|            if (va[i] == EXTRASAMPLE_COREL_UNASSALPHA)
  ------------------
  |  |  317|     75|#define EXTRASAMPLE_COREL_UNASSALPHA 999
  ------------------
  |  Branch (340:17): [True: 1, False: 74]
  ------------------
  341|      1|                va[i] = EXTRASAMPLE_UNASSALPHA;
  ------------------
  |  |  332|      1|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  342|     74|            else
  343|     74|                return 0;
  344|     75|        }
  345|    375|    }
  346|       |
  347|    212|    if (td->td_transferfunction[0] != NULL &&
  ------------------
  |  Branch (347:9): [True: 0, False: 212]
  ------------------
  348|      0|        (td->td_samplesperpixel - *v > 1) &&
  ------------------
  |  Branch (348:9): [True: 0, False: 0]
  ------------------
  349|      0|        !(td->td_samplesperpixel - td->td_extrasamples > 1))
  ------------------
  |  Branch (349:9): [True: 0, False: 0]
  ------------------
  350|      0|    {
  351|      0|        TIFFWarningExtR(tif, module,
  352|      0|                        "ExtraSamples tag value is changing, "
  353|      0|                        "but TransferFunction was read with a different value. "
  354|      0|                        "Canceling it");
  355|      0|        cancelTransferFunction(tif);
  356|      0|    }
  357|       |
  358|    212|    td->td_extrasamples = (uint16_t)*v;
  359|    212|    _TIFFsetShortArrayExt(tif, &td->td_sampleinfo, va, td->td_extrasamples);
  360|    212|    return 1;
  361|       |
  362|    286|#undef EXTRASAMPLE_COREL_UNASSALPHA
  363|    286|}
tif_dir.c:_TIFFsetLong8Array:
   97|      6|{
   98|      6|    setByteArray(tif, (void **)lpp, lp, n, sizeof(uint64_t));
   99|      6|}
tif_dir.c:setTransferFunction:
  278|      7|{
  279|      7|    TIFFDirectory *td = &tif->tif_dir;
  280|      7|    static const char module[] = "setTransferFunction";
  281|      7|    uint16_t *tf[3];
  282|      7|    uint32_t i;
  283|      7|    uint32_t v;
  284|       |
  285|      7|    v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
  ------------------
  |  Branch (285:9): [True: 1, False: 6]
  ------------------
  286|     16|    for (i = 0; i < v; i++)
  ------------------
  |  Branch (286:17): [True: 9, False: 7]
  ------------------
  287|      9|    {
  288|      9|        tf[i] = va_arg(ap, uint16_t *);
  289|      9|        if (tf[i] == NULL) /* typically missing param */
  ------------------
  |  Branch (289:13): [True: 0, False: 9]
  ------------------
  290|      0|        {
  291|      0|            TIFFErrorExtR(tif, module,
  292|      0|                          "%s: TransferFunction requires %" PRIu32
  293|      0|                          " curves of %" PRIu32 " values each",
  294|      0|                          tif->tif_name, v, count);
  295|      0|            return 0; /* nothing installed yet, leave the old value alone */
  296|      0|        }
  297|      9|    }
  298|     16|    for (i = 0; i < v; i++)
  ------------------
  |  Branch (298:17): [True: 9, False: 7]
  ------------------
  299|      9|    {
  300|      9|        if (!setShortArrayWithCount(tif, &td->td_transferfunction[i],
  ------------------
  |  Branch (300:13): [True: 0, False: 9]
  ------------------
  301|      9|                                    &td->td_transferfunction_count, tf[i],
  302|      9|                                    count))
  303|      0|        {
  304|      0|            cancelTransferFunction(tif);
  305|      0|            return 0;
  306|      0|        }
  307|      9|    }
  308|      7|    return 1;
  309|      7|}
tif_dir.c:countInkNamesString:
  370|     51|{
  371|     51|    uint16_t i = 0;
  372|       |
  373|     51|    if (slen > 0)
  ------------------
  |  Branch (373:9): [True: 50, False: 1]
  ------------------
  374|     50|    {
  375|     50|        const char *ep = s + slen;
  376|     50|        const char *cp = s;
  377|     50|        do
  378|    929|        {
  379|  2.29k|            for (; cp < ep && *cp != '\0'; cp++)
  ------------------
  |  Branch (379:20): [True: 2.29k, False: 0]
  |  Branch (379:31): [True: 1.36k, False: 929]
  ------------------
  380|  1.36k|            {
  381|  1.36k|            }
  382|    929|            if (cp >= ep)
  ------------------
  |  Branch (382:17): [True: 0, False: 929]
  ------------------
  383|      0|                goto bad;
  384|    929|            cp++; /* skip \0 */
  385|    929|            i++;
  386|    929|        } while (cp < ep);
  ------------------
  |  Branch (386:18): [True: 879, False: 50]
  ------------------
  387|     50|        return (i);
  388|     50|    }
  389|      1|bad:
  390|      1|    TIFFErrorExtR(tif, "TIFFSetField",
  391|      1|                  "%s: Invalid InkNames value; no null at given buffer end "
  392|      1|                  "location %" PRIu32 ", after %" PRIu16 " ink",
  393|      1|                  tif->tif_name, slen, i);
  394|      1|    return (0);
  395|     51|}
tif_dir.c:_TIFFsetNString:
   71|     50|{
   72|     50|    setByteArray(tif, (void **)cpp, cp, n, 1);
   73|     50|}
tif_dir.c:removeCustomValue:
  403|  1.82k|{
  404|  1.82k|    for (; i < td->td_customValueCount - 1; i++)
  ------------------
  |  Branch (404:12): [True: 0, False: 1.82k]
  ------------------
  405|      0|        td->td_customValues[i] = td->td_customValues[i + 1];
  406|  1.82k|    td->td_customValueCount--;
  407|  1.82k|}
tif_dir.c:_TIFFVGetField:
 1479|   459k|{
 1480|   459k|    TIFFDirectory *td = &tif->tif_dir;
 1481|   459k|    int ret_val = 1;
 1482|   459k|    uint32_t standard_tag = tag;
 1483|   459k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  389|   459k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1484|   459k|    if (fip == NULL) /* cannot happen since TIFFGetField() already checks it */
  ------------------
  |  Branch (1484:9): [True: 0, False: 459k]
  ------------------
 1485|      0|        return 0;
 1486|       |
 1487|       |    /*
 1488|       |     * We want to force the custom code to be used for custom
 1489|       |     * fields even if the tag happens to match a well known
 1490|       |     * one - important for reinterpreted handling of standard
 1491|       |     * tag values in custom directories (i.e. EXIF)
 1492|       |     */
 1493|   459k|    if (fip->field_bit == FIELD_CUSTOM)
  ------------------
  |  |  394|   459k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (1493:9): [True: 594, False: 458k]
  ------------------
 1494|    594|    {
 1495|    594|        standard_tag = 0;
 1496|    594|    }
 1497|       |
 1498|   459k|    switch (standard_tag)
 1499|   459k|    {
 1500|      0|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (1500:9): [True: 0, False: 459k]
  ------------------
 1501|      0|            *va_arg(ap, uint32_t *) = td->td_subfiletype;
 1502|      0|            break;
 1503|  39.7k|        case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  39.7k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (1503:9): [True: 39.7k, False: 419k]
  ------------------
 1504|  39.7k|            *va_arg(ap, uint32_t *) = td->td_imagewidth;
 1505|  39.7k|            break;
 1506|  29.1k|        case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  29.1k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (1506:9): [True: 29.1k, False: 430k]
  ------------------
 1507|  29.1k|            *va_arg(ap, uint32_t *) = td->td_imagelength;
 1508|  29.1k|            break;
 1509|  8.27k|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  8.27k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (1509:9): [True: 8.27k, False: 451k]
  ------------------
 1510|  8.27k|            *va_arg(ap, uint16_t *) = td->td_bitspersample;
 1511|  8.27k|            break;
 1512|  21.4k|        case TIFFTAG_COMPRESSION:
  ------------------
  |  |  181|  21.4k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (1512:9): [True: 21.4k, False: 437k]
  ------------------
 1513|  21.4k|            *va_arg(ap, uint16_t *) = td->td_compression;
 1514|  21.4k|            break;
 1515|  14.5k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  14.5k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (1515:9): [True: 14.5k, False: 444k]
  ------------------
 1516|  14.5k|            *va_arg(ap, uint16_t *) = td->td_photometric;
 1517|  14.5k|            break;
 1518|      0|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      0|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (1518:9): [True: 0, False: 459k]
  ------------------
 1519|      0|            *va_arg(ap, uint16_t *) = td->td_threshholding;
 1520|      0|            break;
 1521|      0|        case TIFFTAG_FILLORDER:
  ------------------
  |  |  240|      0|#define TIFFTAG_FILLORDER 266              /* data order within a byte */
  ------------------
  |  Branch (1521:9): [True: 0, False: 459k]
  ------------------
 1522|      0|            *va_arg(ap, uint16_t *) = td->td_fillorder;
 1523|      0|            break;
 1524|    299|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|    299|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (1524:9): [True: 299, False: 459k]
  ------------------
 1525|    299|            *va_arg(ap, uint16_t *) = td->td_orientation;
 1526|    299|            break;
 1527|  5.39k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  5.39k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (1527:9): [True: 5.39k, False: 454k]
  ------------------
 1528|  5.39k|            *va_arg(ap, uint16_t *) = td->td_samplesperpixel;
 1529|  5.39k|            break;
 1530|  7.16k|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  7.16k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (1530:9): [True: 7.16k, False: 452k]
  ------------------
 1531|  7.16k|            *va_arg(ap, uint32_t *) = td->td_rowsperstrip;
 1532|  7.16k|            break;
 1533|      0|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|      0|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (1533:9): [True: 0, False: 459k]
  ------------------
 1534|      0|            *va_arg(ap, uint16_t *) = td->td_minsamplevalue;
 1535|      0|            break;
 1536|      0|        case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|      0|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (1536:9): [True: 0, False: 459k]
  ------------------
 1537|      0|            *va_arg(ap, uint16_t *) = td->td_maxsamplevalue;
 1538|      0|            break;
 1539|      0|        case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|      0|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (1539:9): [True: 0, False: 459k]
  ------------------
 1540|      0|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  146|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (1540:17): [True: 0, False: 0]
  ------------------
 1541|      0|                *va_arg(ap, double **) = td->td_sminsamplevalue;
 1542|      0|            else
 1543|      0|            {
 1544|       |                /* libtiff historically treats this as a single value. */
 1545|      0|                uint16_t i;
 1546|      0|                double v = td->td_sminsamplevalue[0];
 1547|      0|                for (i = 1; i < td->td_samplesperpixel; ++i)
  ------------------
  |  Branch (1547:29): [True: 0, False: 0]
  ------------------
 1548|      0|                    if (td->td_sminsamplevalue[i] < v)
  ------------------
  |  Branch (1548:25): [True: 0, False: 0]
  ------------------
 1549|      0|                        v = td->td_sminsamplevalue[i];
 1550|      0|                *va_arg(ap, double *) = v;
 1551|      0|            }
 1552|      0|            break;
 1553|      0|        case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|      0|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (1553:9): [True: 0, False: 459k]
  ------------------
 1554|      0|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  146|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (1554:17): [True: 0, False: 0]
  ------------------
 1555|      0|                *va_arg(ap, double **) = td->td_smaxsamplevalue;
 1556|      0|            else
 1557|      0|            {
 1558|       |                /* libtiff historically treats this as a single value. */
 1559|      0|                uint16_t i;
 1560|      0|                double v = td->td_smaxsamplevalue[0];
 1561|      0|                for (i = 1; i < td->td_samplesperpixel; ++i)
  ------------------
  |  Branch (1561:29): [True: 0, False: 0]
  ------------------
 1562|      0|                    if (td->td_smaxsamplevalue[i] > v)
  ------------------
  |  Branch (1562:25): [True: 0, False: 0]
  ------------------
 1563|      0|                        v = td->td_smaxsamplevalue[i];
 1564|      0|                *va_arg(ap, double *) = v;
 1565|      0|            }
 1566|      0|            break;
 1567|      0|        case TIFFTAG_XRESOLUTION:
  ------------------
  |  |  262|      0|#define TIFFTAG_XRESOLUTION 282            /* pixels/resolution in x */
  ------------------
  |  Branch (1567:9): [True: 0, False: 459k]
  ------------------
 1568|      0|            *va_arg(ap, float *) = td->td_xresolution;
 1569|      0|            break;
 1570|      0|        case TIFFTAG_YRESOLUTION:
  ------------------
  |  |  263|      0|#define TIFFTAG_YRESOLUTION 283            /* pixels/resolution in y */
  ------------------
  |  Branch (1570:9): [True: 0, False: 459k]
  ------------------
 1571|      0|            *va_arg(ap, float *) = td->td_yresolution;
 1572|      0|            break;
 1573|  13.1k|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  13.1k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (1573:9): [True: 13.1k, False: 446k]
  ------------------
 1574|  13.1k|            *va_arg(ap, uint16_t *) = td->td_planarconfig;
 1575|  13.1k|            break;
 1576|      0|        case TIFFTAG_XPOSITION:
  ------------------
  |  |  268|      0|#define TIFFTAG_XPOSITION 286              /* x page offset of image lhs */
  ------------------
  |  Branch (1576:9): [True: 0, False: 459k]
  ------------------
 1577|      0|            *va_arg(ap, float *) = td->td_xposition;
 1578|      0|            break;
 1579|      0|        case TIFFTAG_YPOSITION:
  ------------------
  |  |  269|      0|#define TIFFTAG_YPOSITION 287              /* y page offset of image lhs */
  ------------------
  |  Branch (1579:9): [True: 0, False: 459k]
  ------------------
 1580|      0|            *va_arg(ap, float *) = td->td_yposition;
 1581|      0|            break;
 1582|      0|        case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  287|      0|#define TIFFTAG_RESOLUTIONUNIT 296         /* units of resolutions */
  ------------------
  |  Branch (1582:9): [True: 0, False: 459k]
  ------------------
 1583|      0|            *va_arg(ap, uint16_t *) = td->td_resolutionunit;
 1584|      0|            break;
 1585|      0|        case TIFFTAG_PAGENUMBER:
  ------------------
  |  |  291|      0|#define TIFFTAG_PAGENUMBER 297             /* page numbers of multi-page */
  ------------------
  |  Branch (1585:9): [True: 0, False: 459k]
  ------------------
 1586|      0|            *va_arg(ap, uint16_t *) = td->td_pagenumber[0];
 1587|      0|            *va_arg(ap, uint16_t *) = td->td_pagenumber[1];
 1588|      0|            break;
 1589|      0|        case TIFFTAG_HALFTONEHINTS:
  ------------------
  |  |  310|      0|#define TIFFTAG_HALFTONEHINTS 321          /* !highlight+shadow info */
  ------------------
  |  Branch (1589:9): [True: 0, False: 459k]
  ------------------
 1590|      0|            *va_arg(ap, uint16_t *) = td->td_halftonehints[0];
 1591|      0|            *va_arg(ap, uint16_t *) = td->td_halftonehints[1];
 1592|      0|            break;
 1593|    133|        case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|    133|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (1593:9): [True: 133, False: 459k]
  ------------------
 1594|    133|            *va_arg(ap, const uint16_t **) = td->td_colormap[0];
 1595|    133|            *va_arg(ap, const uint16_t **) = td->td_colormap[1];
 1596|    133|            *va_arg(ap, const uint16_t **) = td->td_colormap[2];
 1597|    133|            break;
 1598|      0|        case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|      0|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (1598:9): [True: 0, False: 459k]
  ------------------
 1599|      0|        case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|      0|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (1599:9): [True: 0, False: 459k]
  ------------------
 1600|      0|            _TIFFFillStriles(tif);
 1601|      0|            *va_arg(ap, const uint64_t **) = td->td_stripoffset_p;
 1602|      0|            if (td->td_stripoffset_p == NULL)
  ------------------
  |  Branch (1602:17): [True: 0, False: 0]
  ------------------
 1603|      0|                ret_val = 0;
 1604|      0|            break;
 1605|      0|        case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|      0|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (1605:9): [True: 0, False: 459k]
  ------------------
 1606|      0|        case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|      0|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (1606:9): [True: 0, False: 459k]
  ------------------
 1607|      0|            _TIFFFillStriles(tif);
 1608|      0|            *va_arg(ap, const uint64_t **) = td->td_stripbytecount_p;
 1609|      0|            if (td->td_stripbytecount_p == NULL)
  ------------------
  |  Branch (1609:17): [True: 0, False: 0]
  ------------------
 1610|      0|                ret_val = 0;
 1611|      0|            break;
 1612|      0|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|      0|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (1612:9): [True: 0, False: 459k]
  ------------------
 1613|      0|            *va_arg(ap, uint16_t *) =
 1614|      0|                (td->td_extrasamples == 1 && td->td_sampleinfo &&
  ------------------
  |  Branch (1614:18): [True: 0, False: 0]
  |  Branch (1614:46): [True: 0, False: 0]
  ------------------
 1615|      0|                 td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
  ------------------
  |  |  331|      0|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (1615:18): [True: 0, False: 0]
  ------------------
 1616|      0|            break;
 1617|    191|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|    191|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (1617:9): [True: 191, False: 459k]
  ------------------
 1618|    191|            *va_arg(ap, uint16_t *) = td->td_extrasamples;
 1619|    191|            *va_arg(ap, const uint16_t **) = td->td_sampleinfo;
 1620|    191|            break;
 1621|  21.0k|        case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  21.0k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (1621:9): [True: 21.0k, False: 438k]
  ------------------
 1622|  21.0k|            *va_arg(ap, uint32_t *) = td->td_tilewidth;
 1623|  21.0k|            break;
 1624|  10.4k|        case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  10.4k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (1624:9): [True: 10.4k, False: 448k]
  ------------------
 1625|  10.4k|            *va_arg(ap, uint32_t *) = td->td_tilelength;
 1626|  10.4k|            break;
 1627|      0|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|      0|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (1627:9): [True: 0, False: 459k]
  ------------------
 1628|      0|            *va_arg(ap, uint32_t *) = td->td_tiledepth;
 1629|      0|            break;
 1630|      0|        case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|      0|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (1630:9): [True: 0, False: 459k]
  ------------------
 1631|      0|            switch (td->td_sampleformat)
 1632|      0|            {
 1633|      0|                case SAMPLEFORMAT_UINT:
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (1633:17): [True: 0, False: 0]
  ------------------
 1634|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_UINT;
  ------------------
  |  |   41|      0|#define DATATYPE_UINT 2   /* !unsigned integer data */
  ------------------
 1635|      0|                    break;
 1636|      0|                case SAMPLEFORMAT_INT:
  ------------------
  |  |  335|      0|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
  |  Branch (1636:17): [True: 0, False: 0]
  ------------------
 1637|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_INT;
  ------------------
  |  |   40|      0|#define DATATYPE_INT 1    /* !signed integer data */
  ------------------
 1638|      0|                    break;
 1639|      0|                case SAMPLEFORMAT_IEEEFP:
  ------------------
  |  |  336|      0|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (1639:17): [True: 0, False: 0]
  ------------------
 1640|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_IEEEFP;
  ------------------
  |  |   42|      0|#define DATATYPE_IEEEFP 3 /* !IEEE floating point data */
  ------------------
 1641|      0|                    break;
 1642|      0|                case SAMPLEFORMAT_VOID:
  ------------------
  |  |  337|      0|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
  |  Branch (1642:17): [True: 0, False: 0]
  ------------------
 1643|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_VOID;
  ------------------
  |  |   39|      0|#define DATATYPE_VOID 0   /* !untyped data */
  ------------------
 1644|      0|                    break;
 1645|      0|                default:
  ------------------
  |  Branch (1645:17): [True: 0, False: 0]
  ------------------
 1646|      0|                    break;
 1647|      0|            }
 1648|      0|            break;
 1649|      0|        case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (1649:9): [True: 0, False: 459k]
  ------------------
 1650|      0|            *va_arg(ap, uint16_t *) = td->td_sampleformat;
 1651|      0|            break;
 1652|      0|        case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|      0|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (1652:9): [True: 0, False: 459k]
  ------------------
 1653|      0|            *va_arg(ap, uint32_t *) = td->td_imagedepth;
 1654|      0|            break;
 1655|      0|        case TIFFTAG_SUBIFD:
  ------------------
  |  |  321|      0|#define TIFFTAG_SUBIFD 330                 /* subimage descriptors */
  ------------------
  |  Branch (1655:9): [True: 0, False: 459k]
  ------------------
 1656|      0|            *va_arg(ap, uint16_t *) = td->td_nsubifd;
 1657|      0|            *va_arg(ap, const uint64_t **) = td->td_subifd;
 1658|      0|            break;
 1659|      0|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      0|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (1659:9): [True: 0, False: 459k]
  ------------------
 1660|      0|            *va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
 1661|      0|            break;
 1662|   287k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|   287k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (1662:9): [True: 287k, False: 171k]
  ------------------
 1663|   287k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
 1664|   287k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
 1665|   287k|            break;
 1666|      0|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      0|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (1666:9): [True: 0, False: 459k]
  ------------------
 1667|      0|            *va_arg(ap, const uint16_t **) = td->td_transferfunction[0];
 1668|      0|            if (td->td_samplesperpixel - td->td_extrasamples > 1)
  ------------------
  |  Branch (1668:17): [True: 0, False: 0]
  ------------------
 1669|      0|            {
 1670|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[1];
 1671|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[2];
 1672|      0|            }
 1673|      0|            else
 1674|      0|            {
 1675|      0|                *va_arg(ap, const uint16_t **) = NULL;
 1676|      0|                *va_arg(ap, const uint16_t **) = NULL;
 1677|      0|            }
 1678|      0|            break;
 1679|     55|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|     55|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (1679:9): [True: 55, False: 459k]
  ------------------
 1680|     55|            *va_arg(ap, const float **) = td->td_refblackwhite;
 1681|     55|            break;
 1682|      0|        case TIFFTAG_INKNAMES:
  ------------------
  |  |  325|      0|#define TIFFTAG_INKNAMES 333               /* !ascii names of inks */
  ------------------
  |  Branch (1682:9): [True: 0, False: 459k]
  ------------------
 1683|      0|            *va_arg(ap, const char **) = td->td_inknames;
 1684|      0|            break;
 1685|      0|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|      0|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (1685:9): [True: 0, False: 459k]
  ------------------
 1686|      0|            *va_arg(ap, uint16_t *) = td->td_numberofinks;
 1687|      0|            break;
 1688|    594|        default:
  ------------------
  |  Branch (1688:9): [True: 594, False: 458k]
  ------------------
 1689|    594|        {
 1690|    594|            int i;
 1691|       |
 1692|       |            /*
 1693|       |             * This can happen if multiple images are open
 1694|       |             * with different codecs which have private
 1695|       |             * tags.  The global tag information table may
 1696|       |             * then have tags that are valid for one file
 1697|       |             * but not the other. If the client tries to
 1698|       |             * get a tag that is not valid for the image's
 1699|       |             * codec then we'll arrive here.
 1700|       |             */
 1701|    594|            if (fip->field_bit != FIELD_CUSTOM)
  ------------------
  |  |  394|    594|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (1701:17): [True: 0, False: 594]
  ------------------
 1702|      0|            {
 1703|      0|                TIFFErrorExtR(tif, "_TIFFVGetField",
 1704|      0|                              "%s: Invalid %stag \"%s\" "
 1705|      0|                              "(not supported by codec)",
 1706|      0|                              tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  280|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (280:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1707|      0|                              fip->field_name);
 1708|      0|                ret_val = 0;
 1709|      0|                break;
 1710|      0|            }
 1711|       |
 1712|       |            /*
 1713|       |             * Do we have a custom value?
 1714|       |             */
 1715|    594|            ret_val = 0;
 1716|  2.40k|            for (i = 0; i < td->td_customValueCount; i++)
  ------------------
  |  Branch (1716:25): [True: 1.81k, False: 582]
  ------------------
 1717|  1.81k|            {
 1718|  1.81k|                TIFFTagValue *tv = td->td_customValues + i;
 1719|       |
 1720|  1.81k|                if (tv->info->field_tag != tag)
  ------------------
  |  Branch (1720:21): [True: 1.80k, False: 12]
  ------------------
 1721|  1.80k|                    continue;
 1722|       |
 1723|       |                /* Without a count, the caller cannot tell that there is no
 1724|       |                 * value. */
 1725|     12|                if (tv->value == NULL && !fip->field_passcount)
  ------------------
  |  Branch (1725:21): [True: 0, False: 12]
  |  Branch (1725:42): [True: 0, False: 0]
  ------------------
 1726|      0|                    break;
 1727|       |
 1728|     12|                if (fip->field_passcount)
  ------------------
  |  Branch (1728:21): [True: 0, False: 12]
  ------------------
 1729|      0|                {
 1730|      0|                    if (fip->field_readcount == TIFF_VARIABLE2)
  ------------------
  |  |  392|      0|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1730:25): [True: 0, False: 0]
  ------------------
 1731|      0|                        *va_arg(ap, uint32_t *) = (uint32_t)tv->count;
 1732|      0|                    else /* Assume TIFF_VARIABLE */
 1733|      0|                        *va_arg(ap, uint16_t *) = (uint16_t)tv->count;
 1734|      0|                    *va_arg(ap, const void **) = tv->value;
 1735|      0|                    ret_val = 1;
 1736|      0|                }
 1737|     12|                else if (fip->field_tag == TIFFTAG_DOTRANGE &&
  ------------------
  |  |  327|     24|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (1737:26): [True: 0, False: 12]
  ------------------
 1738|      0|                         strcmp(fip->field_name, "DotRange") == 0)
  ------------------
  |  Branch (1738:26): [True: 0, False: 0]
  ------------------
 1739|      0|                {
 1740|       |                    /* TODO: This is an evil exception and should not have been
 1741|       |                       handled this way ... likely best if we move it into
 1742|       |                       the directory structure with an explicit field in
 1743|       |                       libtiff 4.1 and assign it a FIELD_ value */
 1744|      0|                    *va_arg(ap, uint16_t *) = ((uint16_t *)tv->value)[0];
 1745|      0|                    *va_arg(ap, uint16_t *) = ((uint16_t *)tv->value)[1];
 1746|      0|                    ret_val = 1;
 1747|      0|                }
 1748|     12|                else
 1749|     12|                {
 1750|     12|                    if (fip->field_type == TIFF_ASCII ||
  ------------------
  |  Branch (1750:25): [True: 0, False: 12]
  ------------------
 1751|     12|                        fip->field_readcount == TIFF_VARIABLE ||
  ------------------
  |  |  390|     24|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (1751:25): [True: 0, False: 12]
  ------------------
 1752|     12|                        fip->field_readcount == TIFF_VARIABLE2 ||
  ------------------
  |  |  392|     24|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1752:25): [True: 0, False: 12]
  ------------------
 1753|     12|                        fip->field_readcount == TIFF_SPP || tv->count > 1)
  ------------------
  |  |  391|     24|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (1753:25): [True: 0, False: 12]
  |  Branch (1753:61): [True: 9, False: 3]
  ------------------
 1754|      9|                    {
 1755|      9|                        *va_arg(ap, void **) = tv->value;
 1756|      9|                        ret_val = 1;
 1757|      9|                    }
 1758|      3|                    else
 1759|      3|                    {
 1760|      3|                        char *val = (char *)tv->value;
 1761|      3|                        assert(tv->count == 1);
  ------------------
  |  Branch (1761:25): [True: 0, False: 3]
  |  Branch (1761:25): [True: 3, False: 0]
  ------------------
 1762|      3|                        switch (fip->field_type)
 1763|      3|                        {
 1764|      0|                            case TIFF_BYTE:
  ------------------
  |  Branch (1764:29): [True: 0, False: 3]
  ------------------
 1765|      0|                            case TIFF_UNDEFINED:
  ------------------
  |  Branch (1765:29): [True: 0, False: 3]
  ------------------
 1766|      0|                                *va_arg(ap, uint8_t *) = *(uint8_t *)val;
 1767|      0|                                ret_val = 1;
 1768|      0|                                break;
 1769|      0|                            case TIFF_SBYTE:
  ------------------
  |  Branch (1769:29): [True: 0, False: 3]
  ------------------
 1770|      0|                                *va_arg(ap, int8_t *) = *(int8_t *)val;
 1771|      0|                                ret_val = 1;
 1772|      0|                                break;
 1773|      3|                            case TIFF_SHORT:
  ------------------
  |  Branch (1773:29): [True: 3, False: 0]
  ------------------
 1774|      3|                                *va_arg(ap, uint16_t *) = *(uint16_t *)val;
 1775|      3|                                ret_val = 1;
 1776|      3|                                break;
 1777|      0|                            case TIFF_SSHORT:
  ------------------
  |  Branch (1777:29): [True: 0, False: 3]
  ------------------
 1778|      0|                                *va_arg(ap, int16_t *) = *(int16_t *)val;
 1779|      0|                                ret_val = 1;
 1780|      0|                                break;
 1781|      0|                            case TIFF_LONG:
  ------------------
  |  Branch (1781:29): [True: 0, False: 3]
  ------------------
 1782|      0|                            case TIFF_IFD:
  ------------------
  |  Branch (1782:29): [True: 0, False: 3]
  ------------------
 1783|      0|                                *va_arg(ap, uint32_t *) = *(uint32_t *)val;
 1784|      0|                                ret_val = 1;
 1785|      0|                                break;
 1786|      0|                            case TIFF_SLONG:
  ------------------
  |  Branch (1786:29): [True: 0, False: 3]
  ------------------
 1787|      0|                                *va_arg(ap, int32_t *) = *(int32_t *)val;
 1788|      0|                                ret_val = 1;
 1789|      0|                                break;
 1790|      0|                            case TIFF_LONG8:
  ------------------
  |  Branch (1790:29): [True: 0, False: 3]
  ------------------
 1791|      0|                            case TIFF_IFD8:
  ------------------
  |  Branch (1791:29): [True: 0, False: 3]
  ------------------
 1792|      0|                                *va_arg(ap, uint64_t *) = *(uint64_t *)val;
 1793|      0|                                ret_val = 1;
 1794|      0|                                break;
 1795|      0|                            case TIFF_SLONG8:
  ------------------
  |  Branch (1795:29): [True: 0, False: 3]
  ------------------
 1796|      0|                                *va_arg(ap, int64_t *) = *(int64_t *)val;
 1797|      0|                                ret_val = 1;
 1798|      0|                                break;
 1799|      0|                            case TIFF_RATIONAL:
  ------------------
  |  Branch (1799:29): [True: 0, False: 3]
  ------------------
 1800|      0|                            case TIFF_SRATIONAL:
  ------------------
  |  Branch (1800:29): [True: 0, False: 3]
  ------------------
 1801|      0|                            {
 1802|       |                                /*-- Rational2Double: For Rationals evaluate
 1803|       |                                 * "set_get_field_type" to determine internal
 1804|       |                                 * storage size and return value size. */
 1805|      0|                                int tv_size = TIFFFieldSetGetSize(fip);
 1806|      0|                                if (tv_size == 8)
  ------------------
  |  Branch (1806:37): [True: 0, False: 0]
  ------------------
 1807|      0|                                {
 1808|      0|                                    *va_arg(ap, double *) = *(double *)val;
 1809|      0|                                    ret_val = 1;
 1810|      0|                                }
 1811|      0|                                else
 1812|      0|                                {
 1813|       |                                    /*-- default should be tv_size == 4  */
 1814|      0|                                    *va_arg(ap, float *) = *(float *)val;
 1815|      0|                                    ret_val = 1;
 1816|       |                                    /*-- ToDo: After Testing, this should be
 1817|       |                                     * removed and tv_size==4 should be set as
 1818|       |                                     * default. */
 1819|      0|                                    if (tv_size != 4)
  ------------------
  |  Branch (1819:41): [True: 0, False: 0]
  ------------------
 1820|      0|                                    {
 1821|      0|                                        TIFFErrorExtR(tif, "_TIFFVGetField",
 1822|      0|                                                      "Rational2Double: "
 1823|      0|                                                      ".set_get_field_type "
 1824|      0|                                                      "in not 4 but %d",
 1825|      0|                                                      tv_size);
 1826|      0|                                    }
 1827|      0|                                }
 1828|      0|                            }
 1829|      0|                            break;
 1830|      0|                            case TIFF_FLOAT:
  ------------------
  |  Branch (1830:29): [True: 0, False: 3]
  ------------------
 1831|      0|                                *va_arg(ap, float *) = *(float *)val;
 1832|      0|                                ret_val = 1;
 1833|      0|                                break;
 1834|      0|                            case TIFF_DOUBLE:
  ------------------
  |  Branch (1834:29): [True: 0, False: 3]
  ------------------
 1835|      0|                                *va_arg(ap, double *) = *(double *)val;
 1836|      0|                                ret_val = 1;
 1837|      0|                                break;
 1838|      0|                            case TIFF_NOTYPE:
  ------------------
  |  Branch (1838:29): [True: 0, False: 3]
  ------------------
 1839|      0|                            case TIFF_ASCII:
  ------------------
  |  Branch (1839:29): [True: 0, False: 3]
  ------------------
 1840|      0|                            default:
  ------------------
  |  Branch (1840:29): [True: 0, False: 3]
  ------------------
 1841|      0|                                ret_val = 0;
 1842|      0|                                break;
 1843|      3|                        }
 1844|      3|                    }
 1845|     12|                }
 1846|     12|                break;
 1847|     12|            }
 1848|    594|        }
 1849|   459k|    }
 1850|   459k|    return (ret_val);
 1851|   459k|}

_TIFFGetFields:
  561|  27.2k|const TIFFFieldArray *_TIFFGetFields(void) { return (&tiffFieldArray); }
_TIFFSetupFields:
  568|  27.2k|{
  569|  27.2k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (569:9): [True: 0, False: 27.2k]
  |  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))
  ------------------
  |  |  394|      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|  27.2k|    if (!_TIFFMergeFields(tif, fieldarray->fields, fieldarray->count))
  ------------------
  |  Branch (594:9): [True: 0, False: 27.2k]
  ------------------
  595|      0|    {
  596|      0|        TIFFErrorExtR(tif, "_TIFFSetupFields", "Setting up field info failed");
  597|      0|    }
  598|  27.2k|}
_TIFFMergeFields:
  628|   297k|{
  629|   297k|    static const char module[] = "_TIFFMergeFields";
  630|   297k|    static const char reason[] = "for fields array";
  631|       |    /* TIFFField** tp; */
  632|   297k|    uint32_t i;
  633|       |
  634|   297k|    tif->tif_foundfield = NULL;
  635|       |
  636|   297k|    TIFFField **tif_newfields = NULL;
  637|       |
  638|   297k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (638:9): [True: 270k, False: 27.2k]
  |  Branch (638:28): [True: 270k, False: 0]
  ------------------
  639|   270k|    {
  640|   270k|        tif_newfields = (TIFFField **)_TIFFCheckRealloc(
  641|   270k|            tif, tif->tif_fields, (tmsize_t)tif->tif_nfields + n,
  642|   270k|            (tmsize_t)sizeof(TIFFField *), reason);
  643|   270k|    }
  644|  27.2k|    else
  645|  27.2k|    {
  646|  27.2k|        tif_newfields =
  647|  27.2k|            (TIFFField **)_TIFFCheckMalloc(tif, n, sizeof(TIFFField *), reason);
  648|  27.2k|    }
  649|   297k|    if (!tif_newfields)
  ------------------
  |  Branch (649:9): [True: 0, False: 297k]
  ------------------
  650|      0|    {
  651|      0|        TIFFErrorExtR(tif, module, "Failed to allocate fields array");
  652|      0|        return 0;
  653|      0|    }
  654|   297k|    tif->tif_fields = tif_newfields;
  655|       |
  656|       |    /* tp = tif->tif_fields + tif->tif_nfields; */
  657|  4.78M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (657:17): [True: 4.48M, False: 297k]
  ------------------
  658|  4.48M|    {
  659|  4.48M|        const TIFFField *fip = TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
  ------------------
  |  |  389|  4.48M|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  660|       |
  661|       |        /* only add definitions that aren't already present */
  662|  4.48M|        if (!fip)
  ------------------
  |  Branch (662:13): [True: 4.48M, False: 0]
  ------------------
  663|  4.48M|        {
  664|  4.48M|            tif->tif_fields[tif->tif_nfields] = (TIFFField *)(info + i);
  665|  4.48M|            tif->tif_nfields++;
  666|  4.48M|        }
  667|  4.48M|    }
  668|       |
  669|       |    /* Sort the field info by tag number */
  670|   297k|    qsort(tif->tif_fields, tif->tif_nfields, sizeof(TIFFField *), tagCompare);
  671|       |
  672|   297k|    return (int)n;
  673|   297k|}
TIFFDataWidth:
  695|   257k|{
  696|   257k|    switch (type)
  697|   257k|    {
  698|  2.47k|        case 0: /* nothing */
  ------------------
  |  Branch (698:9): [True: 2.47k, False: 255k]
  ------------------
  699|  69.7k|        case TIFF_BYTE:
  ------------------
  |  Branch (699:9): [True: 67.3k, False: 190k]
  ------------------
  700|   131k|        case TIFF_ASCII:
  ------------------
  |  Branch (700:9): [True: 61.3k, False: 196k]
  ------------------
  701|   137k|        case TIFF_SBYTE:
  ------------------
  |  Branch (701:9): [True: 6.71k, False: 250k]
  ------------------
  702|   139k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (702:9): [True: 2.04k, False: 255k]
  ------------------
  703|   139k|            return 1;
  704|  60.0k|        case TIFF_SHORT:
  ------------------
  |  Branch (704:9): [True: 60.0k, False: 197k]
  ------------------
  705|  64.5k|        case TIFF_SSHORT:
  ------------------
  |  Branch (705:9): [True: 4.57k, False: 252k]
  ------------------
  706|  64.5k|            return 2;
  707|  21.8k|        case TIFF_LONG:
  ------------------
  |  Branch (707:9): [True: 21.8k, False: 235k]
  ------------------
  708|  24.4k|        case TIFF_SLONG:
  ------------------
  |  Branch (708:9): [True: 2.61k, False: 254k]
  ------------------
  709|  24.7k|        case TIFF_FLOAT:
  ------------------
  |  Branch (709:9): [True: 351, False: 257k]
  ------------------
  710|  25.3k|        case TIFF_IFD:
  ------------------
  |  Branch (710:9): [True: 539, False: 257k]
  ------------------
  711|  25.3k|            return 4;
  712|  8.23k|        case TIFF_RATIONAL:
  ------------------
  |  Branch (712:9): [True: 8.23k, False: 249k]
  ------------------
  713|  9.26k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (713:9): [True: 1.03k, False: 256k]
  ------------------
  714|  13.1k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (714:9): [True: 3.93k, False: 253k]
  ------------------
  715|  23.0k|        case TIFF_LONG8:
  ------------------
  |  Branch (715:9): [True: 9.87k, False: 247k]
  ------------------
  716|  25.9k|        case TIFF_SLONG8:
  ------------------
  |  Branch (716:9): [True: 2.86k, False: 254k]
  ------------------
  717|  27.1k|        case TIFF_IFD8:
  ------------------
  |  Branch (717:9): [True: 1.25k, False: 256k]
  ------------------
  718|  27.1k|            return 8;
  719|    538|        default:
  ------------------
  |  Branch (719:9): [True: 538, False: 257k]
  ------------------
  720|    538|            return 0; /* will return 0 for unknown types */
  721|   257k|    }
  722|   257k|}
TIFFFieldSetGetSize:
  731|  42.4k|{
  732|       |    /*
  733|       |     * TIFFSetField() and TIFFGetField() must provide the parameter accordingly
  734|       |     * to the definition of "set_get_field_type" of the tag definition in
  735|       |     * dir_info.c. This function returns the data size for that purpose.
  736|       |     *
  737|       |     * Furthermore, this data size is also used for the internal storage,
  738|       |     * even for TIFF_RATIONAL values for FIELD_CUSTOM, which are stored
  739|       |     * internally as 4-byte float, but some of them should be stored internally
  740|       |     * as 8-byte double, depending on the "set_get_field_type" _FLOAT_ or
  741|       |     * _DOUBLE_.
  742|       |     */
  743|  42.4k|    if (fip == NULL)
  ------------------
  |  Branch (743:9): [True: 0, False: 42.4k]
  ------------------
  744|      0|        return 0;
  745|       |
  746|  42.4k|    switch (fip->set_get_field_type)
  747|  42.4k|    {
  748|      0|        case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (748:9): [True: 0, False: 42.4k]
  ------------------
  749|    773|        case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (749:9): [True: 773, False: 41.6k]
  ------------------
  750|    773|        case TIFF_SETGET_C0_ASCII:
  ------------------
  |  Branch (750:9): [True: 0, False: 42.4k]
  ------------------
  751|    773|        case TIFF_SETGET_C16_ASCII:
  ------------------
  |  Branch (751:9): [True: 0, False: 42.4k]
  ------------------
  752|  26.0k|        case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (752:9): [True: 25.2k, False: 17.1k]
  ------------------
  753|  26.0k|        case TIFF_SETGET_OTHER:
  ------------------
  |  Branch (753:9): [True: 0, False: 42.4k]
  ------------------
  754|  26.0k|            return 1;
  755|     63|        case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (755:9): [True: 63, False: 42.3k]
  ------------------
  756|     63|        case TIFF_SETGET_SINT8:
  ------------------
  |  Branch (756:9): [True: 0, False: 42.4k]
  ------------------
  757|     77|        case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (757:9): [True: 14, False: 42.3k]
  ------------------
  758|     77|        case TIFF_SETGET_C0_SINT8:
  ------------------
  |  Branch (758:9): [True: 0, False: 42.4k]
  ------------------
  759|    102|        case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (759:9): [True: 25, False: 42.3k]
  ------------------
  760|    102|        case TIFF_SETGET_C16_SINT8:
  ------------------
  |  Branch (760:9): [True: 0, False: 42.4k]
  ------------------
  761|  3.94k|        case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (761:9): [True: 3.84k, False: 38.5k]
  ------------------
  762|  4.19k|        case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (762:9): [True: 251, False: 42.1k]
  ------------------
  763|  4.19k|            return 1;
  764|    119|        case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (764:9): [True: 119, False: 42.2k]
  ------------------
  765|    119|        case TIFF_SETGET_SINT16:
  ------------------
  |  Branch (765:9): [True: 0, False: 42.4k]
  ------------------
  766|    120|        case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (766:9): [True: 1, False: 42.3k]
  ------------------
  767|    120|        case TIFF_SETGET_C0_SINT16:
  ------------------
  |  Branch (767:9): [True: 0, False: 42.4k]
  ------------------
  768|    141|        case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (768:9): [True: 21, False: 42.3k]
  ------------------
  769|    141|        case TIFF_SETGET_C16_SINT16:
  ------------------
  |  Branch (769:9): [True: 0, False: 42.4k]
  ------------------
  770|  7.54k|        case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (770:9): [True: 7.40k, False: 34.9k]
  ------------------
  771|  7.70k|        case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (771:9): [True: 166, False: 42.2k]
  ------------------
  772|  7.70k|            return 2;
  773|      0|        case TIFF_SETGET_INT:
  ------------------
  |  Branch (773:9): [True: 0, False: 42.4k]
  ------------------
  774|     80|        case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (774:9): [True: 80, False: 42.3k]
  ------------------
  775|     80|        case TIFF_SETGET_SINT32:
  ------------------
  |  Branch (775:9): [True: 0, False: 42.4k]
  ------------------
  776|    174|        case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (776:9): [True: 94, False: 42.3k]
  ------------------
  777|    178|        case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (777:9): [True: 4, False: 42.3k]
  ------------------
  778|    208|        case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (778:9): [True: 30, False: 42.3k]
  ------------------
  779|    208|        case TIFF_SETGET_C0_SINT32:
  ------------------
  |  Branch (779:9): [True: 0, False: 42.4k]
  ------------------
  780|    241|        case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (780:9): [True: 33, False: 42.3k]
  ------------------
  781|    393|        case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (781:9): [True: 152, False: 42.2k]
  ------------------
  782|    393|        case TIFF_SETGET_C16_SINT32:
  ------------------
  |  Branch (782:9): [True: 0, False: 42.4k]
  ------------------
  783|    698|        case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (783:9): [True: 305, False: 42.0k]
  ------------------
  784|  1.17k|        case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (784:9): [True: 476, False: 41.9k]
  ------------------
  785|  1.29k|        case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (785:9): [True: 117, False: 42.2k]
  ------------------
  786|  2.06k|        case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (786:9): [True: 770, False: 41.6k]
  ------------------
  787|  2.06k|            return 4;
  788|    141|        case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (788:9): [True: 141, False: 42.2k]
  ------------------
  789|    141|        case TIFF_SETGET_SINT64:
  ------------------
  |  Branch (789:9): [True: 0, False: 42.4k]
  ------------------
  790|    156|        case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (790:9): [True: 15, False: 42.3k]
  ------------------
  791|    222|        case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (791:9): [True: 66, False: 42.3k]
  ------------------
  792|    222|        case TIFF_SETGET_C0_UINT64:
  ------------------
  |  Branch (792:9): [True: 0, False: 42.4k]
  ------------------
  793|    222|        case TIFF_SETGET_C0_SINT64:
  ------------------
  |  Branch (793:9): [True: 0, False: 42.4k]
  ------------------
  794|    222|        case TIFF_SETGET_C0_DOUBLE:
  ------------------
  |  Branch (794:9): [True: 0, False: 42.4k]
  ------------------
  795|    222|        case TIFF_SETGET_C0_IFD8:
  ------------------
  |  Branch (795:9): [True: 0, False: 42.4k]
  ------------------
  796|    222|        case TIFF_SETGET_C16_UINT64:
  ------------------
  |  Branch (796:9): [True: 0, False: 42.4k]
  ------------------
  797|    222|        case TIFF_SETGET_C16_SINT64:
  ------------------
  |  Branch (797:9): [True: 0, False: 42.4k]
  ------------------
  798|    222|        case TIFF_SETGET_C16_DOUBLE:
  ------------------
  |  Branch (798:9): [True: 0, False: 42.4k]
  ------------------
  799|    222|        case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (799:9): [True: 0, False: 42.4k]
  ------------------
  800|    432|        case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (800:9): [True: 210, False: 42.1k]
  ------------------
  801|    831|        case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (801:9): [True: 399, False: 42.0k]
  ------------------
  802|  2.19k|        case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (802:9): [True: 1.36k, False: 41.0k]
  ------------------
  803|  2.37k|        case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (803:9): [True: 180, False: 42.2k]
  ------------------
  804|  2.37k|            return 8;
  805|      0|        default:
  ------------------
  |  Branch (805:9): [True: 0, False: 42.4k]
  ------------------
  806|      0|            return 0;
  807|  42.4k|    }
  808|  42.4k|} /*-- TIFFFieldSetGetSize() --- */
TIFFFindField:
  881|  6.24M|{
  882|  6.24M|    TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0,   TIFF_SETGET_UNDEFINED,
  883|  6.24M|                     0, 0, 0, NULL,        NULL};
  884|  6.24M|    TIFFField *pkey = &key;
  885|  6.24M|    const TIFFField **ret;
  886|  6.24M|    if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
  ------------------
  |  Branch (886:9): [True: 1.68M, False: 4.56M]
  |  Branch (886:32): [True: 1.21M, False: 466k]
  ------------------
  887|  1.21M|        (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
  ------------------
  |  |  389|  2.43M|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  |  Branch (887:10): [True: 1.21M, False: 0]
  |  Branch (887:28): [True: 0, False: 0]
  ------------------
  888|  1.21M|        return tif->tif_foundfield;
  889|       |
  890|       |    /* If we are invoked with no field information, then just return. */
  891|  5.02M|    if (!tif->tif_fields)
  ------------------
  |  Branch (891:9): [True: 0, False: 5.02M]
  ------------------
  892|      0|        return NULL;
  893|       |
  894|       |    /* NB: use sorted search (e.g. binary search) */
  895|       |
  896|  5.02M|    key.field_tag = tag;
  897|  5.02M|    key.field_type = dt;
  898|       |
  899|  5.02M|    ret = (const TIFFField **)bsearch(&pkey, tif->tif_fields, tif->tif_nfields,
  900|  5.02M|                                      sizeof(TIFFField *), tagCompare);
  901|  5.02M|    return tif->tif_foundfield = (ret ? *ret : NULL);
  ------------------
  |  Branch (901:35): [True: 543k, False: 4.48M]
  ------------------
  902|  5.02M|}
TIFFFieldWithTag:
  933|   270k|{
  934|   270k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  389|   270k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  935|   270k|    if (!fip)
  ------------------
  |  Branch (935:9): [True: 0, False: 270k]
  ------------------
  936|      0|    {
  937|      0|        if (tif->tif_warn_about_unknown_tags)
  ------------------
  |  Branch (937:13): [True: 0, False: 0]
  ------------------
  938|      0|        {
  939|      0|            TIFFWarningExtR(tif, "TIFFFieldWithTag",
  940|      0|                            "Warning, unknown tag 0x%x", (unsigned int)tag);
  941|      0|        }
  942|      0|    }
  943|   270k|    return (fip);
  944|   270k|}
TIFFFieldIsAnonymous:
  973|  3.05M|{
  974|  3.05M|    return (int)fip->field_anonymous;
  975|  3.05M|}
_TIFFCreateAnonField:
  996|   250k|{
  997|   250k|    TIFFField *fld;
  998|   250k|    (void)tif;
  999|       |
 1000|   250k|    fld = (TIFFField *)_TIFFmallocExt(tif, sizeof(TIFFField));
 1001|   250k|    if (fld == NULL)
  ------------------
  |  Branch (1001:9): [True: 0, False: 250k]
  ------------------
 1002|      0|        return NULL;
 1003|   250k|    _TIFFmemset(fld, 0, sizeof(TIFFField));
 1004|       |
 1005|   250k|    fld->field_tag = tag;
 1006|   250k|    fld->field_readcount = TIFF_VARIABLE2;
  ------------------
  |  |  392|   250k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
 1007|   250k|    fld->field_writecount = TIFF_VARIABLE2;
  ------------------
  |  |  392|   250k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
 1008|   250k|    fld->field_type = field_type;
 1009|   250k|    fld->field_anonymous =
 1010|   250k|        1; /* indicate that this is an anonymous / unknown tag */
 1011|   250k|    switch (field_type)
 1012|   250k|    {
 1013|  6.48k|        case TIFF_BYTE:
  ------------------
  |  Branch (1013:9): [True: 6.48k, False: 244k]
  ------------------
 1014|  7.14k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1014:9): [True: 662, False: 249k]
  ------------------
 1015|  7.14k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT8;
 1016|  7.14k|            break;
 1017|  33.7k|        case TIFF_ASCII:
  ------------------
  |  Branch (1017:9): [True: 33.7k, False: 216k]
  ------------------
 1018|  33.7k|            fld->set_get_field_type = TIFF_SETGET_C32_ASCII;
 1019|  33.7k|            break;
 1020|  25.2k|        case TIFF_SHORT:
  ------------------
  |  Branch (1020:9): [True: 25.2k, False: 225k]
  ------------------
 1021|  25.2k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT16;
 1022|  25.2k|            break;
 1023|  8.51k|        case TIFF_LONG:
  ------------------
  |  Branch (1023:9): [True: 8.51k, False: 242k]
  ------------------
 1024|  8.51k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT32;
 1025|  8.51k|            break;
 1026|  7.00k|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1026:9): [True: 7.00k, False: 243k]
  ------------------
 1027|  7.39k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1027:9): [True: 390, False: 250k]
  ------------------
 1028|  7.61k|        case TIFF_FLOAT:
  ------------------
  |  Branch (1028:9): [True: 216, False: 250k]
  ------------------
 1029|  7.61k|            fld->set_get_field_type = TIFF_SETGET_C32_FLOAT;
 1030|  7.61k|            break;
 1031|  1.48k|        case TIFF_SBYTE:
  ------------------
  |  Branch (1031:9): [True: 1.48k, False: 249k]
  ------------------
 1032|  1.48k|            fld->set_get_field_type = TIFF_SETGET_C32_SINT8;
 1033|  1.48k|            break;
 1034|    661|        case TIFF_SSHORT:
  ------------------
  |  Branch (1034:9): [True: 661, False: 249k]
  ------------------
 1035|    661|            fld->set_get_field_type = TIFF_SETGET_C32_SINT16;
 1036|    661|            break;
 1037|    445|        case TIFF_SLONG:
  ------------------
  |  Branch (1037:9): [True: 445, False: 250k]
  ------------------
 1038|    445|            fld->set_get_field_type = TIFF_SETGET_C32_SINT32;
 1039|    445|            break;
 1040|  2.30k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1040:9): [True: 2.30k, False: 248k]
  ------------------
 1041|  2.30k|            fld->set_get_field_type = TIFF_SETGET_C32_DOUBLE;
 1042|  2.30k|            break;
 1043|    174|        case TIFF_IFD:
  ------------------
  |  Branch (1043:9): [True: 174, False: 250k]
  ------------------
 1044|    337|        case TIFF_IFD8:
  ------------------
  |  Branch (1044:9): [True: 163, False: 250k]
  ------------------
 1045|    337|            fld->set_get_field_type = TIFF_SETGET_C32_IFD8;
 1046|    337|            break;
 1047|    521|        case TIFF_LONG8:
  ------------------
  |  Branch (1047:9): [True: 521, False: 250k]
  ------------------
 1048|    521|            fld->set_get_field_type = TIFF_SETGET_C32_UINT64;
 1049|    521|            break;
 1050|    571|        case TIFF_SLONG8:
  ------------------
  |  Branch (1050:9): [True: 571, False: 250k]
  ------------------
 1051|    571|            fld->set_get_field_type = TIFF_SETGET_C32_SINT64;
 1052|    571|            break;
 1053|  16.0k|        case TIFF_NOTYPE:
  ------------------
  |  Branch (1053:9): [True: 16.0k, False: 234k]
  ------------------
 1054|   162k|        default:
  ------------------
  |  Branch (1054:9): [True: 146k, False: 104k]
  ------------------
 1055|   162k|            fld->set_get_field_type = TIFF_SETGET_UNDEFINED;
 1056|   162k|            break;
 1057|   250k|    }
 1058|   250k|    fld->field_bit = FIELD_CUSTOM;
  ------------------
  |  |  394|   250k|#define FIELD_CUSTOM 65
  ------------------
 1059|   250k|    fld->field_oktochange = TRUE;
  ------------------
  |  |   74|   250k|#define TRUE 1
  ------------------
 1060|   250k|    fld->field_passcount = TRUE;
  ------------------
  |  |   74|   250k|#define TRUE 1
  ------------------
 1061|   250k|    char *field_name_buf = (char *)_TIFFmallocExt(tif, 32);
 1062|   250k|    if (field_name_buf == NULL)
  ------------------
  |  Branch (1062:9): [True: 0, False: 250k]
  ------------------
 1063|      0|    {
 1064|      0|        _TIFFfreeExt(tif, fld);
 1065|      0|        return NULL;
 1066|      0|    }
 1067|   250k|    fld->field_subfields = NULL;
 1068|       |
 1069|       |    /*
 1070|       |     * note that this name is a special sign to TIFFClose() and
 1071|       |     * _TIFFSetupFields() to free the field
 1072|       |     * Update:
 1073|       |     *   This special sign is replaced by fld->field_anonymous  flag.
 1074|       |     */
 1075|   250k|    (void)snprintf(field_name_buf, 32, "Tag %d", (int)tag);
 1076|   250k|    fld->field_name = field_name_buf;
 1077|       |
 1078|   250k|    return fld;
 1079|   250k|}
_TIFFCheckFieldIsValidForCodec:
 1353|   290k|{
 1354|       |    /* Filter out non-codec specific tags */
 1355|   290k|    switch (tag)
 1356|   290k|    {
 1357|       |        /* Shared tags */
 1358|  1.11k|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|  1.11k|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1358:9): [True: 1.11k, False: 289k]
  ------------------
 1359|       |        /* JPEG tags */
 1360|  1.98k|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|  1.98k|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (1360:9): [True: 861, False: 289k]
  ------------------
 1361|       |        /* OJPEG tags */
 1362|  3.58k|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|  3.58k|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (1362:9): [True: 1.60k, False: 288k]
  ------------------
 1363|  3.90k|        case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|  3.90k|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (1363:9): [True: 314, False: 289k]
  ------------------
 1364|  5.30k|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|  5.30k|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (1364:9): [True: 1.40k, False: 288k]
  ------------------
 1365|  6.58k|        case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|  6.58k|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (1365:9): [True: 1.27k, False: 289k]
  ------------------
 1366|  7.75k|        case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|  7.75k|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (1366:9): [True: 1.16k, False: 289k]
  ------------------
 1367|  8.82k|        case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|  8.82k|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (1367:9): [True: 1.07k, False: 289k]
  ------------------
 1368|  8.89k|        case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|  8.89k|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (1368:9): [True: 70, False: 290k]
  ------------------
 1369|       |        /* CCITT* */
 1370|  8.91k|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|  8.91k|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1370:9): [True: 21, False: 290k]
  ------------------
 1371|  8.93k|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|  8.93k|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1371:9): [True: 25, False: 290k]
  ------------------
 1372|  9.24k|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|  9.24k|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1372:9): [True: 306, False: 289k]
  ------------------
 1373|  10.4k|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|  10.4k|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1373:9): [True: 1.24k, False: 289k]
  ------------------
 1374|  10.8k|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|  10.8k|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1374:9): [True: 329, False: 289k]
  ------------------
 1375|       |        /* LERC */
 1376|  10.8k|        case TIFFTAG_LERC_PARAMETERS:
  ------------------
  |  |  502|  10.8k|#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
  ------------------
  |  Branch (1376:9): [True: 8, False: 290k]
  ------------------
 1377|  10.8k|            break;
 1378|   279k|        default:
  ------------------
  |  Branch (1378:9): [True: 279k, False: 10.8k]
  ------------------
 1379|   279k|            return 1;
 1380|   290k|    }
 1381|  10.8k|    if (!TIFFIsCODECConfigured(tif->tif_dir.td_compression))
  ------------------
  |  Branch (1381:9): [True: 188, False: 10.6k]
  ------------------
 1382|    188|    {
 1383|    188|        return 0;
 1384|    188|    }
 1385|       |    /* Check if codec specific tags are allowed for the current
 1386|       |     * compression scheme (codec) */
 1387|  10.6k|    switch (tif->tif_dir.td_compression)
 1388|  10.6k|    {
 1389|    374|        case COMPRESSION_LZW:
  ------------------
  |  |  188|    374|#define COMPRESSION_LZW 5             /* Lempel-Ziv  & Welch */
  ------------------
  |  Branch (1389:9): [True: 374, False: 10.2k]
  ------------------
 1390|    374|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    374|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1390:17): [True: 294, False: 80]
  ------------------
 1391|    294|                return 1;
 1392|     80|            break;
 1393|     80|        case COMPRESSION_PACKBITS:
  ------------------
  |  |  195|      9|#define COMPRESSION_PACKBITS 32773    /* Macintosh RLE */
  ------------------
  |  Branch (1393:9): [True: 9, False: 10.6k]
  ------------------
 1394|       |            /* No codec-specific tags */
 1395|      9|            break;
 1396|     10|        case COMPRESSION_THUNDERSCAN:
  ------------------
  |  |  196|     10|#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
  ------------------
  |  Branch (1396:9): [True: 10, False: 10.6k]
  ------------------
 1397|       |            /* No codec-specific tags */
 1398|     10|            break;
 1399|      6|        case COMPRESSION_NEXT:
  ------------------
  |  |  193|      6|#define COMPRESSION_NEXT 32766        /* NeXT 2-bit RLE */
  ------------------
  |  Branch (1399:9): [True: 6, False: 10.6k]
  ------------------
 1400|       |            /* No codec-specific tags */
 1401|      6|            break;
 1402|  2.23k|        case COMPRESSION_JPEG:
  ------------------
  |  |  190|  2.23k|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
  |  Branch (1402:9): [True: 2.23k, False: 8.40k]
  ------------------
 1403|  2.23k|            if (tag == TIFFTAG_JPEGTABLES)
  ------------------
  |  |  346|  2.23k|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (1403:17): [True: 756, False: 1.47k]
  ------------------
 1404|    756|                return 1;
 1405|  1.47k|            break;
 1406|  5.67k|        case COMPRESSION_OJPEG:
  ------------------
  |  |  189|  5.67k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (1406:9): [True: 5.67k, False: 4.95k]
  ------------------
 1407|  5.67k|            switch (tag)
 1408|  5.67k|            {
 1409|  1.42k|                case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|  1.42k|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (1409:17): [True: 1.42k, False: 4.25k]
  ------------------
 1410|  1.67k|                case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|  1.67k|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (1410:17): [True: 249, False: 5.43k]
  ------------------
 1411|  3.03k|                case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|  3.03k|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (1411:17): [True: 1.35k, False: 4.32k]
  ------------------
 1412|  4.22k|                case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|  4.22k|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (1412:17): [True: 1.19k, False: 4.48k]
  ------------------
 1413|  5.35k|                case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|  5.35k|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (1413:17): [True: 1.13k, False: 4.54k]
  ------------------
 1414|  5.46k|                case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|  5.46k|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (1414:17): [True: 107, False: 5.57k]
  ------------------
 1415|  5.49k|                case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|  5.49k|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (1415:17): [True: 36, False: 5.64k]
  ------------------
 1416|  5.49k|                    return 1;
 1417|    181|                default:
  ------------------
  |  Branch (1417:17): [True: 181, False: 5.49k]
  ------------------
 1418|    181|                    break;
 1419|  5.67k|            }
 1420|    181|            break;
 1421|    181|        case COMPRESSION_CCITTRLE:
  ------------------
  |  |  183|     74|#define COMPRESSION_CCITTRLE 2        /* CCITT modified Huffman RLE */
  ------------------
  |  Branch (1421:9): [True: 74, False: 10.5k]
  ------------------
 1422|     97|        case COMPRESSION_CCITTRLEW:
  ------------------
  |  |  194|     97|#define COMPRESSION_CCITTRLEW 32771   /* #1 w/ word alignment */
  ------------------
  |  Branch (1422:9): [True: 23, False: 10.6k]
  ------------------
 1423|  1.21k|        case COMPRESSION_CCITTFAX3:
  ------------------
  |  |  184|  1.21k|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1423:9): [True: 1.11k, False: 9.52k]
  ------------------
 1424|  1.36k|        case COMPRESSION_CCITTFAX4:
  ------------------
  |  |  186|  1.36k|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1424:9): [True: 157, False: 10.4k]
  ------------------
 1425|  1.36k|            switch (tag)
 1426|  1.36k|            {
 1427|      9|                case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      9|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1427:17): [True: 9, False: 1.35k]
  ------------------
 1428|     20|                case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|     20|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1428:17): [True: 11, False: 1.35k]
  ------------------
 1429|     33|                case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|     33|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1429:17): [True: 13, False: 1.35k]
  ------------------
 1430|     33|                    return 1;
 1431|  1.03k|                case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|  1.03k|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1431:17): [True: 1.03k, False: 334]
  ------------------
 1432|  1.03k|                    if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  184|  1.03k|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1432:25): [True: 981, False: 52]
  ------------------
 1433|    981|                        return 1;
 1434|     52|                    break;
 1435|     52|                case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|     52|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1435:17): [True: 52, False: 1.31k]
  ------------------
 1436|     52|                    if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
  ------------------
  |  |  186|     52|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1436:25): [True: 33, False: 19]
  ------------------
 1437|     33|                        return 1;
 1438|     19|                    break;
 1439|    249|                default:
  ------------------
  |  Branch (1439:17): [True: 249, False: 1.11k]
  ------------------
 1440|    249|                    break;
 1441|  1.36k|            }
 1442|    320|            break;
 1443|    320|        case COMPRESSION_JBIG:
  ------------------
  |  |  209|      0|#define COMPRESSION_JBIG 34661     /* ISO JBIG */
  ------------------
  |  Branch (1443:9): [True: 0, False: 10.6k]
  ------------------
 1444|       |            /* No codec-specific tags */
 1445|      0|            break;
 1446|     19|        case COMPRESSION_DEFLATE:
  ------------------
  |  |  205|     19|#define COMPRESSION_DEFLATE 32946   /* Deflate compression, legacy tag */
  ------------------
  |  Branch (1446:9): [True: 19, False: 10.6k]
  ------------------
 1447|    161|        case COMPRESSION_ADOBE_DEFLATE:
  ------------------
  |  |  206|    161|#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as recognized by Adobe */
  ------------------
  |  Branch (1447:9): [True: 142, False: 10.4k]
  ------------------
 1448|    161|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    161|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1448:17): [True: 86, False: 75]
  ------------------
 1449|     86|                return 1;
 1450|     75|            break;
 1451|    285|        case COMPRESSION_PIXARLOG:
  ------------------
  |  |  204|    285|#define COMPRESSION_PIXARLOG 32909  /* Pixar companded 11bit ZIP */
  ------------------
  |  Branch (1451:9): [True: 285, False: 10.3k]
  ------------------
 1452|    285|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    285|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1452:17): [True: 229, False: 56]
  ------------------
 1453|    229|                return 1;
 1454|     56|            break;
 1455|     56|        case COMPRESSION_SGILOG:
  ------------------
  |  |  210|     11|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (1455:9): [True: 11, False: 10.6k]
  ------------------
 1456|     23|        case COMPRESSION_SGILOG24:
  ------------------
  |  |  211|     23|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (1456:9): [True: 12, False: 10.6k]
  ------------------
 1457|       |            /* No codec-specific tags */
 1458|     23|            break;
 1459|     74|        case COMPRESSION_LZMA:
  ------------------
  |  |  215|     74|#define COMPRESSION_LZMA 34925             /* LZMA2 */
  ------------------
  |  Branch (1459:9): [True: 74, False: 10.5k]
  ------------------
 1460|     74|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|     74|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1460:17): [True: 8, False: 66]
  ------------------
 1461|      8|                return 1;
 1462|     66|            break;
 1463|     66|        case COMPRESSION_ZSTD:
  ------------------
  |  |  216|      0|#define COMPRESSION_ZSTD 50000             /* ZSTD: WARNING not registered in Adobe-maintained registry */
  ------------------
  |  Branch (1463:9): [True: 0, False: 10.6k]
  ------------------
 1464|      0|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|      0|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1464:17): [True: 0, False: 0]
  ------------------
 1465|      0|                return 1;
 1466|      0|            break;
 1467|      0|        case COMPRESSION_LERC:
  ------------------
  |  |  213|      0|#define COMPRESSION_LERC 34887     /* ESRI Lerc codec: https://github.com/Esri/lerc */
  ------------------
  |  Branch (1467:9): [True: 0, False: 10.6k]
  ------------------
 1468|      0|            if (tag == TIFFTAG_LERC_PARAMETERS)
  ------------------
  |  |  502|      0|#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
  ------------------
  |  Branch (1468:17): [True: 0, False: 0]
  ------------------
 1469|      0|                return 1;
 1470|      0|            break;
 1471|    414|        default:
  ------------------
  |  Branch (1471:9): [True: 414, False: 10.2k]
  ------------------
 1472|    414|            break;
 1473|  10.6k|    }
 1474|  2.71k|    return 0;
 1475|  10.6k|}
tif_dirinfo.c:tagCompare:
  601|   687M|{
  602|   687M|    const TIFFField *ta = *(const TIFFField **)a;
  603|   687M|    const TIFFField *tb = *(const TIFFField **)b;
  604|       |    /* NB: be careful of return values for 16-bit platforms */
  605|   687M|    if (ta->field_tag != tb->field_tag)
  ------------------
  |  Branch (605:9): [True: 686M, False: 543k]
  ------------------
  606|   686M|        return (int)ta->field_tag - (int)tb->field_tag;
  607|   543k|    else
  608|   543k|        return (ta->field_type == TIFF_ANY)
  ------------------
  |  |  389|   543k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  |  Branch (608:16): [True: 543k, False: 0]
  ------------------
  609|   543k|                   ? 0
  610|   543k|                   : ((int)tb->field_type - (int)ta->field_type);
  611|   687M|}

TIFFReadDirectory:
 4336|  27.5k|{
 4337|  27.5k|    static const char module[] = "TIFFReadDirectory";
 4338|  27.5k|    TIFFDirEntry *dir;
 4339|  27.5k|    uint16_t dircount;
 4340|  27.5k|    TIFFDirEntry *dp;
 4341|  27.5k|    uint16_t di;
 4342|  27.5k|    const TIFFField *fip;
 4343|  27.5k|    uint32_t fii = FAILED_FII;
  ------------------
  |  |   44|  27.5k|#define FAILED_FII ((uint32_t)-1)
  ------------------
 4344|  27.5k|    toff_t nextdiroff;
 4345|  27.5k|    int bitspersample_read = FALSE;
  ------------------
  |  |   75|  27.5k|#define FALSE 0
  ------------------
 4346|  27.5k|    int color_channels;
 4347|       |
 4348|  27.5k|    if (tif->tif_nextdiroff == 0)
  ------------------
  |  Branch (4348:9): [True: 1, False: 27.5k]
  ------------------
 4349|      1|    {
 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|      1|        tif->tif_diroff = tif->tif_nextdiroff;
 4354|      1|        return 0;
 4355|      1|    }
 4356|       |
 4357|  27.5k|    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|  27.5k|    if (!_TIFFCheckDirNumberAndOffset(tif,
  ------------------
  |  Branch (4361:9): [True: 0, False: 27.5k]
  ------------------
 4362|  27.5k|                                      tif->tif_curdir ==
  ------------------
  |  Branch (4362:39): [True: 27.5k, False: 0]
  ------------------
 4363|  27.5k|                                              TIFF_NON_EXISTENT_DIR_NUMBER
  ------------------
  |  |   68|  27.5k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
 4364|  27.5k|                                          ? 0
 4365|  27.5k|                                          : tif->tif_curdir + 1,
 4366|  27.5k|                                      nextdiroff))
 4367|      0|    {
 4368|      0|        return 0; /* bad offset (IFD looping or more than TIFF_MAX_DIR_COUNT
 4369|       |                     IFDs) */
 4370|      0|    }
 4371|  27.5k|    dircount = TIFFFetchDirectory(tif, nextdiroff, &dir, &tif->tif_nextdiroff);
 4372|  27.5k|    if (!dircount)
  ------------------
  |  Branch (4372:9): [True: 348, False: 27.2k]
  ------------------
 4373|    348|    {
 4374|    348|        TIFFErrorExtR(tif, module,
 4375|    348|                      "Failed to read directory at offset %" PRIu64,
 4376|    348|                      nextdiroff);
 4377|    348|        return 0;
 4378|    348|    }
 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|  27.2k|    if (tif->tif_curdir == TIFF_NON_EXISTENT_DIR_NUMBER)
  ------------------
  |  |   68|  27.2k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
  |  Branch (4382:9): [True: 27.2k, False: 0]
  ------------------
 4383|  27.2k|        tif->tif_curdir = 0;
 4384|      0|    else
 4385|      0|        tif->tif_curdir++;
 4386|       |
 4387|  27.2k|    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|  27.2k|    {
 4394|  27.2k|        TIFFDirEntry *ma;
 4395|  27.2k|        uint16_t mb;
 4396|   808k|        for (ma = dir, mb = 0; mb < dircount; ma++, mb++)
  ------------------
  |  Branch (4396:32): [True: 780k, False: 27.2k]
  ------------------
 4397|   780k|        {
 4398|   780k|            TIFFDirEntry *na;
 4399|   780k|            uint16_t nb;
 4400|   859M|            for (na = ma + 1, nb = (uint16_t)(mb + 1); nb < dircount;
  ------------------
  |  Branch (4400:56): [True: 858M, False: 780k]
  ------------------
 4401|   858M|                 na++, nb++)
 4402|   858M|            {
 4403|   858M|                if (ma->tdir_tag == na->tdir_tag)
  ------------------
  |  Branch (4403:21): [True: 77.9M, False: 780M]
  ------------------
 4404|  77.9M|                {
 4405|  77.9M|                    na->tdir_ignore = TRUE;
  ------------------
  |  |   74|  77.9M|#define TRUE 1
  ------------------
 4406|  77.9M|                }
 4407|   858M|            }
 4408|   780k|        }
 4409|  27.2k|    }
 4410|       |
 4411|  27.2k|    tif->tif_flags &= ~TIFF_BEENWRITING; /* reset before new dir */
  ------------------
  |  |  128|  27.2k|#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
 4412|  27.2k|    tif->tif_flags &= ~TIFF_BUF4WRITE;   /* reset before new dir */
  ------------------
  |  |  144|  27.2k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 4413|  27.2k|    tif->tif_flags &= ~TIFF_POSTENCODE;  /* reset before new dir */
  ------------------
  |  |  134|  27.2k|#define TIFF_POSTENCODE 0x01000U  /* need call to postencode routine */
  ------------------
 4414|  27.2k|    tif->tif_flags &= ~TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  156|  27.2k|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
 4415|       |
 4416|       |    /* When changing directory, in deferred strile loading mode, we must also
 4417|       |     * unset the TIFF_LAZYSTRILELOAD_DONE bit if it was initially set,
 4418|       |     * to make sure the strile offset/bytecount are read again (when they fit
 4419|       |     * in the tag data area).
 4420|       |     */
 4421|  27.2k|    tif->tif_flags &= ~TIFF_LAZYSTRILELOAD_DONE;
  ------------------
  |  |  152|  27.2k|    0x2000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
 4422|       |
 4423|       |    /* Free any old stuff and reinit i/o and other parameters within
 4424|       |     * TIFFDefaultDirectory() since we are starting on a new directory. */
 4425|  27.2k|    TIFFFreeDirectory(tif);
 4426|  27.2k|    TIFFDefaultDirectory(tif);
 4427|       |
 4428|       |    /* After setup a fresh directory indicate that now active IFD is also
 4429|       |     * present on file, even if its entries could not be read successfully
 4430|       |     * below.  */
 4431|  27.2k|    tif->tif_dir.td_iswrittentofile = TRUE;
  ------------------
  |  |   74|  27.2k|#define TRUE 1
  ------------------
 4432|       |
 4433|       |    /* Allocate arrays for offset values outside IFD entry for IFD data size
 4434|       |     * checking. Note: Counter are reset within TIFFFreeDirectory(). */
 4435|  27.2k|    tif->tif_dir.td_dirdatasize_offsets =
 4436|  27.2k|        (TIFFEntryOffsetAndLength *)_TIFFmallocExt(
 4437|  27.2k|            tif,
 4438|  27.2k|            (tmsize_t)((size_t)dircount * sizeof(TIFFEntryOffsetAndLength)));
 4439|  27.2k|    if (tif->tif_dir.td_dirdatasize_offsets == NULL)
  ------------------
  |  Branch (4439:9): [True: 0, False: 27.2k]
  ------------------
 4440|      0|    {
 4441|      0|        TIFFErrorExtR(
 4442|      0|            tif, module,
 4443|      0|            "Failed to allocate memory for counting IFD data size at reading");
 4444|      0|        goto bad;
 4445|      0|    }
 4446|       |    /*
 4447|       |     * Electronic Arts writes gray-scale TIFF files
 4448|       |     * without a PlanarConfiguration directory entry.
 4449|       |     * Thus we setup a default value here, even though
 4450|       |     * the TIFF spec says there is no default value.
 4451|       |     * After PlanarConfiguration is preset in TIFFDefaultDirectory()
 4452|       |     * the following setting is not needed, but does not harm either.
 4453|       |     */
 4454|  27.2k|    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  ------------------
  |  |  264|  27.2k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
                  TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  ------------------
  |  |  265|  27.2k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 4455|       |    /*
 4456|       |     * Setup default value and then make a pass over
 4457|       |     * the fields to check type and tag information,
 4458|       |     * and to extract info required to size data
 4459|       |     * structures.  A second pass is made afterwards
 4460|       |     * to read in everything not taken in the first pass.
 4461|       |     * But we must process the Compression tag first
 4462|       |     * in order to merge in codec-private tag definitions (otherwise
 4463|       |     * we may get complaints about unknown tags).  However, the
 4464|       |     * Compression tag may be dependent on the SamplesPerPixel
 4465|       |     * tag value because older TIFF specs permitted Compression
 4466|       |     * to be written as a SamplesPerPixel-count tag entry.
 4467|       |     * Thus if we don't first figure out the correct SamplesPerPixel
 4468|       |     * tag value then we may end up ignoring the Compression tag
 4469|       |     * value because it has an incorrect count value (if the
 4470|       |     * true value of SamplesPerPixel is not 1).
 4471|       |     */
 4472|  27.2k|    dp =
 4473|  27.2k|        TIFFReadDirectoryFindEntry(tif, dir, dircount, TIFFTAG_SAMPLESPERPIXEL);
  ------------------
  |  |  257|  27.2k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
 4474|  27.2k|    if (dp)
  ------------------
  |  Branch (4474:9): [True: 6.41k, False: 20.7k]
  ------------------
 4475|  6.41k|    {
 4476|  6.41k|        if (!TIFFFetchNormalTag(tif, dp, 0))
  ------------------
  |  Branch (4476:13): [True: 95, False: 6.32k]
  ------------------
 4477|     95|            goto bad;
 4478|  6.32k|        dp->tdir_ignore = TRUE;
  ------------------
  |  |   74|  6.32k|#define TRUE 1
  ------------------
 4479|  6.32k|    }
 4480|  27.1k|    dp = TIFFReadDirectoryFindEntry(tif, dir, dircount, TIFFTAG_COMPRESSION);
  ------------------
  |  |  181|  27.1k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
 4481|  27.1k|    if (dp)
  ------------------
  |  Branch (4481:9): [True: 17.9k, False: 9.16k]
  ------------------
 4482|  17.9k|    {
 4483|       |        /*
 4484|       |         * The 5.0 spec says the Compression tag has one value, while
 4485|       |         * earlier specs say it has one value per sample.  Because of
 4486|       |         * this, we accept the tag if one value is supplied with either
 4487|       |         * count.
 4488|       |         */
 4489|  17.9k|        uint16_t value;
 4490|  17.9k|        enum TIFFReadDirEntryErr err;
 4491|  17.9k|        err = TIFFReadDirEntryShort(tif, dp, &value);
 4492|  17.9k|        if (err == TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (4492:13): [True: 2.74k, False: 15.2k]
  ------------------
 4493|  2.74k|            err = TIFFReadDirEntryPersampleShort(tif, dp, &value);
 4494|  17.9k|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4494:13): [True: 465, False: 17.4k]
  ------------------
 4495|    465|        {
 4496|    465|            TIFFReadDirEntryOutputErr(tif, err, module, "Compression", 0);
 4497|    465|            goto bad;
 4498|    465|        }
 4499|  17.4k|        if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, value))
  ------------------
  |  |  181|  17.4k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (4499:13): [True: 0, False: 17.4k]
  ------------------
 4500|      0|            goto bad;
 4501|  17.4k|        dp->tdir_ignore = TRUE;
  ------------------
  |  |   74|  17.4k|#define TRUE 1
  ------------------
 4502|  17.4k|    }
 4503|  9.16k|    else
 4504|  9.16k|    {
 4505|  9.16k|        if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE))
  ------------------
  |  |  181|  9.16k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
                      if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE))
  ------------------
  |  |  182|  9.16k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (4505:13): [True: 0, False: 9.16k]
  ------------------
 4506|      0|            goto bad;
 4507|  9.16k|    }
 4508|       |    /*
 4509|       |     * First real pass over the directory.
 4510|       |     */
 4511|   801k|    for (di = 0, dp = dir; di < dircount; di++, dp++)
  ------------------
  |  Branch (4511:28): [True: 775k, False: 25.7k]
  ------------------
 4512|   775k|    {
 4513|   775k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4513:13): [True: 397k, False: 378k]
  ------------------
 4514|   397k|        {
 4515|   397k|            TIFFReadDirectoryFindFieldInfo(tif, dp->tdir_tag, &fii);
 4516|   397k|            if (fii == FAILED_FII)
  ------------------
  |  |   44|   397k|#define FAILED_FII ((uint32_t)-1)
  ------------------
  |  Branch (4516:17): [True: 250k, False: 146k]
  ------------------
 4517|   250k|            {
 4518|   250k|                if (tif->tif_warn_about_unknown_tags)
  ------------------
  |  Branch (4518:21): [True: 0, False: 250k]
  ------------------
 4519|      0|                {
 4520|      0|                    TIFFWarningExtR(tif, module,
 4521|      0|                                    "Unknown field with tag %" PRIu16
 4522|      0|                                    " (0x%" PRIx16 ") encountered",
 4523|      0|                                    dp->tdir_tag, dp->tdir_tag);
 4524|      0|                }
 4525|       |                /* the following knowingly leaks the
 4526|       |                   anonymous field structure */
 4527|   250k|                const TIFFField *fld = _TIFFCreateAnonField(
 4528|   250k|                    tif, dp->tdir_tag, (TIFFDataType)dp->tdir_type);
 4529|   250k|                if (fld == NULL || !_TIFFMergeFields(tif, fld, 1))
  ------------------
  |  Branch (4529:21): [True: 0, False: 250k]
  |  Branch (4529:36): [True: 0, False: 250k]
  ------------------
 4530|      0|                {
 4531|      0|                    TIFFWarningExtR(
 4532|      0|                        tif, module,
 4533|      0|                        "Registering anonymous field with tag %" PRIu16
 4534|      0|                        " (0x%" PRIx16 ") failed",
 4535|      0|                        dp->tdir_tag, dp->tdir_tag);
 4536|      0|                    dp->tdir_ignore = TRUE;
  ------------------
  |  |   74|      0|#define TRUE 1
  ------------------
 4537|      0|                }
 4538|   250k|                else
 4539|   250k|                {
 4540|   250k|                    TIFFReadDirectoryFindFieldInfo(tif, dp->tdir_tag, &fii);
 4541|   250k|                    assert(fii != FAILED_FII);
  ------------------
  |  Branch (4541:21): [True: 0, False: 250k]
  |  Branch (4541:21): [True: 250k, False: 0]
  ------------------
 4542|   250k|                }
 4543|   250k|            }
 4544|   397k|        }
 4545|   775k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4545:13): [True: 397k, False: 378k]
  ------------------
 4546|   397k|        {
 4547|   397k|            fip = tif->tif_fields[fii];
 4548|   397k|            if (fip->field_bit == FIELD_IGNORE)
  ------------------
  |  |  209|   397k|#define FIELD_IGNORE 0
  ------------------
  |  Branch (4548:17): [True: 1.32k, False: 396k]
  ------------------
 4549|  1.32k|                dp->tdir_ignore = TRUE;
  ------------------
  |  |   74|  1.32k|#define TRUE 1
  ------------------
 4550|   396k|            else
 4551|   396k|            {
 4552|   396k|                switch (dp->tdir_tag)
 4553|   396k|                {
 4554|  12.0k|                    case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|  12.0k|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (4554:21): [True: 12.0k, False: 384k]
  ------------------
 4555|  20.7k|                    case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|  20.7k|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (4555:21): [True: 8.72k, False: 387k]
  ------------------
 4556|  28.4k|                    case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|  28.4k|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (4556:21): [True: 7.66k, False: 388k]
  ------------------
 4557|  33.9k|                    case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|  33.9k|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (4557:21): [True: 5.47k, False: 390k]
  ------------------
 4558|  33.9k|                        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  268|  33.9k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|  33.9k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|  33.9k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 4559|  33.9k|                        break;
 4560|  21.3k|                    case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  21.3k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (4560:21): [True: 21.3k, False: 374k]
  ------------------
 4561|  41.8k|                    case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  41.8k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (4561:21): [True: 20.5k, False: 375k]
  ------------------
 4562|  41.8k|                    case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|  41.8k|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (4562:21): [True: 54, False: 396k]
  ------------------
 4563|  47.8k|                    case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  47.8k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (4563:21): [True: 5.98k, False: 390k]
  ------------------
 4564|  58.3k|                    case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  58.3k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (4564:21): [True: 10.5k, False: 385k]
  ------------------
 4565|  58.4k|                    case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|  58.4k|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (4565:21): [True: 135, False: 396k]
  ------------------
 4566|  60.6k|                    case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  60.6k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (4566:21): [True: 2.17k, False: 394k]
  ------------------
 4567|  71.2k|                    case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  71.2k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (4567:21): [True: 10.5k, False: 385k]
  ------------------
 4568|  71.9k|                    case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|  71.9k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (4568:21): [True: 693, False: 395k]
  ------------------
 4569|  71.9k|                        if (!TIFFFetchNormalTag(tif, dp, 0))
  ------------------
  |  Branch (4569:29): [True: 914, False: 71.0k]
  ------------------
 4570|    914|                            goto bad;
 4571|  71.0k|                        dp->tdir_ignore = TRUE;
  ------------------
  |  |   74|  71.0k|#define TRUE 1
  ------------------
 4572|  71.0k|                        break;
 4573|   290k|                    default:
  ------------------
  |  Branch (4573:21): [True: 290k, False: 105k]
  ------------------
 4574|   290k|                        if (!_TIFFCheckFieldIsValidForCodec(tif, dp->tdir_tag))
  ------------------
  |  Branch (4574:29): [True: 2.90k, False: 287k]
  ------------------
 4575|  2.90k|                            dp->tdir_ignore = TRUE;
  ------------------
  |  |   74|  2.90k|#define TRUE 1
  ------------------
 4576|   290k|                        break;
 4577|   396k|                }
 4578|   396k|            }
 4579|   397k|        }
 4580|   775k|    }
 4581|       |    /*
 4582|       |     * XXX: OJPEG hack.
 4583|       |     * If a) compression is OJPEG, b) planarconfig tag says it's separate,
 4584|       |     * c) strip offsets/bytecounts tag are both present and
 4585|       |     * d) both contain exactly one value, then we consistently find
 4586|       |     * that the buggy implementation of the buggy compression scheme
 4587|       |     * matches contig planarconfig best. So we 'fix-up' the tag here
 4588|       |     */
 4589|  25.7k|    if ((tif->tif_dir.td_compression == COMPRESSION_OJPEG) &&
  ------------------
  |  |  189|  25.7k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (4589:9): [True: 3.18k, False: 22.5k]
  ------------------
 4590|  3.18k|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE))
  ------------------
  |  |  266|  3.18k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (4590:9): [True: 871, False: 2.31k]
  ------------------
 4591|    871|    {
 4592|    871|        if (!_TIFFFillStriles(tif))
  ------------------
  |  Branch (4592:13): [True: 0, False: 871]
  ------------------
 4593|      0|            goto bad;
 4594|    871|        dp = TIFFReadDirectoryFindEntry(tif, dir, dircount,
 4595|    871|                                        TIFFTAG_STRIPOFFSETS);
  ------------------
  |  |  247|    871|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
 4596|    871|        if ((dp != 0) && (dp->tdir_count == 1))
  ------------------
  |  Branch (4596:13): [True: 850, False: 21]
  |  Branch (4596:26): [True: 48, False: 802]
  ------------------
 4597|     48|        {
 4598|     48|            dp = TIFFReadDirectoryFindEntry(tif, dir, dircount,
 4599|     48|                                            TIFFTAG_STRIPBYTECOUNTS);
  ------------------
  |  |  259|     48|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
 4600|     48|            if ((dp != 0) && (dp->tdir_count == 1))
  ------------------
  |  Branch (4600:17): [True: 25, False: 23]
  |  Branch (4600:30): [True: 8, False: 17]
  ------------------
 4601|      8|            {
 4602|      8|                tif->tif_dir.td_planarconfig = PLANARCONFIG_CONTIG;
  ------------------
  |  |  265|      8|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 4603|      8|                TIFFWarningExtR(tif, module,
 4604|      8|                                "Planarconfig tag value assumed incorrect, "
 4605|      8|                                "assuming data is contig instead of chunky");
 4606|      8|            }
 4607|     48|        }
 4608|    871|    }
 4609|       |    /*
 4610|       |     * Allocate directory structure and setup defaults.
 4611|       |     */
 4612|  25.7k|    if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS))
  ------------------
  |  |  267|  25.7k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  25.7k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  25.7k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4612:9): [True: 587, False: 25.1k]
  ------------------
 4613|    587|    {
 4614|    587|        MissingRequired(tif, "ImageLength");
 4615|    587|        goto bad;
 4616|    587|    }
 4617|       |
 4618|       |    /*
 4619|       |     * Second pass: extract other information.
 4620|       |     */
 4621|   790k|    for (di = 0, dp = dir; di < dircount; di++, dp++)
  ------------------
  |  Branch (4621:28): [True: 765k, False: 24.9k]
  ------------------
 4622|   765k|    {
 4623|   765k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4623:13): [True: 315k, False: 449k]
  ------------------
 4624|   315k|        {
 4625|   315k|            switch (dp->tdir_tag)
 4626|   315k|            {
 4627|     28|                case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|     28|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (4627:17): [True: 28, False: 315k]
  ------------------
 4628|     68|                case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|     68|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (4628:17): [True: 40, False: 315k]
  ------------------
 4629|  8.86k|                case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  8.86k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4629:17): [True: 8.79k, False: 306k]
  ------------------
 4630|  8.99k|                case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|  8.99k|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (4630:17): [True: 123, False: 315k]
  ------------------
 4631|  9.73k|                case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|  9.73k|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (4631:17): [True: 742, False: 314k]
  ------------------
 4632|       |                    /*
 4633|       |                     * The MinSampleValue, MaxSampleValue, BitsPerSample
 4634|       |                     * DataType and SampleFormat tags are supposed to be
 4635|       |                     * written as one value/sample, but some vendors
 4636|       |                     * incorrectly write one value only -- so we accept
 4637|       |                     * that as well (yuck). Other vendors write correct
 4638|       |                     * value for NumberOfSamples, but incorrect one for
 4639|       |                     * BitsPerSample and friends, and we will read this
 4640|       |                     * too.
 4641|       |                     */
 4642|  9.73k|                    {
 4643|  9.73k|                        uint16_t value;
 4644|  9.73k|                        enum TIFFReadDirEntryErr err;
 4645|  9.73k|                        err = TIFFReadDirEntryShort(tif, dp, &value);
 4646|  9.73k|                        if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4646:29): [True: 2, False: 9.73k]
  ------------------
 4647|      2|                            goto bad;
 4648|  9.73k|                        if (err == TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (4648:29): [True: 1.77k, False: 7.95k]
  ------------------
 4649|  1.77k|                            err =
 4650|  1.77k|                                TIFFReadDirEntryPersampleShort(tif, dp, &value);
 4651|  9.73k|                        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4651:29): [True: 84, False: 9.64k]
  ------------------
 4652|     84|                        {
 4653|     84|                            fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4654|     84|                            TIFFReadDirEntryOutputErr(
 4655|     84|                                tif, err, module,
 4656|     84|                                fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (4656:33): [True: 84, False: 0]
  ------------------
 4657|     84|                            goto bad;
 4658|     84|                        }
 4659|  9.64k|                        if (!TIFFSetField(tif, dp->tdir_tag, value))
  ------------------
  |  Branch (4659:29): [True: 13, False: 9.63k]
  ------------------
 4660|     13|                            goto bad;
 4661|  9.63k|                        if (dp->tdir_tag == TIFFTAG_BITSPERSAMPLE)
  ------------------
  |  |  180|  9.63k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4661:29): [True: 8.76k, False: 867]
  ------------------
 4662|  8.76k|                            bitspersample_read = TRUE;
  ------------------
  |  |   74|  8.76k|#define TRUE 1
  ------------------
 4663|  9.63k|                    }
 4664|      0|                    break;
 4665|    375|                case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|    375|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (4665:17): [True: 375, False: 315k]
  ------------------
 4666|    567|                case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|    567|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (4666:17): [True: 192, False: 315k]
  ------------------
 4667|    567|                {
 4668|       |
 4669|    567|                    double *data = NULL;
 4670|    567|                    enum TIFFReadDirEntryErr err;
 4671|    567|                    uint32_t saved_flags;
 4672|    567|                    int m;
 4673|    567|                    if (dp->tdir_count !=
  ------------------
  |  Branch (4673:25): [True: 107, False: 460]
  ------------------
 4674|    567|                        (uint64_t)tif->tif_dir.td_samplesperpixel)
 4675|    107|                        err = TIFFReadDirEntryErrCount;
 4676|    460|                    else
 4677|    460|                        err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 4678|    567|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4678:25): [True: 5, False: 562]
  ------------------
 4679|      5|                        goto bad;
 4680|    562|                    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4680:25): [True: 111, False: 451]
  ------------------
 4681|    111|                    {
 4682|    111|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4683|    111|                        TIFFReadDirEntryOutputErr(
 4684|    111|                            tif, err, module,
 4685|    111|                            fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (4685:29): [True: 111, False: 0]
  ------------------
 4686|    111|                        goto bad;
 4687|    111|                    }
 4688|    451|                    saved_flags = tif->tif_flags;
 4689|    451|                    tif->tif_flags |= TIFF_PERSAMPLE;
  ------------------
  |  |  146|    451|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
 4690|    451|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 4691|    451|                    tif->tif_flags = saved_flags;
 4692|    451|                    _TIFFfreeExt(tif, data);
 4693|    451|                    if (!m)
  ------------------
  |  Branch (4693:25): [True: 0, False: 451]
  ------------------
 4694|      0|                        goto bad;
 4695|    451|                }
 4696|    451|                break;
 4697|  12.0k|                case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|  12.0k|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (4697:17): [True: 12.0k, False: 303k]
  ------------------
 4698|  19.6k|                case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|  19.6k|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (4698:17): [True: 7.65k, False: 307k]
  ------------------
 4699|  19.6k|                {
 4700|  19.6k|                    switch (dp->tdir_type)
 4701|  19.6k|                    {
 4702|    225|                        case TIFF_SHORT:
  ------------------
  |  Branch (4702:25): [True: 225, False: 19.4k]
  ------------------
 4703|  4.19k|                        case TIFF_LONG:
  ------------------
  |  Branch (4703:25): [True: 3.96k, False: 15.7k]
  ------------------
 4704|  5.90k|                        case TIFF_LONG8:
  ------------------
  |  Branch (4704:25): [True: 1.71k, False: 17.9k]
  ------------------
 4705|  5.90k|                            break;
 4706|  13.7k|                        default:
  ------------------
  |  Branch (4706:25): [True: 13.7k, False: 5.90k]
  ------------------
 4707|       |                            /* Warn except if directory typically created with
 4708|       |                             * TIFFDeferStrileArrayWriting() */
 4709|  13.7k|                            if (!(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4709:35): [True: 0, False: 13.7k]
  ------------------
 4710|      0|                                  dp->tdir_count == 0 && dp->tdir_type == 0 &&
  ------------------
  |  Branch (4710:35): [True: 0, False: 0]
  |  Branch (4710:58): [True: 0, False: 0]
  ------------------
 4711|      0|                                  dp->tdir_offset.toff_long8 == 0))
  ------------------
  |  Branch (4711:35): [True: 0, False: 0]
  ------------------
 4712|  13.7k|                            {
 4713|  13.7k|                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4714|  13.7k|                                TIFFWarningExtR(
 4715|  13.7k|                                    tif, module, "Invalid data type for tag %s",
 4716|  13.7k|                                    fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4716:37): [True: 13.7k, False: 0]
  ------------------
 4717|  13.7k|                            }
 4718|  13.7k|                            break;
 4719|  19.6k|                    }
 4720|  19.6k|                    _TIFFmemcpy(&(tif->tif_dir.td_stripoffset_entry), dp,
 4721|  19.6k|                                sizeof(TIFFDirEntry));
 4722|  19.6k|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4722:25): [True: 2, False: 19.6k]
  ------------------
 4723|      2|                        goto bad;
 4724|  19.6k|                }
 4725|  19.6k|                break;
 4726|  19.6k|                case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|  8.70k|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (4726:17): [True: 8.70k, False: 306k]
  ------------------
 4727|  14.1k|                case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|  14.1k|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (4727:17): [True: 5.47k, False: 310k]
  ------------------
 4728|  14.1k|                {
 4729|  14.1k|                    switch (dp->tdir_type)
 4730|  14.1k|                    {
 4731|  1.18k|                        case TIFF_SHORT:
  ------------------
  |  Branch (4731:25): [True: 1.18k, False: 12.9k]
  ------------------
 4732|  2.54k|                        case TIFF_LONG:
  ------------------
  |  Branch (4732:25): [True: 1.36k, False: 12.8k]
  ------------------
 4733|  4.67k|                        case TIFF_LONG8:
  ------------------
  |  Branch (4733:25): [True: 2.13k, False: 12.0k]
  ------------------
 4734|  4.67k|                            break;
 4735|  9.49k|                        default:
  ------------------
  |  Branch (4735:25): [True: 9.49k, False: 4.67k]
  ------------------
 4736|       |                            /* Warn except if directory typically created with
 4737|       |                             * TIFFDeferStrileArrayWriting() */
 4738|  9.49k|                            if (!(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4738:35): [True: 0, False: 9.49k]
  ------------------
 4739|      0|                                  dp->tdir_count == 0 && dp->tdir_type == 0 &&
  ------------------
  |  Branch (4739:35): [True: 0, False: 0]
  |  Branch (4739:58): [True: 0, False: 0]
  ------------------
 4740|      0|                                  dp->tdir_offset.toff_long8 == 0))
  ------------------
  |  Branch (4740:35): [True: 0, False: 0]
  ------------------
 4741|  9.49k|                            {
 4742|  9.49k|                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4743|  9.49k|                                TIFFWarningExtR(
 4744|  9.49k|                                    tif, module, "Invalid data type for tag %s",
 4745|  9.49k|                                    fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4745:37): [True: 9.49k, False: 0]
  ------------------
 4746|  9.49k|                            }
 4747|  9.49k|                            break;
 4748|  14.1k|                    }
 4749|  14.1k|                    _TIFFmemcpy(&(tif->tif_dir.td_stripbytecount_entry), dp,
 4750|  14.1k|                                sizeof(TIFFDirEntry));
 4751|  14.1k|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4751:25): [True: 1, False: 14.1k]
  ------------------
 4752|      1|                        goto bad;
 4753|  14.1k|                }
 4754|  14.1k|                break;
 4755|  14.1k|                case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|    437|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (4755:17): [True: 437, False: 315k]
  ------------------
 4756|    797|                case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|    797|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (4756:17): [True: 360, False: 315k]
  ------------------
 4757|    797|                {
 4758|    797|                    enum TIFFReadDirEntryErr err;
 4759|    797|                    uint32_t countpersample;
 4760|    797|                    uint32_t countrequired;
 4761|    797|                    uint32_t incrementpersample;
 4762|    797|                    uint16_t *value = NULL;
 4763|       |                    /* It would be dangerous to instantiate those tag values */
 4764|       |                    /* since if td_bitspersample has not yet been read (due to
 4765|       |                     */
 4766|       |                    /* unordered tags), it could be read afterwards with a */
 4767|       |                    /* values greater than the default one (1), which may cause
 4768|       |                     */
 4769|       |                    /* crashes in user code */
 4770|    797|                    if (!bitspersample_read)
  ------------------
  |  Branch (4770:25): [True: 391, False: 406]
  ------------------
 4771|    391|                    {
 4772|    391|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4773|    391|                        TIFFWarningExtR(
 4774|    391|                            tif, module,
 4775|    391|                            "Ignoring %s since BitsPerSample tag not found",
 4776|    391|                            fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4776:29): [True: 391, False: 0]
  ------------------
 4777|    391|                        continue;
 4778|    391|                    }
 4779|       |                    /* ColorMap or TransferFunction for high bit */
 4780|       |                    /* depths do not make much sense and could be */
 4781|       |                    /* used as a denial of service vector */
 4782|    406|                    if (tif->tif_dir.td_bitspersample > 24)
  ------------------
  |  Branch (4782:25): [True: 23, False: 383]
  ------------------
 4783|     23|                    {
 4784|     23|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4785|     23|                        TIFFWarningExtR(
 4786|     23|                            tif, module,
 4787|     23|                            "Ignoring %s because BitsPerSample=%" PRIu16 ">24",
 4788|     23|                            fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (4788:29): [True: 23, False: 0]
  ------------------
 4789|     23|                            tif->tif_dir.td_bitspersample);
 4790|     23|                        continue;
 4791|     23|                    }
 4792|    383|                    countpersample = (1U << tif->tif_dir.td_bitspersample);
 4793|    383|                    if ((dp->tdir_tag == TIFFTAG_TRANSFERFUNCTION) &&
  ------------------
  |  |  298|    383|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (4793:25): [True: 155, False: 228]
  ------------------
 4794|    155|                        (dp->tdir_count == (uint64_t)countpersample))
  ------------------
  |  Branch (4794:25): [True: 6, False: 149]
  ------------------
 4795|      6|                    {
 4796|      6|                        countrequired = countpersample;
 4797|      6|                        incrementpersample = 0;
 4798|      6|                    }
 4799|    377|                    else
 4800|    377|                    {
 4801|    377|                        countrequired = 3 * countpersample;
 4802|    377|                        incrementpersample = countpersample;
 4803|    377|                    }
 4804|    383|                    if (dp->tdir_count != (uint64_t)countrequired)
  ------------------
  |  Branch (4804:25): [True: 233, False: 150]
  ------------------
 4805|    233|                        err = TIFFReadDirEntryErrCount;
 4806|    150|                    else
 4807|    150|                        err = TIFFReadDirEntryShortArray(tif, dp, &value);
 4808|    383|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4808:25): [True: 2, False: 381]
  ------------------
 4809|      2|                        goto bad;
 4810|    381|                    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4810:25): [True: 237, False: 144]
  ------------------
 4811|    237|                    {
 4812|    237|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4813|    237|                        TIFFReadDirEntryOutputErr(
 4814|    237|                            tif, err, module,
 4815|    237|                            fip ? fip->field_name : "unknown tagname", 1);
  ------------------
  |  Branch (4815:29): [True: 237, False: 0]
  ------------------
 4816|    237|                    }
 4817|    144|                    else
 4818|    144|                    {
 4819|    144|                        TIFFSetField(tif, dp->tdir_tag, value,
 4820|    144|                                     value + incrementpersample,
 4821|    144|                                     value + 2 * incrementpersample);
 4822|    144|                        _TIFFfreeExt(tif, value);
 4823|    144|                    }
 4824|    381|                }
 4825|      0|                break;
 4826|       |                    /* BEGIN REV 4.0 COMPATIBILITY */
 4827|      0|                case TIFFTAG_OSUBFILETYPE:
  ------------------
  |  |  174|      0|#define TIFFTAG_OSUBFILETYPE 255      /* +kind of data in subfile */
  ------------------
  |  Branch (4827:17): [True: 0, False: 315k]
  ------------------
 4828|      0|                {
 4829|      0|                    uint16_t valueo;
 4830|      0|                    uint32_t value;
 4831|      0|                    if (TIFFReadDirEntryShort(tif, dp, &valueo) ==
  ------------------
  |  Branch (4831:25): [True: 0, False: 0]
  ------------------
 4832|      0|                        TIFFReadDirEntryErrOk)
 4833|      0|                    {
 4834|      0|                        switch (valueo)
 4835|      0|                        {
 4836|      0|                            case OFILETYPE_REDUCEDIMAGE:
  ------------------
  |  |  176|      0|#define OFILETYPE_REDUCEDIMAGE 2      /* reduced size image data */
  ------------------
  |  Branch (4836:29): [True: 0, False: 0]
  ------------------
 4837|      0|                                value = FILETYPE_REDUCEDIMAGE;
  ------------------
  |  |  171|      0|#define FILETYPE_REDUCEDIMAGE 0x1     /* reduced resolution version */
  ------------------
 4838|      0|                                break;
 4839|      0|                            case OFILETYPE_PAGE:
  ------------------
  |  |  177|      0|#define OFILETYPE_PAGE 3              /* one page of many */
  ------------------
  |  Branch (4839:29): [True: 0, False: 0]
  ------------------
 4840|      0|                                value = FILETYPE_PAGE;
  ------------------
  |  |  172|      0|#define FILETYPE_PAGE 0x2             /* one page of many */
  ------------------
 4841|      0|                                break;
 4842|      0|                            default:
  ------------------
  |  Branch (4842:29): [True: 0, False: 0]
  ------------------
 4843|      0|                                value = 0;
 4844|      0|                                break;
 4845|      0|                        }
 4846|      0|                        if (value != 0)
  ------------------
  |  Branch (4846:29): [True: 0, False: 0]
  ------------------
 4847|      0|                            TIFFSetField(tif, TIFFTAG_SUBFILETYPE, value);
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
 4848|      0|                    }
 4849|      0|                }
 4850|      0|                break;
 4851|       |                /* END REV 4.0 COMPATIBILITY */
 4852|       |#if 0
 4853|       |                case TIFFTAG_EP_BATTERYLEVEL:
 4854|       |                    /* TIFFTAG_EP_BATTERYLEVEL can be RATIONAL or ASCII.
 4855|       |                     * LibTiff defines it as ASCII and converts RATIONAL to an
 4856|       |                     * ASCII string. */
 4857|       |                    switch (dp->tdir_type)
 4858|       |                    {
 4859|       |                        case TIFF_RATIONAL:
 4860|       |                        {
 4861|       |                            /* Read rational and convert to ASCII*/
 4862|       |                            enum TIFFReadDirEntryErr err;
 4863|       |                            TIFFRational_t rValue;
 4864|       |                            err = TIFFReadDirEntryCheckedRationalDirect(
 4865|       |                                tif, dp, &rValue);
 4866|       |                            if (err != TIFFReadDirEntryErrOk)
 4867|       |                            {
 4868|       |                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4869|       |                                TIFFReadDirEntryOutputErr(
 4870|       |                                    tif, err, module,
 4871|       |                                    fip ? fip->field_name : "unknown tagname",
 4872|       |                                    1);
 4873|       |                            }
 4874|       |                            else
 4875|       |                            {
 4876|       |                                char szAux[32];
 4877|       |                                snprintf(szAux, sizeof(szAux) - 1, "%d/%d",
 4878|       |                                         rValue.uNum, rValue.uDenom);
 4879|       |                                TIFFSetField(tif, dp->tdir_tag, szAux);
 4880|       |                            }
 4881|       |                        }
 4882|       |                        break;
 4883|       |                        case TIFF_ASCII:
 4884|       |                            (void)TIFFFetchNormalTag(tif, dp, TRUE);
 4885|       |                            break;
 4886|       |                        default:
 4887|       |                            fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4888|       |                            TIFFWarningExtR(tif, module,
 4889|       |                                            "Invalid data type for tag %s. "
 4890|       |                                            "ASCII or RATIONAL expected",
 4891|       |                                            fip ? fip->field_name
 4892|       |                                                : "unknown tagname");
 4893|       |                            break;
 4894|       |                    }
 4895|       |                    break;
 4896|       |#endif
 4897|   270k|                default:
  ------------------
  |  Branch (4897:17): [True: 270k, False: 44.9k]
  ------------------
 4898|   270k|                    (void)TIFFFetchNormalTag(tif, dp, TRUE);
  ------------------
  |  |   74|   270k|#define TRUE 1
  ------------------
 4899|   270k|                    break;
 4900|   315k|            } /* -- switch (dp->tdir_tag) -- */
 4901|   315k|        } /* -- if (!dp->tdir_ignore) */
 4902|   765k|    } /* -- for-loop -- */
 4903|       |
 4904|       |    /* Evaluate final IFD data size. */
 4905|  24.9k|    CalcFinalIFDdatasizeReading(tif, dircount);
 4906|       |
 4907|       |    /*
 4908|       |     * OJPEG hack:
 4909|       |     * - If a) compression is OJPEG, and b) photometric tag is missing,
 4910|       |     * then we consistently find that photometric should be YCbCr
 4911|       |     * - If a) compression is OJPEG, and b) photometric tag says it's RGB,
 4912|       |     * then we consistently find that the buggy implementation of the
 4913|       |     * buggy compression scheme matches photometric YCbCr instead.
 4914|       |     * - If a) compression is OJPEG, and b) bitspersample tag is missing,
 4915|       |     * then we consistently find bitspersample should be 8.
 4916|       |     * - If a) compression is OJPEG, b) samplesperpixel tag is missing,
 4917|       |     * and c) photometric is RGB or YCbCr, then we consistently find
 4918|       |     * samplesperpixel should be 3
 4919|       |     * - If a) compression is OJPEG, b) samplesperpixel tag is missing,
 4920|       |     * and c) photometric is MINISWHITE or MINISBLACK, then we consistently
 4921|       |     * find samplesperpixel should be 3
 4922|       |     */
 4923|  24.9k|    if (tif->tif_dir.td_compression == COMPRESSION_OJPEG)
  ------------------
  |  |  189|  24.9k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (4923:9): [True: 3.11k, False: 21.8k]
  ------------------
 4924|  3.11k|    {
 4925|  3.11k|        if (!TIFFFieldSet(tif, FIELD_PHOTOMETRIC))
  ------------------
  |  |  267|  3.11k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  3.11k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  3.11k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4925:13): [True: 2.98k, False: 137]
  ------------------
 4926|  2.98k|        {
 4927|  2.98k|            TIFFWarningExtR(
 4928|  2.98k|                tif, module,
 4929|  2.98k|                "Photometric tag is missing, assuming data is YCbCr");
 4930|  2.98k|            if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR))
  ------------------
  |  |  220|  2.98k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
                          if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR))
  ------------------
  |  |  227|  2.98k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4930:17): [True: 0, False: 2.98k]
  ------------------
 4931|      0|                goto bad;
 4932|  2.98k|        }
 4933|    137|        else if (tif->tif_dir.td_photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|    137|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4933:18): [True: 8, False: 129]
  ------------------
 4934|      8|        {
 4935|      8|            tif->tif_dir.td_photometric = PHOTOMETRIC_YCBCR;
  ------------------
  |  |  227|      8|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
 4936|      8|            TIFFWarningExtR(tif, module,
 4937|      8|                            "Photometric tag value assumed incorrect, "
 4938|      8|                            "assuming data is YCbCr instead of RGB");
 4939|      8|        }
 4940|  3.11k|        if (!TIFFFieldSet(tif, FIELD_BITSPERSAMPLE))
  ------------------
  |  |  267|  3.11k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  3.11k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  3.11k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4940:13): [True: 3.03k, False: 84]
  ------------------
 4941|  3.03k|        {
 4942|  3.03k|            TIFFWarningExtR(
 4943|  3.03k|                tif, module,
 4944|  3.03k|                "BitsPerSample tag is missing, assuming 8 bits per sample");
 4945|  3.03k|            if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8))
  ------------------
  |  |  180|  3.03k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4945:17): [True: 0, False: 3.03k]
  ------------------
 4946|      0|                goto bad;
 4947|  3.03k|        }
 4948|  3.11k|        if (!TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  267|  3.11k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  3.11k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  3.11k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4948:13): [True: 3.01k, False: 104]
  ------------------
 4949|  3.01k|        {
 4950|  3.01k|            if (tif->tif_dir.td_photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|  3.01k|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4950:17): [True: 0, False: 3.01k]
  ------------------
 4951|      0|            {
 4952|      0|                TIFFWarningExtR(tif, module,
 4953|      0|                                "SamplesPerPixel tag is missing, "
 4954|      0|                                "assuming correct SamplesPerPixel value is 3");
 4955|      0|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3))
  ------------------
  |  |  257|      0|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4955:21): [True: 0, False: 0]
  ------------------
 4956|      0|                    goto bad;
 4957|      0|            }
 4958|  3.01k|            if (tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR)
  ------------------
  |  |  227|  3.01k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4958:17): [True: 2.93k, False: 81]
  ------------------
 4959|  2.93k|            {
 4960|  2.93k|                TIFFWarningExtR(tif, module,
 4961|  2.93k|                                "SamplesPerPixel tag is missing, "
 4962|  2.93k|                                "applying correct SamplesPerPixel value of 3");
 4963|  2.93k|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3))
  ------------------
  |  |  257|  2.93k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4963:21): [True: 0, False: 2.93k]
  ------------------
 4964|      0|                    goto bad;
 4965|  2.93k|            }
 4966|     81|            else if ((tif->tif_dir.td_photometric == PHOTOMETRIC_MINISWHITE) ||
  ------------------
  |  |  221|     81|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (4966:22): [True: 35, False: 46]
  ------------------
 4967|     46|                     (tif->tif_dir.td_photometric == PHOTOMETRIC_MINISBLACK))
  ------------------
  |  |  222|     46|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (4967:22): [True: 3, False: 43]
  ------------------
 4968|     38|            {
 4969|       |                /*
 4970|       |                 * SamplesPerPixel tag is missing, but is not required
 4971|       |                 * by spec.  Assume correct SamplesPerPixel value of 1.
 4972|       |                 */
 4973|     38|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1))
  ------------------
  |  |  257|     38|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4973:21): [True: 0, False: 38]
  ------------------
 4974|      0|                    goto bad;
 4975|     38|            }
 4976|  3.01k|        }
 4977|  3.11k|    }
 4978|       |
 4979|       |    /*
 4980|       |     * Setup appropriate structures (by strip or by tile)
 4981|       |     * We do that only after the above OJPEG hack which alters SamplesPerPixel
 4982|       |     * and thus influences the number of strips in the separate planarconfig.
 4983|       |     */
 4984|  24.9k|    if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS))
  ------------------
  |  |  267|  24.9k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  24.9k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  24.9k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4984:9): [True: 14.0k, False: 10.9k]
  ------------------
 4985|  14.0k|    {
 4986|  14.0k|        tif->tif_dir.td_nstrips = TIFFNumberOfStrips(tif);
 4987|  14.0k|        tif->tif_dir.td_tilewidth = tif->tif_dir.td_imagewidth;
 4988|  14.0k|        tif->tif_dir.td_tilelength = tif->tif_dir.td_rowsperstrip;
 4989|  14.0k|        tif->tif_dir.td_tiledepth = tif->tif_dir.td_imagedepth;
 4990|  14.0k|        tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  132|  14.0k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 4991|  14.0k|    }
 4992|  10.9k|    else
 4993|  10.9k|    {
 4994|  10.9k|        tif->tif_dir.td_nstrips = TIFFNumberOfTiles(tif);
 4995|  10.9k|        tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  132|  10.9k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 4996|  10.9k|    }
 4997|  24.9k|    if (!tif->tif_dir.td_nstrips)
  ------------------
  |  Branch (4997:9): [True: 261, False: 24.6k]
  ------------------
 4998|    261|    {
 4999|    261|        TIFFErrorExtR(tif, module, "Cannot handle zero number of %s",
 5000|    261|                      isTiled(tif) ? "tiles" : "strips");
  ------------------
  |  |  282|    261|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    261|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 206, False: 55]
  |  |  ------------------
  ------------------
 5001|    261|        goto bad;
 5002|    261|    }
 5003|  24.6k|    tif->tif_dir.td_stripsperimage = tif->tif_dir.td_nstrips;
 5004|  24.6k|    if (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  24.6k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5004:9): [True: 1.54k, False: 23.1k]
  ------------------
 5005|  1.54k|        tif->tif_dir.td_stripsperimage /= tif->tif_dir.td_samplesperpixel;
 5006|  24.6k|    if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS))
  ------------------
  |  |  267|  24.6k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  24.6k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  24.6k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5006:9): [True: 5.34k, False: 19.3k]
  ------------------
 5007|  5.34k|    {
 5008|  5.34k|#ifdef OJPEG_SUPPORT
 5009|  5.34k|        if ((tif->tif_dir.td_compression == COMPRESSION_OJPEG) &&
  ------------------
  |  |  189|  5.34k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (5009:13): [True: 867, False: 4.47k]
  ------------------
 5010|    867|            (isTiled(tif) == 0) && (tif->tif_dir.td_nstrips == 1))
  ------------------
  |  |  282|    867|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    867|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (5010:13): [True: 864, False: 3]
  |  Branch (5010:36): [True: 835, False: 29]
  ------------------
 5011|    835|        {
 5012|       |            /*
 5013|       |             * XXX: OJPEG hack.
 5014|       |             * If a) compression is OJPEG, b) it's not a tiled TIFF,
 5015|       |             * and c) the number of strips is 1,
 5016|       |             * then we tolerate the absence of stripoffsets tag,
 5017|       |             * because, presumably, all required data is in the
 5018|       |             * JpegInterchangeFormat stream.
 5019|       |             */
 5020|    835|            TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
  ------------------
  |  |  268|    835|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|    835|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|    835|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 5021|    835|        }
 5022|  4.50k|        else
 5023|  4.50k|#endif
 5024|  4.50k|        {
 5025|  4.50k|            MissingRequired(tif, isTiled(tif) ? "TileOffsets" : "StripOffsets");
  ------------------
  |  |  282|  4.50k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  4.50k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 14, False: 4.49k]
  |  |  ------------------
  ------------------
 5026|  4.50k|            goto bad;
 5027|  4.50k|        }
 5028|  5.34k|    }
 5029|       |
 5030|  20.1k|    if (tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (5030:9): [True: 0, False: 20.1k]
  ------------------
 5031|      0|        tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
  ------------------
  |  Branch (5031:9): [True: 0, False: 0]
  ------------------
 5032|      0|        tif->tif_dir.td_stripoffset_entry.tdir_count == 0 &&
  ------------------
  |  Branch (5032:9): [True: 0, False: 0]
  ------------------
 5033|      0|        tif->tif_dir.td_stripoffset_entry.tdir_type == 0 &&
  ------------------
  |  Branch (5033:9): [True: 0, False: 0]
  ------------------
 5034|      0|        tif->tif_dir.td_stripoffset_entry.tdir_offset.toff_long8 == 0 &&
  ------------------
  |  Branch (5034:9): [True: 0, False: 0]
  ------------------
 5035|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 &&
  ------------------
  |  Branch (5035:9): [True: 0, False: 0]
  ------------------
 5036|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_count == 0 &&
  ------------------
  |  Branch (5036:9): [True: 0, False: 0]
  ------------------
 5037|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_type == 0 &&
  ------------------
  |  Branch (5037:9): [True: 0, False: 0]
  ------------------
 5038|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_offset.toff_long8 == 0)
  ------------------
  |  Branch (5038:9): [True: 0, False: 0]
  ------------------
 5039|      0|    {
 5040|       |        /* Directory typically created with TIFFDeferStrileArrayWriting() */
 5041|      0|        TIFFSetupStrips(tif);
 5042|      0|    }
 5043|  20.1k|    else if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD))
  ------------------
  |  |  150|  20.1k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (5043:14): [True: 20.1k, False: 0]
  ------------------
 5044|  20.1k|    {
 5045|  20.1k|        if (tif->tif_dir.td_stripoffset_entry.tdir_tag != 0)
  ------------------
  |  Branch (5045:13): [True: 19.3k, False: 835]
  ------------------
 5046|  19.3k|        {
 5047|  19.3k|            if (!TIFFFetchStripThing(tif, &(tif->tif_dir.td_stripoffset_entry),
  ------------------
  |  Branch (5047:17): [True: 399, False: 18.9k]
  ------------------
 5048|  19.3k|                                     tif->tif_dir.td_nstrips,
 5049|  19.3k|                                     &tif->tif_dir.td_stripoffset_p))
 5050|    399|            {
 5051|    399|                goto bad;
 5052|    399|            }
 5053|  19.3k|        }
 5054|  19.7k|        if (tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0)
  ------------------
  |  Branch (5054:13): [True: 13.8k, False: 5.94k]
  ------------------
 5055|  13.8k|        {
 5056|  13.8k|            if (!TIFFFetchStripThing(
  ------------------
  |  Branch (5056:17): [True: 45, False: 13.7k]
  ------------------
 5057|  13.8k|                    tif, &(tif->tif_dir.td_stripbytecount_entry),
 5058|  13.8k|                    tif->tif_dir.td_nstrips, &tif->tif_dir.td_stripbytecount_p))
 5059|     45|            {
 5060|     45|                goto bad;
 5061|     45|            }
 5062|  13.8k|        }
 5063|  19.7k|    }
 5064|       |
 5065|       |    /*
 5066|       |     * Make sure all non-color channels are extrasamples.
 5067|       |     * If it's not the case, define them as such.
 5068|       |     */
 5069|  19.7k|    color_channels = _TIFFGetMaxColorChannels(tif->tif_dir.td_photometric);
 5070|  19.7k|    if (color_channels &&
  ------------------
  |  Branch (5070:9): [True: 19.3k, False: 343]
  ------------------
 5071|  19.3k|        tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples >
  ------------------
  |  Branch (5071:9): [True: 1.83k, False: 17.5k]
  ------------------
 5072|  19.3k|            color_channels)
 5073|  1.83k|    {
 5074|  1.83k|        uint16_t old_extrasamples;
 5075|  1.83k|        uint16_t *new_sampleinfo;
 5076|       |
 5077|  1.83k|        TIFFWarningExtR(
 5078|  1.83k|            tif, module,
 5079|  1.83k|            "Sum of Photometric type-related "
 5080|  1.83k|            "color channels and ExtraSamples doesn't match SamplesPerPixel. "
 5081|  1.83k|            "Defining non-color channels as ExtraSamples.");
 5082|       |
 5083|  1.83k|        old_extrasamples = tif->tif_dir.td_extrasamples;
 5084|  1.83k|        tif->tif_dir.td_extrasamples =
 5085|  1.83k|            (uint16_t)(tif->tif_dir.td_samplesperpixel - color_channels);
 5086|       |
 5087|       |        // sampleinfo should contain information relative to these new extra
 5088|       |        // samples
 5089|  1.83k|        new_sampleinfo = (uint16_t *)_TIFFcallocExt(
 5090|  1.83k|            tif, tif->tif_dir.td_extrasamples, sizeof(uint16_t));
 5091|  1.83k|        if (!new_sampleinfo)
  ------------------
  |  Branch (5091:13): [True: 1, False: 1.83k]
  ------------------
 5092|      1|        {
 5093|      1|            TIFFErrorExtR(tif, module,
 5094|      1|                          "Failed to allocate memory for "
 5095|      1|                          "temporary new sampleinfo array "
 5096|      1|                          "(%" PRIu16 " 16 bit elements)",
 5097|      1|                          tif->tif_dir.td_extrasamples);
 5098|      1|            goto bad;
 5099|      1|        }
 5100|       |
 5101|  1.83k|        if (old_extrasamples > 0)
  ------------------
  |  Branch (5101:13): [True: 82, False: 1.75k]
  ------------------
 5102|     82|            memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo,
 5103|     82|                   old_extrasamples * sizeof(uint16_t));
 5104|  1.83k|        _TIFFsetShortArrayExt(tif, &tif->tif_dir.td_sampleinfo, new_sampleinfo,
 5105|  1.83k|                              tif->tif_dir.td_extrasamples);
 5106|  1.83k|        _TIFFfreeExt(tif, new_sampleinfo);
 5107|  1.83k|    }
 5108|       |
 5109|       |    /*
 5110|       |     * Verify Palette image has a Colormap.
 5111|       |     */
 5112|  19.7k|    if (tif->tif_dir.td_photometric == PHOTOMETRIC_PALETTE &&
  ------------------
  |  |  224|  39.4k|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (5112:9): [True: 227, False: 19.4k]
  ------------------
 5113|    227|        !TIFFFieldSet(tif, FIELD_COLORMAP))
  ------------------
  |  |  267|    227|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|    227|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|    227|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5113:9): [True: 94, False: 133]
  ------------------
 5114|     94|    {
 5115|     94|        if (tif->tif_dir.td_bitspersample >= 8 &&
  ------------------
  |  Branch (5115:13): [True: 89, False: 5]
  ------------------
 5116|     89|            tif->tif_dir.td_samplesperpixel == 3)
  ------------------
  |  Branch (5116:13): [True: 23, False: 66]
  ------------------
 5117|     23|            tif->tif_dir.td_photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|     23|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
 5118|     71|        else if (tif->tif_dir.td_bitspersample >= 8)
  ------------------
  |  Branch (5118:18): [True: 66, False: 5]
  ------------------
 5119|     66|            tif->tif_dir.td_photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|     66|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
 5120|      5|        else
 5121|      5|        {
 5122|      5|            MissingRequired(tif, "Colormap");
 5123|      5|            goto bad;
 5124|      5|        }
 5125|     94|    }
 5126|       |    /*
 5127|       |     * OJPEG hack:
 5128|       |     * We do no further messing with strip/tile offsets/bytecounts in OJPEG
 5129|       |     * TIFFs
 5130|       |     */
 5131|  19.7k|    if (tif->tif_dir.td_compression != COMPRESSION_OJPEG)
  ------------------
  |  |  189|  19.7k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (5131:9): [True: 16.6k, False: 3.03k]
  ------------------
 5132|  16.6k|    {
 5133|       |        /*
 5134|       |         * Attempt to deal with a missing StripByteCounts tag.
 5135|       |         */
 5136|  16.6k|        if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS))
  ------------------
  |  |  267|  16.6k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  16.6k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  16.6k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5136:13): [True: 4.49k, False: 12.1k]
  ------------------
 5137|  4.49k|        {
 5138|       |            /*
 5139|       |             * Some manufacturers violate the spec by not giving
 5140|       |             * the size of the strips.  In this case, assume there
 5141|       |             * is one uncompressed strip of data.
 5142|       |             */
 5143|  4.49k|            if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  8.98k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5143:18): [True: 4.22k, False: 272]
  ------------------
 5144|  4.22k|                 tif->tif_dir.td_nstrips > 1) ||
  ------------------
  |  Branch (5144:18): [True: 43, False: 4.17k]
  ------------------
 5145|  4.45k|                (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  266|  8.90k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5145:18): [True: 272, False: 4.17k]
  ------------------
 5146|    272|                 tif->tif_dir.td_nstrips !=
  ------------------
  |  Branch (5146:18): [True: 17, False: 255]
  ------------------
 5147|    272|                     (uint32_t)tif->tif_dir.td_samplesperpixel))
 5148|     60|            {
 5149|     60|                MissingRequired(tif, "StripByteCounts");
 5150|     60|                goto bad;
 5151|     60|            }
 5152|  4.43k|            TIFFWarningExtR(
 5153|  4.43k|                tif, module,
 5154|  4.43k|                "TIFF directory is missing required "
 5155|  4.43k|                "\"StripByteCounts\" field, calculating from imagelength");
 5156|  4.43k|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5156:17): [True: 50, False: 4.38k]
  ------------------
 5157|     50|                goto bad;
 5158|  4.43k|        }
 5159|  12.1k|        else if (tif->tif_dir.td_nstrips == 1 &&
  ------------------
  |  Branch (5159:18): [True: 3.75k, False: 8.41k]
  ------------------
 5160|  3.75k|                 !(tif->tif_flags & TIFF_ISTILED) && ByteCountLooksBad(tif))
  ------------------
  |  |  132|  3.75k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  |  Branch (5160:18): [True: 3.25k, False: 501]
  |  Branch (5160:54): [True: 470, False: 2.78k]
  ------------------
 5161|    470|        {
 5162|       |            /*
 5163|       |             * XXX: Plexus (and others) sometimes give a value of
 5164|       |             * zero for a tag when they don't know what the
 5165|       |             * correct value is!  Try and handle the simple case
 5166|       |             * of estimating the size of a one strip image.
 5167|       |             */
 5168|    470|            TIFFWarningExtR(tif, module,
 5169|    470|                            "Bogus \"StripByteCounts\" field, ignoring and "
 5170|    470|                            "calculating from imagelength");
 5171|    470|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5171:17): [True: 5, False: 465]
  ------------------
 5172|      5|                goto bad;
 5173|    470|        }
 5174|  11.7k|        else if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) &&
  ------------------
  |  |  150|  11.7k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (5174:18): [True: 11.7k, False: 0]
  ------------------
 5175|  11.7k|                 tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  23.4k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5175:18): [True: 11.2k, False: 445]
  ------------------
 5176|  11.2k|                 tif->tif_dir.td_nstrips > 2 &&
  ------------------
  |  Branch (5176:18): [True: 7.77k, False: 3.48k]
  ------------------
 5177|  7.77k|                 tif->tif_dir.td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  182|  19.4k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5177:18): [True: 496, False: 7.28k]
  ------------------
 5178|    496|                 TIFFGetStrileByteCount(tif, 0) !=
  ------------------
  |  Branch (5178:18): [True: 457, False: 39]
  ------------------
 5179|    496|                     TIFFGetStrileByteCount(tif, 1) &&
 5180|    457|                 TIFFGetStrileByteCount(tif, 0) != 0 &&
  ------------------
  |  Branch (5180:18): [True: 454, False: 3]
  ------------------
 5181|    454|                 TIFFGetStrileByteCount(tif, 1) != 0)
  ------------------
  |  Branch (5181:18): [True: 234, False: 220]
  ------------------
 5182|    234|        {
 5183|       |            /*
 5184|       |             * XXX: Some vendors fill StripByteCount array with
 5185|       |             * absolutely wrong values (it can be equal to
 5186|       |             * StripOffset array, for example). Catch this case
 5187|       |             * here.
 5188|       |             *
 5189|       |             * We avoid this check if deferring strile loading
 5190|       |             * as it would always force us to load the strip/tile
 5191|       |             * information.
 5192|       |             */
 5193|    234|            TIFFWarningExtR(tif, module,
 5194|    234|                            "Wrong \"StripByteCounts\" field, ignoring and "
 5195|    234|                            "calculating from imagelength");
 5196|    234|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5196:17): [True: 1, False: 233]
  ------------------
 5197|      1|                goto bad;
 5198|    234|        }
 5199|  16.6k|    }
 5200|  19.5k|    if (dir)
  ------------------
  |  Branch (5200:9): [True: 19.5k, False: 0]
  ------------------
 5201|  19.5k|    {
 5202|  19.5k|        _TIFFfreeExt(tif, dir);
 5203|  19.5k|        dir = NULL;
 5204|  19.5k|    }
 5205|  19.5k|    if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))
  ------------------
  |  |  267|  19.5k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  19.5k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  19.5k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5205:9): [True: 19.5k, False: 6]
  ------------------
 5206|  19.5k|    {
 5207|  19.5k|        if (tif->tif_dir.td_bitspersample >= 16)
  ------------------
  |  Branch (5207:13): [True: 1.09k, False: 18.4k]
  ------------------
 5208|  1.09k|            tif->tif_dir.td_maxsamplevalue = 0xFFFF;
 5209|  18.4k|        else
 5210|  18.4k|            tif->tif_dir.td_maxsamplevalue =
 5211|  18.4k|                (uint16_t)((1 << tif->tif_dir.td_bitspersample) - 1);
 5212|  19.5k|    }
 5213|       |
 5214|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 5215|       |    /*
 5216|       |     * XXX: We can optimize checking for the strip bounds using the sorted
 5217|       |     * bytecounts array. See also comments for TIFFAppendToStrip()
 5218|       |     * function in tif_write.c.
 5219|       |     */
 5220|       |    if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) && tif->tif_dir.td_nstrips > 1)
 5221|       |    {
 5222|       |        uint32_t strip;
 5223|       |
 5224|       |        tif->tif_dir.td_stripbytecountsorted = 1;
 5225|       |        for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++)
 5226|       |        {
 5227|       |            if (TIFFGetStrileOffset(tif, strip - 1) >
 5228|       |                TIFFGetStrileOffset(tif, strip))
 5229|       |            {
 5230|       |                tif->tif_dir.td_stripbytecountsorted = 0;
 5231|       |                break;
 5232|       |            }
 5233|       |        }
 5234|       |    }
 5235|       |#endif
 5236|       |
 5237|       |    /*
 5238|       |     * An opportunity for compression mode dependent tag fixup
 5239|       |     */
 5240|  19.5k|    (*tif->tif_fixuptags)(tif);
 5241|       |
 5242|       |    /*
 5243|       |     * Some manufacturers make life difficult by writing
 5244|       |     * large amounts of uncompressed data as a single strip.
 5245|       |     * This is contrary to the recommendations of the spec.
 5246|       |     * The following makes an attempt at breaking such images
 5247|       |     * into strips closer to the recommended 8k bytes.  A
 5248|       |     * side effect, however, is that the RowsPerStrip tag
 5249|       |     * value may be changed.
 5250|       |     */
 5251|  19.5k|    if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|  19.5k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5251:9): [True: 18.0k, False: 1.51k]
  ------------------
 5252|  18.0k|        (tif->tif_dir.td_nstrips == 1) &&
  ------------------
  |  Branch (5252:9): [True: 9.20k, False: 8.87k]
  ------------------
 5253|  9.20k|        (tif->tif_dir.td_compression == COMPRESSION_NONE) &&
  ------------------
  |  |  182|  9.20k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5253:9): [True: 2.11k, False: 7.09k]
  ------------------
 5254|  2.11k|        ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  137|  2.11k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
                      ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  132|  2.11k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
                      ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  137|  2.11k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  |  Branch (5254:9): [True: 1.83k, False: 275]
  ------------------
 5255|  1.83k|    {
 5256|  1.83k|        ChopUpSingleUncompressedStrip(tif);
 5257|  1.83k|    }
 5258|       |
 5259|       |    /* There are also uncompressed striped files with strips larger than */
 5260|       |    /* 2 GB, which make them unfriendly with a lot of code. If possible, */
 5261|       |    /* try to expose smaller "virtual" strips. */
 5262|  19.5k|    if (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  39.1k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5262:9): [True: 18.0k, False: 1.51k]
  ------------------
 5263|  18.0k|        tif->tif_dir.td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  182|  37.6k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5263:9): [True: 2.65k, False: 15.4k]
  ------------------
 5264|  2.65k|        (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  137|  2.65k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
                      (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  132|  2.65k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
                      (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  137|  22.2k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  |  Branch (5264:9): [True: 2.28k, False: 376]
  ------------------
 5265|  2.28k|        TIFFStripSize64(tif) > 0x7FFFFFFFUL)
  ------------------
  |  Branch (5265:9): [True: 708, False: 1.57k]
  ------------------
 5266|    708|    {
 5267|    708|        TryChopUpUncompressedBigTiff(tif);
 5268|    708|    }
 5269|       |
 5270|       |    /*
 5271|       |     * Clear the dirty directory flag.
 5272|       |     */
 5273|  19.5k|    tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |  125|  19.5k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 5274|  19.5k|    tif->tif_flags &= ~TIFF_DIRTYSTRIP;
  ------------------
  |  |  145|  19.5k|#define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
  ------------------
 5275|       |
 5276|       |    /*
 5277|       |     * Reinitialize some further i/o since we are starting on a new directory.
 5278|       |     */
 5279|  19.5k|    tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 5280|  19.5k|    if (!tif->tif_dir.td_scanlinesize)
  ------------------
  |  Branch (5280:9): [True: 1.30k, False: 18.2k]
  ------------------
 5281|  1.30k|    {
 5282|  1.30k|        TIFFErrorExtR(tif, module, "Cannot handle zero scanline size");
 5283|  1.30k|        return (0);
 5284|  1.30k|    }
 5285|       |
 5286|  18.2k|    if (isTiled(tif))
  ------------------
  |  |  282|  18.2k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  18.2k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 10.6k, False: 7.65k]
  |  |  ------------------
  ------------------
 5287|  10.6k|    {
 5288|  10.6k|        tif->tif_dir.td_tilesize = TIFFTileSize(tif);
 5289|  10.6k|        if (!tif->tif_dir.td_tilesize)
  ------------------
  |  Branch (5289:13): [True: 5, False: 10.6k]
  ------------------
 5290|      5|        {
 5291|      5|            TIFFErrorExtR(tif, module, "Cannot handle zero tile size");
 5292|      5|            return (0);
 5293|      5|        }
 5294|  10.6k|    }
 5295|  7.65k|    else
 5296|  7.65k|    {
 5297|  7.65k|        if (!TIFFStripSize(tif))
  ------------------
  |  Branch (5297:13): [True: 2.29k, False: 5.35k]
  ------------------
 5298|  2.29k|        {
 5299|  2.29k|            TIFFErrorExtR(tif, module, "Cannot handle zero strip size");
 5300|  2.29k|            return (0);
 5301|  2.29k|        }
 5302|  7.65k|    }
 5303|  15.9k|    return (1);
 5304|  7.61k|bad:
 5305|  7.61k|    if (dir)
  ------------------
  |  Branch (5305:9): [True: 7.61k, False: 0]
  ------------------
 5306|  7.61k|        _TIFFfreeExt(tif, dir);
 5307|  7.61k|    return (0);
 5308|  18.2k|} /*-- TIFFReadDirectory() --*/
_TIFFCheckDirNumberAndOffset:
 5807|  27.5k|{
 5808|  27.5k|    if (diroff == 0) /* no more directories */
  ------------------
  |  Branch (5808:9): [True: 0, False: 27.5k]
  ------------------
 5809|      0|        return 0;
 5810|       |
 5811|  27.5k|    if (tif->tif_map_dir_offset_to_number == NULL)
  ------------------
  |  Branch (5811:9): [True: 27.5k, False: 0]
  ------------------
 5812|  27.5k|    {
 5813|  27.5k|        tif->tif_map_dir_offset_to_number = TIFFHashSetNew(
 5814|  27.5k|            tif, hashFuncOffsetToNumber, equalFuncOffsetToNumber, _TIFFfreeExt);
 5815|  27.5k|        if (tif->tif_map_dir_offset_to_number == NULL)
  ------------------
  |  Branch (5815:13): [True: 0, False: 27.5k]
  ------------------
 5816|      0|        {
 5817|      0|            TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5818|      0|                          "Not enough memory");
 5819|      0|            return 0;
 5820|      0|        }
 5821|  27.5k|    }
 5822|       |
 5823|  27.5k|    if (tif->tif_map_dir_number_to_offset == NULL)
  ------------------
  |  Branch (5823:9): [True: 27.5k, False: 0]
  ------------------
 5824|  27.5k|    {
 5825|       |        /* No free callback for this map, as it shares the same items as
 5826|       |         * tif->tif_map_dir_offset_to_number. */
 5827|  27.5k|        tif->tif_map_dir_number_to_offset = TIFFHashSetNew(
 5828|  27.5k|            tif, hashFuncNumberToOffset, equalFuncNumberToOffset, NULL);
 5829|  27.5k|        if (tif->tif_map_dir_number_to_offset == NULL)
  ------------------
  |  Branch (5829:13): [True: 0, False: 27.5k]
  ------------------
 5830|      0|        {
 5831|      0|            TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5832|      0|                          "Not enough memory");
 5833|      0|            return 0;
 5834|      0|        }
 5835|  27.5k|    }
 5836|       |
 5837|       |    /* Check if offset is already in the list:
 5838|       |     * - yes: check, if offset is at the same IFD number - if not, it is an IFD
 5839|       |     * loop
 5840|       |     * -  no: add to list or update offset at that IFD number
 5841|       |     */
 5842|  27.5k|    TIFFOffsetAndDirNumber entry;
 5843|  27.5k|    entry.offset = diroff;
 5844|  27.5k|    entry.dirNumber = dirn;
 5845|       |
 5846|  27.5k|    TIFFOffsetAndDirNumber *foundEntry =
 5847|  27.5k|        (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5848|  27.5k|            tif->tif_map_dir_offset_to_number, &entry);
 5849|  27.5k|    if (foundEntry)
  ------------------
  |  Branch (5849:9): [True: 0, False: 27.5k]
  ------------------
 5850|      0|    {
 5851|      0|        if (foundEntry->dirNumber == dirn)
  ------------------
  |  Branch (5851:13): [True: 0, False: 0]
  ------------------
 5852|      0|        {
 5853|      0|            return 1;
 5854|      0|        }
 5855|      0|        else
 5856|      0|        {
 5857|      0|            TIFFWarningExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5858|      0|                            "TIFF directory %d has IFD looping to directory %u "
 5859|      0|                            "at offset 0x%" PRIx64 " (%" PRIu64 ")",
 5860|      0|                            (int)dirn - 1, foundEntry->dirNumber, diroff,
 5861|      0|                            diroff);
 5862|      0|            return 0;
 5863|      0|        }
 5864|      0|    }
 5865|       |
 5866|       |    /* Check if offset of an IFD has been changed and update offset of that IFD
 5867|       |     * number. */
 5868|  27.5k|    foundEntry = (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5869|  27.5k|        tif->tif_map_dir_number_to_offset, &entry);
 5870|  27.5k|    if (foundEntry)
  ------------------
  |  Branch (5870:9): [True: 0, False: 27.5k]
  ------------------
 5871|      0|    {
 5872|      0|        if (foundEntry->offset != diroff)
  ------------------
  |  Branch (5872:13): [True: 0, False: 0]
  ------------------
 5873|      0|        {
 5874|      0|            TIFFOffsetAndDirNumber entryOld;
 5875|      0|            entryOld.offset = foundEntry->offset;
 5876|      0|            entryOld.dirNumber = dirn;
 5877|       |            /* We must remove first from tif_map_dir_number_to_offset as the */
 5878|       |            /* entry is owned (and thus freed) by */
 5879|       |            /* tif_map_dir_offset_to_number */
 5880|      0|            TIFFOffsetAndDirNumber *foundEntryOld =
 5881|      0|                (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5882|      0|                    tif->tif_map_dir_number_to_offset, &entryOld);
 5883|      0|            if (foundEntryOld)
  ------------------
  |  Branch (5883:17): [True: 0, False: 0]
  ------------------
 5884|      0|            {
 5885|      0|                TIFFHashSetRemove(tif->tif_map_dir_number_to_offset,
 5886|      0|                                  foundEntryOld);
 5887|      0|            }
 5888|      0|            foundEntryOld = (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5889|      0|                tif->tif_map_dir_offset_to_number, &entryOld);
 5890|      0|            if (foundEntryOld)
  ------------------
  |  Branch (5890:17): [True: 0, False: 0]
  ------------------
 5891|      0|            {
 5892|      0|                TIFFHashSetRemove(tif->tif_map_dir_offset_to_number,
 5893|      0|                                  foundEntryOld);
 5894|      0|            }
 5895|       |
 5896|      0|            TIFFOffsetAndDirNumber *entryPtr =
 5897|      0|                (TIFFOffsetAndDirNumber *)_TIFFmallocExt(
 5898|      0|                    tif, sizeof(TIFFOffsetAndDirNumber));
 5899|      0|            if (entryPtr == NULL)
  ------------------
  |  Branch (5899:17): [True: 0, False: 0]
  ------------------
 5900|      0|            {
 5901|      0|                return 0;
 5902|      0|            }
 5903|       |
 5904|       |            /* Add IFD offset and dirn to IFD directory list */
 5905|      0|            *entryPtr = entry;
 5906|       |
 5907|      0|            if (!insertOffsetAndDirNumber(tif, entryPtr))
  ------------------
  |  Branch (5907:17): [True: 0, False: 0]
  ------------------
 5908|      0|            {
 5909|      0|                return 0;
 5910|      0|            }
 5911|      0|        }
 5912|      0|        return 1;
 5913|      0|    }
 5914|       |
 5915|       |    /* Arbitrary (hopefully big enough) limit */
 5916|  27.5k|    if (TIFFHashSetSize(tif->tif_map_dir_offset_to_number) >=
  ------------------
  |  Branch (5916:9): [True: 0, False: 27.5k]
  ------------------
 5917|  27.5k|        TIFF_MAX_DIR_COUNT)
  ------------------
  |  |  122|  27.5k|#define TIFF_MAX_DIR_COUNT 1048576
  ------------------
 5918|      0|    {
 5919|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5920|      0|                      "Cannot handle more than %u TIFF directories",
 5921|      0|                      (unsigned)TIFF_MAX_DIR_COUNT);
  ------------------
  |  |  122|      0|#define TIFF_MAX_DIR_COUNT 1048576
  ------------------
 5922|      0|        return 0;
 5923|      0|    }
 5924|       |
 5925|  27.5k|    TIFFOffsetAndDirNumber *entryPtr = (TIFFOffsetAndDirNumber *)_TIFFmallocExt(
 5926|  27.5k|        tif, sizeof(TIFFOffsetAndDirNumber));
 5927|  27.5k|    if (entryPtr == NULL)
  ------------------
  |  Branch (5927:9): [True: 0, False: 27.5k]
  ------------------
 5928|      0|    {
 5929|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5930|      0|                      "Cannot allocate directory tracking entry");
 5931|      0|        return 0;
 5932|      0|    }
 5933|       |
 5934|       |    /* Add IFD offset and dirn to IFD directory list */
 5935|  27.5k|    *entryPtr = entry;
 5936|       |
 5937|  27.5k|    if (!insertOffsetAndDirNumber(tif, entryPtr))
  ------------------
  |  Branch (5937:9): [True: 0, False: 27.5k]
  ------------------
 5938|      0|    {
 5939|      0|        return 0;
 5940|      0|    }
 5941|       |
 5942|  27.5k|    return 1;
 5943|  27.5k|} /* --- _TIFFCheckDirNumberAndOffset() ---*/
TIFFGetStrileOffset:
 8539|   527k|{
 8540|       |    return TIFFGetStrileOffsetWithErr(tif, strile, NULL);
 8541|   527k|}
TIFFGetStrileOffsetWithErr:
 8546|  68.1M|{
 8547|  68.1M|    TIFFDirectory *td = &tif->tif_dir;
 8548|  68.1M|    return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
 8549|  68.1M|                                                &(td->td_stripoffset_entry),
 8550|  68.1M|                                                &(td->td_stripoffset_p), pbErr);
 8551|  68.1M|}
TIFFGetStrileByteCount:
 8556|  1.45M|{
 8557|       |    return TIFFGetStrileByteCountWithErr(tif, strile, NULL);
 8558|  1.45M|}
TIFFGetStrileByteCountWithErr:
 8563|  2.31M|{
 8564|  2.31M|    TIFFDirectory *td = &tif->tif_dir;
 8565|  2.31M|    return _TIFFGetStrileOffsetOrByteCountValue(
 8566|  2.31M|        tif, strile, &(td->td_stripbytecount_entry), &(td->td_stripbytecount_p),
 8567|  2.31M|        pbErr);
 8568|  2.31M|}
_TIFFFillStriles:
 8570|    871|int _TIFFFillStriles(TIFF *tif) { return _TIFFFillStrilesInternal(tif, 1); }
tif_dirread.c:TIFFReadDirEntryShort:
  486|  45.9k|{
  487|  45.9k|    enum TIFFReadDirEntryErr err;
  488|  45.9k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (488:9): [True: 6.94k, False: 39.0k]
  ------------------
  489|  6.94k|        return (TIFFReadDirEntryErrCount);
  490|  39.0k|    switch (direntry->tdir_type)
  491|  39.0k|    {
  492|  8.03k|        case TIFF_BYTE:
  ------------------
  |  Branch (492:9): [True: 8.03k, False: 31.0k]
  ------------------
  493|  8.03k|        {
  494|  8.03k|            uint8_t m;
  495|  8.03k|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  496|  8.03k|            *value = (uint16_t)m;
  497|  8.03k|            return (TIFFReadDirEntryErrOk);
  498|      0|        }
  499|    881|        case TIFF_SBYTE:
  ------------------
  |  Branch (499:9): [True: 881, False: 38.1k]
  ------------------
  500|    881|        {
  501|    881|            int8_t m;
  502|    881|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  503|    881|            err = TIFFReadDirEntryCheckRangeShortSbyte(m);
  504|    881|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (504:17): [True: 42, False: 839]
  ------------------
  505|     42|                return (err);
  506|    839|            *value = (uint16_t)m;
  507|    839|            return (TIFFReadDirEntryErrOk);
  508|    881|        }
  509|  27.5k|        case TIFF_SHORT:
  ------------------
  |  Branch (509:9): [True: 27.5k, False: 11.5k]
  ------------------
  510|  27.5k|            TIFFReadDirEntryCheckedShort(tif, direntry, value);
  511|  27.5k|            return (TIFFReadDirEntryErrOk);
  512|  1.47k|        case TIFF_SSHORT:
  ------------------
  |  Branch (512:9): [True: 1.47k, False: 37.5k]
  ------------------
  513|  1.47k|        {
  514|  1.47k|            int16_t m;
  515|  1.47k|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  516|  1.47k|            err = TIFFReadDirEntryCheckRangeShortSshort(m);
  517|  1.47k|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (517:17): [True: 20, False: 1.45k]
  ------------------
  518|     20|                return (err);
  519|  1.45k|            *value = (uint16_t)m;
  520|  1.45k|            return (TIFFReadDirEntryErrOk);
  521|  1.47k|        }
  522|    426|        case TIFF_LONG:
  ------------------
  |  Branch (522:9): [True: 426, False: 38.6k]
  ------------------
  523|    426|        {
  524|    426|            uint32_t m;
  525|    426|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  526|    426|            err = TIFFReadDirEntryCheckRangeShortLong(m);
  527|    426|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (527:17): [True: 43, False: 383]
  ------------------
  528|     43|                return (err);
  529|    383|            *value = (uint16_t)m;
  530|    383|            return (TIFFReadDirEntryErrOk);
  531|    426|        }
  532|    130|        case TIFF_SLONG:
  ------------------
  |  Branch (532:9): [True: 130, False: 38.9k]
  ------------------
  533|    130|        {
  534|    130|            int32_t m;
  535|    130|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  536|    130|            err = TIFFReadDirEntryCheckRangeShortSlong(m);
  537|    130|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (537:17): [True: 39, False: 91]
  ------------------
  538|     39|                return (err);
  539|     91|            *value = (uint16_t)m;
  540|     91|            return (TIFFReadDirEntryErrOk);
  541|    130|        }
  542|    103|        case TIFF_LONG8:
  ------------------
  |  Branch (542:9): [True: 103, False: 38.9k]
  ------------------
  543|    103|        {
  544|    103|            uint64_t m;
  545|    103|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  546|    103|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (546:17): [True: 12, False: 91]
  ------------------
  547|     12|                return (err);
  548|     91|            err = TIFFReadDirEntryCheckRangeShortLong8(m);
  549|     91|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (549:17): [True: 77, False: 14]
  ------------------
  550|     77|                return (err);
  551|     14|            *value = (uint16_t)m;
  552|     14|            return (TIFFReadDirEntryErrOk);
  553|     91|        }
  554|    197|        case TIFF_SLONG8:
  ------------------
  |  Branch (554:9): [True: 197, False: 38.8k]
  ------------------
  555|    197|        {
  556|    197|            int64_t m;
  557|    197|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  558|    197|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (558:17): [True: 15, False: 182]
  ------------------
  559|     15|                return (err);
  560|    182|            err = TIFFReadDirEntryCheckRangeShortSlong8(m);
  561|    182|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (561:17): [True: 151, False: 31]
  ------------------
  562|    151|                return (err);
  563|     31|            *value = (uint16_t)m;
  564|     31|            return (TIFFReadDirEntryErrOk);
  565|    182|        }
  566|    262|        default:
  ------------------
  |  Branch (566:9): [True: 262, False: 38.7k]
  ------------------
  567|    262|            return (TIFFReadDirEntryErrType);
  568|  39.0k|    }
  569|  39.0k|} /*-- TIFFReadDirEntryShort() --*/
tif_dirread.c:TIFFReadDirEntryCheckedByte:
 3406|  24.8k|{
 3407|  24.8k|    (void)tif;
 3408|  24.8k|    *value = *(uint8_t *)(&direntry->tdir_offset);
 3409|  24.8k|}
tif_dirread.c:TIFFReadDirEntryCheckedSbyte:
 3413|  6.68k|{
 3414|  6.68k|    (void)tif;
 3415|  6.68k|    *value = *(int8_t *)(&direntry->tdir_offset);
 3416|  6.68k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSbyte:
 3772|  3.39k|{
 3773|  3.39k|    if (value < 0)
  ------------------
  |  Branch (3773:9): [True: 52, False: 3.34k]
  ------------------
 3774|     52|        return (TIFFReadDirEntryErrRange);
 3775|  3.34k|    else
 3776|  3.34k|        return (TIFFReadDirEntryErrOk);
 3777|  3.39k|}
tif_dirread.c:TIFFReadDirEntryCheckedShort:
 3420|  65.9k|{
 3421|  65.9k|    *value = direntry->tdir_offset.toff_short;
 3422|       |    /* *value=*(uint16_t*)(&direntry->tdir_offset); */
 3423|  65.9k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  65.9k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3423:9): [True: 2.06k, False: 63.8k]
  ------------------
 3424|  2.06k|        TIFFSwabShort(value);
 3425|  65.9k|}
tif_dirread.c:TIFFReadDirEntryCheckedSshort:
 3429|  3.07k|{
 3430|  3.07k|    *value = *(int16_t *)(&direntry->tdir_offset);
 3431|  3.07k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  3.07k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3431:9): [True: 227, False: 2.84k]
  ------------------
 3432|    227|        TIFFSwabShort((uint16_t *)value);
 3433|  3.07k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSshort:
 3781|  4.15k|{
 3782|  4.15k|    if (value < 0)
  ------------------
  |  Branch (3782:9): [True: 50, False: 4.10k]
  ------------------
 3783|     50|        return (TIFFReadDirEntryErrRange);
 3784|  4.10k|    else
 3785|  4.10k|        return (TIFFReadDirEntryErrOk);
 3786|  4.15k|}
tif_dirread.c:TIFFReadDirEntryCheckedLong:
 3437|  7.53k|{
 3438|  7.53k|    *value = *(uint32_t *)(&direntry->tdir_offset);
 3439|  7.53k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  7.53k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3439:9): [True: 291, False: 7.24k]
  ------------------
 3440|    291|        TIFFSwabLong(value);
 3441|  7.53k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong:
 3790|    921|{
 3791|    921|    if (value > 0xFFFF)
  ------------------
  |  Branch (3791:9): [True: 74, False: 847]
  ------------------
 3792|     74|        return (TIFFReadDirEntryErrRange);
 3793|    847|    else
 3794|    847|        return (TIFFReadDirEntryErrOk);
 3795|    921|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong:
 3445|  1.68k|{
 3446|  1.68k|    *value = *(int32_t *)(&direntry->tdir_offset);
 3447|  1.68k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.68k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3447:9): [True: 534, False: 1.15k]
  ------------------
 3448|    534|        TIFFSwabLong((uint32_t *)value);
 3449|  1.68k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong:
 3799|    698|{
 3800|    698|    if ((value < 0) || (value > 0xFFFF))
  ------------------
  |  Branch (3800:9): [True: 59, False: 639]
  |  Branch (3800:24): [True: 61, False: 578]
  ------------------
 3801|    120|        return (TIFFReadDirEntryErrRange);
 3802|    578|    else
 3803|    578|        return (TIFFReadDirEntryErrOk);
 3804|    698|}
tif_dirread.c:TIFFReadDirEntryCheckedLong8:
 3453|    666|{
 3454|    666|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|    666|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3454:9): [True: 653, False: 13]
  ------------------
 3455|    653|    {
 3456|    653|        enum TIFFReadDirEntryErr err;
 3457|    653|        uint32_t offset = direntry->tdir_offset.toff_long;
 3458|    653|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    653|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3458:13): [True: 21, False: 632]
  ------------------
 3459|     21|            TIFFSwabLong(&offset);
 3460|    653|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3461|    653|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3461:13): [True: 49, False: 604]
  ------------------
 3462|     49|            return (err);
 3463|    653|    }
 3464|     13|    else
 3465|     13|        *value = direntry->tdir_offset.toff_long8;
 3466|    617|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    617|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3466:9): [True: 13, False: 604]
  ------------------
 3467|     13|        TIFFSwabLong8(value);
 3468|    617|    return (TIFFReadDirEntryErrOk);
 3469|    666|}
tif_dirread.c:TIFFReadDirEntryData:
 3990|  2.24k|{
 3991|  2.24k|    assert(size > 0);
  ------------------
  |  Branch (3991:5): [True: 0, False: 2.24k]
  |  Branch (3991:5): [True: 2.24k, False: 0]
  ------------------
 3992|  2.24k|    if (!isMapped(tif))
  ------------------
  |  |  283|  2.24k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  2.24k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (3992:9): [True: 2.24k, False: 0]
  ------------------
 3993|  2.24k|    {
 3994|  2.24k|        if (!SeekOK(tif, offset))
  ------------------
  |  |  307|  2.24k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (3994:13): [True: 0, False: 2.24k]
  ------------------
 3995|      0|            return (TIFFReadDirEntryErrIo);
 3996|  2.24k|        if (!ReadOK(tif, dest, size))
  ------------------
  |  |  304|  2.24k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  287|  2.24k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (3996:13): [True: 463, False: 1.78k]
  ------------------
 3997|    463|            return (TIFFReadDirEntryErrIo);
 3998|  2.24k|    }
 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|  1.78k|    return (TIFFReadDirEntryErrOk);
 4013|  2.24k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong8:
 3808|    631|{
 3809|    631|    if (value > 0xFFFF)
  ------------------
  |  Branch (3809:9): [True: 172, False: 459]
  ------------------
 3810|    172|        return (TIFFReadDirEntryErrRange);
 3811|    459|    else
 3812|    459|        return (TIFFReadDirEntryErrOk);
 3813|    631|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong8:
 3473|    667|{
 3474|    667|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|    667|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3474:9): [True: 652, False: 15]
  ------------------
 3475|    652|    {
 3476|    652|        enum TIFFReadDirEntryErr err;
 3477|    652|        uint32_t offset = direntry->tdir_offset.toff_long;
 3478|    652|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    652|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3478:13): [True: 27, False: 625]
  ------------------
 3479|     27|            TIFFSwabLong(&offset);
 3480|    652|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3481|    652|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3481:13): [True: 46, False: 606]
  ------------------
 3482|     46|            return (err);
 3483|    652|    }
 3484|     15|    else
 3485|     15|        *value = *(int64_t *)(&direntry->tdir_offset);
 3486|    621|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    621|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3486:9): [True: 19, False: 602]
  ------------------
 3487|     19|        TIFFSwabLong8((uint64_t *)value);
 3488|    621|    return (TIFFReadDirEntryErrOk);
 3489|    667|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong8:
 3817|    881|{
 3818|    881|    if ((value < 0) || (value > 0xFFFF))
  ------------------
  |  Branch (3818:9): [True: 161, False: 720]
  |  Branch (3818:24): [True: 152, False: 568]
  ------------------
 3819|    313|        return (TIFFReadDirEntryErrRange);
 3820|    568|    else
 3821|    568|        return (TIFFReadDirEntryErrOk);
 3822|    881|}
tif_dirread.c:TIFFReadDirEntryPersampleShort:
 3348|  4.52k|{
 3349|  4.52k|    enum TIFFReadDirEntryErr err;
 3350|  4.52k|    uint16_t *m;
 3351|  4.52k|    uint16_t *na;
 3352|  4.52k|    uint16_t nb;
 3353|  4.52k|    if (direntry->tdir_count != (uint64_t)tif->tif_dir.td_samplesperpixel)
  ------------------
  |  Branch (3353:9): [True: 4.26k, False: 255]
  ------------------
 3354|  4.26k|    {
 3355|  4.26k|        const TIFFField *fip = TIFFFieldWithTag(tif, direntry->tdir_tag);
 3356|  4.26k|        if (direntry->tdir_count == 0)
  ------------------
  |  Branch (3356:13): [True: 3, False: 4.26k]
  ------------------
 3357|      3|        {
 3358|      3|            return TIFFReadDirEntryErrCount;
 3359|      3|        }
 3360|  4.26k|        else if (direntry->tdir_count <
  ------------------
  |  Branch (3360:18): [True: 62, False: 4.20k]
  ------------------
 3361|  4.26k|                 (uint64_t)tif->tif_dir.td_samplesperpixel)
 3362|     62|        {
 3363|     62|            TIFFWarningExtR(
 3364|     62|                tif, "TIFFReadDirEntryPersampleShort",
 3365|     62|                "Tag %s entry count is %" PRIu64
 3366|     62|                " , whereas it should be SamplesPerPixel=%d. Assuming that "
 3367|     62|                "missing entries are all at the value of the first one",
 3368|     62|                fip ? fip->field_name : "unknown tagname", direntry->tdir_count,
  ------------------
  |  Branch (3368:17): [True: 62, False: 0]
  ------------------
 3369|     62|                tif->tif_dir.td_samplesperpixel);
 3370|     62|        }
 3371|  4.20k|        else
 3372|  4.20k|        {
 3373|  4.20k|            TIFFWarningExtR(tif, "TIFFReadDirEntryPersampleShort",
 3374|  4.20k|                            "Tag %s entry count is %" PRIu64
 3375|  4.20k|                            " , whereas it should be SamplesPerPixel=%d. "
 3376|  4.20k|                            "Ignoring extra entries",
 3377|  4.20k|                            fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (3377:29): [True: 4.20k, False: 0]
  ------------------
 3378|  4.20k|                            direntry->tdir_count,
 3379|  4.20k|                            tif->tif_dir.td_samplesperpixel);
 3380|  4.20k|        }
 3381|  4.26k|    }
 3382|  4.51k|    err = TIFFReadDirEntryShortArray(tif, direntry, &m);
 3383|  4.51k|    if (err != TIFFReadDirEntryErrOk || m == NULL)
  ------------------
  |  Branch (3383:9): [True: 382, False: 4.13k]
  |  Branch (3383:41): [True: 0, False: 4.13k]
  ------------------
 3384|    382|        return (err);
 3385|  4.13k|    na = m;
 3386|  4.13k|    nb = tif->tif_dir.td_samplesperpixel;
 3387|  4.13k|    if (direntry->tdir_count < nb)
  ------------------
  |  Branch (3387:9): [True: 58, False: 4.07k]
  ------------------
 3388|     58|        nb = (uint16_t)direntry->tdir_count;
 3389|  4.13k|    *value = *na++;
 3390|  4.13k|    nb--;
 3391|  4.95k|    while (nb > 0)
  ------------------
  |  Branch (3391:12): [True: 834, False: 4.12k]
  ------------------
 3392|    834|    {
 3393|    834|        if (*na++ != *value)
  ------------------
  |  Branch (3393:13): [True: 10, False: 824]
  ------------------
 3394|     10|        {
 3395|     10|            err = TIFFReadDirEntryErrPsdif;
 3396|     10|            break;
 3397|     10|        }
 3398|    824|        nb--;
 3399|    824|    }
 3400|  4.13k|    _TIFFfreeExt(tif, m);
 3401|  4.13k|    return (err);
 3402|  4.51k|}
tif_dirread.c:TIFFReadDirEntryOutputErr:
 4018|  62.9k|{
 4019|  62.9k|    if (!recover)
  ------------------
  |  Branch (4019:9): [True: 1.98k, False: 60.9k]
  ------------------
 4020|  1.98k|    {
 4021|  1.98k|        switch (err)
 4022|  1.98k|        {
 4023|    324|            case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (4023:13): [True: 324, False: 1.66k]
  ------------------
 4024|    324|                TIFFErrorExtR(tif, module, "Incorrect count for \"%s\"",
 4025|    324|                              tagname);
 4026|    324|                break;
 4027|    131|            case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (4027:13): [True: 131, False: 1.85k]
  ------------------
 4028|    131|                TIFFErrorExtR(tif, module, "Incompatible type for \"%s\"",
 4029|    131|                              tagname);
 4030|    131|                break;
 4031|    278|            case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (4031:13): [True: 278, False: 1.71k]
  ------------------
 4032|    278|                TIFFErrorExtR(tif, module, "IO error during reading of \"%s\"",
 4033|    278|                              tagname);
 4034|    278|                break;
 4035|  1.03k|            case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (4035:13): [True: 1.03k, False: 949]
  ------------------
 4036|  1.03k|                TIFFErrorExtR(tif, module, "Incorrect value for \"%s\"",
 4037|  1.03k|                              tagname);
 4038|  1.03k|                break;
 4039|     10|            case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (4039:13): [True: 10, False: 1.97k]
  ------------------
 4040|     10|                TIFFErrorExtR(
 4041|     10|                    tif, module,
 4042|     10|                    "Cannot handle different values per sample for \"%s\"",
 4043|     10|                    tagname);
 4044|     10|                break;
 4045|    179|            case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (4045:13): [True: 179, False: 1.80k]
  ------------------
 4046|    179|                TIFFErrorExtR(tif, module,
 4047|    179|                              "Sanity check on size of \"%s\" value failed",
 4048|    179|                              tagname);
 4049|    179|                break;
 4050|     27|            case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (4050:13): [True: 27, False: 1.96k]
  ------------------
 4051|     27|                TIFFErrorExtR(tif, module, "Out of memory reading of \"%s\"",
 4052|     27|                              tagname);
 4053|     27|                break;
 4054|      0|            case TIFFReadDirEntryErrOk:
  ------------------
  |  Branch (4054:13): [True: 0, False: 1.98k]
  ------------------
 4055|      0|            default:
  ------------------
  |  Branch (4055:13): [True: 0, False: 1.98k]
  ------------------
 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|  1.98k|        }
 4059|  1.98k|    }
 4060|  60.9k|    else
 4061|  60.9k|    {
 4062|  60.9k|        switch (err)
 4063|  60.9k|        {
 4064|  10.5k|            case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (4064:13): [True: 10.5k, False: 50.4k]
  ------------------
 4065|  10.5k|                TIFFWarningExtR(tif, module,
 4066|  10.5k|                                "Incorrect count for \"%s\"; tag ignored",
 4067|  10.5k|                                tagname);
 4068|  10.5k|                break;
 4069|  1.74k|            case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (4069:13): [True: 1.74k, False: 59.2k]
  ------------------
 4070|  1.74k|                TIFFWarningExtR(tif, module,
 4071|  1.74k|                                "Incompatible type for \"%s\"; tag ignored",
 4072|  1.74k|                                tagname);
 4073|  1.74k|                break;
 4074|  34.4k|            case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (4074:13): [True: 34.4k, False: 26.4k]
  ------------------
 4075|  34.4k|                TIFFWarningExtR(
 4076|  34.4k|                    tif, module,
 4077|  34.4k|                    "IO error during reading of \"%s\"; tag ignored", tagname);
 4078|  34.4k|                break;
 4079|  1.49k|            case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (4079:13): [True: 1.49k, False: 59.4k]
  ------------------
 4080|  1.49k|                TIFFWarningExtR(tif, module,
 4081|  1.49k|                                "Incorrect value for \"%s\"; tag ignored",
 4082|  1.49k|                                tagname);
 4083|  1.49k|                break;
 4084|      0|            case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (4084:13): [True: 0, False: 60.9k]
  ------------------
 4085|      0|                TIFFWarningExtR(tif, module,
 4086|      0|                                "Cannot handle different values per sample for "
 4087|      0|                                "\"%s\"; tag ignored",
 4088|      0|                                tagname);
 4089|      0|                break;
 4090|  3.90k|            case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (4090:13): [True: 3.90k, False: 57.0k]
  ------------------
 4091|  3.90k|                TIFFWarningExtR(
 4092|  3.90k|                    tif, module,
 4093|  3.90k|                    "Sanity check on size of \"%s\" value failed; tag ignored",
 4094|  3.90k|                    tagname);
 4095|  3.90k|                break;
 4096|  8.82k|            case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (4096:13): [True: 8.82k, False: 52.1k]
  ------------------
 4097|  8.82k|                TIFFWarningExtR(tif, module,
 4098|  8.82k|                                "Out of memory reading of \"%s\"; tag ignored",
 4099|  8.82k|                                tagname);
 4100|  8.82k|                break;
 4101|      0|            case TIFFReadDirEntryErrOk:
  ------------------
  |  Branch (4101:13): [True: 0, False: 60.9k]
  ------------------
 4102|      0|            default:
  ------------------
  |  Branch (4102:13): [True: 0, False: 60.9k]
  ------------------
 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|  60.9k|        }
 4106|  60.9k|    }
 4107|  62.9k|}
tif_dirread.c:EvaluateIFDdatasizeReading:
 4186|  94.0k|{
 4187|  94.0k|    const uint64_t data_width =
 4188|  94.0k|        (uint64_t)TIFFDataWidth((TIFFDataType)dp->tdir_type);
 4189|  94.0k|    if (data_width != 0 && dp->tdir_count > UINT64_MAX / data_width)
  ------------------
  |  Branch (4189:9): [True: 93.5k, False: 502]
  |  Branch (4189:28): [True: 11, False: 93.5k]
  ------------------
 4190|     11|    {
 4191|     11|        TIFFErrorExtR(tif, "EvaluateIFDdatasizeReading",
 4192|     11|                      "Too large IFD data size");
 4193|     11|        return false;
 4194|     11|    }
 4195|  94.0k|    const uint64_t datalength = dp->tdir_count * data_width;
 4196|  94.0k|    if (datalength > ((tif->tif_flags & TIFF_BIGTIFF) ? 0x8U : 0x4U))
  ------------------
  |  |  143|  94.0k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4196:9): [True: 68.7k, False: 25.2k]
  |  Branch (4196:23): [True: 704, False: 93.3k]
  ------------------
 4197|  68.7k|    {
 4198|  68.7k|        if (tif->tif_dir.td_dirdatasize_read > UINT64_MAX - datalength)
  ------------------
  |  Branch (4198:13): [True: 142, False: 68.6k]
  ------------------
 4199|    142|        {
 4200|    142|            TIFFErrorExtR(tif, "EvaluateIFDdatasizeReading",
 4201|    142|                          "Too large IFD data size");
 4202|    142|            return false;
 4203|    142|        }
 4204|  68.6k|        tif->tif_dir.td_dirdatasize_read += datalength;
 4205|  68.6k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|  68.6k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4205:13): [True: 68.2k, False: 315]
  ------------------
 4206|  68.2k|        {
 4207|       |            /* The offset of TIFFDirEntry are not swapped when read in. That has
 4208|       |             * to be done when used. */
 4209|  68.2k|            uint32_t offset = dp->tdir_offset.toff_long;
 4210|  68.2k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  68.2k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (4210:17): [True: 877, False: 67.4k]
  ------------------
 4211|    877|                TIFFSwabLong(&offset);
 4212|  68.2k|            tif->tif_dir
 4213|  68.2k|                .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4214|  68.2k|                .offset = (uint64_t)offset;
 4215|  68.2k|        }
 4216|    315|        else
 4217|    315|        {
 4218|    315|            tif->tif_dir
 4219|    315|                .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4220|    315|                .offset = dp->tdir_offset.toff_long8;
 4221|    315|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    315|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (4221:17): [True: 10, False: 305]
  ------------------
 4222|     10|                TIFFSwabLong8(
 4223|     10|                    &tif->tif_dir
 4224|     10|                         .td_dirdatasize_offsets[tif->tif_dir
 4225|     10|                                                     .td_dirdatasize_Noffsets]
 4226|     10|                         .offset);
 4227|    315|        }
 4228|  68.6k|        tif->tif_dir
 4229|  68.6k|            .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4230|  68.6k|            .length = datalength;
 4231|  68.6k|        tif->tif_dir.td_dirdatasize_Noffsets++;
 4232|  68.6k|    }
 4233|  93.8k|    return true;
 4234|  94.0k|}
tif_dirread.c:TIFFReadDirEntryDoubleArray:
 3046|  2.75k|{
 3047|  2.75k|    enum TIFFReadDirEntryErr err;
 3048|  2.75k|    uint32_t count;
 3049|  2.75k|    void *origdata;
 3050|  2.75k|    double *data;
 3051|  2.75k|    switch (direntry->tdir_type)
 3052|  2.75k|    {
 3053|     13|        case TIFF_BYTE:
  ------------------
  |  Branch (3053:9): [True: 13, False: 2.74k]
  ------------------
 3054|     23|        case TIFF_SBYTE:
  ------------------
  |  Branch (3054:9): [True: 10, False: 2.74k]
  ------------------
 3055|    230|        case TIFF_SHORT:
  ------------------
  |  Branch (3055:9): [True: 207, False: 2.54k]
  ------------------
 3056|    249|        case TIFF_SSHORT:
  ------------------
  |  Branch (3056:9): [True: 19, False: 2.73k]
  ------------------
 3057|    266|        case TIFF_LONG:
  ------------------
  |  Branch (3057:9): [True: 17, False: 2.73k]
  ------------------
 3058|    287|        case TIFF_SLONG:
  ------------------
  |  Branch (3058:9): [True: 21, False: 2.73k]
  ------------------
 3059|    306|        case TIFF_LONG8:
  ------------------
  |  Branch (3059:9): [True: 19, False: 2.73k]
  ------------------
 3060|    324|        case TIFF_SLONG8:
  ------------------
  |  Branch (3060:9): [True: 18, False: 2.73k]
  ------------------
 3061|    395|        case TIFF_RATIONAL:
  ------------------
  |  Branch (3061:9): [True: 71, False: 2.68k]
  ------------------
 3062|    443|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (3062:9): [True: 48, False: 2.70k]
  ------------------
 3063|    455|        case TIFF_FLOAT:
  ------------------
  |  Branch (3063:9): [True: 12, False: 2.74k]
  ------------------
 3064|  2.75k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3064:9): [True: 2.29k, False: 460]
  ------------------
 3065|  2.75k|            break;
 3066|      5|        default:
  ------------------
  |  Branch (3066:9): [True: 5, False: 2.75k]
  ------------------
 3067|      5|            return (TIFFReadDirEntryErrType);
 3068|  2.75k|    }
 3069|  2.75k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 3070|  2.75k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (3070:9): [True: 926, False: 1.82k]
  |  Branch (3070:43): [True: 84, False: 1.74k]
  ------------------
 3071|  1.01k|    {
 3072|  1.01k|        *value = 0;
 3073|  1.01k|        return (err);
 3074|  1.01k|    }
 3075|  1.74k|    switch (direntry->tdir_type)
 3076|  1.74k|    {
 3077|  1.29k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3077:9): [True: 1.29k, False: 451]
  ------------------
 3078|  1.29k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.29k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3078:17): [True: 163, False: 1.12k]
  ------------------
 3079|    163|                TIFFSwabArrayOfLong8((uint64_t *)origdata, count);
 3080|  1.29k|            TIFFCvtIEEEDoubleToNative(tif, count, (double *)origdata);
 3081|  1.29k|            *value = (double *)origdata;
 3082|  1.29k|            return (TIFFReadDirEntryErrOk);
 3083|    451|        default:
  ------------------
  |  Branch (3083:9): [True: 451, False: 1.29k]
  ------------------
 3084|    451|            break;
 3085|  1.74k|    }
 3086|    451|    data = (double *)_TIFFmallocExt(tif,
 3087|    451|                                    (tmsize_t)((size_t)count * sizeof(double)));
 3088|    451|    if (data == 0)
  ------------------
  |  Branch (3088:9): [True: 0, False: 451]
  ------------------
 3089|      0|    {
 3090|      0|        _TIFFfreeExt(tif, origdata);
 3091|      0|        return (TIFFReadDirEntryErrAlloc);
 3092|      0|    }
 3093|    451|    switch (direntry->tdir_type)
 3094|    451|    {
 3095|     13|        case TIFF_BYTE:
  ------------------
  |  Branch (3095:9): [True: 13, False: 438]
  ------------------
 3096|     13|        {
 3097|     13|            uint8_t *ma;
 3098|     13|            double *mb;
 3099|     13|            uint32_t n;
 3100|     13|            ma = (uint8_t *)origdata;
 3101|     13|            mb = data;
 3102|    380|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3102:25): [True: 367, False: 13]
  ------------------
 3103|    367|                *mb++ = (double)(*ma++);
 3104|     13|        }
 3105|     13|        break;
 3106|     10|        case TIFF_SBYTE:
  ------------------
  |  Branch (3106:9): [True: 10, False: 441]
  ------------------
 3107|     10|        {
 3108|     10|            int8_t *ma;
 3109|     10|            double *mb;
 3110|     10|            uint32_t n;
 3111|     10|            ma = (int8_t *)origdata;
 3112|     10|            mb = data;
 3113|    372|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3113:25): [True: 362, False: 10]
  ------------------
 3114|    362|                *mb++ = (double)(*ma++);
 3115|     10|        }
 3116|     10|        break;
 3117|    207|        case TIFF_SHORT:
  ------------------
  |  Branch (3117:9): [True: 207, False: 244]
  ------------------
 3118|    207|        {
 3119|    207|            uint16_t *ma;
 3120|    207|            double *mb;
 3121|    207|            uint32_t n;
 3122|    207|            ma = (uint16_t *)origdata;
 3123|    207|            mb = data;
 3124|  1.44k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3124:25): [True: 1.23k, False: 207]
  ------------------
 3125|  1.23k|            {
 3126|  1.23k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.23k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3126:21): [True: 323, False: 914]
  ------------------
 3127|    323|                    TIFFSwabShort(ma);
 3128|  1.23k|                *mb++ = (double)(*ma++);
 3129|  1.23k|            }
 3130|    207|        }
 3131|    207|        break;
 3132|     19|        case TIFF_SSHORT:
  ------------------
  |  Branch (3132:9): [True: 19, False: 432]
  ------------------
 3133|     19|        {
 3134|     19|            int16_t *ma;
 3135|     19|            double *mb;
 3136|     19|            uint32_t n;
 3137|     19|            ma = (int16_t *)origdata;
 3138|     19|            mb = data;
 3139|    692|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3139:25): [True: 673, False: 19]
  ------------------
 3140|    673|            {
 3141|    673|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    673|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3141:21): [True: 308, False: 365]
  ------------------
 3142|    308|                    TIFFSwabShort((uint16_t *)ma);
 3143|    673|                *mb++ = (double)(*ma++);
 3144|    673|            }
 3145|     19|        }
 3146|     19|        break;
 3147|     17|        case TIFF_LONG:
  ------------------
  |  Branch (3147:9): [True: 17, False: 434]
  ------------------
 3148|     17|        {
 3149|     17|            uint32_t *ma;
 3150|     17|            double *mb;
 3151|     17|            uint32_t n;
 3152|     17|            ma = (uint32_t *)origdata;
 3153|     17|            mb = data;
 3154|    681|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3154:25): [True: 664, False: 17]
  ------------------
 3155|    664|            {
 3156|    664|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    664|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3156:21): [True: 308, False: 356]
  ------------------
 3157|    308|                    TIFFSwabLong(ma);
 3158|    664|                *mb++ = (double)(*ma++);
 3159|    664|            }
 3160|     17|        }
 3161|     17|        break;
 3162|     20|        case TIFF_SLONG:
  ------------------
  |  Branch (3162:9): [True: 20, False: 431]
  ------------------
 3163|     20|        {
 3164|     20|            int32_t *ma;
 3165|     20|            double *mb;
 3166|     20|            uint32_t n;
 3167|     20|            ma = (int32_t *)origdata;
 3168|     20|            mb = data;
 3169|    694|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3169:25): [True: 674, False: 20]
  ------------------
 3170|    674|            {
 3171|    674|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    674|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3171:21): [True: 308, False: 366]
  ------------------
 3172|    308|                    TIFFSwabLong((uint32_t *)ma);
 3173|    674|                *mb++ = (double)(*ma++);
 3174|    674|            }
 3175|     20|        }
 3176|     20|        break;
 3177|     19|        case TIFF_LONG8:
  ------------------
  |  Branch (3177:9): [True: 19, False: 432]
  ------------------
 3178|     19|        {
 3179|     19|            uint64_t *ma;
 3180|     19|            double *mb;
 3181|     19|            uint32_t n;
 3182|     19|            ma = (uint64_t *)origdata;
 3183|     19|            mb = data;
 3184|    692|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3184:25): [True: 673, False: 19]
  ------------------
 3185|    673|            {
 3186|    673|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    673|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3186:21): [True: 308, False: 365]
  ------------------
 3187|    308|                    TIFFSwabLong8(ma);
 3188|    673|                *mb++ = (double)(*ma++);
 3189|    673|            }
 3190|     19|        }
 3191|     19|        break;
 3192|     18|        case TIFF_SLONG8:
  ------------------
  |  Branch (3192:9): [True: 18, False: 433]
  ------------------
 3193|     18|        {
 3194|     18|            int64_t *ma;
 3195|     18|            double *mb;
 3196|     18|            uint32_t n;
 3197|     18|            ma = (int64_t *)origdata;
 3198|     18|            mb = data;
 3199|    688|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3199:25): [True: 670, False: 18]
  ------------------
 3200|    670|            {
 3201|    670|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    670|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3201:21): [True: 308, False: 362]
  ------------------
 3202|    308|                    TIFFSwabLong8((uint64_t *)ma);
 3203|    670|                *mb++ = (double)(*ma++);
 3204|    670|            }
 3205|     18|        }
 3206|     18|        break;
 3207|     70|        case TIFF_RATIONAL:
  ------------------
  |  Branch (3207:9): [True: 70, False: 381]
  ------------------
 3208|     70|        {
 3209|     70|            uint32_t *ma;
 3210|     70|            uint32_t maa;
 3211|     70|            uint32_t mab;
 3212|     70|            double *mb;
 3213|     70|            uint32_t n;
 3214|     70|            ma = (uint32_t *)origdata;
 3215|     70|            mb = data;
 3216|  1.12k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3216:25): [True: 1.05k, False: 70]
  ------------------
 3217|  1.05k|            {
 3218|  1.05k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.05k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3218:21): [True: 579, False: 478]
  ------------------
 3219|    579|                    TIFFSwabLong(ma);
 3220|  1.05k|                maa = *ma++;
 3221|  1.05k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.05k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3221:21): [True: 579, False: 478]
  ------------------
 3222|    579|                    TIFFSwabLong(ma);
 3223|  1.05k|                mab = *ma++;
 3224|  1.05k|                if (mab == 0)
  ------------------
  |  Branch (3224:21): [True: 373, False: 684]
  ------------------
 3225|    373|                    *mb++ = 0.0;
 3226|    684|                else
 3227|    684|                    *mb++ = (double)maa / (double)mab;
 3228|  1.05k|            }
 3229|     70|        }
 3230|     70|        break;
 3231|     47|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (3231:9): [True: 47, False: 404]
  ------------------
 3232|     47|        {
 3233|     47|            uint32_t *ma;
 3234|     47|            int32_t maa;
 3235|     47|            uint32_t mab;
 3236|     47|            double *mb;
 3237|     47|            uint32_t n;
 3238|     47|            ma = (uint32_t *)origdata;
 3239|     47|            mb = data;
 3240|  1.60k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3240:25): [True: 1.55k, False: 47]
  ------------------
 3241|  1.55k|            {
 3242|  1.55k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.55k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3242:21): [True: 787, False: 769]
  ------------------
 3243|    787|                    TIFFSwabLong(ma);
 3244|  1.55k|                maa = *(int32_t *)ma;
 3245|  1.55k|                ma++;
 3246|  1.55k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.55k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3246:21): [True: 787, False: 769]
  ------------------
 3247|    787|                    TIFFSwabLong(ma);
 3248|  1.55k|                mab = *ma++;
 3249|  1.55k|                if (mab == 0)
  ------------------
  |  Branch (3249:21): [True: 549, False: 1.00k]
  ------------------
 3250|    549|                    *mb++ = 0.0;
 3251|  1.00k|                else
 3252|  1.00k|                    *mb++ = (double)maa / (double)mab;
 3253|  1.55k|            }
 3254|     47|        }
 3255|     47|        break;
 3256|     11|        case TIFF_FLOAT:
  ------------------
  |  Branch (3256:9): [True: 11, False: 440]
  ------------------
 3257|     11|        {
 3258|     11|            float *ma;
 3259|     11|            double *mb;
 3260|     11|            uint32_t n;
 3261|     11|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     11|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3261:17): [True: 2, False: 9]
  ------------------
 3262|      2|                TIFFSwabArrayOfLong((uint32_t *)origdata, count);
 3263|     11|            TIFFCvtIEEEFloatToNative(tif, count, (float *)origdata);
 3264|     11|            ma = (float *)origdata;
 3265|     11|            mb = data;
 3266|    374|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3266:25): [True: 363, False: 11]
  ------------------
 3267|    363|                *mb++ = (double)(*ma++);
 3268|     11|        }
 3269|     11|        break;
 3270|      0|        default:
  ------------------
  |  Branch (3270:9): [True: 0, False: 451]
  ------------------
 3271|      0|            break;
 3272|    451|    }
 3273|    451|    _TIFFfreeExt(tif, origdata);
 3274|    451|    *value = data;
 3275|    451|    return (TIFFReadDirEntryErrOk);
 3276|    451|}
tif_dirread.c:TIFFReadDirEntryArray:
 1390|  97.5k|{
 1391|  97.5k|    return TIFFReadDirEntryArrayWithLimit(tif, direntry, count, desttypesize,
 1392|  97.5k|                                          value, ~((uint64_t)0));
 1393|  97.5k|}
tif_dirread.c:TIFFReadDirEntryArrayWithLimit:
 1263|   134k|{
 1264|   134k|    int typesize;
 1265|   134k|    uint32_t datasize;
 1266|   134k|    void *data;
 1267|   134k|    uint64_t target_count64;
 1268|   134k|    int original_datasize_clamped;
 1269|   134k|    typesize = TIFFDataWidth((TIFFDataType)direntry->tdir_type);
 1270|       |
 1271|   134k|    target_count64 =
 1272|   134k|        (direntry->tdir_count > maxcount) ? maxcount : direntry->tdir_count;
  ------------------
  |  Branch (1272:9): [True: 25.0k, False: 109k]
  ------------------
 1273|       |
 1274|   134k|    if ((target_count64 == 0) || (typesize == 0))
  ------------------
  |  Branch (1274:9): [True: 5.04k, False: 129k]
  |  Branch (1274:34): [True: 0, False: 129k]
  ------------------
 1275|  5.04k|    {
 1276|  5.04k|        *value = 0;
 1277|  5.04k|        return (TIFFReadDirEntryErrOk);
 1278|  5.04k|    }
 1279|   129k|    (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|   129k|    original_datasize_clamped =
 1285|   129k|        ((direntry->tdir_count > 10) ? 10 : (int)direntry->tdir_count) *
  ------------------
  |  Branch (1285:10): [True: 104k, False: 24.8k]
  ------------------
 1286|   129k|        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|   129k|    if ((uint64_t)(MAX_SIZE_TAG_DATA / (unsigned int)typesize) < target_count64)
  ------------------
  |  | 1257|   129k|#define MAX_SIZE_TAG_DATA 2147483647U
  ------------------
  |  Branch (1293:9): [True: 4.03k, False: 125k]
  ------------------
 1294|  4.03k|        return (TIFFReadDirEntryErrSizesan);
 1295|   125k|    if ((uint64_t)(MAX_SIZE_TAG_DATA / desttypesize) < target_count64)
  ------------------
  |  | 1257|   125k|#define MAX_SIZE_TAG_DATA 2147483647U
  ------------------
  |  Branch (1295:9): [True: 50, False: 125k]
  ------------------
 1296|     50|        return (TIFFReadDirEntryErrSizesan);
 1297|       |
 1298|   125k|    *count = (uint32_t)target_count64;
 1299|   125k|    datasize = (uint32_t)(*count) * (unsigned int)typesize;
 1300|   125k|    assert((tmsize_t)datasize > 0);
  ------------------
  |  Branch (1300:5): [True: 0, False: 125k]
  |  Branch (1300:5): [True: 125k, False: 0]
  ------------------
 1301|       |
 1302|   125k|    if (datasize > 100 * 1024 * 1024)
  ------------------
  |  Branch (1302:9): [True: 2.39k, False: 123k]
  ------------------
 1303|  2.39k|    {
 1304|       |        /* Before allocating a huge amount of memory for corrupted files, check
 1305|       |         * if size of requested memory is not greater than file size.
 1306|       |         */
 1307|  2.39k|        const uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|  2.39k|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 1308|  2.39k|        if (datasize > filesize)
  ------------------
  |  Branch (1308:13): [True: 2.39k, False: 0]
  ------------------
 1309|  2.39k|        {
 1310|  2.39k|            TIFFWarningExtR(tif, "ReadDirEntryArray",
 1311|  2.39k|                            "Requested memory size for tag %d (0x%x) %" PRIu32
 1312|  2.39k|                            " is greater than filesize %" PRIu64
 1313|  2.39k|                            ". Memory not allocated, tag not read",
 1314|  2.39k|                            direntry->tdir_tag, direntry->tdir_tag, datasize,
 1315|  2.39k|                            filesize);
 1316|  2.39k|            return (TIFFReadDirEntryErrAlloc);
 1317|  2.39k|        }
 1318|  2.39k|    }
 1319|       |
 1320|   123k|    if (isMapped(tif) && datasize > (uint64_t)tif->tif_size)
  ------------------
  |  |  283|   246k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|   123k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 123k]
  |  |  ------------------
  ------------------
  |  Branch (1320:26): [True: 0, False: 0]
  ------------------
 1321|      0|        return TIFFReadDirEntryErrIo;
 1322|       |
 1323|   123k|    if (!isMapped(tif) && (((tif->tif_flags & TIFF_BIGTIFF) && datasize > 8) ||
  ------------------
  |  |  283|   246k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|   123k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
                  if (!isMapped(tif) && (((tif->tif_flags & TIFF_BIGTIFF) && datasize > 8) ||
  ------------------
  |  |  143|   123k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1323:9): [True: 123k, False: 0]
  |  Branch (1323:29): [True: 675, False: 122k]
  |  Branch (1323:64): [True: 246, False: 429]
  ------------------
 1324|   122k|                           (!(tif->tif_flags & TIFF_BIGTIFF) && datasize > 4)))
  ------------------
  |  |  143|   122k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1324:29): [True: 122k, False: 429]
  |  Branch (1324:65): [True: 102k, False: 20.2k]
  ------------------
 1325|   102k|    {
 1326|   102k|        data = NULL;
 1327|   102k|    }
 1328|  20.6k|    else
 1329|  20.6k|    {
 1330|  20.6k|        data = _TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
 1331|  20.6k|        if (data == 0)
  ------------------
  |  Branch (1331:13): [True: 0, False: 20.6k]
  ------------------
 1332|      0|            return (TIFFReadDirEntryErrAlloc);
 1333|  20.6k|    }
 1334|   123k|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|   123k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1334:9): [True: 122k, False: 675]
  ------------------
 1335|   122k|    {
 1336|       |        /* Only the condition on original_datasize_clamped. The second
 1337|       |         * one is implied, but Coverity Scan cannot see it. */
 1338|   122k|        if (original_datasize_clamped <= 4 && datasize <= 4)
  ------------------
  |  Branch (1338:13): [True: 14.0k, False: 108k]
  |  Branch (1338:47): [True: 14.0k, False: 0]
  ------------------
 1339|  14.0k|            _TIFFmemcpy(data, &direntry->tdir_offset, datasize);
 1340|   108k|        else
 1341|   108k|        {
 1342|   108k|            enum TIFFReadDirEntryErr err;
 1343|   108k|            uint32_t offset = direntry->tdir_offset.toff_long;
 1344|   108k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|   108k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1344:17): [True: 1.01k, False: 107k]
  ------------------
 1345|  1.01k|                TIFFSwabLong(&offset);
 1346|   108k|            if (isMapped(tif))
  ------------------
  |  |  283|   108k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|   108k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 108k]
  |  |  ------------------
  ------------------
 1347|      0|                err = TIFFReadDirEntryData(tif, (uint64_t)offset,
 1348|      0|                                           (tmsize_t)datasize, data);
 1349|   108k|            else
 1350|   108k|                err = TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset,
 1351|   108k|                                                     (tmsize_t)datasize, &data);
 1352|   108k|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1352:17): [True: 40.5k, False: 67.8k]
  ------------------
 1353|  40.5k|            {
 1354|  40.5k|                _TIFFfreeExt(tif, data);
 1355|  40.5k|                return (err);
 1356|  40.5k|            }
 1357|   108k|        }
 1358|   122k|    }
 1359|    675|    else
 1360|    675|    {
 1361|       |        /* See above comment for the Classic TIFF case */
 1362|    675|        if (original_datasize_clamped <= 8 && datasize <= 8)
  ------------------
  |  Branch (1362:13): [True: 184, False: 491]
  |  Branch (1362:47): [True: 184, False: 0]
  ------------------
 1363|    184|            _TIFFmemcpy(data, &direntry->tdir_offset, datasize);
 1364|    491|        else
 1365|    491|        {
 1366|    491|            enum TIFFReadDirEntryErr err;
 1367|    491|            uint64_t offset = direntry->tdir_offset.toff_long8;
 1368|    491|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    491|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1368:17): [True: 23, False: 468]
  ------------------
 1369|     23|                TIFFSwabLong8(&offset);
 1370|    491|            if (isMapped(tif))
  ------------------
  |  |  283|    491|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|    491|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 491]
  |  |  ------------------
  ------------------
 1371|      0|                err = TIFFReadDirEntryData(tif, (uint64_t)offset,
 1372|      0|                                           (tmsize_t)datasize, data);
 1373|    491|            else
 1374|    491|                err = TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset,
 1375|    491|                                                     (tmsize_t)datasize, &data);
 1376|    491|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1376:17): [True: 157, False: 334]
  ------------------
 1377|    157|            {
 1378|    157|                _TIFFfreeExt(tif, data);
 1379|    157|                return (err);
 1380|    157|            }
 1381|    491|        }
 1382|    675|    }
 1383|  82.3k|    *value = data;
 1384|  82.3k|    return (TIFFReadDirEntryErrOk);
 1385|   123k|}
tif_dirread.c:TIFFReadDirEntryDataAndRealloc:
 1199|   108k|{
 1200|   108k|#if SIZEOF_SIZE_T == 8
 1201|   108k|    tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  | 1189|   108k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
 1202|   108k|#endif
 1203|   108k|    tmsize_t already_read = 0;
 1204|       |
 1205|   108k|    assert(!isMapped(tif));
  ------------------
  |  Branch (1205:5): [True: 0, False: 108k]
  |  Branch (1205:5): [True: 108k, False: 0]
  ------------------
 1206|       |
 1207|   108k|    if (!SeekOK(tif, offset))
  ------------------
  |  |  307|   108k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (1207:9): [True: 38, False: 108k]
  ------------------
 1208|     38|        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|   177k|    while (already_read < size)
  ------------------
  |  Branch (1216:12): [True: 108k, False: 68.1k]
  ------------------
 1217|   108k|    {
 1218|   108k|        void *new_dest;
 1219|   108k|        tmsize_t bytes_read;
 1220|   108k|        tmsize_t to_read = size - already_read;
 1221|   108k|#if SIZEOF_SIZE_T == 8
 1222|   108k|        if (to_read >= threshold && threshold < MAX_THRESHOLD)
  ------------------
  |  | 1192|  14.6k|    (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|  14.6k|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|  14.6k|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|  14.6k|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  | 1193|  14.6k|     INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  | 1189|  14.6k|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (1222:13): [True: 14.6k, False: 94.2k]
  |  Branch (1222:37): [True: 14.6k, False: 0]
  ------------------
 1223|  14.6k|        {
 1224|  14.6k|            to_read = threshold;
 1225|  14.6k|            threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  | 1190|  14.6k|#define THRESHOLD_MULTIPLIER 10
  ------------------
 1226|  14.6k|        }
 1227|   108k|#endif
 1228|       |
 1229|   108k|        new_dest =
 1230|   108k|            (uint8_t *)_TIFFreallocExt(tif, *pdest, already_read + to_read);
 1231|   108k|        if (new_dest == NULL)
  ------------------
  |  Branch (1231:13): [True: 6.45k, False: 102k]
  ------------------
 1232|  6.45k|        {
 1233|  6.45k|            TIFFErrorExtR(tif, tif->tif_name,
 1234|  6.45k|                          "Failed to allocate memory for %s "
 1235|  6.45k|                          "(%" TIFF_SSIZE_FORMAT
 1236|  6.45k|                          " elements of %" TIFF_SSIZE_FORMAT " bytes each)",
 1237|  6.45k|                          "TIFFReadDirEntryArray", (tmsize_t)1,
 1238|  6.45k|                          already_read + to_read);
 1239|  6.45k|            return TIFFReadDirEntryErrAlloc;
 1240|  6.45k|        }
 1241|   102k|        *pdest = new_dest;
 1242|       |
 1243|   102k|        bytes_read = TIFFReadFile(tif, (char *)*pdest + already_read, to_read);
  ------------------
  |  |  287|   102k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 1244|   102k|        if (bytes_read < 0)
  ------------------
  |  Branch (1244:13): [True: 0, False: 102k]
  ------------------
 1245|      0|            return TIFFReadDirEntryErrIo;
 1246|   102k|        already_read += bytes_read;
 1247|   102k|        if (bytes_read != to_read)
  ------------------
  |  Branch (1247:13): [True: 34.2k, False: 68.1k]
  ------------------
 1248|  34.2k|        {
 1249|  34.2k|            return TIFFReadDirEntryErrIo;
 1250|  34.2k|        }
 1251|   102k|    }
 1252|  68.1k|    return TIFFReadDirEntryErrOk;
 1253|   108k|}
tif_dirread.c:TIFFReadDirEntryShortArray:
 1767|  31.6k|{
 1768|  31.6k|    enum TIFFReadDirEntryErr err;
 1769|  31.6k|    uint32_t count;
 1770|  31.6k|    void *origdata;
 1771|  31.6k|    uint16_t *data;
 1772|  31.6k|    switch (direntry->tdir_type)
 1773|  31.6k|    {
 1774|  1.89k|        case TIFF_BYTE:
  ------------------
  |  Branch (1774:9): [True: 1.89k, False: 29.7k]
  ------------------
 1775|  2.79k|        case TIFF_SBYTE:
  ------------------
  |  Branch (1775:9): [True: 901, False: 30.7k]
  ------------------
 1776|  29.7k|        case TIFF_SHORT:
  ------------------
  |  Branch (1776:9): [True: 26.9k, False: 4.67k]
  ------------------
 1777|  30.9k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1777:9): [True: 1.14k, False: 30.5k]
  ------------------
 1778|  31.0k|        case TIFF_LONG:
  ------------------
  |  Branch (1778:9): [True: 86, False: 31.5k]
  ------------------
 1779|  31.1k|        case TIFF_SLONG:
  ------------------
  |  Branch (1779:9): [True: 161, False: 31.4k]
  ------------------
 1780|  31.3k|        case TIFF_LONG8:
  ------------------
  |  Branch (1780:9): [True: 155, False: 31.4k]
  ------------------
 1781|  31.5k|        case TIFF_SLONG8:
  ------------------
  |  Branch (1781:9): [True: 209, False: 31.4k]
  ------------------
 1782|  31.5k|            break;
 1783|    115|        default:
  ------------------
  |  Branch (1783:9): [True: 115, False: 31.5k]
  ------------------
 1784|    115|            return (TIFFReadDirEntryErrType);
 1785|  31.6k|    }
 1786|  31.5k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 2, &origdata);
 1787|  31.5k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1787:9): [True: 17.8k, False: 13.7k]
  |  Branch (1787:43): [True: 139, False: 13.5k]
  ------------------
 1788|  17.9k|    {
 1789|  17.9k|        *value = 0;
 1790|  17.9k|        return (err);
 1791|  17.9k|    }
 1792|  13.5k|    switch (direntry->tdir_type)
 1793|  13.5k|    {
 1794|  9.33k|        case TIFF_SHORT:
  ------------------
  |  Branch (1794:9): [True: 9.33k, False: 4.24k]
  ------------------
 1795|  9.33k|            *value = (uint16_t *)origdata;
 1796|  9.33k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  9.33k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1796:17): [True: 286, False: 9.05k]
  ------------------
 1797|    286|                TIFFSwabArrayOfShort(*value, count);
 1798|  9.33k|            return (TIFFReadDirEntryErrOk);
 1799|  1.11k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1799:9): [True: 1.11k, False: 12.4k]
  ------------------
 1800|  1.11k|        {
 1801|  1.11k|            int16_t *m;
 1802|  1.11k|            uint32_t n;
 1803|  1.11k|            m = (int16_t *)origdata;
 1804|  3.75k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1804:25): [True: 2.67k, False: 1.08k]
  ------------------
 1805|  2.67k|            {
 1806|  2.67k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  2.67k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1806:21): [True: 306, False: 2.37k]
  ------------------
 1807|    306|                    TIFFSwabShort((uint16_t *)m);
 1808|  2.67k|                err = TIFFReadDirEntryCheckRangeShortSshort(*m);
 1809|  2.67k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1809:21): [True: 30, False: 2.64k]
  ------------------
 1810|     30|                {
 1811|     30|                    _TIFFfreeExt(tif, origdata);
 1812|     30|                    return (err);
 1813|     30|                }
 1814|  2.64k|                m++;
 1815|  2.64k|            }
 1816|  1.08k|            *value = (uint16_t *)origdata;
 1817|  1.08k|            return (TIFFReadDirEntryErrOk);
 1818|  1.11k|        }
 1819|  3.13k|        default:
  ------------------
  |  Branch (1819:9): [True: 3.13k, False: 10.4k]
  ------------------
 1820|  3.13k|            break;
 1821|  13.5k|    }
 1822|  3.13k|    data = (uint16_t *)_TIFFCheckMalloc(tif, count, sizeof(uint16_t),
 1823|  3.13k|                                        "TIFFReadDirEntryShortArray");
 1824|  3.13k|    if (data == 0)
  ------------------
  |  Branch (1824:9): [True: 1, False: 3.13k]
  ------------------
 1825|      1|    {
 1826|      1|        _TIFFfreeExt(tif, origdata);
 1827|      1|        return (TIFFReadDirEntryErrAlloc);
 1828|      1|    }
 1829|  3.13k|    switch (direntry->tdir_type)
 1830|  3.13k|    {
 1831|  1.76k|        case TIFF_BYTE:
  ------------------
  |  Branch (1831:9): [True: 1.76k, False: 1.36k]
  ------------------
 1832|  1.76k|        {
 1833|  1.76k|            uint8_t *ma;
 1834|  1.76k|            uint16_t *mb;
 1835|  1.76k|            uint32_t n;
 1836|  1.76k|            ma = (uint8_t *)origdata;
 1837|  1.76k|            mb = data;
 1838|  18.6k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1838:25): [True: 16.8k, False: 1.76k]
  ------------------
 1839|  16.8k|                *mb++ = (uint16_t)(*ma++);
 1840|  1.76k|        }
 1841|  1.76k|        break;
 1842|    887|        case TIFF_SBYTE:
  ------------------
  |  Branch (1842:9): [True: 887, False: 2.24k]
  ------------------
 1843|    887|        {
 1844|    887|            int8_t *ma;
 1845|    887|            uint16_t *mb;
 1846|    887|            uint32_t n;
 1847|    887|            ma = (int8_t *)origdata;
 1848|    887|            mb = data;
 1849|  3.38k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1849:25): [True: 2.51k, False: 877]
  ------------------
 1850|  2.51k|            {
 1851|  2.51k|                err = TIFFReadDirEntryCheckRangeShortSbyte(*ma);
 1852|  2.51k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1852:21): [True: 10, False: 2.50k]
  ------------------
 1853|     10|                    break;
 1854|  2.50k|                *mb++ = (uint16_t)(*ma++);
 1855|  2.50k|            }
 1856|    887|        }
 1857|    887|        break;
 1858|     65|        case TIFF_LONG:
  ------------------
  |  Branch (1858:9): [True: 65, False: 3.07k]
  ------------------
 1859|     65|        {
 1860|     65|            uint32_t *ma;
 1861|     65|            uint16_t *mb;
 1862|     65|            uint32_t n;
 1863|     65|            ma = (uint32_t *)origdata;
 1864|     65|            mb = data;
 1865|    529|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1865:25): [True: 495, False: 34]
  ------------------
 1866|    495|            {
 1867|    495|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    495|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1867:21): [True: 224, False: 271]
  ------------------
 1868|    224|                    TIFFSwabLong(ma);
 1869|    495|                err = TIFFReadDirEntryCheckRangeShortLong(*ma);
 1870|    495|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1870:21): [True: 31, False: 464]
  ------------------
 1871|     31|                    break;
 1872|    464|                *mb++ = (uint16_t)(*ma++);
 1873|    464|            }
 1874|     65|        }
 1875|     65|        break;
 1876|    119|        case TIFF_SLONG:
  ------------------
  |  Branch (1876:9): [True: 119, False: 3.01k]
  ------------------
 1877|    119|        {
 1878|    119|            int32_t *ma;
 1879|    119|            uint16_t *mb;
 1880|    119|            uint32_t n;
 1881|    119|            ma = (int32_t *)origdata;
 1882|    119|            mb = data;
 1883|    606|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1883:25): [True: 568, False: 38]
  ------------------
 1884|    568|            {
 1885|    568|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    568|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1885:21): [True: 228, False: 340]
  ------------------
 1886|    228|                    TIFFSwabLong((uint32_t *)ma);
 1887|    568|                err = TIFFReadDirEntryCheckRangeShortSlong(*ma);
 1888|    568|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1888:21): [True: 81, False: 487]
  ------------------
 1889|     81|                    break;
 1890|    487|                *mb++ = (uint16_t)(*ma++);
 1891|    487|            }
 1892|    119|        }
 1893|    119|        break;
 1894|    115|        case TIFF_LONG8:
  ------------------
  |  Branch (1894:9): [True: 115, False: 3.02k]
  ------------------
 1895|    115|        {
 1896|    115|            uint64_t *ma;
 1897|    115|            uint16_t *mb;
 1898|    115|            uint32_t n;
 1899|    115|            ma = (uint64_t *)origdata;
 1900|    115|            mb = data;
 1901|    560|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1901:25): [True: 540, False: 20]
  ------------------
 1902|    540|            {
 1903|    540|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    540|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1903:21): [True: 214, False: 326]
  ------------------
 1904|    214|                    TIFFSwabLong8(ma);
 1905|    540|                err = TIFFReadDirEntryCheckRangeShortLong8(*ma);
 1906|    540|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1906:21): [True: 95, False: 445]
  ------------------
 1907|     95|                    break;
 1908|    445|                *mb++ = (uint16_t)(*ma++);
 1909|    445|            }
 1910|    115|        }
 1911|    115|        break;
 1912|    182|        case TIFF_SLONG8:
  ------------------
  |  Branch (1912:9): [True: 182, False: 2.95k]
  ------------------
 1913|    182|        {
 1914|    182|            int64_t *ma;
 1915|    182|            uint16_t *mb;
 1916|    182|            uint32_t n;
 1917|    182|            ma = (int64_t *)origdata;
 1918|    182|            mb = data;
 1919|    719|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1919:25): [True: 699, False: 20]
  ------------------
 1920|    699|            {
 1921|    699|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    699|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1921:21): [True: 262, False: 437]
  ------------------
 1922|    262|                    TIFFSwabLong8((uint64_t *)ma);
 1923|    699|                err = TIFFReadDirEntryCheckRangeShortSlong8(*ma);
 1924|    699|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1924:21): [True: 162, False: 537]
  ------------------
 1925|    162|                    break;
 1926|    537|                *mb++ = (uint16_t)(*ma++);
 1927|    537|            }
 1928|    182|        }
 1929|    182|        break;
 1930|      0|        default:
  ------------------
  |  Branch (1930:9): [True: 0, False: 3.13k]
  ------------------
 1931|      0|            break;
 1932|  3.13k|    }
 1933|  3.13k|    _TIFFfreeExt(tif, origdata);
 1934|  3.13k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1934:9): [True: 379, False: 2.75k]
  ------------------
 1935|    379|    {
 1936|    379|        _TIFFfreeExt(tif, data);
 1937|    379|        return (err);
 1938|    379|    }
 1939|  2.75k|    *value = data;
 1940|  2.75k|    return (TIFFReadDirEntryErrOk);
 1941|  3.13k|}
tif_dirread.c:CalcFinalIFDdatasizeReading:
 4260|  24.9k|{
 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|  24.9k|    if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (4264:9): [True: 24.9k, False: 0]
  ------------------
 4265|  24.9k|        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))
  ------------------
  |  |  143|      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);
  ------------------
  |  |  291|      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))
  ------------------
  |  |  143|      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|  19.7k|{
 4116|  19.7k|    switch (photometric)
 4117|  19.7k|    {
 4118|    227|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|    227|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (4118:9): [True: 227, False: 19.4k]
  ------------------
 4119|  12.0k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  12.0k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (4119:9): [True: 11.8k, False: 7.84k]
  ------------------
 4120|  12.2k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  12.2k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (4120:9): [True: 124, False: 19.5k]
  ------------------
 4121|  12.2k|            return 1;
 4122|  6.29k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  6.29k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4122:9): [True: 6.29k, False: 13.4k]
  ------------------
 4123|  6.56k|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|  6.56k|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4123:9): [True: 270, False: 19.4k]
  ------------------
 4124|  6.65k|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|  6.65k|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (4124:9): [True: 89, False: 19.6k]
  ------------------
 4125|  6.99k|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|  6.99k|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (4125:9): [True: 335, False: 19.3k]
  ------------------
 4126|  6.99k|        case PHOTOMETRIC_ITULAB:
  ------------------
  |  |  230|  6.99k|#define PHOTOMETRIC_ITULAB 10              /* ITU L*a*b* */
  ------------------
  |  Branch (4126:9): [True: 2, False: 19.7k]
  ------------------
 4127|  6.99k|        case PHOTOMETRIC_ICCLAB:
  ------------------
  |  |  229|  6.99k|#define PHOTOMETRIC_ICCLAB 9               /* ICC L*a*b* [Adobe TIFF Technote 4] */
  ------------------
  |  Branch (4127:9): [True: 2, False: 19.7k]
  ------------------
 4128|  6.99k|            return 3;
 4129|    152|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|    152|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (4129:9): [True: 152, False: 19.5k]
  ------------------
 4130|    155|        case PHOTOMETRIC_MASK:
  ------------------
  |  |  225|    155|#define PHOTOMETRIC_MASK 4                 /* $holdout mask */
  ------------------
  |  Branch (4130:9): [True: 3, False: 19.7k]
  ------------------
 4131|    155|            return 4;
 4132|    194|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|    194|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (4132:9): [True: 194, False: 19.5k]
  ------------------
 4133|    194|        case PHOTOMETRIC_CFA:
  ------------------
  |  |  231|    194|#define PHOTOMETRIC_CFA 32803              /* color filter array */
  ------------------
  |  Branch (4133:9): [True: 0, False: 19.7k]
  ------------------
 4134|    343|        default:
  ------------------
  |  Branch (4134:9): [True: 149, False: 19.5k]
  ------------------
 4135|    343|            return 0;
 4136|  19.7k|    }
 4137|  19.7k|}
tif_dirread.c:ByteCountLooksBad:
 4140|  3.25k|{
 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|  3.25k|    uint64_t bytecount = TIFFGetStrileByteCount(tif, 0);
 4155|  3.25k|    uint64_t offset = TIFFGetStrileOffset(tif, 0);
 4156|  3.25k|    uint64_t filesize;
 4157|       |
 4158|  3.25k|    if (offset == 0)
  ------------------
  |  Branch (4158:9): [True: 213, False: 3.04k]
  ------------------
 4159|    213|        return 0;
 4160|  3.04k|    if (bytecount == 0)
  ------------------
  |  Branch (4160:9): [True: 428, False: 2.61k]
  ------------------
 4161|    428|        return 1;
 4162|  2.61k|    if (tif->tif_dir.td_compression != COMPRESSION_NONE)
  ------------------
  |  |  182|  2.61k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (4162:9): [True: 2.05k, False: 560]
  ------------------
 4163|  2.05k|        return 0;
 4164|    560|    filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|    560|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 4165|    560|    if (offset <= filesize && bytecount > filesize - offset)
  ------------------
  |  Branch (4165:9): [True: 139, False: 421]
  |  Branch (4165:31): [True: 21, False: 118]
  ------------------
 4166|     21|        return 1;
 4167|    539|    if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (4167:9): [True: 539, False: 0]
  ------------------
 4168|    539|    {
 4169|    539|        uint64_t scanlinesize = TIFFScanlineSize64(tif);
 4170|    539|        if (tif->tif_dir.td_imagelength > 0 &&
  ------------------
  |  Branch (4170:13): [True: 508, False: 31]
  ------------------
 4171|    508|            scanlinesize > UINT64_MAX / tif->tif_dir.td_imagelength)
  ------------------
  |  Branch (4171:13): [True: 2, False: 506]
  ------------------
 4172|      2|        {
 4173|      2|            return 1;
 4174|      2|        }
 4175|    537|        if (bytecount < scanlinesize * tif->tif_dir.td_imagelength)
  ------------------
  |  Branch (4175:13): [True: 19, False: 518]
  ------------------
 4176|     19|            return 1;
 4177|    537|    }
 4178|    518|    return 0;
 4179|    539|}
tif_dirread.c:TIFFReadDirectoryCheckOrder:
 5312|  27.2k|{
 5313|  27.2k|    static const char module[] = "TIFFReadDirectoryCheckOrder";
 5314|  27.2k|    uint32_t m;
 5315|  27.2k|    uint16_t n;
 5316|  27.2k|    TIFFDirEntry *o;
 5317|  27.2k|    m = 0;
 5318|   104k|    for (n = 0, o = dir; n < dircount; n++, o++)
  ------------------
  |  Branch (5318:26): [True: 99.9k, False: 4.09k]
  ------------------
 5319|  99.9k|    {
 5320|  99.9k|        if (o->tdir_tag < m)
  ------------------
  |  Branch (5320:13): [True: 23.1k, False: 76.8k]
  ------------------
 5321|  23.1k|        {
 5322|  23.1k|            TIFFWarningExtR(tif, module,
 5323|  23.1k|                            "Invalid TIFF directory; tags are not sorted in "
 5324|  23.1k|                            "ascending order");
 5325|  23.1k|            break;
 5326|  23.1k|        }
 5327|  76.8k|        m = o->tdir_tag + 1U;
 5328|  76.8k|    }
 5329|  27.2k|}
tif_dirread.c:TIFFReadDirectoryFindEntry:
 5334|  55.2k|{
 5335|  55.2k|    TIFFDirEntry *m;
 5336|  55.2k|    uint16_t n;
 5337|  55.2k|    (void)tif;
 5338|  1.07M|    for (m = dir, n = 0; n < dircount; m++, n++)
  ------------------
  |  Branch (5338:26): [True: 1.04M, False: 29.9k]
  ------------------
 5339|  1.04M|    {
 5340|  1.04M|        if (m->tdir_tag == tagid)
  ------------------
  |  Branch (5340:13): [True: 25.2k, False: 1.02M]
  ------------------
 5341|  25.2k|            return (m);
 5342|  1.04M|    }
 5343|  29.9k|    return (0);
 5344|  55.2k|}
tif_dirread.c:TIFFReadDirectoryFindFieldInfo:
 5348|   997k|{
 5349|   997k|    int32_t ma, mb, mc;
 5350|   997k|    ma = -1;
 5351|   997k|    mc = (int32_t)tif->tif_nfields;
 5352|  7.97M|    while (1)
  ------------------
  |  Branch (5352:12): [True: 7.97M, Folded]
  ------------------
 5353|  7.97M|    {
 5354|  7.97M|        if (ma + 1 == mc)
  ------------------
  |  Branch (5354:13): [True: 250k, False: 7.72M]
  ------------------
 5355|   250k|        {
 5356|   250k|            *fii = FAILED_FII;
  ------------------
  |  |   44|   250k|#define FAILED_FII ((uint32_t)-1)
  ------------------
 5357|   250k|            return;
 5358|   250k|        }
 5359|  7.72M|        mb = (ma + mc) / 2;
 5360|  7.72M|        if (tif->tif_fields[mb]->field_tag == (uint32_t)tagid)
  ------------------
  |  Branch (5360:13): [True: 746k, False: 6.97M]
  ------------------
 5361|   746k|            break;
 5362|  6.97M|        if (tif->tif_fields[mb]->field_tag < (uint32_t)tagid)
  ------------------
  |  Branch (5362:13): [True: 3.33M, False: 3.64M]
  ------------------
 5363|  3.33M|            ma = mb;
 5364|  3.64M|        else
 5365|  3.64M|            mc = mb;
 5366|  6.97M|    }
 5367|   746k|    while (1)
  ------------------
  |  Branch (5367:12): [True: 746k, Folded]
  ------------------
 5368|   746k|    {
 5369|   746k|        if (mb == 0)
  ------------------
  |  Branch (5369:13): [True: 22.0k, False: 724k]
  ------------------
 5370|  22.0k|            break;
 5371|   724k|        if (tif->tif_fields[mb - 1]->field_tag != (uint32_t)tagid)
  ------------------
  |  Branch (5371:13): [True: 724k, False: 0]
  ------------------
 5372|   724k|            break;
 5373|      0|        mb--;
 5374|      0|    }
 5375|   746k|    *fii = (uint32_t)mb;
 5376|   746k|}
tif_dirread.c:EstimateStripByteCounts:
 5583|  5.13k|{
 5584|  5.13k|    static const char module[] = "EstimateStripByteCounts";
 5585|       |
 5586|  5.13k|    TIFFDirEntry *dp;
 5587|  5.13k|    TIFFDirectory *td = &tif->tif_dir;
 5588|  5.13k|    uint32_t strip;
 5589|       |
 5590|       |    /* Do not try to load stripbytecount as we will compute it */
 5591|  5.13k|    if (!_TIFFFillStrilesInternal(tif, 0))
  ------------------
  |  Branch (5591:9): [True: 0, False: 5.13k]
  ------------------
 5592|      0|        return -1;
 5593|       |
 5594|  5.13k|    const uint64_t allocsize = (uint64_t)td->td_nstrips * sizeof(uint64_t);
 5595|  5.13k|    uint64_t filesize = 0;
 5596|  5.13k|    if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (5596:9): [True: 0, False: 5.13k]
  ------------------
 5597|      0|    {
 5598|       |        /* Before allocating a huge amount of memory for corrupted files, check
 5599|       |         * if size of requested memory is not greater than file size. */
 5600|      0|        filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 5601|      0|        if (allocsize > filesize)
  ------------------
  |  Branch (5601:13): [True: 0, False: 0]
  ------------------
 5602|      0|        {
 5603|      0|            TIFFWarningExtR(
 5604|      0|                tif, module,
 5605|      0|                "Requested memory size for StripByteCounts of %" PRIu64
 5606|      0|                " is greater than filesize %" PRIu64 ". Memory not allocated",
 5607|      0|                allocsize, filesize);
 5608|      0|            return -1;
 5609|      0|        }
 5610|      0|    }
 5611|       |
 5612|  5.13k|    if (td->td_stripbytecount_p)
  ------------------
  |  Branch (5612:9): [True: 704, False: 4.43k]
  ------------------
 5613|    704|        _TIFFfreeExt(tif, td->td_stripbytecount_p);
 5614|  5.13k|    td->td_stripbytecount_p = (uint64_t *)_TIFFCheckMalloc(
 5615|  5.13k|        tif, td->td_nstrips, sizeof(uint64_t), "for \"StripByteCounts\" array");
 5616|  5.13k|    if (td->td_stripbytecount_p == NULL)
  ------------------
  |  Branch (5616:9): [True: 0, False: 5.13k]
  ------------------
 5617|      0|        return -1;
 5618|       |
 5619|  5.13k|    if (td->td_compression != COMPRESSION_NONE)
  ------------------
  |  |  182|  5.13k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5619:9): [True: 3.51k, False: 1.62k]
  ------------------
 5620|  3.51k|    {
 5621|  3.51k|        uint64_t space;
 5622|  3.51k|        uint16_t n;
 5623|  3.51k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|  3.51k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (5623:13): [True: 3.40k, False: 110]
  ------------------
 5624|  3.40k|            space = sizeof(TIFFHeaderClassic) + 2 +
 5625|  3.40k|                    (unsigned long)dircount * 12 + 4;
 5626|    110|        else
 5627|    110|            space =
 5628|    110|                sizeof(TIFFHeaderBig) + 8 + (unsigned long)dircount * 20 + 8;
 5629|       |        /* calculate amount of space used by indirect values */
 5630|  32.3k|        for (dp = dir, n = dircount; n > 0; n--, dp++)
  ------------------
  |  Branch (5630:38): [True: 28.8k, False: 3.46k]
  ------------------
 5631|  28.8k|        {
 5632|  28.8k|            uint32_t typewidth;
 5633|  28.8k|            uint64_t datasize;
 5634|  28.8k|            typewidth = (uint32_t)TIFFDataWidth((TIFFDataType)dp->tdir_type);
 5635|  28.8k|            if (typewidth == 0)
  ------------------
  |  Branch (5635:17): [True: 36, False: 28.8k]
  ------------------
 5636|     36|            {
 5637|     36|                TIFFErrorExtR(
 5638|     36|                    tif, module,
 5639|     36|                    "Cannot determine size of unknown tag type %" PRIu16,
 5640|     36|                    dp->tdir_type);
 5641|     36|                return -1;
 5642|     36|            }
 5643|  28.8k|            if (dp->tdir_count > UINT64_MAX / typewidth)
  ------------------
  |  Branch (5643:17): [True: 2, False: 28.8k]
  ------------------
 5644|      2|                return -1;
 5645|  28.8k|            datasize = (uint64_t)typewidth * dp->tdir_count;
 5646|  28.8k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|  28.8k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (5646:17): [True: 28.3k, False: 503]
  ------------------
 5647|  28.3k|            {
 5648|  28.3k|                if (datasize <= 4)
  ------------------
  |  Branch (5648:21): [True: 22.9k, False: 5.36k]
  ------------------
 5649|  22.9k|                    datasize = 0;
 5650|  28.3k|            }
 5651|    503|            else
 5652|    503|            {
 5653|    503|                if (datasize <= 8)
  ------------------
  |  Branch (5653:21): [True: 320, False: 183]
  ------------------
 5654|    320|                    datasize = 0;
 5655|    503|            }
 5656|  28.8k|            if (space > UINT64_MAX - datasize)
  ------------------
  |  Branch (5656:17): [True: 5, False: 28.8k]
  ------------------
 5657|      5|                return -1;
 5658|  28.8k|            space += datasize;
 5659|  28.8k|        }
 5660|  3.46k|        if (filesize == 0)
  ------------------
  |  Branch (5660:13): [True: 3.46k, False: 0]
  ------------------
 5661|  3.46k|            filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|  3.46k|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 5662|  3.46k|        if (filesize < space)
  ------------------
  |  Branch (5662:13): [True: 2.92k, False: 541]
  ------------------
 5663|       |            /* we should perhaps return in error ? */
 5664|  2.92k|            space = filesize;
 5665|    541|        else
 5666|    541|            space = filesize - space;
 5667|  3.46k|        if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  3.46k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5667:13): [True: 188, False: 3.28k]
  ------------------
 5668|    188|            space /= td->td_samplesperpixel;
 5669|   203k|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5669:25): [True: 200k, False: 3.46k]
  ------------------
 5670|   200k|            td->td_stripbytecount_p[strip] = space;
 5671|       |        /*
 5672|       |         * This gross hack handles the case were the offset to
 5673|       |         * the last strip is past the place where we think the strip
 5674|       |         * should begin.  Since a strip of data must be contiguous,
 5675|       |         * it's safe to assume that we've overestimated the amount
 5676|       |         * of data in the strip and trim this number back accordingly.
 5677|       |         */
 5678|  3.46k|        strip--;
 5679|  3.46k|        if (td->td_stripoffset_p[strip] >
  ------------------
  |  Branch (5679:13): [True: 3, False: 3.46k]
  ------------------
 5680|  3.46k|            UINT64_MAX - td->td_stripbytecount_p[strip])
 5681|      3|            return -1;
 5682|  3.46k|        if (td->td_stripoffset_p[strip] + td->td_stripbytecount_p[strip] >
  ------------------
  |  Branch (5682:13): [True: 1.49k, False: 1.97k]
  ------------------
 5683|  3.46k|            filesize)
 5684|  1.49k|        {
 5685|  1.49k|            if (td->td_stripoffset_p[strip] >= filesize)
  ------------------
  |  Branch (5685:17): [True: 257, False: 1.23k]
  ------------------
 5686|    257|            {
 5687|       |                /* Not sure what we should in that case... */
 5688|    257|                td->td_stripbytecount_p[strip] = 0;
 5689|    257|            }
 5690|  1.23k|            else
 5691|  1.23k|            {
 5692|  1.23k|                td->td_stripbytecount_p[strip] =
 5693|  1.23k|                    filesize - td->td_stripoffset_p[strip];
 5694|  1.23k|            }
 5695|  1.49k|        }
 5696|  3.46k|    }
 5697|  1.62k|    else if (isTiled(tif))
  ------------------
  |  |  282|  1.62k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  1.62k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 229, False: 1.39k]
  |  |  ------------------
  ------------------
 5698|    229|    {
 5699|    229|        uint64_t bytespertile = TIFFTileSize64(tif);
 5700|       |
 5701|  3.11M|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5701:25): [True: 3.11M, False: 229]
  ------------------
 5702|  3.11M|            td->td_stripbytecount_p[strip] = bytespertile;
 5703|    229|    }
 5704|  1.39k|    else
 5705|  1.39k|    {
 5706|  1.39k|        uint64_t rowbytes = TIFFScanlineSize64(tif);
 5707|  1.39k|        uint32_t rowsperstrip = td->td_imagelength / td->td_stripsperimage;
 5708|  7.39M|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5708:25): [True: 7.39M, False: 1.38k]
  ------------------
 5709|  7.39M|        {
 5710|  7.39M|            if (rowbytes > 0 && rowsperstrip > UINT64_MAX / rowbytes)
  ------------------
  |  Branch (5710:17): [True: 1.25M, False: 6.14M]
  |  Branch (5710:33): [True: 10, False: 1.25M]
  ------------------
 5711|     10|                return -1;
 5712|  7.39M|            td->td_stripbytecount_p[strip] = rowbytes * rowsperstrip;
 5713|  7.39M|        }
 5714|  1.39k|    }
 5715|  5.08k|    TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
  ------------------
  |  |  268|  5.08k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|  5.08k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|  5.08k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 5716|  5.08k|    if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
  ------------------
  |  |  267|  5.08k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  5.08k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  5.08k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5716:9): [True: 1.89k, False: 3.19k]
  ------------------
 5717|  1.89k|        td->td_rowsperstrip = td->td_imagelength;
 5718|  5.08k|    return 1;
 5719|  5.13k|}
tif_dirread.c:MissingRequired:
 5722|  5.15k|{
 5723|  5.15k|    static const char module[] = "MissingRequired";
 5724|       |
 5725|  5.15k|    TIFFErrorExtR(tif, module,
 5726|  5.15k|                  "TIFF directory is missing required \"%s\" field", tagname);
 5727|  5.15k|}
tif_dirread.c:hashFuncOffsetToNumber:
 5730|  82.6k|{
 5731|  82.6k|    const TIFFOffsetAndDirNumber *offsetAndDirNumber =
 5732|  82.6k|        (const TIFFOffsetAndDirNumber *)elt;
 5733|  82.6k|    const uint32_t hash = (uint32_t)(offsetAndDirNumber->offset >> 32) ^
 5734|  82.6k|                          ((uint32_t)offsetAndDirNumber->offset & 0xFFFFFFFFU);
 5735|  82.6k|    return hash;
 5736|  82.6k|}
tif_dirread.c:hashFuncNumberToOffset:
 5748|  82.6k|{
 5749|  82.6k|    const TIFFOffsetAndDirNumber *offsetAndDirNumber =
 5750|  82.6k|        (const TIFFOffsetAndDirNumber *)elt;
 5751|  82.6k|    return offsetAndDirNumber->dirNumber;
 5752|  82.6k|}
tif_dirread.c:insertOffsetAndDirNumber:
 5775|  27.5k|{
 5776|  27.5k|    if (!TIFFHashSetInsert(tif->tif_map_dir_offset_to_number, entryPtr))
  ------------------
  |  Branch (5776:9): [True: 0, False: 27.5k]
  ------------------
 5777|      0|    {
 5778|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5779|      0|                      "Insertion in tif_map_dir_offset_to_number failed");
 5780|      0|        return false;
 5781|      0|    }
 5782|  27.5k|    if (!TIFFHashSetInsert(tif->tif_map_dir_number_to_offset, entryPtr))
  ------------------
  |  Branch (5782:9): [True: 0, False: 27.5k]
  ------------------
 5783|      0|    {
 5784|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5785|      0|                      "Insertion in tif_map_dir_number_to_offset failed");
 5786|      0|        if (!TIFFHashSetRemove(tif->tif_map_dir_offset_to_number, entryPtr))
  ------------------
  |  Branch (5786:13): [True: 0, False: 0]
  ------------------
 5787|      0|        {
 5788|      0|            TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5789|      0|                          "Rollback of directory tracking entry failed");
 5790|      0|        }
 5791|      0|        return false;
 5792|      0|    }
 5793|  27.5k|    return true;
 5794|  27.5k|}
tif_dirread.c:TIFFFetchDirectory:
 6104|  27.5k|{
 6105|  27.5k|    static const char module[] = "TIFFFetchDirectory";
 6106|       |
 6107|  27.5k|    void *origdir;
 6108|  27.5k|    uint16_t dircount16;
 6109|  27.5k|    uint32_t dirsize;
 6110|  27.5k|    TIFFDirEntry *dir;
 6111|  27.5k|    uint8_t *ma;
 6112|  27.5k|    TIFFDirEntry *mb;
 6113|  27.5k|    uint16_t n;
 6114|       |
 6115|  27.5k|    assert(pdir);
  ------------------
  |  Branch (6115:5): [True: 0, False: 27.5k]
  |  Branch (6115:5): [True: 27.5k, False: 0]
  ------------------
 6116|       |
 6117|  27.5k|    tif->tif_diroff = diroff;
 6118|  27.5k|    if (nextdiroff)
  ------------------
  |  Branch (6118:9): [True: 27.5k, False: 0]
  ------------------
 6119|  27.5k|        *nextdiroff = 0;
 6120|  27.5k|    if (!isMapped(tif))
  ------------------
  |  |  283|  27.5k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  27.5k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (6120:9): [True: 27.5k, False: 0]
  ------------------
 6121|  27.5k|    {
 6122|  27.5k|        if (!SeekOK(tif, tif->tif_diroff))
  ------------------
  |  |  307|  27.5k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (6122:13): [True: 68, False: 27.4k]
  ------------------
 6123|     68|        {
 6124|     68|            TIFFErrorExtR(tif, module,
 6125|     68|                          "%s: Seek error accessing TIFF directory",
 6126|     68|                          tif->tif_name);
 6127|     68|            return 0;
 6128|     68|        }
 6129|  27.4k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|  27.4k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6129:13): [True: 26.0k, False: 1.42k]
  ------------------
 6130|  26.0k|        {
 6131|  26.0k|            if (!ReadOK(tif, &dircount16, sizeof(uint16_t)))
  ------------------
  |  |  304|  26.0k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  287|  26.0k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6131:17): [True: 60, False: 26.0k]
  ------------------
 6132|     60|            {
 6133|     60|                TIFFErrorExtR(tif, module,
 6134|     60|                              "%s: Can not read TIFF directory count",
 6135|     60|                              tif->tif_name);
 6136|     60|                return 0;
 6137|     60|            }
 6138|  26.0k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  26.0k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6138:17): [True: 1.47k, False: 24.5k]
  ------------------
 6139|  1.47k|                TIFFSwabShort(&dircount16);
 6140|  26.0k|            if (dircount16 > 4096)
  ------------------
  |  Branch (6140:17): [True: 6, False: 25.9k]
  ------------------
 6141|      6|            {
 6142|      6|                TIFFErrorExtR(tif, module,
 6143|      6|                              "Sanity check on directory count failed, this is "
 6144|      6|                              "probably not a valid IFD offset");
 6145|      6|                return 0;
 6146|      6|            }
 6147|  25.9k|            dirsize = 12;
 6148|  25.9k|        }
 6149|  1.42k|        else
 6150|  1.42k|        {
 6151|  1.42k|            uint64_t dircount64;
 6152|  1.42k|            if (!ReadOK(tif, &dircount64, sizeof(uint64_t)))
  ------------------
  |  |  304|  1.42k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  287|  1.42k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6152:17): [True: 64, False: 1.35k]
  ------------------
 6153|     64|            {
 6154|     64|                TIFFErrorExtR(tif, module,
 6155|     64|                              "%s: Can not read TIFF directory count",
 6156|     64|                              tif->tif_name);
 6157|     64|                return 0;
 6158|     64|            }
 6159|  1.35k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.35k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6159:17): [True: 22, False: 1.33k]
  ------------------
 6160|     22|                TIFFSwabLong8(&dircount64);
 6161|  1.35k|            if (dircount64 > 4096)
  ------------------
  |  Branch (6161:17): [True: 77, False: 1.27k]
  ------------------
 6162|     77|            {
 6163|     77|                TIFFErrorExtR(tif, module,
 6164|     77|                              "Sanity check on directory count failed, this is "
 6165|     77|                              "probably not a valid IFD offset");
 6166|     77|                return 0;
 6167|     77|            }
 6168|  1.27k|            dircount16 = (uint16_t)dircount64;
 6169|  1.27k|            dirsize = 20;
 6170|  1.27k|        }
 6171|  27.2k|        origdir = _TIFFCheckMalloc(tif, dircount16, dirsize,
 6172|  27.2k|                                   "to read TIFF directory");
 6173|  27.2k|        if (origdir == NULL)
  ------------------
  |  Branch (6173:13): [True: 3, False: 27.2k]
  ------------------
 6174|      3|            return 0;
 6175|  27.2k|        if (!ReadOK(tif, origdir, (tmsize_t)dircount16 * dirsize))
  ------------------
  |  |  304|  27.2k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  287|  27.2k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6175:13): [True: 70, False: 27.2k]
  ------------------
 6176|     70|        {
 6177|     70|            TIFFErrorExtR(tif, module, "%.100s: Can not read TIFF directory",
 6178|     70|                          tif->tif_name);
 6179|     70|            _TIFFfreeExt(tif, origdir);
 6180|     70|            return 0;
 6181|     70|        }
 6182|       |        /*
 6183|       |         * Read offset to next directory for sequential scans if
 6184|       |         * needed.
 6185|       |         */
 6186|  27.2k|        if (nextdiroff)
  ------------------
  |  Branch (6186:13): [True: 27.2k, False: 0]
  ------------------
 6187|  27.2k|        {
 6188|  27.2k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|  27.2k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6188:17): [True: 25.9k, False: 1.26k]
  ------------------
 6189|  25.9k|            {
 6190|  25.9k|                uint32_t nextdiroff32;
 6191|  25.9k|                if (!ReadOK(tif, &nextdiroff32, sizeof(uint32_t)))
  ------------------
  |  |  304|  25.9k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  287|  25.9k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6191:21): [True: 11.1k, False: 14.7k]
  ------------------
 6192|  11.1k|                    nextdiroff32 = 0;
 6193|  25.9k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  25.9k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6193:21): [True: 1.46k, False: 24.4k]
  ------------------
 6194|  1.46k|                    TIFFSwabLong(&nextdiroff32);
 6195|  25.9k|                *nextdiroff = nextdiroff32;
 6196|  25.9k|            }
 6197|  1.26k|            else
 6198|  1.26k|            {
 6199|  1.26k|                if (!ReadOK(tif, nextdiroff, sizeof(uint64_t)))
  ------------------
  |  |  304|  1.26k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  287|  1.26k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6199:21): [True: 1.22k, False: 40]
  ------------------
 6200|  1.22k|                    *nextdiroff = 0;
 6201|  1.26k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.26k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6201:21): [True: 20, False: 1.24k]
  ------------------
 6202|     20|                    TIFFSwabLong8(nextdiroff);
 6203|  1.26k|            }
 6204|  27.2k|        }
 6205|  27.2k|    }
 6206|      0|    else
 6207|      0|    {
 6208|      0|        tmsize_t m;
 6209|      0|        tmsize_t off;
 6210|      0|        if (tif->tif_diroff > (uint64_t)INT64_MAX)
  ------------------
  |  Branch (6210:13): [True: 0, False: 0]
  ------------------
 6211|      0|        {
 6212|      0|            TIFFErrorExtR(tif, module, "Can not read TIFF directory count");
 6213|      0|            return (0);
 6214|      0|        }
 6215|      0|        off = (tmsize_t)tif->tif_diroff;
 6216|       |
 6217|       |        /*
 6218|       |         * Check for integer overflow when validating the dir_off,
 6219|       |         * otherwise a very high offset may cause an OOB read and
 6220|       |         * crash the client. Make two comparisons instead of
 6221|       |         *
 6222|       |         *  off + sizeof(uint16_t) > tif->tif_size
 6223|       |         *
 6224|       |         * to avoid overflow.
 6225|       |         */
 6226|      0|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6226:13): [True: 0, False: 0]
  ------------------
 6227|      0|        {
 6228|      0|            m = (tmsize_t)((uint64_t)off + sizeof(uint16_t));
 6229|      0|            if ((m < off) || ((uint64_t)m < sizeof(uint16_t)) ||
  ------------------
  |  Branch (6229:17): [True: 0, False: 0]
  |  Branch (6229:30): [True: 0, False: 0]
  ------------------
 6230|      0|                ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6230:17): [True: 0, False: 0]
  ------------------
 6231|      0|            {
 6232|      0|                TIFFErrorExtR(tif, module, "Can not read TIFF directory count");
 6233|      0|                return 0;
 6234|      0|            }
 6235|      0|            else
 6236|      0|            {
 6237|      0|                _TIFFmemcpy(&dircount16, tif->tif_base + off, sizeof(uint16_t));
 6238|      0|            }
 6239|      0|            off = (tmsize_t)((uint64_t)off + sizeof(uint16_t));
 6240|      0|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6240:17): [True: 0, False: 0]
  ------------------
 6241|      0|                TIFFSwabShort(&dircount16);
 6242|      0|            if (dircount16 > 4096)
  ------------------
  |  Branch (6242:17): [True: 0, False: 0]
  ------------------
 6243|      0|            {
 6244|      0|                TIFFErrorExtR(tif, module,
 6245|      0|                              "Sanity check on directory count failed, this is "
 6246|      0|                              "probably not a valid IFD offset");
 6247|      0|                return 0;
 6248|      0|            }
 6249|      0|            dirsize = 12;
 6250|      0|        }
 6251|      0|        else
 6252|      0|        {
 6253|      0|            uint64_t dircount64;
 6254|      0|            m = (tmsize_t)((uint64_t)off + sizeof(uint64_t));
 6255|      0|            if ((m < off) || ((uint64_t)m < sizeof(uint64_t)) ||
  ------------------
  |  Branch (6255:17): [True: 0, False: 0]
  |  Branch (6255:30): [True: 0, False: 0]
  ------------------
 6256|      0|                ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6256:17): [True: 0, False: 0]
  ------------------
 6257|      0|            {
 6258|      0|                TIFFErrorExtR(tif, module, "Can not read TIFF directory count");
 6259|      0|                return 0;
 6260|      0|            }
 6261|      0|            else
 6262|      0|            {
 6263|      0|                _TIFFmemcpy(&dircount64, tif->tif_base + off, sizeof(uint64_t));
 6264|      0|            }
 6265|      0|            off = (tmsize_t)((uint64_t)off + sizeof(uint64_t));
 6266|      0|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6266:17): [True: 0, False: 0]
  ------------------
 6267|      0|                TIFFSwabLong8(&dircount64);
 6268|      0|            if (dircount64 > 4096)
  ------------------
  |  Branch (6268:17): [True: 0, False: 0]
  ------------------
 6269|      0|            {
 6270|      0|                TIFFErrorExtR(tif, module,
 6271|      0|                              "Sanity check on directory count failed, this is "
 6272|      0|                              "probably not a valid IFD offset");
 6273|      0|                return 0;
 6274|      0|            }
 6275|      0|            dircount16 = (uint16_t)dircount64;
 6276|      0|            dirsize = 20;
 6277|      0|        }
 6278|      0|        if (dircount16 == 0)
  ------------------
  |  Branch (6278:13): [True: 0, False: 0]
  ------------------
 6279|      0|        {
 6280|      0|            TIFFErrorExtR(tif, module,
 6281|      0|                          "Sanity check on directory count failed, zero tag "
 6282|      0|                          "directories not supported");
 6283|      0|            return 0;
 6284|      0|        }
 6285|       |        /* Before allocating a huge amount of memory for corrupted files, check
 6286|       |         * if size of requested memory is not greater than file size. */
 6287|      0|        uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 6288|      0|        uint64_t allocsize = (uint64_t)dircount16 * dirsize;
 6289|      0|        if (allocsize > filesize)
  ------------------
  |  Branch (6289:13): [True: 0, False: 0]
  ------------------
 6290|      0|        {
 6291|      0|            TIFFWarningExtR(
 6292|      0|                tif, module,
 6293|      0|                "Requested memory size for TIFF directory of %" PRIu64
 6294|      0|                " is greater than filesize %" PRIu64
 6295|      0|                ". Memory not allocated, TIFF directory not read",
 6296|      0|                allocsize, filesize);
 6297|      0|            return 0;
 6298|      0|        }
 6299|      0|        origdir = _TIFFCheckMalloc(tif, dircount16, dirsize,
 6300|      0|                                   "to read TIFF directory");
 6301|      0|        if (origdir == NULL)
  ------------------
  |  Branch (6301:13): [True: 0, False: 0]
  ------------------
 6302|      0|            return 0;
 6303|      0|        m = off + dircount16 * dirsize;
 6304|      0|        if ((m < off) || (m < (tmsize_t)dircount16 * (tmsize_t)dirsize) ||
  ------------------
  |  Branch (6304:13): [True: 0, False: 0]
  |  Branch (6304:26): [True: 0, False: 0]
  ------------------
 6305|      0|            (m > tif->tif_size))
  ------------------
  |  Branch (6305:13): [True: 0, False: 0]
  ------------------
 6306|      0|        {
 6307|      0|            TIFFErrorExtR(tif, module, "Can not read TIFF directory");
 6308|      0|            _TIFFfreeExt(tif, origdir);
 6309|      0|            return 0;
 6310|      0|        }
 6311|      0|        else
 6312|      0|        {
 6313|      0|            _TIFFmemcpy(origdir, tif->tif_base + off,
 6314|      0|                        (tmsize_t)dircount16 * dirsize);
 6315|      0|        }
 6316|      0|        if (nextdiroff)
  ------------------
  |  Branch (6316:13): [True: 0, False: 0]
  ------------------
 6317|      0|        {
 6318|      0|            off += dircount16 * dirsize;
 6319|      0|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6319:17): [True: 0, False: 0]
  ------------------
 6320|      0|            {
 6321|      0|                uint32_t nextdiroff32;
 6322|      0|                m = (tmsize_t)((uint64_t)off + sizeof(uint32_t));
 6323|      0|                if ((m < off) || ((uint64_t)m < sizeof(uint32_t)) ||
  ------------------
  |  Branch (6323:21): [True: 0, False: 0]
  |  Branch (6323:34): [True: 0, False: 0]
  ------------------
 6324|      0|                    ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6324:21): [True: 0, False: 0]
  ------------------
 6325|      0|                    nextdiroff32 = 0;
 6326|      0|                else
 6327|      0|                    _TIFFmemcpy(&nextdiroff32, tif->tif_base + off,
 6328|      0|                                sizeof(uint32_t));
 6329|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6329:21): [True: 0, False: 0]
  ------------------
 6330|      0|                    TIFFSwabLong(&nextdiroff32);
 6331|      0|                *nextdiroff = nextdiroff32;
 6332|      0|            }
 6333|      0|            else
 6334|      0|            {
 6335|      0|                m = (tmsize_t)((uint64_t)off + sizeof(uint64_t));
 6336|      0|                if ((m < off) || ((uint64_t)m < sizeof(uint64_t)) ||
  ------------------
  |  Branch (6336:21): [True: 0, False: 0]
  |  Branch (6336:34): [True: 0, False: 0]
  ------------------
 6337|      0|                    ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6337:21): [True: 0, False: 0]
  ------------------
 6338|      0|                    *nextdiroff = 0;
 6339|      0|                else
 6340|      0|                    _TIFFmemcpy(nextdiroff, tif->tif_base + off,
 6341|      0|                                sizeof(uint64_t));
 6342|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6342:21): [True: 0, False: 0]
  ------------------
 6343|      0|                    TIFFSwabLong8(nextdiroff);
 6344|      0|            }
 6345|      0|        }
 6346|      0|    }
 6347|       |    /* No check against filesize needed here because "dir" should have same size
 6348|       |     * than "origdir" checked above. */
 6349|  27.2k|    dir = (TIFFDirEntry *)_TIFFCheckMalloc(
 6350|  27.2k|        tif, dircount16, sizeof(TIFFDirEntry), "to read TIFF directory");
 6351|  27.2k|    if (dir == 0)
  ------------------
  |  Branch (6351:9): [True: 0, False: 27.2k]
  ------------------
 6352|      0|    {
 6353|      0|        _TIFFfreeExt(tif, origdir);
 6354|      0|        return 0;
 6355|      0|    }
 6356|  27.2k|    ma = (uint8_t *)origdir;
 6357|  27.2k|    mb = dir;
 6358|   808k|    for (n = 0; n < dircount16; n++)
  ------------------
  |  Branch (6358:17): [True: 780k, False: 27.2k]
  ------------------
 6359|   780k|    {
 6360|   780k|        mb->tdir_ignore = FALSE;
  ------------------
  |  |   75|   780k|#define FALSE 0
  ------------------
 6361|   780k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|   780k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6361:13): [True: 10.3k, False: 770k]
  ------------------
 6362|  10.3k|            TIFFSwabShort((uint16_t *)ma);
 6363|   780k|        mb->tdir_tag = *(uint16_t *)ma;
 6364|   780k|        ma += sizeof(uint16_t);
 6365|   780k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|   780k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6365:13): [True: 10.3k, False: 770k]
  ------------------
 6366|  10.3k|            TIFFSwabShort((uint16_t *)ma);
 6367|   780k|        mb->tdir_type = *(uint16_t *)ma;
 6368|   780k|        ma += sizeof(uint16_t);
 6369|   780k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|   780k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6369:13): [True: 776k, False: 4.10k]
  ------------------
 6370|   776k|        {
 6371|   776k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|   776k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6371:17): [True: 10.0k, False: 766k]
  ------------------
 6372|  10.0k|                TIFFSwabLong((uint32_t *)ma);
 6373|   776k|            mb->tdir_count = (uint64_t)(*(uint32_t *)ma);
 6374|   776k|            ma += sizeof(uint32_t);
 6375|   776k|            mb->tdir_offset.toff_long8 = 0;
 6376|   776k|            *(uint32_t *)(&mb->tdir_offset) = *(uint32_t *)ma;
 6377|   776k|            ma += sizeof(uint32_t);
 6378|   776k|        }
 6379|  4.10k|        else
 6380|  4.10k|        {
 6381|  4.10k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  4.10k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6381:17): [True: 337, False: 3.77k]
  ------------------
 6382|    337|                TIFFSwabLong8((uint64_t *)ma);
 6383|  4.10k|            mb->tdir_count = TIFFReadUInt64(ma);
 6384|  4.10k|            ma += sizeof(uint64_t);
 6385|  4.10k|            mb->tdir_offset.toff_long8 = TIFFReadUInt64(ma);
 6386|  4.10k|            ma += sizeof(uint64_t);
 6387|  4.10k|        }
 6388|   780k|        mb++;
 6389|   780k|    }
 6390|  27.2k|    _TIFFfreeExt(tif, origdir);
 6391|  27.2k|    *pdir = dir;
 6392|  27.2k|    return dircount16;
 6393|  27.2k|}
tif_dirread.c:TIFFReadUInt64:
  283|  8.21k|{
  284|  8.21k|    UInt64Aligned_t result;
  285|       |
  286|  8.21k|    result.c[0] = value[0];
  287|  8.21k|    result.c[1] = value[1];
  288|  8.21k|    result.c[2] = value[2];
  289|  8.21k|    result.c[3] = value[3];
  290|  8.21k|    result.c[4] = value[4];
  291|  8.21k|    result.c[5] = value[5];
  292|  8.21k|    result.c[6] = value[6];
  293|  8.21k|    result.c[7] = value[7];
  294|       |
  295|  8.21k|    return result.l;
  296|  8.21k|}
tif_dirread.c:TIFFFetchNormalTag:
 6399|   348k|{
 6400|   348k|    static const char module[] = "TIFFFetchNormalTag";
 6401|   348k|    enum TIFFReadDirEntryErr err;
 6402|   348k|    uint32_t fii;
 6403|   348k|    const TIFFField *fip = NULL;
 6404|   348k|    TIFFReadDirectoryFindFieldInfo(tif, dp->tdir_tag, &fii);
 6405|   348k|    if (fii == FAILED_FII)
  ------------------
  |  |   44|   348k|#define FAILED_FII ((uint32_t)-1)
  ------------------
  |  Branch (6405:9): [True: 0, False: 348k]
  ------------------
 6406|      0|    {
 6407|      0|        TIFFErrorExtR(tif, "TIFFFetchNormalTag",
 6408|      0|                      "No definition found for tag %" PRIu16, dp->tdir_tag);
 6409|      0|        return 0;
 6410|      0|    }
 6411|   348k|    fip = tif->tif_fields[fii];
 6412|   348k|    assert(fip != NULL); /* should not happen */
  ------------------
  |  Branch (6412:5): [True: 0, False: 348k]
  |  Branch (6412:5): [True: 348k, False: 0]
  ------------------
 6413|   348k|    assert(fip->set_get_field_type !=
  ------------------
  |  Branch (6413:5): [True: 0, False: 348k]
  |  Branch (6413:5): [True: 348k, False: 0]
  ------------------
 6414|   348k|           TIFF_SETGET_OTHER); /* if so, we shouldn't arrive here but deal with
 6415|       |                                  this in specialized code */
 6416|   348k|    assert(fip->set_get_field_type !=
  ------------------
  |  Branch (6416:5): [True: 0, False: 348k]
  |  Branch (6416:5): [True: 348k, False: 0]
  ------------------
 6417|   348k|           TIFF_SETGET_INT); /* if so, we shouldn't arrive here as this is only
 6418|       |                                the case for pseudo-tags */
 6419|   348k|    err = TIFFReadDirEntryErrOk;
 6420|   348k|    switch (fip->set_get_field_type)
 6421|   348k|    {
 6422|   154k|        case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (6422:9): [True: 154k, False: 194k]
  ------------------
 6423|   154k|            TIFFErrorExtR(
 6424|   154k|                tif, "TIFFFetchNormalTag",
 6425|   154k|                "Defined set_get_field_type of custom tag %u (%s) is "
 6426|   154k|                "TIFF_SETGET_UNDEFINED and thus tag is not read from file",
 6427|   154k|                fip->field_tag, fip->field_name);
 6428|   154k|            break;
 6429|  2.52k|        case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (6429:9): [True: 2.52k, False: 346k]
  ------------------
 6430|  2.52k|        {
 6431|  2.52k|            uint8_t *data;
 6432|  2.52k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6432:13): [True: 0, False: 2.52k]
  |  Branch (6432:13): [True: 2.52k, False: 0]
  ------------------
 6433|  2.52k|            err = TIFFReadDirEntryByteArray(tif, dp, &data);
 6434|  2.52k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6434:17): [True: 785, False: 1.73k]
  ------------------
 6435|    785|            {
 6436|    785|                size_t mb = 0;
 6437|    785|                int n;
 6438|    785|                if (data != NULL)
  ------------------
  |  Branch (6438:21): [True: 769, False: 16]
  ------------------
 6439|    769|                {
 6440|    769|                    if (dp->tdir_count > 0 && data[dp->tdir_count - 1] == 0)
  ------------------
  |  Branch (6440:25): [True: 769, False: 0]
  |  Branch (6440:47): [True: 346, False: 423]
  ------------------
 6441|    346|                    {
 6442|       |                        /* optimization: if data is known to be 0 terminated, we
 6443|       |                         * can use strlen() */
 6444|    346|                        mb = strlen((const char *)data);
 6445|    346|                    }
 6446|    423|                    else
 6447|    423|                    {
 6448|       |                        /* general case. equivalent to non-portable */
 6449|       |                        /* mb = strnlen((const char*)data,
 6450|       |                         * (uint32_t)dp->tdir_count); */
 6451|    423|                        uint8_t *ma = data;
 6452|   277k|                        while (mb < (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6452:32): [True: 277k, False: 235]
  ------------------
 6453|   277k|                        {
 6454|   277k|                            if (*ma == 0)
  ------------------
  |  Branch (6454:33): [True: 188, False: 277k]
  ------------------
 6455|    188|                                break;
 6456|   277k|                            ma++;
 6457|   277k|                            mb++;
 6458|   277k|                        }
 6459|    423|                    }
 6460|    769|                }
 6461|    785|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6461:21): [True: 12, False: 773]
  ------------------
 6462|     12|                {
 6463|     12|                    if (data != NULL)
  ------------------
  |  Branch (6463:25): [True: 12, False: 0]
  ------------------
 6464|     12|                        _TIFFfreeExt(tif, data);
 6465|     12|                    return (0);
 6466|     12|                }
 6467|    773|                if (mb + 1 < (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6467:21): [True: 348, False: 425]
  ------------------
 6468|    348|                    TIFFWarningExtR(
 6469|    348|                        tif, module,
 6470|    348|                        "ASCII value for tag \"%s\" contains null byte in "
 6471|    348|                        "value; value incorrectly truncated during reading due "
 6472|    348|                        "to implementation limitations",
 6473|    348|                        fip->field_name);
 6474|    425|                else if (mb + 1 > (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6474:26): [True: 251, False: 174]
  ------------------
 6475|    251|                {
 6476|    251|                    TIFFWarningExtR(tif, module,
 6477|    251|                                    "ASCII value for tag \"%s\" does not end "
 6478|    251|                                    "in null byte. Forcing it to be null",
 6479|    251|                                    fip->field_name);
 6480|       |                    /* TIFFReadDirEntryArrayWithLimit() ensures this can't be
 6481|       |                     * larger than MAX_SIZE_TAG_DATA */
 6482|    251|                    assert((uint32_t)dp->tdir_count + 1 == dp->tdir_count + 1);
  ------------------
  |  Branch (6482:21): [True: 0, False: 251]
  |  Branch (6482:21): [True: 251, False: 0]
  ------------------
 6483|    251|                    uint8_t *o = (uint8_t *)_TIFFmallocExt(
 6484|    251|                        tif, (uint32_t)dp->tdir_count + 1);
 6485|    251|                    if (o == NULL)
  ------------------
  |  Branch (6485:25): [True: 0, False: 251]
  ------------------
 6486|      0|                    {
 6487|      0|                        if (data != NULL)
  ------------------
  |  Branch (6487:29): [True: 0, False: 0]
  ------------------
 6488|      0|                            _TIFFfreeExt(tif, data);
 6489|      0|                        return (0);
 6490|      0|                    }
 6491|    251|                    if (dp->tdir_count > 0)
  ------------------
  |  Branch (6491:25): [True: 235, False: 16]
  ------------------
 6492|    235|                    {
 6493|    235|                        _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 6494|    235|                    }
 6495|    251|                    o[(uint32_t)dp->tdir_count] = 0;
 6496|    251|                    if (data != 0)
  ------------------
  |  Branch (6496:25): [True: 235, False: 16]
  ------------------
 6497|    235|                        _TIFFfreeExt(tif, data);
 6498|    251|                    data = o;
 6499|    251|                }
 6500|    773|                n = TIFFSetField(tif, dp->tdir_tag, data);
 6501|    773|                if (data != 0)
  ------------------
  |  Branch (6501:21): [True: 773, False: 0]
  ------------------
 6502|    773|                    _TIFFfreeExt(tif, data);
 6503|    773|                if (!n)
  ------------------
  |  Branch (6503:21): [True: 0, False: 773]
  ------------------
 6504|      0|                    return (0);
 6505|    773|            }
 6506|  2.52k|        }
 6507|  2.51k|        break;
 6508|  2.51k|        case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (6508:9): [True: 499, False: 348k]
  ------------------
 6509|    499|        {
 6510|    499|            uint8_t data = 0;
 6511|    499|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6511:13): [True: 0, False: 499]
  |  Branch (6511:13): [True: 499, False: 0]
  ------------------
 6512|    499|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6512:13): [True: 0, False: 499]
  |  Branch (6512:13): [True: 499, False: 0]
  ------------------
 6513|    499|            err = TIFFReadDirEntryByte(tif, dp, &data);
 6514|    499|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6514:17): [True: 63, False: 436]
  ------------------
 6515|     63|            {
 6516|     63|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6516:21): [True: 0, False: 63]
  ------------------
 6517|      0|                    return (0);
 6518|     63|            }
 6519|    499|        }
 6520|    499|        break;
 6521|    499|        case TIFF_SETGET_SINT8:
  ------------------
  |  Branch (6521:9): [True: 0, False: 348k]
  ------------------
 6522|      0|        {
 6523|      0|            int8_t data = 0;
 6524|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6524:13): [True: 0, False: 0]
  |  Branch (6524:13): [True: 0, False: 0]
  ------------------
 6525|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6525:13): [True: 0, False: 0]
  |  Branch (6525:13): [True: 0, False: 0]
  ------------------
 6526|      0|            err = TIFFReadDirEntrySbyte(tif, dp, &data);
 6527|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6527:17): [True: 0, False: 0]
  ------------------
 6528|      0|            {
 6529|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6529:21): [True: 0, False: 0]
  ------------------
 6530|      0|                    return (0);
 6531|      0|            }
 6532|      0|        }
 6533|      0|        break;
 6534|  18.3k|        case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (6534:9): [True: 18.3k, False: 330k]
  ------------------
 6535|  18.3k|        {
 6536|  18.3k|            uint16_t data;
 6537|  18.3k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6537:13): [True: 0, False: 18.3k]
  |  Branch (6537:13): [True: 18.3k, False: 0]
  ------------------
 6538|  18.3k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6538:13): [True: 0, False: 18.3k]
  |  Branch (6538:13): [True: 18.3k, False: 0]
  ------------------
 6539|  18.3k|            err = TIFFReadDirEntryShort(tif, dp, &data);
 6540|  18.3k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6540:17): [True: 15.3k, False: 2.93k]
  ------------------
 6541|  15.3k|            {
 6542|  15.3k|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6542:21): [True: 181, False: 15.2k]
  ------------------
 6543|    181|                    return (0);
 6544|  15.3k|            }
 6545|  18.3k|        }
 6546|  18.1k|        break;
 6547|  18.1k|        case TIFF_SETGET_SINT16:
  ------------------
  |  Branch (6547:9): [True: 0, False: 348k]
  ------------------
 6548|      0|        {
 6549|      0|            int16_t data;
 6550|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6550:13): [True: 0, False: 0]
  |  Branch (6550:13): [True: 0, False: 0]
  ------------------
 6551|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6551:13): [True: 0, False: 0]
  |  Branch (6551:13): [True: 0, False: 0]
  ------------------
 6552|      0|            err = TIFFReadDirEntrySshort(tif, dp, &data);
 6553|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6553:17): [True: 0, False: 0]
  ------------------
 6554|      0|            {
 6555|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6555:21): [True: 0, False: 0]
  ------------------
 6556|      0|                    return (0);
 6557|      0|            }
 6558|      0|        }
 6559|      0|        break;
 6560|  70.8k|        case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (6560:9): [True: 70.8k, False: 278k]
  ------------------
 6561|  70.8k|        {
 6562|  70.8k|            uint32_t data;
 6563|  70.8k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6563:13): [True: 0, False: 70.8k]
  |  Branch (6563:13): [True: 70.8k, False: 0]
  ------------------
 6564|  70.8k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6564:13): [True: 0, False: 70.8k]
  |  Branch (6564:13): [True: 70.8k, False: 0]
  ------------------
 6565|  70.8k|            err = TIFFReadDirEntryLong(tif, dp, &data);
 6566|  70.8k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6566:17): [True: 69.8k, False: 1.00k]
  ------------------
 6567|  69.8k|            {
 6568|  69.8k|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6568:21): [True: 3, False: 69.8k]
  ------------------
 6569|      3|                    return (0);
 6570|  69.8k|            }
 6571|  70.8k|        }
 6572|  70.8k|        break;
 6573|  70.8k|        case TIFF_SETGET_SINT32:
  ------------------
  |  Branch (6573:9): [True: 0, False: 348k]
  ------------------
 6574|      0|        {
 6575|      0|            int32_t data;
 6576|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6576:13): [True: 0, False: 0]
  |  Branch (6576:13): [True: 0, False: 0]
  ------------------
 6577|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6577:13): [True: 0, False: 0]
  |  Branch (6577:13): [True: 0, False: 0]
  ------------------
 6578|      0|            err = TIFFReadDirEntrySlong(tif, dp, &data);
 6579|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6579:17): [True: 0, False: 0]
  ------------------
 6580|      0|            {
 6581|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6581:21): [True: 0, False: 0]
  ------------------
 6582|      0|                    return (0);
 6583|      0|            }
 6584|      0|        }
 6585|      0|        break;
 6586|  1.97k|        case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (6586:9): [True: 1.97k, False: 346k]
  ------------------
 6587|  1.97k|        {
 6588|  1.97k|            uint64_t data;
 6589|  1.97k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6589:13): [True: 0, False: 1.97k]
  |  Branch (6589:13): [True: 1.97k, False: 0]
  ------------------
 6590|  1.97k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6590:13): [True: 0, False: 1.97k]
  |  Branch (6590:13): [True: 1.97k, False: 0]
  ------------------
 6591|  1.97k|            err = TIFFReadDirEntryLong8(tif, dp, &data);
 6592|  1.97k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6592:17): [True: 1.35k, False: 623]
  ------------------
 6593|  1.35k|            {
 6594|  1.35k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6594:21): [True: 0, False: 1.35k]
  ------------------
 6595|      0|                    return 0;
 6596|  1.35k|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6596:21): [True: 53, False: 1.29k]
  ------------------
 6597|     53|                    return (0);
 6598|  1.35k|            }
 6599|  1.97k|        }
 6600|  1.92k|        break;
 6601|  1.92k|        case TIFF_SETGET_SINT64:
  ------------------
  |  Branch (6601:9): [True: 0, False: 348k]
  ------------------
 6602|      0|        {
 6603|      0|            int64_t data;
 6604|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6604:13): [True: 0, False: 0]
  |  Branch (6604:13): [True: 0, False: 0]
  ------------------
 6605|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6605:13): [True: 0, False: 0]
  |  Branch (6605:13): [True: 0, False: 0]
  ------------------
 6606|      0|            err = TIFFReadDirEntrySlong8(tif, dp, &data);
 6607|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6607:17): [True: 0, False: 0]
  ------------------
 6608|      0|            {
 6609|      0|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6609:21): [True: 0, False: 0]
  ------------------
 6610|      0|                    return 0;
 6611|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6611:21): [True: 0, False: 0]
  ------------------
 6612|      0|                    return (0);
 6613|      0|            }
 6614|      0|        }
 6615|      0|        break;
 6616|  2.49k|        case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (6616:9): [True: 2.49k, False: 346k]
  ------------------
 6617|  2.49k|        {
 6618|  2.49k|            float data;
 6619|  2.49k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6619:13): [True: 0, False: 2.49k]
  |  Branch (6619:13): [True: 2.49k, False: 0]
  ------------------
 6620|  2.49k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6620:13): [True: 0, False: 2.49k]
  |  Branch (6620:13): [True: 2.49k, False: 0]
  ------------------
 6621|  2.49k|            err = TIFFReadDirEntryFloat(tif, dp, &data);
 6622|  2.49k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6622:17): [True: 865, False: 1.62k]
  ------------------
 6623|    865|            {
 6624|    865|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6624:21): [True: 0, False: 865]
  ------------------
 6625|      0|                    return 0;
 6626|    865|                if (!TIFFSetField(tif, dp->tdir_tag, (double)data))
  ------------------
  |  Branch (6626:21): [True: 51, False: 814]
  ------------------
 6627|     51|                    return (0);
 6628|    865|            }
 6629|  2.49k|        }
 6630|  2.44k|        break;
 6631|  2.44k|        case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (6631:9): [True: 62, False: 348k]
  ------------------
 6632|     62|        {
 6633|     62|            double data;
 6634|     62|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6634:13): [True: 0, False: 62]
  |  Branch (6634:13): [True: 62, False: 0]
  ------------------
 6635|     62|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6635:13): [True: 0, False: 62]
  |  Branch (6635:13): [True: 62, False: 0]
  ------------------
 6636|     62|            err = TIFFReadDirEntryDouble(tif, dp, &data);
 6637|     62|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6637:17): [True: 15, False: 47]
  ------------------
 6638|     15|            {
 6639|     15|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6639:21): [True: 0, False: 15]
  ------------------
 6640|      0|                    return 0;
 6641|     15|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6641:21): [True: 0, False: 15]
  ------------------
 6642|      0|                    return (0);
 6643|     15|            }
 6644|     62|        }
 6645|     62|        break;
 6646|    356|        case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (6646:9): [True: 356, False: 348k]
  ------------------
 6647|    356|        {
 6648|    356|            uint64_t data;
 6649|    356|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6649:13): [True: 0, False: 356]
  |  Branch (6649:13): [True: 356, False: 0]
  ------------------
 6650|    356|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6650:13): [True: 0, False: 356]
  |  Branch (6650:13): [True: 356, False: 0]
  ------------------
 6651|    356|            err = TIFFReadDirEntryIfd8(tif, dp, &data);
 6652|    356|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6652:17): [True: 66, False: 290]
  ------------------
 6653|     66|            {
 6654|     66|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6654:21): [True: 0, False: 66]
  ------------------
 6655|      0|                    return 0;
 6656|     66|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6656:21): [True: 19, False: 47]
  ------------------
 6657|     19|                    return (0);
 6658|     66|            }
 6659|    356|        }
 6660|    337|        break;
 6661|  1.67k|        case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (6661:9): [True: 1.67k, False: 347k]
  ------------------
 6662|  1.67k|        {
 6663|  1.67k|            uint16_t *data;
 6664|  1.67k|            assert(fip->field_readcount == 2);
  ------------------
  |  Branch (6664:13): [True: 0, False: 1.67k]
  |  Branch (6664:13): [True: 1.67k, False: 0]
  ------------------
 6665|  1.67k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6665:13): [True: 0, False: 1.67k]
  |  Branch (6665:13): [True: 1.67k, False: 0]
  ------------------
 6666|  1.67k|            if (dp->tdir_count != 2)
  ------------------
  |  Branch (6666:17): [True: 286, False: 1.39k]
  ------------------
 6667|    286|            {
 6668|    286|                TIFFWarningExtR(tif, module,
 6669|    286|                                "incorrect count for field \"%s\", expected 2, "
 6670|    286|                                "got %" PRIu64,
 6671|    286|                                fip->field_name, dp->tdir_count);
 6672|    286|                return (0);
 6673|    286|            }
 6674|  1.39k|            err = TIFFReadDirEntryShortArray(tif, dp, &data);
 6675|  1.39k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6675:17): [True: 1.29k, False: 97]
  ------------------
 6676|  1.29k|            {
 6677|  1.29k|                int m;
 6678|  1.29k|                assert(data); /* avoid CLang static Analyzer false positive */
  ------------------
  |  Branch (6678:17): [True: 0, False: 1.29k]
  |  Branch (6678:17): [True: 1.29k, False: 0]
  ------------------
 6679|  1.29k|                m = TIFFSetField(tif, dp->tdir_tag, data[0], data[1]);
 6680|  1.29k|                _TIFFfreeExt(tif, data);
 6681|  1.29k|                if (!m)
  ------------------
  |  Branch (6681:21): [True: 0, False: 1.29k]
  ------------------
 6682|      0|                    return (0);
 6683|  1.29k|            }
 6684|  1.39k|        }
 6685|  1.39k|        break;
 6686|  1.39k|        case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (6686:9): [True: 358, False: 348k]
  ------------------
 6687|    358|        {
 6688|    358|            uint8_t *data;
 6689|    358|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6689:13): [True: 0, False: 358]
  |  Branch (6689:13): [True: 358, False: 0]
  ------------------
 6690|    358|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6690:13): [True: 0, False: 358]
  |  Branch (6690:13): [True: 358, False: 0]
  ------------------
 6691|    358|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6691:17): [True: 335, False: 23]
  ------------------
 6692|    335|            {
 6693|    335|                TIFFWarningExtR(tif, module,
 6694|    335|                                "incorrect count for field \"%s\", expected "
 6695|    335|                                "%d, got %" PRIu64,
 6696|    335|                                fip->field_name, (int)fip->field_readcount,
 6697|    335|                                dp->tdir_count);
 6698|    335|                return (0);
 6699|    335|            }
 6700|     23|            else
 6701|     23|            {
 6702|     23|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 6703|     23|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6703:21): [True: 14, False: 9]
  ------------------
 6704|     14|                {
 6705|     14|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6705:25): [True: 0, False: 14]
  ------------------
 6706|      0|                    {
 6707|      0|                        if (data != 0)
  ------------------
  |  Branch (6707:29): [True: 0, False: 0]
  ------------------
 6708|      0|                            _TIFFfreeExt(tif, data);
 6709|      0|                        return 0;
 6710|      0|                    }
 6711|     14|                    int m;
 6712|     14|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6713|     14|                    if (data != 0)
  ------------------
  |  Branch (6713:25): [True: 14, False: 0]
  ------------------
 6714|     14|                        _TIFFfreeExt(tif, data);
 6715|     14|                    if (!m)
  ------------------
  |  Branch (6715:25): [True: 0, False: 14]
  ------------------
 6716|      0|                        return (0);
 6717|     14|                }
 6718|     23|            }
 6719|    358|        }
 6720|     23|        break;
 6721|     23|        case TIFF_SETGET_C0_SINT8:
  ------------------
  |  Branch (6721:9): [True: 0, False: 348k]
  ------------------
 6722|      0|        {
 6723|      0|            int8_t *data;
 6724|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6724:13): [True: 0, False: 0]
  |  Branch (6724:13): [True: 0, False: 0]
  ------------------
 6725|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6725:13): [True: 0, False: 0]
  |  Branch (6725:13): [True: 0, False: 0]
  ------------------
 6726|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6726:17): [True: 0, False: 0]
  ------------------
 6727|      0|            {
 6728|      0|                TIFFWarningExtR(tif, module,
 6729|      0|                                "incorrect count for field \"%s\", expected "
 6730|      0|                                "%d, got %" PRIu64,
 6731|      0|                                fip->field_name, (int)fip->field_readcount,
 6732|      0|                                dp->tdir_count);
 6733|      0|                return (0);
 6734|      0|            }
 6735|      0|            else
 6736|      0|            {
 6737|      0|                err = TIFFReadDirEntrySbyteArray(tif, dp, &data);
 6738|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6738:21): [True: 0, False: 0]
  ------------------
 6739|      0|                {
 6740|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6740:25): [True: 0, False: 0]
  ------------------
 6741|      0|                    {
 6742|      0|                        if (data != 0)
  ------------------
  |  Branch (6742:29): [True: 0, False: 0]
  ------------------
 6743|      0|                            _TIFFfreeExt(tif, data);
 6744|      0|                        return 0;
 6745|      0|                    }
 6746|      0|                    int m;
 6747|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6748|      0|                    if (data != 0)
  ------------------
  |  Branch (6748:25): [True: 0, False: 0]
  ------------------
 6749|      0|                        _TIFFfreeExt(tif, data);
 6750|      0|                    if (!m)
  ------------------
  |  Branch (6750:25): [True: 0, False: 0]
  ------------------
 6751|      0|                        return (0);
 6752|      0|                }
 6753|      0|            }
 6754|      0|        }
 6755|      0|        break;
 6756|     75|        case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (6756:9): [True: 75, False: 348k]
  ------------------
 6757|     75|        {
 6758|     75|            uint16_t *data;
 6759|     75|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6759:13): [True: 0, False: 75]
  |  Branch (6759:13): [True: 75, False: 0]
  ------------------
 6760|     75|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6760:13): [True: 0, False: 75]
  |  Branch (6760:13): [True: 75, False: 0]
  ------------------
 6761|     75|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6761:17): [True: 72, False: 3]
  ------------------
 6762|     72|            {
 6763|     72|                TIFFWarningExtR(tif, module,
 6764|     72|                                "incorrect count for field \"%s\", expected "
 6765|     72|                                "%d, got %" PRIu64,
 6766|     72|                                fip->field_name, (int)fip->field_readcount,
 6767|     72|                                dp->tdir_count);
 6768|     72|                return (0);
 6769|     72|            }
 6770|      3|            else
 6771|      3|            {
 6772|      3|                err = TIFFReadDirEntryShortArray(tif, dp, &data);
 6773|      3|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6773:21): [True: 1, False: 2]
  ------------------
 6774|      1|                {
 6775|      1|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6775:25): [True: 0, False: 1]
  ------------------
 6776|      0|                    {
 6777|      0|                        if (data != 0)
  ------------------
  |  Branch (6777:29): [True: 0, False: 0]
  ------------------
 6778|      0|                            _TIFFfreeExt(tif, data);
 6779|      0|                        return 0;
 6780|      0|                    }
 6781|      1|                    int m;
 6782|      1|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6783|      1|                    if (data != 0)
  ------------------
  |  Branch (6783:25): [True: 1, False: 0]
  ------------------
 6784|      1|                        _TIFFfreeExt(tif, data);
 6785|      1|                    if (!m)
  ------------------
  |  Branch (6785:25): [True: 0, False: 1]
  ------------------
 6786|      0|                        return (0);
 6787|      1|                }
 6788|      3|            }
 6789|     75|        }
 6790|      3|        break;
 6791|      3|        case TIFF_SETGET_C0_SINT16:
  ------------------
  |  Branch (6791:9): [True: 0, False: 348k]
  ------------------
 6792|      0|        {
 6793|      0|            int16_t *data;
 6794|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6794:13): [True: 0, False: 0]
  |  Branch (6794:13): [True: 0, False: 0]
  ------------------
 6795|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6795:13): [True: 0, False: 0]
  |  Branch (6795:13): [True: 0, False: 0]
  ------------------
 6796|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6796:17): [True: 0, False: 0]
  ------------------
 6797|      0|            {
 6798|      0|                TIFFWarningExtR(tif, module,
 6799|      0|                                "incorrect count for field \"%s\", expected "
 6800|      0|                                "%d, got %" PRIu64,
 6801|      0|                                fip->field_name, (int)fip->field_readcount,
 6802|      0|                                dp->tdir_count);
 6803|      0|                return (0);
 6804|      0|            }
 6805|      0|            else
 6806|      0|            {
 6807|      0|                err = TIFFReadDirEntrySshortArray(tif, dp, &data);
 6808|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6808:21): [True: 0, False: 0]
  ------------------
 6809|      0|                {
 6810|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6810:25): [True: 0, False: 0]
  ------------------
 6811|      0|                    {
 6812|      0|                        if (data != 0)
  ------------------
  |  Branch (6812:29): [True: 0, False: 0]
  ------------------
 6813|      0|                            _TIFFfreeExt(tif, data);
 6814|      0|                        return 0;
 6815|      0|                    }
 6816|      0|                    int m;
 6817|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6818|      0|                    if (data != 0)
  ------------------
  |  Branch (6818:25): [True: 0, False: 0]
  ------------------
 6819|      0|                        _TIFFfreeExt(tif, data);
 6820|      0|                    if (!m)
  ------------------
  |  Branch (6820:25): [True: 0, False: 0]
  ------------------
 6821|      0|                        return (0);
 6822|      0|                }
 6823|      0|            }
 6824|      0|        }
 6825|      0|        break;
 6826|    101|        case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (6826:9): [True: 101, False: 348k]
  ------------------
 6827|    101|        {
 6828|    101|            uint32_t *data;
 6829|    101|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6829:13): [True: 0, False: 101]
  |  Branch (6829:13): [True: 101, False: 0]
  ------------------
 6830|    101|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6830:13): [True: 0, False: 101]
  |  Branch (6830:13): [True: 101, False: 0]
  ------------------
 6831|    101|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6831:17): [True: 17, False: 84]
  ------------------
 6832|     17|            {
 6833|     17|                TIFFWarningExtR(tif, module,
 6834|     17|                                "incorrect count for field \"%s\", expected "
 6835|     17|                                "%d, got %" PRIu64,
 6836|     17|                                fip->field_name, (int)fip->field_readcount,
 6837|     17|                                dp->tdir_count);
 6838|     17|                return (0);
 6839|     17|            }
 6840|     84|            else
 6841|     84|            {
 6842|     84|                err = TIFFReadDirEntryLongArray(tif, dp, &data);
 6843|     84|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6843:21): [True: 30, False: 54]
  ------------------
 6844|     30|                {
 6845|     30|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6845:25): [True: 0, False: 30]
  ------------------
 6846|      0|                    {
 6847|      0|                        if (data != 0)
  ------------------
  |  Branch (6847:29): [True: 0, False: 0]
  ------------------
 6848|      0|                            _TIFFfreeExt(tif, data);
 6849|      0|                        return 0;
 6850|      0|                    }
 6851|     30|                    int m;
 6852|     30|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6853|     30|                    if (data != 0)
  ------------------
  |  Branch (6853:25): [True: 30, False: 0]
  ------------------
 6854|     30|                        _TIFFfreeExt(tif, data);
 6855|     30|                    if (!m)
  ------------------
  |  Branch (6855:25): [True: 0, False: 30]
  ------------------
 6856|      0|                        return (0);
 6857|     30|                }
 6858|     84|            }
 6859|    101|        }
 6860|     84|        break;
 6861|     84|        case TIFF_SETGET_C0_SINT32:
  ------------------
  |  Branch (6861:9): [True: 0, False: 348k]
  ------------------
 6862|      0|        {
 6863|      0|            int32_t *data;
 6864|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6864:13): [True: 0, False: 0]
  |  Branch (6864:13): [True: 0, False: 0]
  ------------------
 6865|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6865:13): [True: 0, False: 0]
  |  Branch (6865:13): [True: 0, False: 0]
  ------------------
 6866|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6866:17): [True: 0, False: 0]
  ------------------
 6867|      0|            {
 6868|      0|                TIFFWarningExtR(tif, module,
 6869|      0|                                "incorrect count for field \"%s\", expected "
 6870|      0|                                "%d, got %" PRIu64,
 6871|      0|                                fip->field_name, (int)fip->field_readcount,
 6872|      0|                                dp->tdir_count);
 6873|      0|                return (0);
 6874|      0|            }
 6875|      0|            else
 6876|      0|            {
 6877|      0|                err = TIFFReadDirEntrySlongArray(tif, dp, &data);
 6878|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6878:21): [True: 0, False: 0]
  ------------------
 6879|      0|                {
 6880|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6880:25): [True: 0, False: 0]
  ------------------
 6881|      0|                    {
 6882|      0|                        if (data != 0)
  ------------------
  |  Branch (6882:29): [True: 0, False: 0]
  ------------------
 6883|      0|                            _TIFFfreeExt(tif, data);
 6884|      0|                        return 0;
 6885|      0|                    }
 6886|      0|                    int m;
 6887|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6888|      0|                    if (data != 0)
  ------------------
  |  Branch (6888:25): [True: 0, False: 0]
  ------------------
 6889|      0|                        _TIFFfreeExt(tif, data);
 6890|      0|                    if (!m)
  ------------------
  |  Branch (6890:25): [True: 0, False: 0]
  ------------------
 6891|      0|                        return (0);
 6892|      0|                }
 6893|      0|            }
 6894|      0|        }
 6895|      0|        break;
 6896|      0|        case TIFF_SETGET_C0_UINT64:
  ------------------
  |  Branch (6896:9): [True: 0, False: 348k]
  ------------------
 6897|      0|        {
 6898|      0|            uint64_t *data;
 6899|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6899:13): [True: 0, False: 0]
  |  Branch (6899:13): [True: 0, False: 0]
  ------------------
 6900|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6900:13): [True: 0, False: 0]
  |  Branch (6900:13): [True: 0, False: 0]
  ------------------
 6901|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6901:17): [True: 0, False: 0]
  ------------------
 6902|      0|            {
 6903|      0|                TIFFWarningExtR(tif, module,
 6904|      0|                                "incorrect count for field \"%s\", expected "
 6905|      0|                                "%d, got %" PRIu64,
 6906|      0|                                fip->field_name, (int)fip->field_readcount,
 6907|      0|                                dp->tdir_count);
 6908|      0|                return (0);
 6909|      0|            }
 6910|      0|            else
 6911|      0|            {
 6912|      0|                err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 6913|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6913:21): [True: 0, False: 0]
  ------------------
 6914|      0|                {
 6915|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6915:25): [True: 0, False: 0]
  ------------------
 6916|      0|                    {
 6917|      0|                        if (data != 0)
  ------------------
  |  Branch (6917:29): [True: 0, False: 0]
  ------------------
 6918|      0|                            _TIFFfreeExt(tif, data);
 6919|      0|                        return 0;
 6920|      0|                    }
 6921|      0|                    int m;
 6922|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6923|      0|                    if (data != 0)
  ------------------
  |  Branch (6923:25): [True: 0, False: 0]
  ------------------
 6924|      0|                        _TIFFfreeExt(tif, data);
 6925|      0|                    if (!m)
  ------------------
  |  Branch (6925:25): [True: 0, False: 0]
  ------------------
 6926|      0|                        return (0);
 6927|      0|                }
 6928|      0|            }
 6929|      0|        }
 6930|      0|        break;
 6931|      0|        case TIFF_SETGET_C0_SINT64:
  ------------------
  |  Branch (6931:9): [True: 0, False: 348k]
  ------------------
 6932|      0|        {
 6933|      0|            int64_t *data;
 6934|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6934:13): [True: 0, False: 0]
  |  Branch (6934:13): [True: 0, False: 0]
  ------------------
 6935|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6935:13): [True: 0, False: 0]
  |  Branch (6935:13): [True: 0, False: 0]
  ------------------
 6936|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6936:17): [True: 0, False: 0]
  ------------------
 6937|      0|            {
 6938|      0|                TIFFWarningExtR(tif, module,
 6939|      0|                                "incorrect count for field \"%s\", expected "
 6940|      0|                                "%d, got %" PRIu64,
 6941|      0|                                fip->field_name, (int)fip->field_readcount,
 6942|      0|                                dp->tdir_count);
 6943|      0|                return (0);
 6944|      0|            }
 6945|      0|            else
 6946|      0|            {
 6947|      0|                err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 6948|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6948:21): [True: 0, False: 0]
  ------------------
 6949|      0|                {
 6950|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6950:25): [True: 0, False: 0]
  ------------------
 6951|      0|                    {
 6952|      0|                        if (data != 0)
  ------------------
  |  Branch (6952:29): [True: 0, False: 0]
  ------------------
 6953|      0|                            _TIFFfreeExt(tif, data);
 6954|      0|                        return 0;
 6955|      0|                    }
 6956|      0|                    int m;
 6957|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6958|      0|                    if (data != 0)
  ------------------
  |  Branch (6958:25): [True: 0, False: 0]
  ------------------
 6959|      0|                        _TIFFfreeExt(tif, data);
 6960|      0|                    if (!m)
  ------------------
  |  Branch (6960:25): [True: 0, False: 0]
  ------------------
 6961|      0|                        return (0);
 6962|      0|                }
 6963|      0|            }
 6964|      0|        }
 6965|      0|        break;
 6966|    628|        case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (6966:9): [True: 628, False: 348k]
  ------------------
 6967|    628|        {
 6968|    628|            float *data;
 6969|    628|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6969:13): [True: 0, False: 628]
  |  Branch (6969:13): [True: 628, False: 0]
  ------------------
 6970|    628|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6970:13): [True: 0, False: 628]
  |  Branch (6970:13): [True: 628, False: 0]
  ------------------
 6971|    628|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6971:17): [True: 520, False: 108]
  ------------------
 6972|    520|            {
 6973|    520|                TIFFWarningExtR(tif, module,
 6974|    520|                                "incorrect count for field \"%s\", expected "
 6975|    520|                                "%d, got %" PRIu64,
 6976|    520|                                fip->field_name, (int)fip->field_readcount,
 6977|    520|                                dp->tdir_count);
 6978|    520|                return (0);
 6979|    520|            }
 6980|    108|            else
 6981|    108|            {
 6982|    108|                err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 6983|    108|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6983:21): [True: 91, False: 17]
  ------------------
 6984|     91|                {
 6985|     91|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6985:25): [True: 0, False: 91]
  ------------------
 6986|      0|                    {
 6987|      0|                        if (data != 0)
  ------------------
  |  Branch (6987:29): [True: 0, False: 0]
  ------------------
 6988|      0|                            _TIFFfreeExt(tif, data);
 6989|      0|                        return 0;
 6990|      0|                    }
 6991|     91|                    int m;
 6992|     91|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6993|     91|                    if (data != 0)
  ------------------
  |  Branch (6993:25): [True: 91, False: 0]
  ------------------
 6994|     91|                        _TIFFfreeExt(tif, data);
 6995|     91|                    if (!m)
  ------------------
  |  Branch (6995:25): [True: 0, False: 91]
  ------------------
 6996|      0|                        return (0);
 6997|     91|                }
 6998|    108|            }
 6999|    628|        }
 7000|    108|        break;
 7001|       |        /*--: Rational2Double: Extend for Double Arrays and Rational-Arrays read
 7002|       |         * into Double-Arrays. */
 7003|    108|        case TIFF_SETGET_C0_DOUBLE:
  ------------------
  |  Branch (7003:9): [True: 0, False: 348k]
  ------------------
 7004|      0|        {
 7005|      0|            double *data;
 7006|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (7006:13): [True: 0, False: 0]
  |  Branch (7006:13): [True: 0, False: 0]
  ------------------
 7007|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (7007:13): [True: 0, False: 0]
  |  Branch (7007:13): [True: 0, False: 0]
  ------------------
 7008|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (7008:17): [True: 0, False: 0]
  ------------------
 7009|      0|            {
 7010|      0|                TIFFWarningExtR(tif, module,
 7011|      0|                                "incorrect count for field \"%s\", expected "
 7012|      0|                                "%d, got %" PRIu64,
 7013|      0|                                fip->field_name, (int)fip->field_readcount,
 7014|      0|                                dp->tdir_count);
 7015|      0|                return (0);
 7016|      0|            }
 7017|      0|            else
 7018|      0|            {
 7019|      0|                err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 7020|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7020:21): [True: 0, False: 0]
  ------------------
 7021|      0|                {
 7022|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7022:25): [True: 0, False: 0]
  ------------------
 7023|      0|                    {
 7024|      0|                        if (data != 0)
  ------------------
  |  Branch (7024:29): [True: 0, False: 0]
  ------------------
 7025|      0|                            _TIFFfreeExt(tif, data);
 7026|      0|                        return 0;
 7027|      0|                    }
 7028|      0|                    int m;
 7029|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 7030|      0|                    if (data != 0)
  ------------------
  |  Branch (7030:25): [True: 0, False: 0]
  ------------------
 7031|      0|                        _TIFFfreeExt(tif, data);
 7032|      0|                    if (!m)
  ------------------
  |  Branch (7032:25): [True: 0, False: 0]
  ------------------
 7033|      0|                        return (0);
 7034|      0|                }
 7035|      0|            }
 7036|      0|        }
 7037|      0|        break;
 7038|      0|        case TIFF_SETGET_C0_IFD8:
  ------------------
  |  Branch (7038:9): [True: 0, False: 348k]
  ------------------
 7039|      0|        {
 7040|      0|            uint64_t *data;
 7041|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (7041:13): [True: 0, False: 0]
  |  Branch (7041:13): [True: 0, False: 0]
  ------------------
 7042|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (7042:13): [True: 0, False: 0]
  |  Branch (7042:13): [True: 0, False: 0]
  ------------------
 7043|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (7043:17): [True: 0, False: 0]
  ------------------
 7044|      0|            {
 7045|      0|                TIFFWarningExtR(tif, module,
 7046|      0|                                "incorrect count for field \"%s\", expected "
 7047|      0|                                "%d, got %" PRIu64,
 7048|      0|                                fip->field_name, (int)fip->field_readcount,
 7049|      0|                                dp->tdir_count);
 7050|      0|                return (0);
 7051|      0|            }
 7052|      0|            else
 7053|      0|            {
 7054|      0|                err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7055|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7055:21): [True: 0, False: 0]
  ------------------
 7056|      0|                {
 7057|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7057:25): [True: 0, False: 0]
  ------------------
 7058|      0|                    {
 7059|      0|                        if (data != 0)
  ------------------
  |  Branch (7059:29): [True: 0, False: 0]
  ------------------
 7060|      0|                            _TIFFfreeExt(tif, data);
 7061|      0|                        return 0;
 7062|      0|                    }
 7063|      0|                    int m;
 7064|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 7065|      0|                    if (data != 0)
  ------------------
  |  Branch (7065:25): [True: 0, False: 0]
  ------------------
 7066|      0|                        _TIFFfreeExt(tif, data);
 7067|      0|                    if (!m)
  ------------------
  |  Branch (7067:25): [True: 0, False: 0]
  ------------------
 7068|      0|                        return (0);
 7069|      0|                }
 7070|      0|            }
 7071|      0|        }
 7072|      0|        break;
 7073|    162|        case TIFF_SETGET_C16_ASCII:
  ------------------
  |  Branch (7073:9): [True: 162, False: 348k]
  ------------------
 7074|    162|        {
 7075|    162|            uint8_t *data;
 7076|    162|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7076:13): [True: 0, False: 162]
  |  Branch (7076:13): [True: 162, False: 0]
  ------------------
 7077|    162|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7077:13): [True: 0, False: 162]
  |  Branch (7077:13): [True: 162, False: 0]
  ------------------
 7078|    162|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7078:17): [True: 84, False: 78]
  ------------------
 7079|     84|                err = TIFFReadDirEntryErrCount;
 7080|     78|            else
 7081|     78|            {
 7082|     78|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7083|     78|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7083:21): [True: 52, False: 26]
  ------------------
 7084|     52|                {
 7085|     52|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7085:25): [True: 1, False: 51]
  ------------------
 7086|      1|                    {
 7087|      1|                        if (data != 0)
  ------------------
  |  Branch (7087:29): [True: 1, False: 0]
  ------------------
 7088|      1|                            _TIFFfreeExt(tif, data);
 7089|      1|                        return 0;
 7090|      1|                    }
 7091|     51|                    int m;
 7092|     51|                    if (data != 0 && dp->tdir_count > 0 &&
  ------------------
  |  Branch (7092:25): [True: 50, False: 1]
  |  Branch (7092:38): [True: 50, False: 0]
  ------------------
 7093|     50|                        data[dp->tdir_count - 1] != '\0')
  ------------------
  |  Branch (7093:25): [True: 20, False: 30]
  ------------------
 7094|     20|                    {
 7095|     20|                        TIFFWarningExtR(tif, module,
 7096|     20|                                        "ASCII value for ASCII array tag "
 7097|     20|                                        "\"%s\" does not end in null "
 7098|     20|                                        "byte. Forcing it to be null",
 7099|     20|                                        fip->field_name);
 7100|       |                        /* Enlarge buffer and add terminating null. */
 7101|     20|                        uint8_t *o = (uint8_t *)_TIFFmallocExt(
 7102|     20|                            tif, (uint32_t)dp->tdir_count + 1);
 7103|     20|                        if (o == NULL)
  ------------------
  |  Branch (7103:29): [True: 0, False: 20]
  ------------------
 7104|      0|                        {
 7105|      0|                            if (data != NULL)
  ------------------
  |  Branch (7105:33): [True: 0, False: 0]
  ------------------
 7106|      0|                                _TIFFfreeExt(tif, data);
 7107|      0|                            return (0);
 7108|      0|                        }
 7109|     20|                        if (dp->tdir_count > 0)
  ------------------
  |  Branch (7109:29): [True: 20, False: 0]
  ------------------
 7110|     20|                        {
 7111|     20|                            _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 7112|     20|                        }
 7113|     20|                        o[(uint32_t)dp->tdir_count] = 0;
 7114|     20|                        dp->tdir_count++; /* Increment for added null. */
 7115|     20|                        if (data != 0)
  ------------------
  |  Branch (7115:29): [True: 20, False: 0]
  ------------------
 7116|     20|                            _TIFFfreeExt(tif, data);
 7117|     20|                        data = o;
 7118|     20|                    }
 7119|     51|                    m = TIFFSetField(tif, dp->tdir_tag,
 7120|     51|                                     (uint16_t)(dp->tdir_count), data);
 7121|     51|                    if (data != 0)
  ------------------
  |  Branch (7121:25): [True: 50, False: 1]
  ------------------
 7122|     50|                        _TIFFfreeExt(tif, data);
 7123|     51|                    if (!m)
  ------------------
  |  Branch (7123:25): [True: 1, False: 50]
  ------------------
 7124|      1|                        return (0);
 7125|     51|                }
 7126|     78|            }
 7127|    162|        }
 7128|    160|        break;
 7129|    160|        case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (7129:9): [True: 157, False: 348k]
  ------------------
 7130|    157|        {
 7131|    157|            uint8_t *data;
 7132|    157|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7132:13): [True: 0, False: 157]
  |  Branch (7132:13): [True: 157, False: 0]
  ------------------
 7133|    157|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7133:13): [True: 0, False: 157]
  |  Branch (7133:13): [True: 157, False: 0]
  ------------------
 7134|    157|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7134:17): [True: 92, False: 65]
  ------------------
 7135|     92|                err = TIFFReadDirEntryErrCount;
 7136|     65|            else
 7137|     65|            {
 7138|     65|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7139|     65|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7139:21): [True: 26, False: 39]
  ------------------
 7140|     26|                {
 7141|     26|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7141:25): [True: 1, False: 25]
  ------------------
 7142|      1|                    {
 7143|      1|                        if (data != 0)
  ------------------
  |  Branch (7143:29): [True: 1, False: 0]
  ------------------
 7144|      1|                            _TIFFfreeExt(tif, data);
 7145|      1|                        return 0;
 7146|      1|                    }
 7147|     25|                    int m;
 7148|     25|                    m = TIFFSetField(tif, dp->tdir_tag,
 7149|     25|                                     (uint16_t)(dp->tdir_count), data);
 7150|     25|                    if (data != 0)
  ------------------
  |  Branch (7150:25): [True: 15, False: 10]
  ------------------
 7151|     15|                        _TIFFfreeExt(tif, data);
 7152|     25|                    if (!m)
  ------------------
  |  Branch (7152:25): [True: 0, False: 25]
  ------------------
 7153|      0|                        return (0);
 7154|     25|                }
 7155|     65|            }
 7156|    157|        }
 7157|    156|        break;
 7158|    156|        case TIFF_SETGET_C16_SINT8:
  ------------------
  |  Branch (7158:9): [True: 0, False: 348k]
  ------------------
 7159|      0|        {
 7160|      0|            int8_t *data;
 7161|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7161:13): [True: 0, False: 0]
  |  Branch (7161:13): [True: 0, False: 0]
  ------------------
 7162|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7162:13): [True: 0, False: 0]
  |  Branch (7162:13): [True: 0, False: 0]
  ------------------
 7163|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7163:17): [True: 0, False: 0]
  ------------------
 7164|      0|                err = TIFFReadDirEntryErrCount;
 7165|      0|            else
 7166|      0|            {
 7167|      0|                err = TIFFReadDirEntrySbyteArray(tif, dp, &data);
 7168|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7168:21): [True: 0, False: 0]
  ------------------
 7169|      0|                {
 7170|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7170:25): [True: 0, False: 0]
  ------------------
 7171|      0|                    {
 7172|      0|                        if (data != 0)
  ------------------
  |  Branch (7172:29): [True: 0, False: 0]
  ------------------
 7173|      0|                            _TIFFfreeExt(tif, data);
 7174|      0|                        return 0;
 7175|      0|                    }
 7176|      0|                    int m;
 7177|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7178|      0|                                     (uint16_t)(dp->tdir_count), data);
 7179|      0|                    if (data != 0)
  ------------------
  |  Branch (7179:25): [True: 0, False: 0]
  ------------------
 7180|      0|                        _TIFFfreeExt(tif, data);
 7181|      0|                    if (!m)
  ------------------
  |  Branch (7181:25): [True: 0, False: 0]
  ------------------
 7182|      0|                        return (0);
 7183|      0|                }
 7184|      0|            }
 7185|      0|        }
 7186|      0|        break;
 7187|    778|        case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (7187:9): [True: 778, False: 348k]
  ------------------
 7188|    778|        {
 7189|    778|            uint16_t *data;
 7190|    778|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7190:13): [True: 0, False: 778]
  |  Branch (7190:13): [True: 778, False: 0]
  ------------------
 7191|    778|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7191:13): [True: 0, False: 778]
  |  Branch (7191:13): [True: 778, False: 0]
  ------------------
 7192|    778|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7192:17): [True: 91, False: 687]
  ------------------
 7193|     91|                err = TIFFReadDirEntryErrCount;
 7194|    687|            else
 7195|    687|            {
 7196|    687|                err = TIFFReadDirEntryShortArray(tif, dp, &data);
 7197|    687|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7197:21): [True: 329, False: 358]
  ------------------
 7198|    329|                {
 7199|    329|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7199:25): [True: 1, False: 328]
  ------------------
 7200|      1|                    {
 7201|      1|                        if (data != 0)
  ------------------
  |  Branch (7201:29): [True: 1, False: 0]
  ------------------
 7202|      1|                            _TIFFfreeExt(tif, data);
 7203|      1|                        return 0;
 7204|      1|                    }
 7205|    328|                    int m;
 7206|    328|                    m = TIFFSetField(tif, dp->tdir_tag,
 7207|    328|                                     (uint16_t)(dp->tdir_count), data);
 7208|    328|                    if (data != 0)
  ------------------
  |  Branch (7208:25): [True: 314, False: 14]
  ------------------
 7209|    314|                        _TIFFfreeExt(tif, data);
 7210|    328|                    if (!m)
  ------------------
  |  Branch (7210:25): [True: 95, False: 233]
  ------------------
 7211|     95|                        return (0);
 7212|    328|                }
 7213|    687|            }
 7214|    778|        }
 7215|    682|        break;
 7216|    682|        case TIFF_SETGET_C16_SINT16:
  ------------------
  |  Branch (7216:9): [True: 0, False: 348k]
  ------------------
 7217|      0|        {
 7218|      0|            int16_t *data;
 7219|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7219:13): [True: 0, False: 0]
  |  Branch (7219:13): [True: 0, False: 0]
  ------------------
 7220|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7220:13): [True: 0, False: 0]
  |  Branch (7220:13): [True: 0, False: 0]
  ------------------
 7221|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7221:17): [True: 0, False: 0]
  ------------------
 7222|      0|                err = TIFFReadDirEntryErrCount;
 7223|      0|            else
 7224|      0|            {
 7225|      0|                err = TIFFReadDirEntrySshortArray(tif, dp, &data);
 7226|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7226:21): [True: 0, False: 0]
  ------------------
 7227|      0|                {
 7228|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7228:25): [True: 0, False: 0]
  ------------------
 7229|      0|                    {
 7230|      0|                        if (data != 0)
  ------------------
  |  Branch (7230:29): [True: 0, False: 0]
  ------------------
 7231|      0|                            _TIFFfreeExt(tif, data);
 7232|      0|                        return 0;
 7233|      0|                    }
 7234|      0|                    int m;
 7235|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7236|      0|                                     (uint16_t)(dp->tdir_count), data);
 7237|      0|                    if (data != 0)
  ------------------
  |  Branch (7237:25): [True: 0, False: 0]
  ------------------
 7238|      0|                        _TIFFfreeExt(tif, data);
 7239|      0|                    if (!m)
  ------------------
  |  Branch (7239:25): [True: 0, False: 0]
  ------------------
 7240|      0|                        return (0);
 7241|      0|                }
 7242|      0|            }
 7243|      0|        }
 7244|      0|        break;
 7245|    771|        case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (7245:9): [True: 771, False: 348k]
  ------------------
 7246|    771|        {
 7247|    771|            uint32_t *data;
 7248|    771|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7248:13): [True: 0, False: 771]
  |  Branch (7248:13): [True: 771, False: 0]
  ------------------
 7249|    771|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7249:13): [True: 0, False: 771]
  |  Branch (7249:13): [True: 771, False: 0]
  ------------------
 7250|    771|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7250:17): [True: 227, False: 544]
  ------------------
 7251|    227|                err = TIFFReadDirEntryErrCount;
 7252|    544|            else
 7253|    544|            {
 7254|    544|                err = TIFFReadDirEntryLongArray(tif, dp, &data);
 7255|    544|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7255:21): [True: 153, False: 391]
  ------------------
 7256|    153|                {
 7257|    153|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7257:25): [True: 1, False: 152]
  ------------------
 7258|      1|                    {
 7259|      1|                        if (data != 0)
  ------------------
  |  Branch (7259:29): [True: 1, False: 0]
  ------------------
 7260|      1|                            _TIFFfreeExt(tif, data);
 7261|      1|                        return 0;
 7262|      1|                    }
 7263|    152|                    int m;
 7264|    152|                    m = TIFFSetField(tif, dp->tdir_tag,
 7265|    152|                                     (uint16_t)(dp->tdir_count), data);
 7266|    152|                    if (data != 0)
  ------------------
  |  Branch (7266:25): [True: 142, False: 10]
  ------------------
 7267|    142|                        _TIFFfreeExt(tif, data);
 7268|    152|                    if (!m)
  ------------------
  |  Branch (7268:25): [True: 0, False: 152]
  ------------------
 7269|      0|                        return (0);
 7270|    152|                }
 7271|    544|            }
 7272|    771|        }
 7273|    770|        break;
 7274|    770|        case TIFF_SETGET_C16_SINT32:
  ------------------
  |  Branch (7274:9): [True: 0, False: 348k]
  ------------------
 7275|      0|        {
 7276|      0|            int32_t *data;
 7277|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7277:13): [True: 0, False: 0]
  |  Branch (7277:13): [True: 0, False: 0]
  ------------------
 7278|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7278:13): [True: 0, False: 0]
  |  Branch (7278:13): [True: 0, False: 0]
  ------------------
 7279|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7279:17): [True: 0, False: 0]
  ------------------
 7280|      0|                err = TIFFReadDirEntryErrCount;
 7281|      0|            else
 7282|      0|            {
 7283|      0|                err = TIFFReadDirEntrySlongArray(tif, dp, &data);
 7284|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7284:21): [True: 0, False: 0]
  ------------------
 7285|      0|                {
 7286|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7286:25): [True: 0, False: 0]
  ------------------
 7287|      0|                    {
 7288|      0|                        if (data != 0)
  ------------------
  |  Branch (7288:29): [True: 0, False: 0]
  ------------------
 7289|      0|                            _TIFFfreeExt(tif, data);
 7290|      0|                        return 0;
 7291|      0|                    }
 7292|      0|                    int m;
 7293|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7294|      0|                                     (uint16_t)(dp->tdir_count), data);
 7295|      0|                    if (data != 0)
  ------------------
  |  Branch (7295:25): [True: 0, False: 0]
  ------------------
 7296|      0|                        _TIFFfreeExt(tif, data);
 7297|      0|                    if (!m)
  ------------------
  |  Branch (7297:25): [True: 0, False: 0]
  ------------------
 7298|      0|                        return (0);
 7299|      0|                }
 7300|      0|            }
 7301|      0|        }
 7302|      0|        break;
 7303|      0|        case TIFF_SETGET_C16_UINT64:
  ------------------
  |  Branch (7303:9): [True: 0, False: 348k]
  ------------------
 7304|      0|        {
 7305|      0|            uint64_t *data;
 7306|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7306:13): [True: 0, False: 0]
  |  Branch (7306:13): [True: 0, False: 0]
  ------------------
 7307|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7307:13): [True: 0, False: 0]
  |  Branch (7307:13): [True: 0, False: 0]
  ------------------
 7308|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7308:17): [True: 0, False: 0]
  ------------------
 7309|      0|                err = TIFFReadDirEntryErrCount;
 7310|      0|            else
 7311|      0|            {
 7312|      0|                err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 7313|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7313:21): [True: 0, False: 0]
  ------------------
 7314|      0|                {
 7315|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7315:25): [True: 0, False: 0]
  ------------------
 7316|      0|                    {
 7317|      0|                        if (data != 0)
  ------------------
  |  Branch (7317:29): [True: 0, False: 0]
  ------------------
 7318|      0|                            _TIFFfreeExt(tif, data);
 7319|      0|                        return 0;
 7320|      0|                    }
 7321|      0|                    int m;
 7322|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7323|      0|                                     (uint16_t)(dp->tdir_count), data);
 7324|      0|                    if (data != 0)
  ------------------
  |  Branch (7324:25): [True: 0, False: 0]
  ------------------
 7325|      0|                        _TIFFfreeExt(tif, data);
 7326|      0|                    if (!m)
  ------------------
  |  Branch (7326:25): [True: 0, False: 0]
  ------------------
 7327|      0|                        return (0);
 7328|      0|                }
 7329|      0|            }
 7330|      0|        }
 7331|      0|        break;
 7332|      0|        case TIFF_SETGET_C16_SINT64:
  ------------------
  |  Branch (7332:9): [True: 0, False: 348k]
  ------------------
 7333|      0|        {
 7334|      0|            int64_t *data;
 7335|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7335:13): [True: 0, False: 0]
  |  Branch (7335:13): [True: 0, False: 0]
  ------------------
 7336|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7336:13): [True: 0, False: 0]
  |  Branch (7336:13): [True: 0, False: 0]
  ------------------
 7337|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7337:17): [True: 0, False: 0]
  ------------------
 7338|      0|                err = TIFFReadDirEntryErrCount;
 7339|      0|            else
 7340|      0|            {
 7341|      0|                err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 7342|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7342:21): [True: 0, False: 0]
  ------------------
 7343|      0|                {
 7344|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7344:25): [True: 0, False: 0]
  ------------------
 7345|      0|                    {
 7346|      0|                        if (data != 0)
  ------------------
  |  Branch (7346:29): [True: 0, False: 0]
  ------------------
 7347|      0|                            _TIFFfreeExt(tif, data);
 7348|      0|                        return 0;
 7349|      0|                    }
 7350|      0|                    int m;
 7351|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7352|      0|                                     (uint16_t)(dp->tdir_count), data);
 7353|      0|                    if (data != 0)
  ------------------
  |  Branch (7353:25): [True: 0, False: 0]
  ------------------
 7354|      0|                        _TIFFfreeExt(tif, data);
 7355|      0|                    if (!m)
  ------------------
  |  Branch (7355:25): [True: 0, False: 0]
  ------------------
 7356|      0|                        return (0);
 7357|      0|                }
 7358|      0|            }
 7359|      0|        }
 7360|      0|        break;
 7361|    530|        case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (7361:9): [True: 530, False: 348k]
  ------------------
 7362|    530|        {
 7363|    530|            float *data;
 7364|    530|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7364:13): [True: 0, False: 530]
  |  Branch (7364:13): [True: 530, False: 0]
  ------------------
 7365|    530|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7365:13): [True: 0, False: 530]
  |  Branch (7365:13): [True: 530, False: 0]
  ------------------
 7366|    530|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7366:17): [True: 102, False: 428]
  ------------------
 7367|    102|                err = TIFFReadDirEntryErrCount;
 7368|    428|            else
 7369|    428|            {
 7370|    428|                err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 7371|    428|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7371:21): [True: 306, False: 122]
  ------------------
 7372|    306|                {
 7373|    306|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7373:25): [True: 1, False: 305]
  ------------------
 7374|      1|                    {
 7375|      1|                        if (data != 0)
  ------------------
  |  Branch (7375:29): [True: 1, False: 0]
  ------------------
 7376|      1|                            _TIFFfreeExt(tif, data);
 7377|      1|                        return 0;
 7378|      1|                    }
 7379|    305|                    int m;
 7380|    305|                    m = TIFFSetField(tif, dp->tdir_tag,
 7381|    305|                                     (uint16_t)(dp->tdir_count), data);
 7382|    305|                    if (data != 0)
  ------------------
  |  Branch (7382:25): [True: 299, False: 6]
  ------------------
 7383|    299|                        _TIFFfreeExt(tif, data);
 7384|    305|                    if (!m)
  ------------------
  |  Branch (7384:25): [True: 0, False: 305]
  ------------------
 7385|      0|                        return (0);
 7386|    305|                }
 7387|    428|            }
 7388|    530|        }
 7389|    529|        break;
 7390|    529|        case TIFF_SETGET_C16_DOUBLE:
  ------------------
  |  Branch (7390:9): [True: 0, False: 348k]
  ------------------
 7391|      0|        {
 7392|      0|            double *data;
 7393|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7393:13): [True: 0, False: 0]
  |  Branch (7393:13): [True: 0, False: 0]
  ------------------
 7394|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7394:13): [True: 0, False: 0]
  |  Branch (7394:13): [True: 0, False: 0]
  ------------------
 7395|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7395:17): [True: 0, False: 0]
  ------------------
 7396|      0|                err = TIFFReadDirEntryErrCount;
 7397|      0|            else
 7398|      0|            {
 7399|      0|                err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 7400|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7400:21): [True: 0, False: 0]
  ------------------
 7401|      0|                {
 7402|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7402:25): [True: 0, False: 0]
  ------------------
 7403|      0|                    {
 7404|      0|                        if (data != 0)
  ------------------
  |  Branch (7404:29): [True: 0, False: 0]
  ------------------
 7405|      0|                            _TIFFfreeExt(tif, data);
 7406|      0|                        return 0;
 7407|      0|                    }
 7408|      0|                    int m;
 7409|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7410|      0|                                     (uint16_t)(dp->tdir_count), data);
 7411|      0|                    if (data != 0)
  ------------------
  |  Branch (7411:25): [True: 0, False: 0]
  ------------------
 7412|      0|                        _TIFFfreeExt(tif, data);
 7413|      0|                    if (!m)
  ------------------
  |  Branch (7413:25): [True: 0, False: 0]
  ------------------
 7414|      0|                        return (0);
 7415|      0|                }
 7416|      0|            }
 7417|      0|        }
 7418|      0|        break;
 7419|     94|        case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (7419:9): [True: 94, False: 348k]
  ------------------
 7420|     94|        {
 7421|     94|            uint64_t *data;
 7422|     94|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7422:13): [True: 0, False: 94]
  |  Branch (7422:13): [True: 94, False: 0]
  ------------------
 7423|     94|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7423:13): [True: 0, False: 94]
  |  Branch (7423:13): [True: 94, False: 0]
  ------------------
 7424|     94|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7424:17): [True: 69, False: 25]
  ------------------
 7425|     69|                err = TIFFReadDirEntryErrCount;
 7426|     25|            else
 7427|     25|            {
 7428|     25|                err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7429|     25|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7429:21): [True: 7, False: 18]
  ------------------
 7430|      7|                {
 7431|      7|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7431:25): [True: 1, False: 6]
  ------------------
 7432|      1|                    {
 7433|      1|                        if (data != 0)
  ------------------
  |  Branch (7433:29): [True: 1, False: 0]
  ------------------
 7434|      1|                            _TIFFfreeExt(tif, data);
 7435|      1|                        return 0;
 7436|      1|                    }
 7437|      6|                    int m;
 7438|      6|                    m = TIFFSetField(tif, dp->tdir_tag,
 7439|      6|                                     (uint16_t)(dp->tdir_count), data);
 7440|      6|                    if (data != 0)
  ------------------
  |  Branch (7440:25): [True: 5, False: 1]
  ------------------
 7441|      5|                        _TIFFfreeExt(tif, data);
 7442|      6|                    if (!m)
  ------------------
  |  Branch (7442:25): [True: 0, False: 6]
  ------------------
 7443|      0|                        return (0);
 7444|      6|                }
 7445|     25|            }
 7446|     94|        }
 7447|     93|        break;
 7448|  33.7k|        case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (7448:9): [True: 33.7k, False: 315k]
  ------------------
 7449|  33.7k|        {
 7450|  33.7k|            uint8_t *data;
 7451|  33.7k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7451:13): [True: 0, False: 33.7k]
  |  Branch (7451:13): [True: 33.7k, False: 0]
  ------------------
 7452|  33.7k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7452:13): [True: 0, False: 33.7k]
  |  Branch (7452:13): [True: 33.7k, False: 0]
  ------------------
 7453|  33.7k|            err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7454|  33.7k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7454:17): [True: 26.0k, False: 7.63k]
  ------------------
 7455|  26.0k|            {
 7456|  26.0k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7456:21): [True: 11, False: 26.0k]
  ------------------
 7457|     11|                {
 7458|     11|                    if (data != 0)
  ------------------
  |  Branch (7458:25): [True: 11, False: 0]
  ------------------
 7459|     11|                        _TIFFfreeExt(tif, data);
 7460|     11|                    return 0;
 7461|     11|                }
 7462|  26.0k|                int m;
 7463|  26.0k|                if (data != 0 && dp->tdir_count > 0 &&
  ------------------
  |  Branch (7463:21): [True: 25.9k, False: 69]
  |  Branch (7463:34): [True: 25.9k, False: 0]
  ------------------
 7464|  25.9k|                    data[dp->tdir_count - 1] != '\0')
  ------------------
  |  Branch (7464:21): [True: 18.7k, False: 7.23k]
  ------------------
 7465|  18.7k|                {
 7466|  18.7k|                    TIFFWarningExtR(
 7467|  18.7k|                        tif, module,
 7468|  18.7k|                        "ASCII value for ASCII array tag \"%s\" does not end "
 7469|  18.7k|                        "in null byte. Forcing it to be null",
 7470|  18.7k|                        fip->field_name);
 7471|       |                    /* Enlarge buffer and add terminating null. */
 7472|  18.7k|                    uint8_t *o = (uint8_t *)_TIFFmallocExt(
 7473|  18.7k|                        tif, (uint32_t)dp->tdir_count + 1);
 7474|  18.7k|                    if (o == NULL)
  ------------------
  |  Branch (7474:25): [True: 784, False: 17.9k]
  ------------------
 7475|    784|                    {
 7476|    784|                        if (data != NULL)
  ------------------
  |  Branch (7476:29): [True: 784, False: 0]
  ------------------
 7477|    784|                            _TIFFfreeExt(tif, data);
 7478|    784|                        return (0);
 7479|    784|                    }
 7480|  17.9k|                    if (dp->tdir_count > 0)
  ------------------
  |  Branch (7480:25): [True: 17.9k, False: 0]
  ------------------
 7481|  17.9k|                    {
 7482|  17.9k|                        _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 7483|  17.9k|                    }
 7484|  17.9k|                    o[(uint32_t)dp->tdir_count] = 0;
 7485|  17.9k|                    dp->tdir_count++; /* Increment for added null. */
 7486|  17.9k|                    if (data != 0)
  ------------------
  |  Branch (7486:25): [True: 17.9k, False: 0]
  ------------------
 7487|  17.9k|                        _TIFFfreeExt(tif, data);
 7488|  17.9k|                    data = o;
 7489|  17.9k|                }
 7490|  25.2k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7491|  25.2k|                                 data);
 7492|  25.2k|                if (data != 0)
  ------------------
  |  Branch (7492:21): [True: 25.2k, False: 69]
  ------------------
 7493|  25.2k|                    _TIFFfreeExt(tif, data);
 7494|  25.2k|                if (!m)
  ------------------
  |  Branch (7494:21): [True: 405, False: 24.8k]
  ------------------
 7495|    405|                    return (0);
 7496|  25.2k|            }
 7497|  33.7k|        }
 7498|  32.5k|        break;
 7499|  32.5k|        case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (7499:9): [True: 7.61k, False: 341k]
  ------------------
 7500|  7.61k|        {
 7501|  7.61k|            uint8_t *data;
 7502|  7.61k|            uint32_t count = 0;
 7503|  7.61k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7503:13): [True: 0, False: 7.61k]
  |  Branch (7503:13): [True: 7.61k, False: 0]
  ------------------
 7504|  7.61k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7504:13): [True: 0, False: 7.61k]
  |  Branch (7504:13): [True: 7.61k, False: 0]
  ------------------
 7505|  7.61k|            if (fip->field_tag == TIFFTAG_RICHTIFFIPTC &&
  ------------------
  |  |  448|  15.2k|#define TIFFTAG_RICHTIFFIPTC 33723
  ------------------
  |  Branch (7505:17): [True: 21, False: 7.59k]
  ------------------
 7506|     21|                dp->tdir_type == TIFF_LONG)
  ------------------
  |  Branch (7506:17): [True: 5, False: 16]
  ------------------
 7507|      5|            {
 7508|       |                /* Adobe's software (wrongly) writes RichTIFFIPTC tag with
 7509|       |                 * data type LONG instead of UNDEFINED. Work around this
 7510|       |                 * frequently found issue */
 7511|      5|                void *origdata;
 7512|      5|                err = TIFFReadDirEntryArray(tif, dp, &count, 4, &origdata);
 7513|      5|                if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (7513:21): [True: 2, False: 3]
  |  Branch (7513:55): [True: 1, False: 2]
  ------------------
 7514|      3|                {
 7515|      3|                    data = NULL;
 7516|      3|                }
 7517|      2|                else
 7518|      2|                {
 7519|      2|                    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|      2|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (7519:25): [True: 1, False: 1]
  ------------------
 7520|      1|                        TIFFSwabArrayOfLong((uint32_t *)origdata, count);
 7521|      2|                    data = (uint8_t *)origdata;
 7522|      2|                    count = (uint32_t)(count * 4);
 7523|      2|                }
 7524|      5|            }
 7525|  7.61k|            else
 7526|  7.61k|            {
 7527|  7.61k|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7528|  7.61k|                count = (uint32_t)(dp->tdir_count);
 7529|  7.61k|            }
 7530|  7.61k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7530:17): [True: 4.37k, False: 3.23k]
  ------------------
 7531|  4.37k|            {
 7532|  4.37k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7532:21): [True: 12, False: 4.36k]
  ------------------
 7533|     12|                {
 7534|     12|                    if (data != 0)
  ------------------
  |  Branch (7534:25): [True: 12, False: 0]
  ------------------
 7535|     12|                        _TIFFfreeExt(tif, data);
 7536|     12|                    return 0;
 7537|     12|                }
 7538|  4.36k|                int m;
 7539|  4.36k|                m = TIFFSetField(tif, dp->tdir_tag, count, data);
 7540|  4.36k|                if (data != 0)
  ------------------
  |  Branch (7540:21): [True: 2.69k, False: 1.67k]
  ------------------
 7541|  2.69k|                    _TIFFfreeExt(tif, data);
 7542|  4.36k|                if (!m)
  ------------------
  |  Branch (7542:21): [True: 53, False: 4.31k]
  ------------------
 7543|     53|                    return (0);
 7544|  4.36k|            }
 7545|  7.61k|        }
 7546|  7.55k|        break;
 7547|  7.55k|        case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (7547:9): [True: 1.39k, False: 347k]
  ------------------
 7548|  1.39k|        {
 7549|  1.39k|            int8_t *data = NULL;
 7550|  1.39k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7550:13): [True: 0, False: 1.39k]
  |  Branch (7550:13): [True: 1.39k, False: 0]
  ------------------
 7551|  1.39k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7551:13): [True: 0, False: 1.39k]
  |  Branch (7551:13): [True: 1.39k, False: 0]
  ------------------
 7552|  1.39k|            err = TIFFReadDirEntrySbyteArray(tif, dp, &data);
 7553|  1.39k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7553:17): [True: 261, False: 1.13k]
  ------------------
 7554|    261|            {
 7555|    261|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7555:21): [True: 10, False: 251]
  ------------------
 7556|     10|                {
 7557|     10|                    if (data != 0)
  ------------------
  |  Branch (7557:25): [True: 10, False: 0]
  ------------------
 7558|     10|                        _TIFFfreeExt(tif, data);
 7559|     10|                    return 0;
 7560|     10|                }
 7561|    251|                int m;
 7562|    251|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7563|    251|                                 data);
 7564|    251|                if (data != 0)
  ------------------
  |  Branch (7564:21): [True: 226, False: 25]
  ------------------
 7565|    226|                    _TIFFfreeExt(tif, data);
 7566|    251|                if (!m)
  ------------------
  |  Branch (7566:21): [True: 37, False: 214]
  ------------------
 7567|     37|                    return (0);
 7568|    251|            }
 7569|  1.39k|        }
 7570|  1.34k|        break;
 7571|  24.9k|        case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (7571:9): [True: 24.9k, False: 324k]
  ------------------
 7572|  24.9k|        {
 7573|  24.9k|            uint16_t *data;
 7574|  24.9k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7574:13): [True: 0, False: 24.9k]
  |  Branch (7574:13): [True: 24.9k, False: 0]
  ------------------
 7575|  24.9k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7575:13): [True: 0, False: 24.9k]
  |  Branch (7575:13): [True: 24.9k, False: 0]
  ------------------
 7576|  24.9k|            err = TIFFReadDirEntryShortArray(tif, dp, &data);
 7577|  24.9k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7577:17): [True: 7.41k, False: 17.4k]
  ------------------
 7578|  7.41k|            {
 7579|  7.41k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7579:21): [True: 10, False: 7.40k]
  ------------------
 7580|     10|                {
 7581|     10|                    if (data != 0)
  ------------------
  |  Branch (7581:25): [True: 10, False: 0]
  ------------------
 7582|     10|                        _TIFFfreeExt(tif, data);
 7583|     10|                    return 0;
 7584|     10|                }
 7585|  7.40k|                int m;
 7586|  7.40k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7587|  7.40k|                                 data);
 7588|  7.40k|                if (data != 0)
  ------------------
  |  Branch (7588:21): [True: 7.27k, False: 125]
  ------------------
 7589|  7.27k|                    _TIFFfreeExt(tif, data);
 7590|  7.40k|                if (!m)
  ------------------
  |  Branch (7590:21): [True: 1.33k, False: 6.06k]
  ------------------
 7591|  1.33k|                    return (0);
 7592|  7.40k|            }
 7593|  24.9k|        }
 7594|  23.5k|        break;
 7595|  23.5k|        case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (7595:9): [True: 646, False: 348k]
  ------------------
 7596|    646|        {
 7597|    646|            int16_t *data = NULL;
 7598|    646|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7598:13): [True: 0, False: 646]
  |  Branch (7598:13): [True: 646, False: 0]
  ------------------
 7599|    646|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7599:13): [True: 0, False: 646]
  |  Branch (7599:13): [True: 646, False: 0]
  ------------------
 7600|    646|            err = TIFFReadDirEntrySshortArray(tif, dp, &data);
 7601|    646|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7601:17): [True: 176, False: 470]
  ------------------
 7602|    176|            {
 7603|    176|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7603:21): [True: 10, False: 166]
  ------------------
 7604|     10|                {
 7605|     10|                    if (data != 0)
  ------------------
  |  Branch (7605:25): [True: 10, False: 0]
  ------------------
 7606|     10|                        _TIFFfreeExt(tif, data);
 7607|     10|                    return 0;
 7608|     10|                }
 7609|    166|                int m;
 7610|    166|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7611|    166|                                 data);
 7612|    166|                if (data != 0)
  ------------------
  |  Branch (7612:21): [True: 108, False: 58]
  ------------------
 7613|    108|                    _TIFFfreeExt(tif, data);
 7614|    166|                if (!m)
  ------------------
  |  Branch (7614:21): [True: 1, False: 165]
  ------------------
 7615|      1|                    return (0);
 7616|    166|            }
 7617|    646|        }
 7618|    635|        break;
 7619|  8.34k|        case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (7619:9): [True: 8.34k, False: 340k]
  ------------------
 7620|  8.34k|        {
 7621|  8.34k|            uint32_t *data;
 7622|  8.34k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7622:13): [True: 0, False: 8.34k]
  |  Branch (7622:13): [True: 8.34k, False: 0]
  ------------------
 7623|  8.34k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7623:13): [True: 0, False: 8.34k]
  |  Branch (7623:13): [True: 8.34k, False: 0]
  ------------------
 7624|  8.34k|            err = TIFFReadDirEntryLongArray(tif, dp, &data);
 7625|  8.34k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7625:17): [True: 486, False: 7.86k]
  ------------------
 7626|    486|            {
 7627|    486|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7627:21): [True: 10, False: 476]
  ------------------
 7628|     10|                {
 7629|     10|                    if (data != 0)
  ------------------
  |  Branch (7629:25): [True: 10, False: 0]
  ------------------
 7630|     10|                        _TIFFfreeExt(tif, data);
 7631|     10|                    return 0;
 7632|     10|                }
 7633|    476|                int m;
 7634|    476|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7635|    476|                                 data);
 7636|    476|                if (data != 0)
  ------------------
  |  Branch (7636:21): [True: 366, False: 110]
  ------------------
 7637|    366|                    _TIFFfreeExt(tif, data);
 7638|    476|                if (!m)
  ------------------
  |  Branch (7638:21): [True: 1, False: 475]
  ------------------
 7639|      1|                    return (0);
 7640|    476|            }
 7641|  8.34k|        }
 7642|  8.33k|        break;
 7643|  8.33k|        case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (7643:9): [True: 430, False: 348k]
  ------------------
 7644|    430|        {
 7645|    430|            int32_t *data = NULL;
 7646|    430|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7646:13): [True: 0, False: 430]
  |  Branch (7646:13): [True: 430, False: 0]
  ------------------
 7647|    430|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7647:13): [True: 0, False: 430]
  |  Branch (7647:13): [True: 430, False: 0]
  ------------------
 7648|    430|            err = TIFFReadDirEntrySlongArray(tif, dp, &data);
 7649|    430|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7649:17): [True: 127, False: 303]
  ------------------
 7650|    127|            {
 7651|    127|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7651:21): [True: 10, False: 117]
  ------------------
 7652|     10|                {
 7653|     10|                    if (data != 0)
  ------------------
  |  Branch (7653:25): [True: 10, False: 0]
  ------------------
 7654|     10|                        _TIFFfreeExt(tif, data);
 7655|     10|                    return 0;
 7656|     10|                }
 7657|    117|                int m;
 7658|    117|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7659|    117|                                 data);
 7660|    117|                if (data != 0)
  ------------------
  |  Branch (7660:21): [True: 50, False: 67]
  ------------------
 7661|     50|                    _TIFFfreeExt(tif, data);
 7662|    117|                if (!m)
  ------------------
  |  Branch (7662:21): [True: 1, False: 116]
  ------------------
 7663|      1|                    return (0);
 7664|    117|            }
 7665|    430|        }
 7666|    419|        break;
 7667|  4.16k|        case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (7667:9): [True: 4.16k, False: 344k]
  ------------------
 7668|  4.16k|        {
 7669|  4.16k|            uint64_t *data;
 7670|  4.16k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7670:13): [True: 0, False: 4.16k]
  |  Branch (7670:13): [True: 4.16k, False: 0]
  ------------------
 7671|  4.16k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7671:13): [True: 0, False: 4.16k]
  |  Branch (7671:13): [True: 4.16k, False: 0]
  ------------------
 7672|  4.16k|            err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 7673|  4.16k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7673:17): [True: 3.70k, False: 461]
  ------------------
 7674|  3.70k|            {
 7675|  3.70k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7675:21): [True: 10, False: 3.69k]
  ------------------
 7676|     10|                {
 7677|     10|                    if (data != 0)
  ------------------
  |  Branch (7677:25): [True: 10, False: 0]
  ------------------
 7678|     10|                        _TIFFfreeExt(tif, data);
 7679|     10|                    return 0;
 7680|     10|                }
 7681|  3.69k|                int m;
 7682|  3.69k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7683|  3.69k|                                 data);
 7684|  3.69k|                if (data != 0)
  ------------------
  |  Branch (7684:21): [True: 3.64k, False: 48]
  ------------------
 7685|  3.64k|                    _TIFFfreeExt(tif, data);
 7686|  3.69k|                if (!m)
  ------------------
  |  Branch (7686:21): [True: 168, False: 3.52k]
  ------------------
 7687|    168|                    return (0);
 7688|  3.69k|            }
 7689|  4.16k|        }
 7690|  3.98k|        break;
 7691|  3.98k|        case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (7691:9): [True: 558, False: 348k]
  ------------------
 7692|    558|        {
 7693|    558|            int64_t *data = NULL;
 7694|    558|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7694:13): [True: 0, False: 558]
  |  Branch (7694:13): [True: 558, False: 0]
  ------------------
 7695|    558|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7695:13): [True: 0, False: 558]
  |  Branch (7695:13): [True: 558, False: 0]
  ------------------
 7696|    558|            err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 7697|    558|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7697:17): [True: 409, False: 149]
  ------------------
 7698|    409|            {
 7699|    409|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7699:21): [True: 10, False: 399]
  ------------------
 7700|     10|                {
 7701|     10|                    if (data != 0)
  ------------------
  |  Branch (7701:25): [True: 10, False: 0]
  ------------------
 7702|     10|                        _TIFFfreeExt(tif, data);
 7703|     10|                    return 0;
 7704|     10|                }
 7705|    399|                int m;
 7706|    399|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7707|    399|                                 data);
 7708|    399|                if (data != 0)
  ------------------
  |  Branch (7708:21): [True: 306, False: 93]
  ------------------
 7709|    306|                    _TIFFfreeExt(tif, data);
 7710|    399|                if (!m)
  ------------------
  |  Branch (7710:21): [True: 245, False: 154]
  ------------------
 7711|    245|                    return (0);
 7712|    399|            }
 7713|    558|        }
 7714|    303|        break;
 7715|  7.47k|        case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (7715:9): [True: 7.47k, False: 341k]
  ------------------
 7716|  7.47k|        {
 7717|  7.47k|            float *data;
 7718|  7.47k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7718:13): [True: 0, False: 7.47k]
  |  Branch (7718:13): [True: 7.47k, False: 0]
  ------------------
 7719|  7.47k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7719:13): [True: 0, False: 7.47k]
  |  Branch (7719:13): [True: 7.47k, False: 0]
  ------------------
 7720|  7.47k|            err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 7721|  7.47k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7721:17): [True: 780, False: 6.69k]
  ------------------
 7722|    780|            {
 7723|    780|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7723:21): [True: 10, False: 770]
  ------------------
 7724|     10|                {
 7725|     10|                    if (data != 0)
  ------------------
  |  Branch (7725:25): [True: 10, False: 0]
  ------------------
 7726|     10|                        _TIFFfreeExt(tif, data);
 7727|     10|                    return 0;
 7728|     10|                }
 7729|    770|                int m;
 7730|    770|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7731|    770|                                 data);
 7732|    770|                if (data != 0)
  ------------------
  |  Branch (7732:21): [True: 704, False: 66]
  ------------------
 7733|    704|                    _TIFFfreeExt(tif, data);
 7734|    770|                if (!m)
  ------------------
  |  Branch (7734:21): [True: 0, False: 770]
  ------------------
 7735|      0|                    return (0);
 7736|    770|            }
 7737|  7.47k|        }
 7738|  7.46k|        break;
 7739|  7.46k|        case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (7739:9): [True: 2.29k, False: 346k]
  ------------------
 7740|  2.29k|        {
 7741|  2.29k|            double *data;
 7742|  2.29k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7742:13): [True: 0, False: 2.29k]
  |  Branch (7742:13): [True: 2.29k, False: 0]
  ------------------
 7743|  2.29k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7743:13): [True: 0, False: 2.29k]
  |  Branch (7743:13): [True: 2.29k, False: 0]
  ------------------
 7744|  2.29k|            err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 7745|  2.29k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7745:17): [True: 1.37k, False: 922]
  ------------------
 7746|  1.37k|            {
 7747|  1.37k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7747:21): [True: 10, False: 1.36k]
  ------------------
 7748|     10|                {
 7749|     10|                    if (data != 0)
  ------------------
  |  Branch (7749:25): [True: 10, False: 0]
  ------------------
 7750|     10|                        _TIFFfreeExt(tif, data);
 7751|     10|                    return 0;
 7752|     10|                }
 7753|  1.36k|                int m;
 7754|  1.36k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7755|  1.36k|                                 data);
 7756|  1.36k|                if (data != 0)
  ------------------
  |  Branch (7756:21): [True: 1.28k, False: 84]
  ------------------
 7757|  1.28k|                    _TIFFfreeExt(tif, data);
 7758|  1.36k|                if (!m)
  ------------------
  |  Branch (7758:21): [True: 1, False: 1.36k]
  ------------------
 7759|      1|                    return (0);
 7760|  1.36k|            }
 7761|  2.29k|        }
 7762|  2.28k|        break;
 7763|  2.28k|        case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (7763:9): [True: 327, False: 348k]
  ------------------
 7764|    327|        {
 7765|    327|            uint64_t *data;
 7766|    327|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7766:13): [True: 0, False: 327]
  |  Branch (7766:13): [True: 327, False: 0]
  ------------------
 7767|    327|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7767:13): [True: 0, False: 327]
  |  Branch (7767:13): [True: 327, False: 0]
  ------------------
 7768|    327|            err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7769|    327|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7769:17): [True: 190, False: 137]
  ------------------
 7770|    190|            {
 7771|    190|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7771:21): [True: 10, False: 180]
  ------------------
 7772|     10|                {
 7773|     10|                    if (data != 0)
  ------------------
  |  Branch (7773:25): [True: 10, False: 0]
  ------------------
 7774|     10|                        _TIFFfreeExt(tif, data);
 7775|     10|                    return 0;
 7776|     10|                }
 7777|    180|                int m;
 7778|    180|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7779|    180|                                 data);
 7780|    180|                if (data != 0)
  ------------------
  |  Branch (7780:21): [True: 136, False: 44]
  ------------------
 7781|    136|                    _TIFFfreeExt(tif, data);
 7782|    180|                if (!m)
  ------------------
  |  Branch (7782:21): [True: 46, False: 134]
  ------------------
 7783|     46|                    return (0);
 7784|    180|            }
 7785|    327|        }
 7786|    271|        break;
 7787|    271|        case TIFF_SETGET_INT:
  ------------------
  |  Branch (7787:9): [True: 0, False: 348k]
  ------------------
 7788|      0|        case TIFF_SETGET_C0_ASCII:
  ------------------
  |  Branch (7788:9): [True: 0, False: 348k]
  ------------------
 7789|      0|        case TIFF_SETGET_OTHER:
  ------------------
  |  Branch (7789:9): [True: 0, False: 348k]
  ------------------
 7790|      0|            assert(0); /* these should not arrive here */
  ------------------
  |  Branch (7790:13): [Folded, False: 0]
  |  Branch (7790:13): [Folded, False: 0]
  ------------------
 7791|      0|            break;
 7792|      0|        default:
  ------------------
  |  Branch (7792:9): [True: 0, False: 348k]
  ------------------
 7793|      0|            assert(0); /* we should never get here */
  ------------------
  |  Branch (7793:13): [Folded, False: 0]
  |  Branch (7793:13): [Folded, False: 0]
  ------------------
 7794|      0|            break;
 7795|   348k|    }
 7796|   344k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7796:9): [True: 56.9k, False: 287k]
  ------------------
 7797|  56.9k|    {
 7798|  56.9k|        TIFFReadDirEntryOutputErr(tif, err, module, fip->field_name, recover);
 7799|  56.9k|        return (0);
 7800|  56.9k|    }
 7801|   287k|    return (1);
 7802|   344k|}
tif_dirread.c:TIFFReadDirEntryByteArray:
 1397|  44.0k|{
 1398|  44.0k|    enum TIFFReadDirEntryErr err;
 1399|  44.0k|    uint32_t count;
 1400|  44.0k|    void *origdata;
 1401|  44.0k|    uint8_t *data;
 1402|  44.0k|    switch (direntry->tdir_type)
 1403|  44.0k|    {
 1404|  34.4k|        case TIFF_ASCII:
  ------------------
  |  Branch (1404:9): [True: 34.4k, False: 9.54k]
  ------------------
 1405|  35.6k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1405:9): [True: 1.19k, False: 42.8k]
  ------------------
 1406|  41.9k|        case TIFF_BYTE:
  ------------------
  |  Branch (1406:9): [True: 6.32k, False: 37.6k]
  ------------------
 1407|  42.0k|        case TIFF_SBYTE:
  ------------------
  |  Branch (1407:9): [True: 76, False: 43.9k]
  ------------------
 1408|  42.2k|        case TIFF_SHORT:
  ------------------
  |  Branch (1408:9): [True: 226, False: 43.7k]
  ------------------
 1409|  42.3k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1409:9): [True: 100, False: 43.9k]
  ------------------
 1410|  42.4k|        case TIFF_LONG:
  ------------------
  |  Branch (1410:9): [True: 95, False: 43.9k]
  ------------------
 1411|  42.6k|        case TIFF_SLONG:
  ------------------
  |  Branch (1411:9): [True: 130, False: 43.8k]
  ------------------
 1412|  42.7k|        case TIFF_LONG8:
  ------------------
  |  Branch (1412:9): [True: 142, False: 43.8k]
  ------------------
 1413|  42.9k|        case TIFF_SLONG8:
  ------------------
  |  Branch (1413:9): [True: 204, False: 43.8k]
  ------------------
 1414|  42.9k|            break;
 1415|  1.05k|        default:
  ------------------
  |  Branch (1415:9): [True: 1.05k, False: 42.9k]
  ------------------
 1416|  1.05k|            return (TIFFReadDirEntryErrType);
 1417|  44.0k|    }
 1418|  42.9k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 1, &origdata);
 1419|  42.9k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1419:9): [True: 11.0k, False: 31.8k]
  |  Branch (1419:43): [True: 1.76k, False: 30.1k]
  ------------------
 1420|  12.8k|    {
 1421|  12.8k|        *value = 0;
 1422|  12.8k|        return (err);
 1423|  12.8k|    }
 1424|  30.1k|    switch (direntry->tdir_type)
 1425|  30.1k|    {
 1426|  26.4k|        case TIFF_ASCII:
  ------------------
  |  Branch (1426:9): [True: 26.4k, False: 3.61k]
  ------------------
 1427|  27.2k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1427:9): [True: 791, False: 29.3k]
  ------------------
 1428|  29.2k|        case TIFF_BYTE:
  ------------------
  |  Branch (1428:9): [True: 2.00k, False: 28.1k]
  ------------------
 1429|  29.2k|            *value = (uint8_t *)origdata;
 1430|  29.2k|            return (TIFFReadDirEntryErrOk);
 1431|     57|        case TIFF_SBYTE:
  ------------------
  |  Branch (1431:9): [True: 57, False: 30.0k]
  ------------------
 1432|     57|        {
 1433|     57|            int8_t *m;
 1434|     57|            uint32_t n;
 1435|     57|            m = (int8_t *)origdata;
 1436|    797|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1436:25): [True: 756, False: 41]
  ------------------
 1437|    756|            {
 1438|    756|                err = TIFFReadDirEntryCheckRangeByteSbyte(*m);
 1439|    756|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1439:21): [True: 16, False: 740]
  ------------------
 1440|     16|                {
 1441|     16|                    _TIFFfreeExt(tif, origdata);
 1442|     16|                    return (err);
 1443|     16|                }
 1444|    740|                m++;
 1445|    740|            }
 1446|     41|            *value = (uint8_t *)origdata;
 1447|     41|            return (TIFFReadDirEntryErrOk);
 1448|     57|        }
 1449|    768|        default:
  ------------------
  |  Branch (1449:9): [True: 768, False: 29.3k]
  ------------------
 1450|    768|            break;
 1451|  30.1k|    }
 1452|    768|    data = (uint8_t *)_TIFFmallocExt(tif, count);
 1453|    768|    if (data == 0)
  ------------------
  |  Branch (1453:9): [True: 1, False: 767]
  ------------------
 1454|      1|    {
 1455|      1|        _TIFFfreeExt(tif, origdata);
 1456|      1|        return (TIFFReadDirEntryErrAlloc);
 1457|      1|    }
 1458|    767|    switch (direntry->tdir_type)
 1459|    767|    {
 1460|    181|        case TIFF_SHORT:
  ------------------
  |  Branch (1460:9): [True: 181, False: 586]
  ------------------
 1461|    181|        {
 1462|    181|            uint16_t *ma;
 1463|    181|            uint8_t *mb;
 1464|    181|            uint32_t n;
 1465|    181|            ma = (uint16_t *)origdata;
 1466|    181|            mb = data;
 1467|    767|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1467:25): [True: 640, False: 127]
  ------------------
 1468|    640|            {
 1469|    640|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    640|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1469:21): [True: 223, False: 417]
  ------------------
 1470|    223|                    TIFFSwabShort(ma);
 1471|    640|                err = TIFFReadDirEntryCheckRangeByteShort(*ma);
 1472|    640|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1472:21): [True: 54, False: 586]
  ------------------
 1473|     54|                    break;
 1474|    586|                *mb++ = (uint8_t)(*ma++);
 1475|    586|            }
 1476|    181|        }
 1477|    181|        break;
 1478|     69|        case TIFF_SSHORT:
  ------------------
  |  Branch (1478:9): [True: 69, False: 698]
  ------------------
 1479|     69|        {
 1480|     69|            int16_t *ma;
 1481|     69|            uint8_t *mb;
 1482|     69|            uint32_t n;
 1483|     69|            ma = (int16_t *)origdata;
 1484|     69|            mb = data;
 1485|    710|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1485:25): [True: 674, False: 36]
  ------------------
 1486|    674|            {
 1487|    674|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    674|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1487:21): [True: 241, False: 433]
  ------------------
 1488|    241|                    TIFFSwabShort((uint16_t *)ma);
 1489|    674|                err = TIFFReadDirEntryCheckRangeByteSshort(*ma);
 1490|    674|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1490:21): [True: 33, False: 641]
  ------------------
 1491|     33|                    break;
 1492|    641|                *mb++ = (uint8_t)(*ma++);
 1493|    641|            }
 1494|     69|        }
 1495|     69|        break;
 1496|     88|        case TIFF_LONG:
  ------------------
  |  Branch (1496:9): [True: 88, False: 679]
  ------------------
 1497|     88|        {
 1498|     88|            uint32_t *ma;
 1499|     88|            uint8_t *mb;
 1500|     88|            uint32_t n;
 1501|     88|            ma = (uint32_t *)origdata;
 1502|     88|            mb = data;
 1503|    561|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1503:25): [True: 542, False: 19]
  ------------------
 1504|    542|            {
 1505|    542|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    542|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1505:21): [True: 238, False: 304]
  ------------------
 1506|    238|                    TIFFSwabLong(ma);
 1507|    542|                err = TIFFReadDirEntryCheckRangeByteLong(*ma);
 1508|    542|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1508:21): [True: 69, False: 473]
  ------------------
 1509|     69|                    break;
 1510|    473|                *mb++ = (uint8_t)(*ma++);
 1511|    473|            }
 1512|     88|        }
 1513|     88|        break;
 1514|    114|        case TIFF_SLONG:
  ------------------
  |  Branch (1514:9): [True: 114, False: 653]
  ------------------
 1515|    114|        {
 1516|    114|            int32_t *ma;
 1517|    114|            uint8_t *mb;
 1518|    114|            uint32_t n;
 1519|    114|            ma = (int32_t *)origdata;
 1520|    114|            mb = data;
 1521|    568|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1521:25): [True: 549, False: 19]
  ------------------
 1522|    549|            {
 1523|    549|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    549|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1523:21): [True: 240, False: 309]
  ------------------
 1524|    240|                    TIFFSwabLong((uint32_t *)ma);
 1525|    549|                err = TIFFReadDirEntryCheckRangeByteSlong(*ma);
 1526|    549|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1526:21): [True: 95, False: 454]
  ------------------
 1527|     95|                    break;
 1528|    454|                *mb++ = (uint8_t)(*ma++);
 1529|    454|            }
 1530|    114|        }
 1531|    114|        break;
 1532|    128|        case TIFF_LONG8:
  ------------------
  |  Branch (1532:9): [True: 128, False: 639]
  ------------------
 1533|    128|        {
 1534|    128|            uint64_t *ma;
 1535|    128|            uint8_t *mb;
 1536|    128|            uint32_t n;
 1537|    128|            ma = (uint64_t *)origdata;
 1538|    128|            mb = data;
 1539|    668|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1539:25): [True: 651, False: 17]
  ------------------
 1540|    651|            {
 1541|    651|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    651|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1541:21): [True: 248, False: 403]
  ------------------
 1542|    248|                    TIFFSwabLong8(ma);
 1543|    651|                err = TIFFReadDirEntryCheckRangeByteLong8(*ma);
 1544|    651|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1544:21): [True: 111, False: 540]
  ------------------
 1545|    111|                    break;
 1546|    540|                *mb++ = (uint8_t)(*ma++);
 1547|    540|            }
 1548|    128|        }
 1549|    128|        break;
 1550|    187|        case TIFF_SLONG8:
  ------------------
  |  Branch (1550:9): [True: 187, False: 580]
  ------------------
 1551|    187|        {
 1552|    187|            int64_t *ma;
 1553|    187|            uint8_t *mb;
 1554|    187|            uint32_t n;
 1555|    187|            ma = (int64_t *)origdata;
 1556|    187|            mb = data;
 1557|    624|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1557:25): [True: 608, False: 16]
  ------------------
 1558|    608|            {
 1559|    608|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    608|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1559:21): [True: 206, False: 402]
  ------------------
 1560|    206|                    TIFFSwabLong8((uint64_t *)ma);
 1561|    608|                err = TIFFReadDirEntryCheckRangeByteSlong8(*ma);
 1562|    608|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1562:21): [True: 171, False: 437]
  ------------------
 1563|    171|                    break;
 1564|    437|                *mb++ = (uint8_t)(*ma++);
 1565|    437|            }
 1566|    187|        }
 1567|    187|        break;
 1568|      0|        default:
  ------------------
  |  Branch (1568:9): [True: 0, False: 767]
  ------------------
 1569|      0|            break;
 1570|    767|    }
 1571|    767|    _TIFFfreeExt(tif, origdata);
 1572|    767|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1572:9): [True: 533, False: 234]
  ------------------
 1573|    533|    {
 1574|    533|        _TIFFfreeExt(tif, data);
 1575|    533|        return (err);
 1576|    533|    }
 1577|    234|    *value = data;
 1578|    234|    return (TIFFReadDirEntryErrOk);
 1579|    767|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSbyte:
 3646|    769|{
 3647|    769|    if (value < 0)
  ------------------
  |  Branch (3647:9): [True: 23, False: 746]
  ------------------
 3648|     23|        return (TIFFReadDirEntryErrRange);
 3649|    746|    else
 3650|    746|        return (TIFFReadDirEntryErrOk);
 3651|    769|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteShort:
 3655|    669|{
 3656|    669|    if (value > 0xFF)
  ------------------
  |  Branch (3656:9): [True: 70, False: 599]
  ------------------
 3657|     70|        return (TIFFReadDirEntryErrRange);
 3658|    599|    else
 3659|    599|        return (TIFFReadDirEntryErrOk);
 3660|    669|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSshort:
 3664|    702|{
 3665|    702|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3665:9): [True: 16, False: 686]
  |  Branch (3665:24): [True: 35, False: 651]
  ------------------
 3666|     51|        return (TIFFReadDirEntryErrRange);
 3667|    651|    else
 3668|    651|        return (TIFFReadDirEntryErrOk);
 3669|    702|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteLong:
 3673|    578|{
 3674|    578|    if (value > 0xFF)
  ------------------
  |  Branch (3674:9): [True: 101, False: 477]
  ------------------
 3675|    101|        return (TIFFReadDirEntryErrRange);
 3676|    477|    else
 3677|    477|        return (TIFFReadDirEntryErrOk);
 3678|    578|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSlong:
 3682|    600|{
 3683|    600|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3683:9): [True: 57, False: 543]
  |  Branch (3683:24): [True: 80, False: 463]
  ------------------
 3684|    137|        return (TIFFReadDirEntryErrRange);
 3685|    463|    else
 3686|    463|        return (TIFFReadDirEntryErrOk);
 3687|    600|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteLong8:
 3691|    730|{
 3692|    730|    if (value > 0xFF)
  ------------------
  |  Branch (3692:9): [True: 187, False: 543]
  ------------------
 3693|    187|        return (TIFFReadDirEntryErrRange);
 3694|    543|    else
 3695|    543|        return (TIFFReadDirEntryErrOk);
 3696|    730|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSlong8:
 3700|    717|{
 3701|    717|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3701:9): [True: 149, False: 568]
  |  Branch (3701:24): [True: 121, False: 447]
  ------------------
 3702|    270|        return (TIFFReadDirEntryErrRange);
 3703|    447|    else
 3704|    447|        return (TIFFReadDirEntryErrOk);
 3705|    717|}
tif_dirread.c:TIFFReadDirEntryByte:
  300|    499|{
  301|    499|    enum TIFFReadDirEntryErr err;
  302|    499|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (302:9): [True: 135, False: 364]
  ------------------
  303|    135|        return (TIFFReadDirEntryErrCount);
  304|    364|    switch (direntry->tdir_type)
  305|    364|    {
  306|      5|        case TIFF_BYTE:
  ------------------
  |  Branch (306:9): [True: 5, False: 359]
  ------------------
  307|      8|        case TIFF_UNDEFINED: /* Support to read TIFF_UNDEFINED with
  ------------------
  |  Branch (307:9): [True: 3, False: 361]
  ------------------
  308|       |                                field_readcount==1 */
  309|      8|            TIFFReadDirEntryCheckedByte(tif, direntry, value);
  310|      8|            return (TIFFReadDirEntryErrOk);
  311|     13|        case TIFF_SBYTE:
  ------------------
  |  Branch (311:9): [True: 13, False: 351]
  ------------------
  312|     13|        {
  313|     13|            int8_t m;
  314|     13|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  315|     13|            err = TIFFReadDirEntryCheckRangeByteSbyte(m);
  316|     13|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (316:17): [True: 7, False: 6]
  ------------------
  317|      7|                return (err);
  318|      6|            *value = (uint8_t)m;
  319|      6|            return (TIFFReadDirEntryErrOk);
  320|     13|        }
  321|     29|        case TIFF_SHORT:
  ------------------
  |  Branch (321:9): [True: 29, False: 335]
  ------------------
  322|     29|        {
  323|     29|            uint16_t m;
  324|     29|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  325|     29|            err = TIFFReadDirEntryCheckRangeByteShort(m);
  326|     29|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (326:17): [True: 16, False: 13]
  ------------------
  327|     16|                return (err);
  328|     13|            *value = (uint8_t)m;
  329|     13|            return (TIFFReadDirEntryErrOk);
  330|     29|        }
  331|     28|        case TIFF_SSHORT:
  ------------------
  |  Branch (331:9): [True: 28, False: 336]
  ------------------
  332|     28|        {
  333|     28|            int16_t m;
  334|     28|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  335|     28|            err = TIFFReadDirEntryCheckRangeByteSshort(m);
  336|     28|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (336:17): [True: 18, False: 10]
  ------------------
  337|     18|                return (err);
  338|     10|            *value = (uint8_t)m;
  339|     10|            return (TIFFReadDirEntryErrOk);
  340|     28|        }
  341|     36|        case TIFF_LONG:
  ------------------
  |  Branch (341:9): [True: 36, False: 328]
  ------------------
  342|     36|        {
  343|     36|            uint32_t m;
  344|     36|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  345|     36|            err = TIFFReadDirEntryCheckRangeByteLong(m);
  346|     36|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (346:17): [True: 32, False: 4]
  ------------------
  347|     32|                return (err);
  348|      4|            *value = (uint8_t)m;
  349|      4|            return (TIFFReadDirEntryErrOk);
  350|     36|        }
  351|     51|        case TIFF_SLONG:
  ------------------
  |  Branch (351:9): [True: 51, False: 313]
  ------------------
  352|     51|        {
  353|     51|            int32_t m;
  354|     51|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  355|     51|            err = TIFFReadDirEntryCheckRangeByteSlong(m);
  356|     51|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (356:17): [True: 42, False: 9]
  ------------------
  357|     42|                return (err);
  358|      9|            *value = (uint8_t)m;
  359|      9|            return (TIFFReadDirEntryErrOk);
  360|     51|        }
  361|     83|        case TIFF_LONG8:
  ------------------
  |  Branch (361:9): [True: 83, False: 281]
  ------------------
  362|     83|        {
  363|     83|            uint64_t m;
  364|     83|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  365|     83|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (365:17): [True: 4, False: 79]
  ------------------
  366|      4|                return (err);
  367|     79|            err = TIFFReadDirEntryCheckRangeByteLong8(m);
  368|     79|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (368:17): [True: 76, False: 3]
  ------------------
  369|     76|                return (err);
  370|      3|            *value = (uint8_t)m;
  371|      3|            return (TIFFReadDirEntryErrOk);
  372|     79|        }
  373|    112|        case TIFF_SLONG8:
  ------------------
  |  Branch (373:9): [True: 112, False: 252]
  ------------------
  374|    112|        {
  375|    112|            int64_t m;
  376|    112|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  377|    112|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (377:17): [True: 3, False: 109]
  ------------------
  378|      3|                return (err);
  379|    109|            err = TIFFReadDirEntryCheckRangeByteSlong8(m);
  380|    109|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (380:17): [True: 99, False: 10]
  ------------------
  381|     99|                return (err);
  382|     10|            *value = (uint8_t)m;
  383|     10|            return (TIFFReadDirEntryErrOk);
  384|    109|        }
  385|      4|        default:
  ------------------
  |  Branch (385:9): [True: 4, False: 360]
  ------------------
  386|      4|            return (TIFFReadDirEntryErrType);
  387|    364|    }
  388|    364|}
tif_dirread.c:TIFFReadDirEntryLong:
  657|  70.8k|{
  658|  70.8k|    enum TIFFReadDirEntryErr err;
  659|  70.8k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (659:9): [True: 626, False: 70.1k]
  ------------------
  660|    626|        return (TIFFReadDirEntryErrCount);
  661|  70.1k|    switch (direntry->tdir_type)
  662|  70.1k|    {
  663|  16.5k|        case TIFF_BYTE:
  ------------------
  |  Branch (663:9): [True: 16.5k, False: 53.6k]
  ------------------
  664|  16.5k|        {
  665|  16.5k|            uint8_t m;
  666|  16.5k|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  667|  16.5k|            *value = (uint32_t)m;
  668|  16.5k|            return (TIFFReadDirEntryErrOk);
  669|      0|        }
  670|  5.41k|        case TIFF_SBYTE:
  ------------------
  |  Branch (670:9): [True: 5.41k, False: 64.7k]
  ------------------
  671|  5.41k|        {
  672|  5.41k|            int8_t m;
  673|  5.41k|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  674|  5.41k|            err = TIFFReadDirEntryCheckRangeLongSbyte(m);
  675|  5.41k|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (675:17): [True: 7, False: 5.40k]
  ------------------
  676|      7|                return (err);
  677|  5.40k|            *value = (uint32_t)m;
  678|  5.40k|            return (TIFFReadDirEntryErrOk);
  679|  5.41k|        }
  680|  38.2k|        case TIFF_SHORT:
  ------------------
  |  Branch (680:9): [True: 38.2k, False: 31.9k]
  ------------------
  681|  38.2k|        {
  682|  38.2k|            uint16_t m;
  683|  38.2k|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  684|  38.2k|            *value = (uint32_t)m;
  685|  38.2k|            return (TIFFReadDirEntryErrOk);
  686|  5.41k|        }
  687|  1.50k|        case TIFF_SSHORT:
  ------------------
  |  Branch (687:9): [True: 1.50k, False: 68.6k]
  ------------------
  688|  1.50k|        {
  689|  1.50k|            int16_t m;
  690|  1.50k|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  691|  1.50k|            err = TIFFReadDirEntryCheckRangeLongSshort(m);
  692|  1.50k|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (692:17): [True: 13, False: 1.49k]
  ------------------
  693|     13|                return (err);
  694|  1.49k|            *value = (uint32_t)m;
  695|  1.49k|            return (TIFFReadDirEntryErrOk);
  696|  1.50k|        }
  697|  6.54k|        case TIFF_LONG:
  ------------------
  |  Branch (697:9): [True: 6.54k, False: 63.6k]
  ------------------
  698|  6.69k|        case TIFF_IFD:
  ------------------
  |  Branch (698:9): [True: 150, False: 70.0k]
  ------------------
  699|  6.69k|            TIFFReadDirEntryCheckedLong(tif, direntry, value);
  700|  6.69k|            return (TIFFReadDirEntryErrOk);
  701|  1.41k|        case TIFF_SLONG:
  ------------------
  |  Branch (701:9): [True: 1.41k, False: 68.7k]
  ------------------
  702|  1.41k|        {
  703|  1.41k|            int32_t m;
  704|  1.41k|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  705|  1.41k|            err = TIFFReadDirEntryCheckRangeLongSlong(m);
  706|  1.41k|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (706:17): [True: 36, False: 1.38k]
  ------------------
  707|     36|                return (err);
  708|  1.38k|            *value = (uint32_t)m;
  709|  1.38k|            return (TIFFReadDirEntryErrOk);
  710|  1.41k|        }
  711|    129|        case TIFF_LONG8:
  ------------------
  |  Branch (711:9): [True: 129, False: 70.0k]
  ------------------
  712|    144|        case TIFF_IFD8:
  ------------------
  |  Branch (712:9): [True: 15, False: 70.1k]
  ------------------
  713|    144|        {
  714|    144|            uint64_t m;
  715|    144|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  716|    144|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (716:17): [True: 12, False: 132]
  ------------------
  717|     12|                return (err);
  718|    132|            err = TIFFReadDirEntryCheckRangeLongLong8(m);
  719|    132|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (719:17): [True: 82, False: 50]
  ------------------
  720|     82|                return (err);
  721|     50|            *value = (uint32_t)m;
  722|     50|            return (TIFFReadDirEntryErrOk);
  723|    132|        }
  724|    216|        case TIFF_SLONG8:
  ------------------
  |  Branch (724:9): [True: 216, False: 69.9k]
  ------------------
  725|    216|        {
  726|    216|            int64_t m;
  727|    216|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  728|    216|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (728:17): [True: 12, False: 204]
  ------------------
  729|     12|                return (err);
  730|    204|            err = TIFFReadDirEntryCheckRangeLongSlong8(m);
  731|    204|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (731:17): [True: 151, False: 53]
  ------------------
  732|    151|                return (err);
  733|     53|            *value = (uint32_t)m;
  734|     53|            return (TIFFReadDirEntryErrOk);
  735|    204|        }
  736|     62|        default:
  ------------------
  |  Branch (736:9): [True: 62, False: 70.1k]
  ------------------
  737|     62|            return (TIFFReadDirEntryErrType);
  738|  70.1k|    }
  739|  70.1k|} /*-- TIFFReadDirEntryLong() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSbyte:
 3871|  5.72k|{
 3872|  5.72k|    if (value < 0)
  ------------------
  |  Branch (3872:9): [True: 22, False: 5.70k]
  ------------------
 3873|     22|        return (TIFFReadDirEntryErrRange);
 3874|  5.70k|    else
 3875|  5.70k|        return (TIFFReadDirEntryErrOk);
 3876|  5.72k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSshort:
 3880|  2.11k|{
 3881|  2.11k|    if (value < 0)
  ------------------
  |  Branch (3881:9): [True: 37, False: 2.08k]
  ------------------
 3882|     37|        return (TIFFReadDirEntryErrRange);
 3883|  2.08k|    else
 3884|  2.08k|        return (TIFFReadDirEntryErrOk);
 3885|  2.11k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong:
 3889|  1.95k|{
 3890|  1.95k|    if (value < 0)
  ------------------
  |  Branch (3890:9): [True: 76, False: 1.88k]
  ------------------
 3891|     76|        return (TIFFReadDirEntryErrRange);
 3892|  1.88k|    else
 3893|  1.88k|        return (TIFFReadDirEntryErrOk);
 3894|  1.95k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongLong8:
 3898|    958|{
 3899|    958|    if (value > UINT32_MAX)
  ------------------
  |  Branch (3899:9): [True: 178, False: 780]
  ------------------
 3900|    178|        return (TIFFReadDirEntryErrRange);
 3901|    780|    else
 3902|    780|        return (TIFFReadDirEntryErrOk);
 3903|    958|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong8:
 3907|  1.29k|{
 3908|  1.29k|    if ((value < 0) || (value > (int64_t)UINT32_MAX))
  ------------------
  |  Branch (3908:9): [True: 174, False: 1.12k]
  |  Branch (3908:24): [True: 143, False: 977]
  ------------------
 3909|    317|        return (TIFFReadDirEntryErrRange);
 3910|    977|    else
 3911|    977|        return (TIFFReadDirEntryErrOk);
 3912|  1.29k|}
tif_dirread.c:TIFFReadDirEntryLong8:
  821|  1.97k|{
  822|  1.97k|    enum TIFFReadDirEntryErr err;
  823|  1.97k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (823:9): [True: 506, False: 1.46k]
  ------------------
  824|    506|        return (TIFFReadDirEntryErrCount);
  825|  1.46k|    switch (direntry->tdir_type)
  826|  1.46k|    {
  827|    255|        case TIFF_BYTE:
  ------------------
  |  Branch (827:9): [True: 255, False: 1.21k]
  ------------------
  828|    255|        {
  829|    255|            uint8_t m;
  830|    255|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  831|    255|            *value = (uint64_t)m;
  832|    255|            return (TIFFReadDirEntryErrOk);
  833|      0|        }
  834|    370|        case TIFF_SBYTE:
  ------------------
  |  Branch (834:9): [True: 370, False: 1.09k]
  ------------------
  835|    370|        {
  836|    370|            int8_t m;
  837|    370|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  838|    370|            err = TIFFReadDirEntryCheckRangeLong8Sbyte(m);
  839|    370|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (839:17): [True: 4, False: 366]
  ------------------
  840|      4|                return (err);
  841|    366|            *value = (uint64_t)m;
  842|    366|            return (TIFFReadDirEntryErrOk);
  843|    370|        }
  844|     17|        case TIFF_SHORT:
  ------------------
  |  Branch (844:9): [True: 17, False: 1.45k]
  ------------------
  845|     17|        {
  846|     17|            uint16_t m;
  847|     17|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  848|     17|            *value = (uint64_t)m;
  849|     17|            return (TIFFReadDirEntryErrOk);
  850|    370|        }
  851|     37|        case TIFF_SSHORT:
  ------------------
  |  Branch (851:9): [True: 37, False: 1.43k]
  ------------------
  852|     37|        {
  853|     37|            int16_t m;
  854|     37|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  855|     37|            err = TIFFReadDirEntryCheckRangeLong8Sshort(m);
  856|     37|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (856:17): [True: 19, False: 18]
  ------------------
  857|     19|                return (err);
  858|     18|            *value = (uint64_t)m;
  859|     18|            return (TIFFReadDirEntryErrOk);
  860|     37|        }
  861|    298|        case TIFF_LONG:
  ------------------
  |  Branch (861:9): [True: 298, False: 1.17k]
  ------------------
  862|    306|        case TIFF_IFD:
  ------------------
  |  Branch (862:9): [True: 8, False: 1.46k]
  ------------------
  863|    306|        {
  864|    306|            uint32_t m;
  865|    306|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  866|    306|            *value = (uint64_t)m;
  867|    306|            return (TIFFReadDirEntryErrOk);
  868|    298|        }
  869|     70|        case TIFF_SLONG:
  ------------------
  |  Branch (869:9): [True: 70, False: 1.39k]
  ------------------
  870|     70|        {
  871|     70|            int32_t m;
  872|     70|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  873|     70|            err = TIFFReadDirEntryCheckRangeLong8Slong(m);
  874|     70|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (874:17): [True: 23, False: 47]
  ------------------
  875|     23|                return (err);
  876|     47|            *value = (uint64_t)m;
  877|     47|            return (TIFFReadDirEntryErrOk);
  878|     70|        }
  879|    269|        case TIFF_LONG8:
  ------------------
  |  Branch (879:9): [True: 269, False: 1.20k]
  ------------------
  880|    282|        case TIFF_IFD8:
  ------------------
  |  Branch (880:9): [True: 13, False: 1.45k]
  ------------------
  881|    282|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, value);
  882|    282|            return (err);
  883|    113|        case TIFF_SLONG8:
  ------------------
  |  Branch (883:9): [True: 113, False: 1.35k]
  ------------------
  884|    113|        {
  885|    113|            int64_t m;
  886|    113|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  887|    113|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (887:17): [True: 4, False: 109]
  ------------------
  888|      4|                return (err);
  889|    109|            err = TIFFReadDirEntryCheckRangeLong8Slong8(m);
  890|    109|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (890:17): [True: 42, False: 67]
  ------------------
  891|     42|                return (err);
  892|     67|            *value = (uint64_t)m;
  893|     67|            return (TIFFReadDirEntryErrOk);
  894|    109|        }
  895|     19|        default:
  ------------------
  |  Branch (895:9): [True: 19, False: 1.45k]
  ------------------
  896|     19|            return (TIFFReadDirEntryErrType);
  897|  1.46k|    }
  898|  1.46k|} /*-- TIFFReadDirEntryLong8() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sbyte:
 3945|  1.08k|{
 3946|  1.08k|    if (value < 0)
  ------------------
  |  Branch (3946:9): [True: 23, False: 1.06k]
  ------------------
 3947|     23|        return (TIFFReadDirEntryErrRange);
 3948|  1.06k|    else
 3949|  1.06k|        return (TIFFReadDirEntryErrOk);
 3950|  1.08k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sshort:
 3954|  1.12k|{
 3955|  1.12k|    if (value < 0)
  ------------------
  |  Branch (3955:9): [True: 52, False: 1.07k]
  ------------------
 3956|     52|        return (TIFFReadDirEntryErrRange);
 3957|  1.07k|    else
 3958|  1.07k|        return (TIFFReadDirEntryErrOk);
 3959|  1.12k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong:
 3963|  1.29k|{
 3964|  1.29k|    if (value < 0)
  ------------------
  |  Branch (3964:9): [True: 70, False: 1.22k]
  ------------------
 3965|     70|        return (TIFFReadDirEntryErrRange);
 3966|  1.22k|    else
 3967|  1.22k|        return (TIFFReadDirEntryErrOk);
 3968|  1.29k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong8:
 3972|  1.15k|{
 3973|  1.15k|    if (value < 0)
  ------------------
  |  Branch (3973:9): [True: 126, False: 1.02k]
  ------------------
 3974|    126|        return (TIFFReadDirEntryErrRange);
 3975|  1.02k|    else
 3976|  1.02k|        return (TIFFReadDirEntryErrOk);
 3977|  1.15k|}
tif_dirread.c:TIFFReadDirEntryFloat:
  972|  2.49k|{
  973|  2.49k|    enum TIFFReadDirEntryErr err;
  974|  2.49k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (974:9): [True: 1.15k, False: 1.33k]
  ------------------
  975|  1.15k|        return (TIFFReadDirEntryErrCount);
  976|  1.33k|    switch (direntry->tdir_type)
  977|  1.33k|    {
  978|     12|        case TIFF_BYTE:
  ------------------
  |  Branch (978:9): [True: 12, False: 1.32k]
  ------------------
  979|     12|        {
  980|     12|            uint8_t m;
  981|     12|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  982|     12|            *value = (float)m;
  983|     12|            return (TIFFReadDirEntryErrOk);
  984|      0|        }
  985|     13|        case TIFF_SBYTE:
  ------------------
  |  Branch (985:9): [True: 13, False: 1.32k]
  ------------------
  986|     13|        {
  987|     13|            int8_t m;
  988|     13|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  989|     13|            *value = (float)m;
  990|     13|            return (TIFFReadDirEntryErrOk);
  991|      0|        }
  992|    126|        case TIFF_SHORT:
  ------------------
  |  Branch (992:9): [True: 126, False: 1.21k]
  ------------------
  993|    126|        {
  994|    126|            uint16_t m;
  995|    126|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  996|    126|            *value = (float)m;
  997|    126|            return (TIFFReadDirEntryErrOk);
  998|      0|        }
  999|     22|        case TIFF_SSHORT:
  ------------------
  |  Branch (999:9): [True: 22, False: 1.31k]
  ------------------
 1000|     22|        {
 1001|     22|            int16_t m;
 1002|     22|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
 1003|     22|            *value = (float)m;
 1004|     22|            return (TIFFReadDirEntryErrOk);
 1005|      0|        }
 1006|     29|        case TIFF_LONG:
  ------------------
  |  Branch (1006:9): [True: 29, False: 1.30k]
  ------------------
 1007|     29|        {
 1008|     29|            uint32_t m;
 1009|     29|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
 1010|     29|            *value = (float)m;
 1011|     29|            return (TIFFReadDirEntryErrOk);
 1012|      0|        }
 1013|     17|        case TIFF_SLONG:
  ------------------
  |  Branch (1013:9): [True: 17, False: 1.32k]
  ------------------
 1014|     17|        {
 1015|     17|            int32_t m;
 1016|     17|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
 1017|     17|            *value = (float)m;
 1018|     17|            return (TIFFReadDirEntryErrOk);
 1019|      0|        }
 1020|     29|        case TIFF_LONG8:
  ------------------
  |  Branch (1020:9): [True: 29, False: 1.30k]
  ------------------
 1021|     29|        {
 1022|     29|            uint64_t m;
 1023|     29|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
 1024|     29|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1024:17): [True: 13, False: 16]
  ------------------
 1025|     13|                return (err);
 1026|     16|            *value = (float)m;
 1027|     16|            return (TIFFReadDirEntryErrOk);
 1028|     29|        }
 1029|     27|        case TIFF_SLONG8:
  ------------------
  |  Branch (1029:9): [True: 27, False: 1.31k]
  ------------------
 1030|     27|        {
 1031|     27|            int64_t m;
 1032|     27|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
 1033|     27|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1033:17): [True: 11, False: 16]
  ------------------
 1034|     11|                return (err);
 1035|     16|            *value = (float)m;
 1036|     16|            return (TIFFReadDirEntryErrOk);
 1037|     27|        }
 1038|    757|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1038:9): [True: 757, False: 580]
  ------------------
 1039|    757|        {
 1040|    757|            double m;
 1041|    757|            err = TIFFReadDirEntryCheckedRational(tif, direntry, &m);
 1042|    757|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1042:17): [True: 320, False: 437]
  ------------------
 1043|    320|                return (err);
 1044|    437|            *value = (float)m;
 1045|    437|            return (TIFFReadDirEntryErrOk);
 1046|    757|        }
 1047|    162|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1047:9): [True: 162, False: 1.17k]
  ------------------
 1048|    162|        {
 1049|    162|            double m;
 1050|    162|            err = TIFFReadDirEntryCheckedSrational(tif, direntry, &m);
 1051|    162|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1051:17): [True: 33, False: 129]
  ------------------
 1052|     33|                return (err);
 1053|    129|            *value = (float)m;
 1054|    129|            return (TIFFReadDirEntryErrOk);
 1055|    162|        }
 1056|     25|        case TIFF_FLOAT:
  ------------------
  |  Branch (1056:9): [True: 25, False: 1.31k]
  ------------------
 1057|     25|            TIFFReadDirEntryCheckedFloat(tif, direntry, value);
 1058|     25|            return (TIFFReadDirEntryErrOk);
 1059|     49|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1059:9): [True: 49, False: 1.28k]
  ------------------
 1060|     49|        {
 1061|     49|            double m;
 1062|     49|            err = TIFFReadDirEntryCheckedDouble(tif, direntry, &m);
 1063|     49|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1063:17): [True: 11, False: 38]
  ------------------
 1064|     11|                return (err);
 1065|     38|            if ((m > (double)FLT_MAX) || (m < -(double)FLT_MAX))
  ------------------
  |  Branch (1065:17): [True: 8, False: 30]
  |  Branch (1065:42): [True: 7, False: 23]
  ------------------
 1066|     15|                return (TIFFReadDirEntryErrRange);
 1067|     23|            *value = (float)m;
 1068|     23|            return (TIFFReadDirEntryErrOk);
 1069|     38|        }
 1070|     69|        default:
  ------------------
  |  Branch (1070:9): [True: 69, False: 1.26k]
  ------------------
 1071|     69|            return (TIFFReadDirEntryErrType);
 1072|  1.33k|    }
 1073|  1.33k|}
tif_dirread.c:TIFFReadDirEntryCheckedRational:
 3494|    758|{
 3495|    758|    UInt64Aligned_t m;
 3496|       |
 3497|    758|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3497:5): [True: 0, Folded]
  |  Branch (3497:5): [True: 758, Folded]
  ------------------
 3498|    758|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3498:5): [True: 0, Folded]
  |  Branch (3498:5): [True: 758, Folded]
  ------------------
 3499|    758|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3499:5): [True: 0, Folded]
  |  Branch (3499:5): [True: 758, Folded]
  ------------------
 3500|    758|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|    758|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3500:9): [True: 748, False: 10]
  ------------------
 3501|    748|    {
 3502|    748|        enum TIFFReadDirEntryErr err;
 3503|    748|        uint32_t offset = direntry->tdir_offset.toff_long;
 3504|    748|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    748|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3504:13): [True: 24, False: 724]
  ------------------
 3505|     24|            TIFFSwabLong(&offset);
 3506|    748|        err = TIFFReadDirEntryData(tif, offset, 8, m.i);
 3507|    748|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3507:13): [True: 320, False: 428]
  ------------------
 3508|    320|            return (err);
 3509|    748|    }
 3510|     10|    else
 3511|     10|        m.l = direntry->tdir_offset.toff_long8;
 3512|    438|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    438|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3512:9): [True: 19, False: 419]
  ------------------
 3513|     19|        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|    438|    if (m.i[0] == 0 || m.i[1] == 0)
  ------------------
  |  Branch (3517:9): [True: 33, False: 405]
  |  Branch (3517:24): [True: 79, False: 326]
  ------------------
 3518|    112|        *value = 0.0;
 3519|    326|    else
 3520|    326|        *value = (double)m.i[0] / (double)m.i[1];
 3521|    438|    return (TIFFReadDirEntryErrOk);
 3522|    758|}
tif_dirread.c:TIFFReadDirEntryCheckedSrational:
 3527|    163|{
 3528|    163|    UInt64Aligned_t m;
 3529|    163|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3529:5): [True: 0, Folded]
  |  Branch (3529:5): [True: 163, Folded]
  ------------------
 3530|    163|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3530:5): [True: 0, Folded]
  |  Branch (3530:5): [True: 163, Folded]
  ------------------
 3531|    163|    assert(sizeof(int32_t) == 4);
  ------------------
  |  Branch (3531:5): [True: 0, Folded]
  |  Branch (3531:5): [True: 163, Folded]
  ------------------
 3532|    163|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3532:5): [True: 0, Folded]
  |  Branch (3532:5): [True: 163, Folded]
  ------------------
 3533|    163|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|    163|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3533:9): [True: 153, False: 10]
  ------------------
 3534|    153|    {
 3535|    153|        enum TIFFReadDirEntryErr err;
 3536|    153|        uint32_t offset = direntry->tdir_offset.toff_long;
 3537|    153|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    153|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3537:13): [True: 32, False: 121]
  ------------------
 3538|     32|            TIFFSwabLong(&offset);
 3539|    153|        err = TIFFReadDirEntryData(tif, offset, 8, m.i);
 3540|    153|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3540:13): [True: 34, False: 119]
  ------------------
 3541|     34|            return (err);
 3542|    153|    }
 3543|     10|    else
 3544|     10|        m.l = direntry->tdir_offset.toff_long8;
 3545|    129|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    129|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3545:9): [True: 28, False: 101]
  ------------------
 3546|     28|        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|    129|    if ((int32_t)m.i[0] == 0 || m.i[1] == 0)
  ------------------
  |  Branch (3550:9): [True: 23, False: 106]
  |  Branch (3550:33): [True: 11, False: 95]
  ------------------
 3551|     34|        *value = 0.0;
 3552|     95|    else
 3553|     95|        *value = (double)((int32_t)m.i[0]) / (double)m.i[1];
 3554|    129|    return (TIFFReadDirEntryErrOk);
 3555|    163|}
tif_dirread.c:TIFFReadDirEntryCheckedFloat:
 3602|     27|{
 3603|     27|    union
 3604|     27|    {
 3605|     27|        float f;
 3606|     27|        uint32_t i;
 3607|     27|    } float_union;
 3608|     27|    assert(sizeof(float) == 4);
  ------------------
  |  Branch (3608:5): [True: 0, Folded]
  |  Branch (3608:5): [True: 27, Folded]
  ------------------
 3609|     27|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3609:5): [True: 0, Folded]
  |  Branch (3609:5): [True: 27, Folded]
  ------------------
 3610|     27|    assert(sizeof(float_union) == 4);
  ------------------
  |  Branch (3610:5): [True: 0, Folded]
  |  Branch (3610:5): [True: 27, Folded]
  ------------------
 3611|     27|    float_union.i = *(uint32_t *)(&direntry->tdir_offset);
 3612|     27|    *value = float_union.f;
 3613|     27|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     27|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3613:9): [True: 11, False: 16]
  ------------------
 3614|     11|        TIFFSwabLong((uint32_t *)value);
 3615|     27|}
tif_dirread.c:TIFFReadDirEntryCheckedDouble:
 3619|     52|{
 3620|     52|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3620:5): [True: 0, Folded]
  |  Branch (3620:5): [True: 52, Folded]
  ------------------
 3621|     52|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3621:5): [True: 0, Folded]
  |  Branch (3621:5): [True: 52, Folded]
  ------------------
 3622|     52|    assert(sizeof(UInt64Aligned_t) == 8);
  ------------------
  |  Branch (3622:5): [True: 0, Folded]
  |  Branch (3622:5): [True: 52, Folded]
  ------------------
 3623|     52|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  143|     52|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3623:9): [True: 41, False: 11]
  ------------------
 3624|     41|    {
 3625|     41|        enum TIFFReadDirEntryErr err;
 3626|     41|        uint32_t offset = direntry->tdir_offset.toff_long;
 3627|     41|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     41|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3627:13): [True: 8, False: 33]
  ------------------
 3628|      8|            TIFFSwabLong(&offset);
 3629|     41|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3630|     41|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3630:13): [True: 14, False: 27]
  ------------------
 3631|     14|            return (err);
 3632|     41|    }
 3633|     11|    else
 3634|     11|    {
 3635|     11|        UInt64Aligned_t uint64_union;
 3636|     11|        uint64_union.l = direntry->tdir_offset.toff_long8;
 3637|     11|        *value = uint64_union.d;
 3638|     11|    }
 3639|     38|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     38|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3639:9): [True: 17, False: 21]
  ------------------
 3640|     17|        TIFFSwabLong8((uint64_t *)value);
 3641|     38|    return (TIFFReadDirEntryErrOk);
 3642|     52|}
tif_dirread.c:TIFFReadDirEntryDouble:
 1077|     62|{
 1078|     62|    enum TIFFReadDirEntryErr err;
 1079|     62|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (1079:9): [True: 38, False: 24]
  ------------------
 1080|     38|        return (TIFFReadDirEntryErrCount);
 1081|     24|    switch (direntry->tdir_type)
 1082|     24|    {
 1083|      1|        case TIFF_BYTE:
  ------------------
  |  Branch (1083:9): [True: 1, False: 23]
  ------------------
 1084|      1|        {
 1085|      1|            uint8_t m;
 1086|      1|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
 1087|      1|            *value = (double)m;
 1088|      1|            return (TIFFReadDirEntryErrOk);
 1089|      0|        }
 1090|      1|        case TIFF_SBYTE:
  ------------------
  |  Branch (1090:9): [True: 1, False: 23]
  ------------------
 1091|      1|        {
 1092|      1|            int8_t m;
 1093|      1|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
 1094|      1|            *value = (double)m;
 1095|      1|            return (TIFFReadDirEntryErrOk);
 1096|      0|        }
 1097|      2|        case TIFF_SHORT:
  ------------------
  |  Branch (1097:9): [True: 2, False: 22]
  ------------------
 1098|      2|        {
 1099|      2|            uint16_t m;
 1100|      2|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
 1101|      2|            *value = (double)m;
 1102|      2|            return (TIFFReadDirEntryErrOk);
 1103|      0|        }
 1104|      2|        case TIFF_SSHORT:
  ------------------
  |  Branch (1104:9): [True: 2, False: 22]
  ------------------
 1105|      2|        {
 1106|      2|            int16_t m;
 1107|      2|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
 1108|      2|            *value = (double)m;
 1109|      2|            return (TIFFReadDirEntryErrOk);
 1110|      0|        }
 1111|      2|        case TIFF_LONG:
  ------------------
  |  Branch (1111:9): [True: 2, False: 22]
  ------------------
 1112|      2|        {
 1113|      2|            uint32_t m;
 1114|      2|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
 1115|      2|            *value = (double)m;
 1116|      2|            return (TIFFReadDirEntryErrOk);
 1117|      0|        }
 1118|      2|        case TIFF_SLONG:
  ------------------
  |  Branch (1118:9): [True: 2, False: 22]
  ------------------
 1119|      2|        {
 1120|      2|            int32_t m;
 1121|      2|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
 1122|      2|            *value = (double)m;
 1123|      2|            return (TIFFReadDirEntryErrOk);
 1124|      0|        }
 1125|      2|        case TIFF_LONG8:
  ------------------
  |  Branch (1125:9): [True: 2, False: 22]
  ------------------
 1126|      2|        {
 1127|      2|            uint64_t m;
 1128|      2|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
 1129|      2|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1129:17): [True: 1, False: 1]
  ------------------
 1130|      1|                return (err);
 1131|      1|            *value = (double)m;
 1132|      1|            return (TIFFReadDirEntryErrOk);
 1133|      2|        }
 1134|      2|        case TIFF_SLONG8:
  ------------------
  |  Branch (1134:9): [True: 2, False: 22]
  ------------------
 1135|      2|        {
 1136|      2|            int64_t m;
 1137|      2|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
 1138|      2|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1138:17): [True: 1, False: 1]
  ------------------
 1139|      1|                return (err);
 1140|      1|            *value = (double)m;
 1141|      1|            return (TIFFReadDirEntryErrOk);
 1142|      2|        }
 1143|      1|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1143:9): [True: 1, False: 23]
  ------------------
 1144|      1|            err = TIFFReadDirEntryCheckedRational(tif, direntry, value);
 1145|      1|            return (err);
 1146|      1|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1146:9): [True: 1, False: 23]
  ------------------
 1147|      1|            err = TIFFReadDirEntryCheckedSrational(tif, direntry, value);
 1148|      1|            return (err);
 1149|      2|        case TIFF_FLOAT:
  ------------------
  |  Branch (1149:9): [True: 2, False: 22]
  ------------------
 1150|      2|        {
 1151|      2|            float m;
 1152|      2|            TIFFReadDirEntryCheckedFloat(tif, direntry, &m);
 1153|      2|            *value = (double)m;
 1154|      2|            return (TIFFReadDirEntryErrOk);
 1155|      2|        }
 1156|      3|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1156:9): [True: 3, False: 21]
  ------------------
 1157|      3|            err = TIFFReadDirEntryCheckedDouble(tif, direntry, value);
 1158|      3|            return (err);
 1159|      3|        default:
  ------------------
  |  Branch (1159:9): [True: 3, False: 21]
  ------------------
 1160|      3|            return (TIFFReadDirEntryErrType);
 1161|     24|    }
 1162|     24|}
tif_dirread.c:TIFFReadDirEntryIfd8:
 1166|    356|{
 1167|    356|    enum TIFFReadDirEntryErr err;
 1168|    356|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (1168:9): [True: 283, False: 73]
  ------------------
 1169|    283|        return (TIFFReadDirEntryErrCount);
 1170|     73|    switch (direntry->tdir_type)
 1171|     73|    {
 1172|     41|        case TIFF_LONG:
  ------------------
  |  Branch (1172:9): [True: 41, False: 32]
  ------------------
 1173|     44|        case TIFF_IFD:
  ------------------
  |  Branch (1173:9): [True: 3, False: 70]
  ------------------
 1174|     44|        {
 1175|     44|            uint32_t m;
 1176|     44|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
 1177|     44|            *value = (uint64_t)m;
 1178|     44|            return (TIFFReadDirEntryErrOk);
 1179|     41|        }
 1180|     22|        case TIFF_LONG8:
  ------------------
  |  Branch (1180:9): [True: 22, False: 51]
  ------------------
 1181|     23|        case TIFF_IFD8:
  ------------------
  |  Branch (1181:9): [True: 1, False: 72]
  ------------------
 1182|     23|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, value);
 1183|     23|            return (err);
 1184|      6|        default:
  ------------------
  |  Branch (1184:9): [True: 6, False: 67]
  ------------------
 1185|      6|            return (TIFFReadDirEntryErrType);
 1186|     73|    }
 1187|     73|}
tif_dirread.c:TIFFReadDirEntrySbyteArray:
 1583|  1.39k|{
 1584|  1.39k|    enum TIFFReadDirEntryErr err;
 1585|  1.39k|    uint32_t count;
 1586|  1.39k|    void *origdata;
 1587|  1.39k|    int8_t *data;
 1588|  1.39k|    switch (direntry->tdir_type)
 1589|  1.39k|    {
 1590|      0|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1590:9): [True: 0, False: 1.39k]
  ------------------
 1591|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1591:9): [True: 0, False: 1.39k]
  ------------------
 1592|  1.39k|        case TIFF_SBYTE:
  ------------------
  |  Branch (1592:9): [True: 1.39k, False: 0]
  ------------------
 1593|  1.39k|        case TIFF_SHORT:
  ------------------
  |  Branch (1593:9): [True: 0, False: 1.39k]
  ------------------
 1594|  1.39k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1594:9): [True: 0, False: 1.39k]
  ------------------
 1595|  1.39k|        case TIFF_LONG:
  ------------------
  |  Branch (1595:9): [True: 0, False: 1.39k]
  ------------------
 1596|  1.39k|        case TIFF_SLONG:
  ------------------
  |  Branch (1596:9): [True: 0, False: 1.39k]
  ------------------
 1597|  1.39k|        case TIFF_LONG8:
  ------------------
  |  Branch (1597:9): [True: 0, False: 1.39k]
  ------------------
 1598|  1.39k|        case TIFF_SLONG8:
  ------------------
  |  Branch (1598:9): [True: 0, False: 1.39k]
  ------------------
 1599|  1.39k|            break;
 1600|      0|        default:
  ------------------
  |  Branch (1600:9): [True: 0, False: 1.39k]
  ------------------
 1601|      0|            return (TIFFReadDirEntryErrType);
 1602|  1.39k|    }
 1603|  1.39k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 1, &origdata);
 1604|  1.39k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1604:9): [True: 1.13k, False: 261]
  |  Branch (1604:43): [True: 25, False: 236]
  ------------------
 1605|  1.15k|    {
 1606|  1.15k|        *value = 0;
 1607|  1.15k|        return (err);
 1608|  1.15k|    }
 1609|    236|    switch (direntry->tdir_type)
 1610|    236|    {
 1611|      0|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1611:9): [True: 0, False: 236]
  ------------------
 1612|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1612:9): [True: 0, False: 236]
  ------------------
 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|    236|        case TIFF_SBYTE:
  ------------------
  |  Branch (1630:9): [True: 236, False: 0]
  ------------------
 1631|    236|            *value = (int8_t *)origdata;
 1632|    236|            return (TIFFReadDirEntryErrOk);
 1633|      0|        default:
  ------------------
  |  Branch (1633:9): [True: 0, False: 236]
  ------------------
 1634|      0|            break;
 1635|    236|    }
 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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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|    646|{
 1946|    646|    enum TIFFReadDirEntryErr err;
 1947|    646|    uint32_t count;
 1948|    646|    void *origdata;
 1949|    646|    int16_t *data;
 1950|    646|    switch (direntry->tdir_type)
 1951|    646|    {
 1952|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1952:9): [True: 0, False: 646]
  ------------------
 1953|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (1953:9): [True: 0, False: 646]
  ------------------
 1954|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1954:9): [True: 0, False: 646]
  ------------------
 1955|    646|        case TIFF_SSHORT:
  ------------------
  |  Branch (1955:9): [True: 646, False: 0]
  ------------------
 1956|    646|        case TIFF_LONG:
  ------------------
  |  Branch (1956:9): [True: 0, False: 646]
  ------------------
 1957|    646|        case TIFF_SLONG:
  ------------------
  |  Branch (1957:9): [True: 0, False: 646]
  ------------------
 1958|    646|        case TIFF_LONG8:
  ------------------
  |  Branch (1958:9): [True: 0, False: 646]
  ------------------
 1959|    646|        case TIFF_SLONG8:
  ------------------
  |  Branch (1959:9): [True: 0, False: 646]
  ------------------
 1960|    646|            break;
 1961|      0|        default:
  ------------------
  |  Branch (1961:9): [True: 0, False: 646]
  ------------------
 1962|      0|            return (TIFFReadDirEntryErrType);
 1963|    646|    }
 1964|    646|    err = TIFFReadDirEntryArray(tif, direntry, &count, 2, &origdata);
 1965|    646|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1965:9): [True: 470, False: 176]
  |  Branch (1965:43): [True: 58, False: 118]
  ------------------
 1966|    528|    {
 1967|    528|        *value = 0;
 1968|    528|        return (err);
 1969|    528|    }
 1970|    118|    switch (direntry->tdir_type)
 1971|    118|    {
 1972|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1972:9): [True: 0, False: 118]
  ------------------
 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)
  ------------------
  |  |  129|      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|    118|        case TIFF_SSHORT:
  ------------------
  |  Branch (1992:9): [True: 118, False: 0]
  ------------------
 1993|    118|            *value = (int16_t *)origdata;
 1994|    118|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    118|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1994:17): [True: 24, False: 94]
  ------------------
 1995|     24|                TIFFSwabArrayOfShort((uint16_t *)(*value), count);
 1996|    118|            return (TIFFReadDirEntryErrOk);
 1997|      0|        default:
  ------------------
  |  Branch (1997:9): [True: 0, False: 118]
  ------------------
 1998|      0|            break;
 1999|    118|    }
 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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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|  8.97k|{
 2119|  8.97k|    enum TIFFReadDirEntryErr err;
 2120|  8.97k|    uint32_t count;
 2121|  8.97k|    void *origdata;
 2122|  8.97k|    uint32_t *data;
 2123|  8.97k|    switch (direntry->tdir_type)
 2124|  8.97k|    {
 2125|     25|        case TIFF_BYTE:
  ------------------
  |  Branch (2125:9): [True: 25, False: 8.95k]
  ------------------
 2126|     46|        case TIFF_SBYTE:
  ------------------
  |  Branch (2126:9): [True: 21, False: 8.95k]
  ------------------
 2127|     70|        case TIFF_SHORT:
  ------------------
  |  Branch (2127:9): [True: 24, False: 8.95k]
  ------------------
 2128|    123|        case TIFF_SSHORT:
  ------------------
  |  Branch (2128:9): [True: 53, False: 8.92k]
  ------------------
 2129|  8.47k|        case TIFF_LONG:
  ------------------
  |  Branch (2129:9): [True: 8.34k, False: 626]
  ------------------
 2130|  8.54k|        case TIFF_SLONG:
  ------------------
  |  Branch (2130:9): [True: 72, False: 8.90k]
  ------------------
 2131|  8.62k|        case TIFF_LONG8:
  ------------------
  |  Branch (2131:9): [True: 85, False: 8.89k]
  ------------------
 2132|  8.86k|        case TIFF_SLONG8:
  ------------------
  |  Branch (2132:9): [True: 238, False: 8.73k]
  ------------------
 2133|  8.89k|        case TIFF_IFD:
  ------------------
  |  Branch (2133:9): [True: 24, False: 8.95k]
  ------------------
 2134|  8.94k|        case TIFF_IFD8:
  ------------------
  |  Branch (2134:9): [True: 55, False: 8.92k]
  ------------------
 2135|  8.94k|            break;
 2136|     29|        default:
  ------------------
  |  Branch (2136:9): [True: 29, False: 8.94k]
  ------------------
 2137|     29|            return (TIFFReadDirEntryErrType);
 2138|  8.97k|    }
 2139|  8.94k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2140|  8.94k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2140:9): [True: 7.93k, False: 1.01k]
  |  Branch (2140:43): [True: 120, False: 890]
  ------------------
 2141|  8.05k|    {
 2142|  8.05k|        *value = 0;
 2143|  8.05k|        return (err);
 2144|  8.05k|    }
 2145|    890|    switch (direntry->tdir_type)
 2146|    890|    {
 2147|    377|        case TIFF_LONG:
  ------------------
  |  Branch (2147:9): [True: 377, False: 513]
  ------------------
 2148|    394|        case TIFF_IFD:
  ------------------
  |  Branch (2148:9): [True: 17, False: 873]
  ------------------
 2149|    394|            *value = (uint32_t *)origdata;
 2150|    394|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    394|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2150:17): [True: 96, False: 298]
  ------------------
 2151|     96|                TIFFSwabArrayOfLong(*value, count);
 2152|    394|            return (TIFFReadDirEntryErrOk);
 2153|     68|        case TIFF_SLONG:
  ------------------
  |  Branch (2153:9): [True: 68, False: 822]
  ------------------
 2154|     68|        {
 2155|     68|            int32_t *m;
 2156|     68|            uint32_t n;
 2157|     68|            m = (int32_t *)origdata;
 2158|    567|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2158:25): [True: 539, False: 28]
  ------------------
 2159|    539|            {
 2160|    539|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    539|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2160:21): [True: 214, False: 325]
  ------------------
 2161|    214|                    TIFFSwabLong((uint32_t *)m);
 2162|    539|                err = TIFFReadDirEntryCheckRangeLongSlong(*m);
 2163|    539|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2163:21): [True: 40, False: 499]
  ------------------
 2164|     40|                {
 2165|     40|                    _TIFFfreeExt(tif, origdata);
 2166|     40|                    return (err);
 2167|     40|                }
 2168|    499|                m++;
 2169|    499|            }
 2170|     28|            *value = (uint32_t *)origdata;
 2171|     28|            return (TIFFReadDirEntryErrOk);
 2172|     68|        }
 2173|    428|        default:
  ------------------
  |  Branch (2173:9): [True: 428, False: 462]
  ------------------
 2174|    428|            break;
 2175|    890|    }
 2176|    428|    data = (uint32_t *)_TIFFCheckMalloc(tif, count, sizeof(uint32_t),
 2177|    428|                                        "TIFFReadDirEntryLongArray");
 2178|    428|    if (data == 0)
  ------------------
  |  Branch (2178:9): [True: 0, False: 428]
  ------------------
 2179|      0|    {
 2180|      0|        _TIFFfreeExt(tif, origdata);
 2181|      0|        return (TIFFReadDirEntryErrAlloc);
 2182|      0|    }
 2183|    428|    switch (direntry->tdir_type)
 2184|    428|    {
 2185|     22|        case TIFF_BYTE:
  ------------------
  |  Branch (2185:9): [True: 22, False: 406]
  ------------------
 2186|     22|        {
 2187|     22|            uint8_t *ma;
 2188|     22|            uint32_t *mb;
 2189|     22|            uint32_t n;
 2190|     22|            ma = (uint8_t *)origdata;
 2191|     22|            mb = data;
 2192|    301|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2192:25): [True: 279, False: 22]
  ------------------
 2193|    279|                *mb++ = (uint32_t)(*ma++);
 2194|     22|        }
 2195|     22|        break;
 2196|     19|        case TIFF_SBYTE:
  ------------------
  |  Branch (2196:9): [True: 19, False: 409]
  ------------------
 2197|     19|        {
 2198|     19|            int8_t *ma;
 2199|     19|            uint32_t *mb;
 2200|     19|            uint32_t n;
 2201|     19|            ma = (int8_t *)origdata;
 2202|     19|            mb = data;
 2203|    318|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2203:25): [True: 314, False: 4]
  ------------------
 2204|    314|            {
 2205|    314|                err = TIFFReadDirEntryCheckRangeLongSbyte(*ma);
 2206|    314|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2206:21): [True: 15, False: 299]
  ------------------
 2207|     15|                    break;
 2208|    299|                *mb++ = (uint32_t)(*ma++);
 2209|    299|            }
 2210|     19|        }
 2211|     19|        break;
 2212|     22|        case TIFF_SHORT:
  ------------------
  |  Branch (2212:9): [True: 22, False: 406]
  ------------------
 2213|     22|        {
 2214|     22|            uint16_t *ma;
 2215|     22|            uint32_t *mb;
 2216|     22|            uint32_t n;
 2217|     22|            ma = (uint16_t *)origdata;
 2218|     22|            mb = data;
 2219|    679|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2219:25): [True: 657, False: 22]
  ------------------
 2220|    657|            {
 2221|    657|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    657|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2221:21): [True: 263, False: 394]
  ------------------
 2222|    263|                    TIFFSwabShort(ma);
 2223|    657|                *mb++ = (uint32_t)(*ma++);
 2224|    657|            }
 2225|     22|        }
 2226|     22|        break;
 2227|     43|        case TIFF_SSHORT:
  ------------------
  |  Branch (2227:9): [True: 43, False: 385]
  ------------------
 2228|     43|        {
 2229|     43|            int16_t *ma;
 2230|     43|            uint32_t *mb;
 2231|     43|            uint32_t n;
 2232|     43|            ma = (int16_t *)origdata;
 2233|     43|            mb = data;
 2234|    630|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2234:25): [True: 611, False: 19]
  ------------------
 2235|    611|            {
 2236|    611|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    611|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2236:21): [True: 255, False: 356]
  ------------------
 2237|    255|                    TIFFSwabShort((uint16_t *)ma);
 2238|    611|                err = TIFFReadDirEntryCheckRangeLongSshort(*ma);
 2239|    611|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2239:21): [True: 24, False: 587]
  ------------------
 2240|     24|                    break;
 2241|    587|                *mb++ = (uint32_t)(*ma++);
 2242|    587|            }
 2243|     43|        }
 2244|     43|        break;
 2245|     73|        case TIFF_LONG8:
  ------------------
  |  Branch (2245:9): [True: 73, False: 355]
  ------------------
 2246|    117|        case TIFF_IFD8:
  ------------------
  |  Branch (2246:9): [True: 44, False: 384]
  ------------------
 2247|    117|        {
 2248|    117|            uint64_t *ma;
 2249|    117|            uint32_t *mb;
 2250|    117|            uint32_t n;
 2251|    117|            ma = (uint64_t *)origdata;
 2252|    117|            mb = data;
 2253|    847|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2253:25): [True: 826, False: 21]
  ------------------
 2254|    826|            {
 2255|    826|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    826|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2255:21): [True: 200, False: 626]
  ------------------
 2256|    200|                    TIFFSwabLong8(ma);
 2257|    826|                err = TIFFReadDirEntryCheckRangeLongLong8(*ma);
 2258|    826|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2258:21): [True: 96, False: 730]
  ------------------
 2259|     96|                    break;
 2260|    730|                *mb++ = (uint32_t)(*ma++);
 2261|    730|            }
 2262|    117|        }
 2263|    117|        break;
 2264|    205|        case TIFF_SLONG8:
  ------------------
  |  Branch (2264:9): [True: 205, False: 223]
  ------------------
 2265|    205|        {
 2266|    205|            int64_t *ma;
 2267|    205|            uint32_t *mb;
 2268|    205|            uint32_t n;
 2269|    205|            ma = (int64_t *)origdata;
 2270|    205|            mb = data;
 2271|  1.12k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2271:25): [True: 1.09k, False: 39]
  ------------------
 2272|  1.09k|            {
 2273|  1.09k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.09k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2273:21): [True: 396, False: 694]
  ------------------
 2274|    396|                    TIFFSwabLong8((uint64_t *)ma);
 2275|  1.09k|                err = TIFFReadDirEntryCheckRangeLongSlong8(*ma);
 2276|  1.09k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2276:21): [True: 166, False: 924]
  ------------------
 2277|    166|                    break;
 2278|    924|                *mb++ = (uint32_t)(*ma++);
 2279|    924|            }
 2280|    205|        }
 2281|    205|        break;
 2282|      0|        default:
  ------------------
  |  Branch (2282:9): [True: 0, False: 428]
  ------------------
 2283|      0|            break;
 2284|    428|    }
 2285|    428|    _TIFFfreeExt(tif, origdata);
 2286|    428|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2286:9): [True: 301, False: 127]
  ------------------
 2287|    301|    {
 2288|    301|        _TIFFfreeExt(tif, data);
 2289|    301|        return (err);
 2290|    301|    }
 2291|    127|    *value = data;
 2292|    127|    return (TIFFReadDirEntryErrOk);
 2293|    428|}
tif_dirread.c:TIFFReadDirEntrySlongArray:
 2297|    430|{
 2298|    430|    enum TIFFReadDirEntryErr err;
 2299|    430|    uint32_t count;
 2300|    430|    void *origdata;
 2301|    430|    int32_t *data;
 2302|    430|    switch (direntry->tdir_type)
 2303|    430|    {
 2304|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2304:9): [True: 0, False: 430]
  ------------------
 2305|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2305:9): [True: 0, False: 430]
  ------------------
 2306|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2306:9): [True: 0, False: 430]
  ------------------
 2307|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2307:9): [True: 0, False: 430]
  ------------------
 2308|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2308:9): [True: 0, False: 430]
  ------------------
 2309|    430|        case TIFF_SLONG:
  ------------------
  |  Branch (2309:9): [True: 430, False: 0]
  ------------------
 2310|    430|        case TIFF_LONG8:
  ------------------
  |  Branch (2310:9): [True: 0, False: 430]
  ------------------
 2311|    430|        case TIFF_SLONG8:
  ------------------
  |  Branch (2311:9): [True: 0, False: 430]
  ------------------
 2312|    430|            break;
 2313|      0|        default:
  ------------------
  |  Branch (2313:9): [True: 0, False: 430]
  ------------------
 2314|      0|            return (TIFFReadDirEntryErrType);
 2315|    430|    }
 2316|    430|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2317|    430|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2317:9): [True: 303, False: 127]
  |  Branch (2317:43): [True: 67, False: 60]
  ------------------
 2318|    370|    {
 2319|    370|        *value = 0;
 2320|    370|        return (err);
 2321|    370|    }
 2322|     60|    switch (direntry->tdir_type)
 2323|     60|    {
 2324|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2324:9): [True: 0, False: 60]
  ------------------
 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)
  ------------------
  |  |  129|      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|     60|        case TIFF_SLONG:
  ------------------
  |  Branch (2344:9): [True: 60, False: 0]
  ------------------
 2345|     60|            *value = (int32_t *)origdata;
 2346|     60|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     60|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2346:17): [True: 19, False: 41]
  ------------------
 2347|     19|                TIFFSwabArrayOfLong((uint32_t *)(*value), count);
 2348|     60|            return (TIFFReadDirEntryErrOk);
 2349|      0|        default:
  ------------------
  |  Branch (2349:9): [True: 0, False: 60]
  ------------------
 2350|      0|            break;
 2351|     60|    }
 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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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|  4.16k|{
 2643|  4.16k|    return TIFFReadDirEntryLong8ArrayWithLimit(tif, direntry, value,
 2644|  4.16k|                                               ~((uint64_t)0));
 2645|  4.16k|}
tif_dirread.c:TIFFReadDirEntryLong8ArrayWithLimit:
 2465|  37.3k|{
 2466|  37.3k|    enum TIFFReadDirEntryErr err;
 2467|  37.3k|    uint32_t count;
 2468|  37.3k|    void *origdata;
 2469|  37.3k|    uint64_t *data;
 2470|  37.3k|    switch (direntry->tdir_type)
 2471|  37.3k|    {
 2472|  21.9k|        case TIFF_BYTE:
  ------------------
  |  Branch (2472:9): [True: 21.9k, False: 15.3k]
  ------------------
 2473|  22.3k|        case TIFF_SBYTE:
  ------------------
  |  Branch (2473:9): [True: 402, False: 36.9k]
  ------------------
 2474|  25.3k|        case TIFF_SHORT:
  ------------------
  |  Branch (2474:9): [True: 2.95k, False: 34.3k]
  ------------------
 2475|  25.9k|        case TIFF_SSHORT:
  ------------------
  |  Branch (2475:9): [True: 639, False: 36.6k]
  ------------------
 2476|  31.2k|        case TIFF_LONG:
  ------------------
  |  Branch (2476:9): [True: 5.22k, False: 32.0k]
  ------------------
 2477|  31.7k|        case TIFF_SLONG:
  ------------------
  |  Branch (2477:9): [True: 539, False: 36.7k]
  ------------------
 2478|  36.1k|        case TIFF_LONG8:
  ------------------
  |  Branch (2478:9): [True: 4.35k, False: 32.9k]
  ------------------
 2479|  36.5k|        case TIFF_SLONG8:
  ------------------
  |  Branch (2479:9): [True: 460, False: 36.8k]
  ------------------
 2480|  36.6k|        case TIFF_IFD:
  ------------------
  |  Branch (2480:9): [True: 91, False: 37.2k]
  ------------------
 2481|  37.1k|        case TIFF_IFD8:
  ------------------
  |  Branch (2481:9): [True: 459, False: 36.8k]
  ------------------
 2482|  37.1k|            break;
 2483|    191|        default:
  ------------------
  |  Branch (2483:9): [True: 191, False: 37.1k]
  ------------------
 2484|    191|            return (TIFFReadDirEntryErrType);
 2485|  37.3k|    }
 2486|  37.1k|    err = TIFFReadDirEntryArrayWithLimit(tif, direntry, &count, 8, &origdata,
 2487|  37.1k|                                         maxcount);
 2488|  37.1k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2488:9): [True: 487, False: 36.6k]
  |  Branch (2488:43): [True: 2.56k, False: 34.0k]
  ------------------
 2489|  3.05k|    {
 2490|  3.05k|        *value = 0;
 2491|  3.05k|        return (err);
 2492|  3.05k|    }
 2493|  34.0k|    switch (direntry->tdir_type)
 2494|  34.0k|    {
 2495|  3.42k|        case TIFF_LONG8:
  ------------------
  |  Branch (2495:9): [True: 3.42k, False: 30.6k]
  ------------------
 2496|  3.86k|        case TIFF_IFD8:
  ------------------
  |  Branch (2496:9): [True: 439, False: 33.6k]
  ------------------
 2497|  3.86k|            *value = (uint64_t *)origdata;
 2498|  3.86k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  3.86k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2498:17): [True: 27, False: 3.83k]
  ------------------
 2499|     27|                TIFFSwabArrayOfLong8(*value, count);
 2500|  3.86k|            return (TIFFReadDirEntryErrOk);
 2501|    438|        case TIFF_SLONG8:
  ------------------
  |  Branch (2501:9): [True: 438, False: 33.6k]
  ------------------
 2502|    438|        {
 2503|    438|            int64_t *m;
 2504|    438|            uint32_t n;
 2505|    438|            m = (int64_t *)origdata;
 2506|  1.39k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2506:25): [True: 1.04k, False: 354]
  ------------------
 2507|  1.04k|            {
 2508|  1.04k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.04k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2508:21): [True: 246, False: 798]
  ------------------
 2509|    246|                    TIFFSwabLong8((uint64_t *)m);
 2510|  1.04k|                err = TIFFReadDirEntryCheckRangeLong8Slong8(*m);
 2511|  1.04k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2511:21): [True: 84, False: 960]
  ------------------
 2512|     84|                {
 2513|     84|                    _TIFFfreeExt(tif, origdata);
 2514|     84|                    return (err);
 2515|     84|                }
 2516|    960|                m++;
 2517|    960|            }
 2518|    354|            *value = (uint64_t *)origdata;
 2519|    354|            return (TIFFReadDirEntryErrOk);
 2520|    438|        }
 2521|  29.7k|        default:
  ------------------
  |  Branch (2521:9): [True: 29.7k, False: 4.29k]
  ------------------
 2522|  29.7k|            break;
 2523|  34.0k|    }
 2524|  29.7k|    data = (uint64_t *)_TIFFCheckMalloc(tif, count, sizeof(uint64_t),
 2525|  29.7k|                                        "TIFFReadDirEntryLong8ArrayWithLimit");
 2526|  29.7k|    if (data == 0)
  ------------------
  |  Branch (2526:9): [True: 1, False: 29.7k]
  ------------------
 2527|      1|    {
 2528|      1|        _TIFFfreeExt(tif, origdata);
 2529|      1|        return (TIFFReadDirEntryErrAlloc);
 2530|      1|    }
 2531|  29.7k|    switch (direntry->tdir_type)
 2532|  29.7k|    {
 2533|  20.5k|        case TIFF_BYTE:
  ------------------
  |  Branch (2533:9): [True: 20.5k, False: 9.16k]
  ------------------
 2534|  20.5k|        {
 2535|  20.5k|            uint8_t *ma;
 2536|  20.5k|            uint64_t *mb;
 2537|  20.5k|            uint32_t n;
 2538|  20.5k|            ma = (uint8_t *)origdata;
 2539|  20.5k|            mb = data;
 2540|  1.79M|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2540:25): [True: 1.76M, False: 20.5k]
  ------------------
 2541|  1.76M|                *mb++ = (uint64_t)(*ma++);
 2542|  20.5k|        }
 2543|  20.5k|        break;
 2544|    214|        case TIFF_SBYTE:
  ------------------
  |  Branch (2544:9): [True: 214, False: 29.5k]
  ------------------
 2545|    214|        {
 2546|    214|            int8_t *ma;
 2547|    214|            uint64_t *mb;
 2548|    214|            uint32_t n;
 2549|    214|            ma = (int8_t *)origdata;
 2550|    214|            mb = data;
 2551|    908|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2551:25): [True: 713, False: 195]
  ------------------
 2552|    713|            {
 2553|    713|                err = TIFFReadDirEntryCheckRangeLong8Sbyte(*ma);
 2554|    713|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2554:21): [True: 19, False: 694]
  ------------------
 2555|     19|                    break;
 2556|    694|                *mb++ = (uint64_t)(*ma++);
 2557|    694|            }
 2558|    214|        }
 2559|    214|        break;
 2560|  2.89k|        case TIFF_SHORT:
  ------------------
  |  Branch (2560:9): [True: 2.89k, False: 26.8k]
  ------------------
 2561|  2.89k|        {
 2562|  2.89k|            uint16_t *ma;
 2563|  2.89k|            uint64_t *mb;
 2564|  2.89k|            uint32_t n;
 2565|  2.89k|            ma = (uint16_t *)origdata;
 2566|  2.89k|            mb = data;
 2567|  17.1k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2567:25): [True: 14.2k, False: 2.89k]
  ------------------
 2568|  14.2k|            {
 2569|  14.2k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  14.2k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2569:21): [True: 373, False: 13.9k]
  ------------------
 2570|    373|                    TIFFSwabShort(ma);
 2571|  14.2k|                *mb++ = (uint64_t)(*ma++);
 2572|  14.2k|            }
 2573|  2.89k|        }
 2574|  2.89k|        break;
 2575|    429|        case TIFF_SSHORT:
  ------------------
  |  Branch (2575:9): [True: 429, False: 29.3k]
  ------------------
 2576|    429|        {
 2577|    429|            int16_t *ma;
 2578|    429|            uint64_t *mb;
 2579|    429|            uint32_t n;
 2580|    429|            ma = (int16_t *)origdata;
 2581|    429|            mb = data;
 2582|  1.48k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2582:25): [True: 1.09k, False: 396]
  ------------------
 2583|  1.09k|            {
 2584|  1.09k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.09k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2584:21): [True: 244, False: 846]
  ------------------
 2585|    244|                    TIFFSwabShort((uint16_t *)ma);
 2586|  1.09k|                err = TIFFReadDirEntryCheckRangeLong8Sshort(*ma);
 2587|  1.09k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2587:21): [True: 33, False: 1.05k]
  ------------------
 2588|     33|                    break;
 2589|  1.05k|                *mb++ = (uint64_t)(*ma++);
 2590|  1.05k|            }
 2591|    429|        }
 2592|    429|        break;
 2593|  5.00k|        case TIFF_LONG:
  ------------------
  |  Branch (2593:9): [True: 5.00k, False: 24.7k]
  ------------------
 2594|  5.09k|        case TIFF_IFD:
  ------------------
  |  Branch (2594:9): [True: 89, False: 29.6k]
  ------------------
 2595|  5.09k|        {
 2596|  5.09k|            uint32_t *ma;
 2597|  5.09k|            uint64_t *mb;
 2598|  5.09k|            uint32_t n;
 2599|  5.09k|            ma = (uint32_t *)origdata;
 2600|  5.09k|            mb = data;
 2601|   108k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2601:25): [True: 103k, False: 5.09k]
  ------------------
 2602|   103k|            {
 2603|   103k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|   103k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2603:21): [True: 1.41k, False: 101k]
  ------------------
 2604|  1.41k|                    TIFFSwabLong(ma);
 2605|   103k|                *mb++ = (uint64_t)(*ma++);
 2606|   103k|            }
 2607|  5.09k|        }
 2608|  5.09k|        break;
 2609|    530|        case TIFF_SLONG:
  ------------------
  |  Branch (2609:9): [True: 530, False: 29.2k]
  ------------------
 2610|    530|        {
 2611|    530|            int32_t *ma;
 2612|    530|            uint64_t *mb;
 2613|    530|            uint32_t n;
 2614|    530|            ma = (int32_t *)origdata;
 2615|    530|            mb = data;
 2616|  1.70k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2616:25): [True: 1.22k, False: 483]
  ------------------
 2617|  1.22k|            {
 2618|  1.22k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.22k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2618:21): [True: 259, False: 964]
  ------------------
 2619|    259|                    TIFFSwabLong((uint32_t *)ma);
 2620|  1.22k|                err = TIFFReadDirEntryCheckRangeLong8Slong(*ma);
 2621|  1.22k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2621:21): [True: 47, False: 1.17k]
  ------------------
 2622|     47|                    break;
 2623|  1.17k|                *mb++ = (uint64_t)(*ma++);
 2624|  1.17k|            }
 2625|    530|        }
 2626|    530|        break;
 2627|      0|        default:
  ------------------
  |  Branch (2627:9): [True: 0, False: 29.7k]
  ------------------
 2628|      0|            break;
 2629|  29.7k|    }
 2630|  29.7k|    _TIFFfreeExt(tif, origdata);
 2631|  29.7k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2631:9): [True: 99, False: 29.6k]
  ------------------
 2632|     99|    {
 2633|     99|        _TIFFfreeExt(tif, data);
 2634|     99|        return (err);
 2635|     99|    }
 2636|  29.6k|    *value = data;
 2637|  29.6k|    return (TIFFReadDirEntryErrOk);
 2638|  29.7k|}
tif_dirread.c:TIFFReadDirEntrySlong8Array:
 2649|    558|{
 2650|    558|    enum TIFFReadDirEntryErr err;
 2651|    558|    uint32_t count;
 2652|    558|    void *origdata;
 2653|    558|    int64_t *data;
 2654|    558|    switch (direntry->tdir_type)
 2655|    558|    {
 2656|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2656:9): [True: 0, False: 558]
  ------------------
 2657|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2657:9): [True: 0, False: 558]
  ------------------
 2658|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2658:9): [True: 0, False: 558]
  ------------------
 2659|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2659:9): [True: 0, False: 558]
  ------------------
 2660|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2660:9): [True: 0, False: 558]
  ------------------
 2661|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (2661:9): [True: 0, False: 558]
  ------------------
 2662|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (2662:9): [True: 0, False: 558]
  ------------------
 2663|    558|        case TIFF_SLONG8:
  ------------------
  |  Branch (2663:9): [True: 558, False: 0]
  ------------------
 2664|    558|            break;
 2665|      0|        default:
  ------------------
  |  Branch (2665:9): [True: 0, False: 558]
  ------------------
 2666|      0|            return (TIFFReadDirEntryErrType);
 2667|    558|    }
 2668|    558|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 2669|    558|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2669:9): [True: 149, False: 409]
  |  Branch (2669:43): [True: 93, False: 316]
  ------------------
 2670|    242|    {
 2671|    242|        *value = 0;
 2672|    242|        return (err);
 2673|    242|    }
 2674|    316|    switch (direntry->tdir_type)
 2675|    316|    {
 2676|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (2676:9): [True: 0, False: 316]
  ------------------
 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)
  ------------------
  |  |  129|      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|    316|        case TIFF_SLONG8:
  ------------------
  |  Branch (2696:9): [True: 316, False: 0]
  ------------------
 2697|    316|            *value = (int64_t *)origdata;
 2698|    316|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    316|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2698:17): [True: 26, False: 290]
  ------------------
 2699|     26|                TIFFSwabArrayOfLong8((uint64_t *)(*value), count);
 2700|    316|            return (TIFFReadDirEntryErrOk);
 2701|      0|        default:
  ------------------
  |  Branch (2701:9): [True: 0, False: 316]
  ------------------
 2702|      0|            break;
 2703|    316|    }
 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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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)
  ------------------
  |  |  129|      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|  8.01k|{
 2806|  8.01k|    enum TIFFReadDirEntryErr err;
 2807|  8.01k|    uint32_t count;
 2808|  8.01k|    void *origdata;
 2809|  8.01k|    float *data;
 2810|  8.01k|    switch (direntry->tdir_type)
 2811|  8.01k|    {
 2812|     32|        case TIFF_BYTE:
  ------------------
  |  Branch (2812:9): [True: 32, False: 7.98k]
  ------------------
 2813|     65|        case TIFF_SBYTE:
  ------------------
  |  Branch (2813:9): [True: 33, False: 7.98k]
  ------------------
 2814|     90|        case TIFF_SHORT:
  ------------------
  |  Branch (2814:9): [True: 25, False: 7.99k]
  ------------------
 2815|    125|        case TIFF_SSHORT:
  ------------------
  |  Branch (2815:9): [True: 35, False: 7.98k]
  ------------------
 2816|    157|        case TIFF_LONG:
  ------------------
  |  Branch (2816:9): [True: 32, False: 7.98k]
  ------------------
 2817|    185|        case TIFF_SLONG:
  ------------------
  |  Branch (2817:9): [True: 28, False: 7.98k]
  ------------------
 2818|    236|        case TIFF_LONG8:
  ------------------
  |  Branch (2818:9): [True: 51, False: 7.96k]
  ------------------
 2819|    284|        case TIFF_SLONG8:
  ------------------
  |  Branch (2819:9): [True: 48, False: 7.96k]
  ------------------
 2820|  7.18k|        case TIFF_RATIONAL:
  ------------------
  |  Branch (2820:9): [True: 6.90k, False: 1.11k]
  ------------------
 2821|  7.67k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (2821:9): [True: 488, False: 7.52k]
  ------------------
 2822|  7.90k|        case TIFF_FLOAT:
  ------------------
  |  Branch (2822:9): [True: 228, False: 7.78k]
  ------------------
 2823|  7.97k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (2823:9): [True: 67, False: 7.94k]
  ------------------
 2824|  7.97k|            break;
 2825|     43|        default:
  ------------------
  |  Branch (2825:9): [True: 43, False: 7.97k]
  ------------------
 2826|     43|            return (TIFFReadDirEntryErrType);
 2827|  8.01k|    }
 2828|  7.97k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2829|  7.97k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2829:9): [True: 6.79k, False: 1.17k]
  |  Branch (2829:43): [True: 72, False: 1.10k]
  ------------------
 2830|  6.86k|    {
 2831|  6.86k|        *value = 0;
 2832|  6.86k|        return (err);
 2833|  6.86k|    }
 2834|  1.10k|    switch (direntry->tdir_type)
 2835|  1.10k|    {
 2836|     45|        case TIFF_FLOAT:
  ------------------
  |  Branch (2836:9): [True: 45, False: 1.06k]
  ------------------
 2837|     45|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     45|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2837:17): [True: 12, False: 33]
  ------------------
 2838|     12|                TIFFSwabArrayOfLong((uint32_t *)origdata, count);
 2839|     45|            TIFFCvtIEEEFloatToNative(tif, count, (float *)origdata);
 2840|     45|            *value = (float *)origdata;
 2841|     45|            return (TIFFReadDirEntryErrOk);
 2842|  1.06k|        default:
  ------------------
  |  Branch (2842:9): [True: 1.06k, False: 45]
  ------------------
 2843|  1.06k|            break;
 2844|  1.10k|    }
 2845|  1.06k|    data = (float *)_TIFFCheckMalloc(tif, count, sizeof(float),
 2846|  1.06k|                                     "TIFFReadDirEntryFloatArray");
 2847|  1.06k|    if (data == 0)
  ------------------
  |  Branch (2847:9): [True: 1, False: 1.06k]
  ------------------
 2848|      1|    {
 2849|      1|        _TIFFfreeExt(tif, origdata);
 2850|      1|        return (TIFFReadDirEntryErrAlloc);
 2851|      1|    }
 2852|  1.06k|    switch (direntry->tdir_type)
 2853|  1.06k|    {
 2854|     32|        case TIFF_BYTE:
  ------------------
  |  Branch (2854:9): [True: 32, False: 1.02k]
  ------------------
 2855|     32|        {
 2856|     32|            uint8_t *ma;
 2857|     32|            float *mb;
 2858|     32|            uint32_t n;
 2859|     32|            ma = (uint8_t *)origdata;
 2860|     32|            mb = data;
 2861|    389|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2861:25): [True: 357, False: 32]
  ------------------
 2862|    357|                *mb++ = (float)(*ma++);
 2863|     32|        }
 2864|     32|        break;
 2865|     27|        case TIFF_SBYTE:
  ------------------
  |  Branch (2865:9): [True: 27, False: 1.03k]
  ------------------
 2866|     27|        {
 2867|     27|            int8_t *ma;
 2868|     27|            float *mb;
 2869|     27|            uint32_t n;
 2870|     27|            ma = (int8_t *)origdata;
 2871|     27|            mb = data;
 2872|  2.68k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2872:25): [True: 2.65k, False: 27]
  ------------------
 2873|  2.65k|                *mb++ = (float)(*ma++);
 2874|     27|        }
 2875|     27|        break;
 2876|     24|        case TIFF_SHORT:
  ------------------
  |  Branch (2876:9): [True: 24, False: 1.03k]
  ------------------
 2877|     24|        {
 2878|     24|            uint16_t *ma;
 2879|     24|            float *mb;
 2880|     24|            uint32_t n;
 2881|     24|            ma = (uint16_t *)origdata;
 2882|     24|            mb = data;
 2883|    541|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2883:25): [True: 517, False: 24]
  ------------------
 2884|    517|            {
 2885|    517|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    517|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2885:21): [True: 208, False: 309]
  ------------------
 2886|    208|                    TIFFSwabShort(ma);
 2887|    517|                *mb++ = (float)(*ma++);
 2888|    517|            }
 2889|     24|        }
 2890|     24|        break;
 2891|     32|        case TIFF_SSHORT:
  ------------------
  |  Branch (2891:9): [True: 32, False: 1.02k]
  ------------------
 2892|     32|        {
 2893|     32|            int16_t *ma;
 2894|     32|            float *mb;
 2895|     32|            uint32_t n;
 2896|     32|            ma = (int16_t *)origdata;
 2897|     32|            mb = data;
 2898|    830|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2898:25): [True: 798, False: 32]
  ------------------
 2899|    798|            {
 2900|    798|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    798|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2900:21): [True: 537, False: 261]
  ------------------
 2901|    537|                    TIFFSwabShort((uint16_t *)ma);
 2902|    798|                *mb++ = (float)(*ma++);
 2903|    798|            }
 2904|     32|        }
 2905|     32|        break;
 2906|     28|        case TIFF_LONG:
  ------------------
  |  Branch (2906:9): [True: 28, False: 1.03k]
  ------------------
 2907|     28|        {
 2908|     28|            uint32_t *ma;
 2909|     28|            float *mb;
 2910|     28|            uint32_t n;
 2911|     28|            ma = (uint32_t *)origdata;
 2912|     28|            mb = data;
 2913|    616|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2913:25): [True: 588, False: 28]
  ------------------
 2914|    588|            {
 2915|    588|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    588|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2915:21): [True: 211, False: 377]
  ------------------
 2916|    211|                    TIFFSwabLong(ma);
 2917|    588|                *mb++ = (float)(*ma++);
 2918|    588|            }
 2919|     28|        }
 2920|     28|        break;
 2921|     23|        case TIFF_SLONG:
  ------------------
  |  Branch (2921:9): [True: 23, False: 1.03k]
  ------------------
 2922|     23|        {
 2923|     23|            int32_t *ma;
 2924|     23|            float *mb;
 2925|     23|            uint32_t n;
 2926|     23|            ma = (int32_t *)origdata;
 2927|     23|            mb = data;
 2928|    526|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2928:25): [True: 503, False: 23]
  ------------------
 2929|    503|            {
 2930|    503|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    503|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2930:21): [True: 263, False: 240]
  ------------------
 2931|    263|                    TIFFSwabLong((uint32_t *)ma);
 2932|    503|                *mb++ = (float)(*ma++);
 2933|    503|            }
 2934|     23|        }
 2935|     23|        break;
 2936|     37|        case TIFF_LONG8:
  ------------------
  |  Branch (2936:9): [True: 37, False: 1.02k]
  ------------------
 2937|     37|        {
 2938|     37|            uint64_t *ma;
 2939|     37|            float *mb;
 2940|     37|            uint32_t n;
 2941|     37|            ma = (uint64_t *)origdata;
 2942|     37|            mb = data;
 2943|    756|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2943:25): [True: 719, False: 37]
  ------------------
 2944|    719|            {
 2945|    719|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    719|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2945:21): [True: 207, False: 512]
  ------------------
 2946|    207|                    TIFFSwabLong8(ma);
 2947|    719|                *mb++ = (float)(*ma++);
 2948|    719|            }
 2949|     37|        }
 2950|     37|        break;
 2951|     30|        case TIFF_SLONG8:
  ------------------
  |  Branch (2951:9): [True: 30, False: 1.03k]
  ------------------
 2952|     30|        {
 2953|     30|            int64_t *ma;
 2954|     30|            float *mb;
 2955|     30|            uint32_t n;
 2956|     30|            ma = (int64_t *)origdata;
 2957|     30|            mb = data;
 2958|    720|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2958:25): [True: 690, False: 30]
  ------------------
 2959|    690|            {
 2960|    690|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    690|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2960:21): [True: 236, False: 454]
  ------------------
 2961|    236|                    TIFFSwabLong8((uint64_t *)ma);
 2962|    690|                *mb++ = (float)(*ma++);
 2963|    690|            }
 2964|     30|        }
 2965|     30|        break;
 2966|    486|        case TIFF_RATIONAL:
  ------------------
  |  Branch (2966:9): [True: 486, False: 574]
  ------------------
 2967|    486|        {
 2968|    486|            uint32_t *ma;
 2969|    486|            uint32_t maa;
 2970|    486|            uint32_t mab;
 2971|    486|            float *mb;
 2972|    486|            uint32_t n;
 2973|    486|            ma = (uint32_t *)origdata;
 2974|    486|            mb = data;
 2975|  5.12k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2975:25): [True: 4.64k, False: 486]
  ------------------
 2976|  4.64k|            {
 2977|  4.64k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  4.64k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2977:21): [True: 216, False: 4.42k]
  ------------------
 2978|    216|                    TIFFSwabLong(ma);
 2979|  4.64k|                maa = *ma++;
 2980|  4.64k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  4.64k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2980:21): [True: 216, False: 4.42k]
  ------------------
 2981|    216|                    TIFFSwabLong(ma);
 2982|  4.64k|                mab = *ma++;
 2983|  4.64k|                if (mab == 0)
  ------------------
  |  Branch (2983:21): [True: 479, False: 4.16k]
  ------------------
 2984|    479|                    *mb++ = 0.0;
 2985|  4.16k|                else
 2986|  4.16k|                    *mb++ = (float)maa / (float)mab;
 2987|  4.64k|            }
 2988|    486|        }
 2989|    486|        break;
 2990|    295|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (2990:9): [True: 295, False: 765]
  ------------------
 2991|    295|        {
 2992|    295|            uint32_t *ma;
 2993|    295|            int32_t maa;
 2994|    295|            uint32_t mab;
 2995|    295|            float *mb;
 2996|    295|            uint32_t n;
 2997|    295|            ma = (uint32_t *)origdata;
 2998|    295|            mb = data;
 2999|  5.32k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2999:25): [True: 5.02k, False: 295]
  ------------------
 3000|  5.02k|            {
 3001|  5.02k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  5.02k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3001:21): [True: 887, False: 4.14k]
  ------------------
 3002|    887|                    TIFFSwabLong(ma);
 3003|  5.02k|                maa = *(int32_t *)ma;
 3004|  5.02k|                ma++;
 3005|  5.02k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  5.02k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3005:21): [True: 887, False: 4.14k]
  ------------------
 3006|    887|                    TIFFSwabLong(ma);
 3007|  5.02k|                mab = *ma++;
 3008|  5.02k|                if (mab == 0)
  ------------------
  |  Branch (3008:21): [True: 407, False: 4.62k]
  ------------------
 3009|    407|                    *mb++ = 0.0;
 3010|  4.62k|                else
 3011|  4.62k|                    *mb++ = (float)maa / (float)mab;
 3012|  5.02k|            }
 3013|    295|        }
 3014|    295|        break;
 3015|     46|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3015:9): [True: 46, False: 1.01k]
  ------------------
 3016|     46|        {
 3017|     46|            double *ma;
 3018|     46|            float *mb;
 3019|     46|            uint32_t n;
 3020|     46|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     46|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3020:17): [True: 13, False: 33]
  ------------------
 3021|     13|                TIFFSwabArrayOfLong8((uint64_t *)origdata, count);
 3022|     46|            TIFFCvtIEEEDoubleToNative(tif, count, (double *)origdata);
 3023|     46|            ma = (double *)origdata;
 3024|     46|            mb = data;
 3025|  1.17k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3025:25): [True: 1.12k, False: 46]
  ------------------
 3026|  1.12k|            {
 3027|  1.12k|                double val = *ma++;
 3028|  1.12k|                if (val > (double)FLT_MAX)
  ------------------
  |  Branch (3028:21): [True: 347, False: 780]
  ------------------
 3029|    347|                    val = (double)FLT_MAX;
 3030|    780|                else if (val < -(double)FLT_MAX)
  ------------------
  |  Branch (3030:26): [True: 249, False: 531]
  ------------------
 3031|    249|                    val = -(double)FLT_MAX;
 3032|  1.12k|                *mb++ = (float)val;
 3033|  1.12k|            }
 3034|     46|        }
 3035|     46|        break;
 3036|      0|        default:
  ------------------
  |  Branch (3036:9): [True: 0, False: 1.06k]
  ------------------
 3037|      0|            break;
 3038|  1.06k|    }
 3039|  1.06k|    _TIFFfreeExt(tif, origdata);
 3040|  1.06k|    *value = data;
 3041|  1.06k|    return (TIFFReadDirEntryErrOk);
 3042|  1.06k|}
tif_dirread.c:TIFFReadDirEntryIfd8Array:
 3280|    352|{
 3281|    352|    enum TIFFReadDirEntryErr err;
 3282|    352|    uint32_t count;
 3283|    352|    void *origdata;
 3284|    352|    uint64_t *data;
 3285|    352|    switch (direntry->tdir_type)
 3286|    352|    {
 3287|      7|        case TIFF_LONG:
  ------------------
  |  Branch (3287:9): [True: 7, False: 345]
  ------------------
 3288|     10|        case TIFF_LONG8:
  ------------------
  |  Branch (3288:9): [True: 3, False: 349]
  ------------------
 3289|    180|        case TIFF_IFD:
  ------------------
  |  Branch (3289:9): [True: 170, False: 182]
  ------------------
 3290|    337|        case TIFF_IFD8:
  ------------------
  |  Branch (3290:9): [True: 157, False: 195]
  ------------------
 3291|    337|            break;
 3292|     15|        default:
  ------------------
  |  Branch (3292:9): [True: 15, False: 337]
  ------------------
 3293|     15|            return (TIFFReadDirEntryErrType);
 3294|    352|    }
 3295|    337|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 3296|    337|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (3296:9): [True: 140, False: 197]
  |  Branch (3296:43): [True: 45, False: 152]
  ------------------
 3297|    185|    {
 3298|    185|        *value = 0;
 3299|    185|        return (err);
 3300|    185|    }
 3301|    152|    switch (direntry->tdir_type)
 3302|    152|    {
 3303|      2|        case TIFF_LONG8:
  ------------------
  |  Branch (3303:9): [True: 2, False: 150]
  ------------------
 3304|     78|        case TIFF_IFD8:
  ------------------
  |  Branch (3304:9): [True: 76, False: 76]
  ------------------
 3305|     78|            *value = (uint64_t *)origdata;
 3306|     78|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     78|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3306:17): [True: 18, False: 60]
  ------------------
 3307|     18|                TIFFSwabArrayOfLong8(*value, count);
 3308|     78|            return (TIFFReadDirEntryErrOk);
 3309|     74|        default:
  ------------------
  |  Branch (3309:9): [True: 74, False: 78]
  ------------------
 3310|     74|            break;
 3311|    152|    }
 3312|     74|    data = (uint64_t *)_TIFFCheckMalloc(tif, count, sizeof(uint64_t),
 3313|     74|                                        "TIFFReadDirEntryIfd8Array");
 3314|     74|    if (data == 0)
  ------------------
  |  Branch (3314:9): [True: 0, False: 74]
  ------------------
 3315|      0|    {
 3316|      0|        _TIFFfreeExt(tif, origdata);
 3317|      0|        return (TIFFReadDirEntryErrAlloc);
 3318|      0|    }
 3319|     74|    switch (direntry->tdir_type)
 3320|     74|    {
 3321|      4|        case TIFF_LONG:
  ------------------
  |  Branch (3321:9): [True: 4, False: 70]
  ------------------
 3322|     74|        case TIFF_IFD:
  ------------------
  |  Branch (3322:9): [True: 70, False: 4]
  ------------------
 3323|     74|        {
 3324|     74|            uint32_t *ma;
 3325|     74|            uint64_t *mb;
 3326|     74|            uint32_t n;
 3327|     74|            ma = (uint32_t *)origdata;
 3328|     74|            mb = data;
 3329|  1.57k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3329:25): [True: 1.50k, False: 74]
  ------------------
 3330|  1.50k|            {
 3331|  1.50k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  1.50k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3331:21): [True: 292, False: 1.21k]
  ------------------
 3332|    292|                    TIFFSwabLong(ma);
 3333|  1.50k|                *mb++ = (uint64_t)(*ma++);
 3334|  1.50k|            }
 3335|     74|        }
 3336|     74|        break;
 3337|      0|        default:
  ------------------
  |  Branch (3337:9): [True: 0, False: 74]
  ------------------
 3338|      0|            break;
 3339|     74|    }
 3340|     74|    _TIFFfreeExt(tif, origdata);
 3341|     74|    *value = data;
 3342|     74|    return (TIFFReadDirEntryErrOk);
 3343|     74|}
tif_dirread.c:TIFFFetchStripThing:
 7810|  33.1k|{
 7811|  33.1k|    static const char module[] = "TIFFFetchStripThing";
 7812|  33.1k|    enum TIFFReadDirEntryErr err;
 7813|  33.1k|    uint64_t *data;
 7814|  33.1k|    err = TIFFReadDirEntryLong8ArrayWithLimit(tif, dir, &data, nstrips);
 7815|  33.1k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7815:9): [True: 401, False: 32.7k]
  ------------------
 7816|    401|    {
 7817|    401|        const TIFFField *fip = TIFFFieldWithTag(tif, dir->tdir_tag);
 7818|    401|        TIFFReadDirEntryOutputErr(tif, err, module,
 7819|    401|                                  fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (7819:35): [True: 401, False: 0]
  ------------------
 7820|    401|        return (0);
 7821|    401|    }
 7822|  32.7k|    if (dir->tdir_count < (uint64_t)nstrips)
  ------------------
  |  Branch (7822:9): [True: 4.66k, False: 28.0k]
  ------------------
 7823|  4.66k|    {
 7824|  4.66k|        uint64_t *resizeddata;
 7825|  4.66k|        const TIFFField *fip = TIFFFieldWithTag(tif, dir->tdir_tag);
 7826|  4.66k|        const char *pszMax = getenv("LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT");
 7827|  4.66k|        uint32_t max_nstrips = 1000000;
 7828|  4.66k|        if (pszMax)
  ------------------
  |  Branch (7828:13): [True: 0, False: 4.66k]
  ------------------
 7829|      0|            max_nstrips = _TIFFParseUInt32(pszMax, 1000000, UINT32_MAX);
 7830|  4.66k|        TIFFReadDirEntryOutputErr(tif, TIFFReadDirEntryErrCount, module,
 7831|  4.66k|                                  fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (7831:35): [True: 4.66k, False: 0]
  ------------------
 7832|  4.66k|                                  (nstrips <= max_nstrips));
 7833|       |
 7834|  4.66k|        if (nstrips > max_nstrips)
  ------------------
  |  Branch (7834:13): [True: 42, False: 4.61k]
  ------------------
 7835|     42|        {
 7836|     42|            _TIFFfreeExt(tif, data);
 7837|     42|            return (0);
 7838|     42|        }
 7839|       |
 7840|  4.61k|        const uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t);
 7841|  4.61k|        if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (7841:13): [True: 0, False: 4.61k]
  ------------------
 7842|      0|        {
 7843|       |            /* Before allocating a huge amount of memory for corrupted files,
 7844|       |             * check if size of requested memory is not greater than file size.
 7845|       |             */
 7846|      0|            const uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 7847|      0|            if (allocsize > filesize)
  ------------------
  |  Branch (7847:17): [True: 0, False: 0]
  ------------------
 7848|      0|            {
 7849|      0|                TIFFWarningExtR(
 7850|      0|                    tif, module,
 7851|      0|                    "Requested memory size for StripArray of %" PRIu64
 7852|      0|                    " is greater than filesize %" PRIu64
 7853|      0|                    ". Memory not allocated",
 7854|      0|                    allocsize, filesize);
 7855|      0|                _TIFFfreeExt(tif, data);
 7856|      0|                return (0);
 7857|      0|            }
 7858|      0|        }
 7859|  4.61k|        resizeddata = (uint64_t *)_TIFFCheckMalloc(
 7860|  4.61k|            tif, nstrips, sizeof(uint64_t), "for strip array");
 7861|  4.61k|        if (resizeddata == 0)
  ------------------
  |  Branch (7861:13): [True: 1, False: 4.61k]
  ------------------
 7862|      1|        {
 7863|      1|            _TIFFfreeExt(tif, data);
 7864|      1|            return (0);
 7865|      1|        }
 7866|  4.61k|        if (dir->tdir_count)
  ------------------
  |  Branch (7866:13): [True: 2.13k, False: 2.48k]
  ------------------
 7867|  2.13k|            _TIFFmemcpy(resizeddata, data,
 7868|  2.13k|                        (tmsize_t)((size_t)dir->tdir_count * sizeof(uint64_t)));
 7869|  4.61k|        _TIFFmemset(resizeddata + (uint32_t)dir->tdir_count, 0,
 7870|  4.61k|                    (tmsize_t)((size_t)(nstrips - (uint32_t)dir->tdir_count) *
 7871|  4.61k|                               sizeof(uint64_t)));
 7872|  4.61k|        _TIFFfreeExt(tif, data);
 7873|  4.61k|        data = resizeddata;
 7874|  4.61k|    }
 7875|  32.6k|    *lpp = data;
 7876|  32.6k|    return (1);
 7877|  32.7k|}
tif_dirread.c:ChopUpSingleUncompressedStrip:
 8034|  1.83k|{
 8035|  1.83k|    TIFFDirectory *td = &tif->tif_dir;
 8036|  1.83k|    uint64_t bytecount;
 8037|  1.83k|    uint64_t offset;
 8038|  1.83k|    uint32_t rowblock;
 8039|  1.83k|    uint64_t rowblockbytes;
 8040|  1.83k|    uint64_t stripbytes;
 8041|  1.83k|    uint32_t nstrips;
 8042|  1.83k|    uint32_t rowsperstrip;
 8043|       |
 8044|  1.83k|    bytecount = TIFFGetStrileByteCount(tif, 0);
 8045|       |    /* On a newly created file, just re-opened to be filled, we */
 8046|       |    /* don't want strip chop to trigger as it is going to cause issues */
 8047|       |    /* later ( StripOffsets and StripByteCounts improperly filled) . */
 8048|  1.83k|    if (bytecount == 0 && tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (8048:9): [True: 505, False: 1.33k]
  |  Branch (8048:27): [True: 0, False: 505]
  ------------------
 8049|      0|        return;
 8050|  1.83k|    offset = TIFFGetStrileOffset(tif, 0);
 8051|  1.83k|    assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
  ------------------
  |  Branch (8051:5): [True: 0, False: 1.83k]
  |  Branch (8051:5): [True: 1.83k, False: 0]
  ------------------
 8052|  1.83k|    if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|  1.83k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                  if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  285|    137|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  136|    137|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (8052:9): [True: 137, False: 1.70k]
  |  Branch (8052:54): [True: 137, False: 0]
  ------------------
 8053|    137|        rowblock = td->td_ycbcrsubsampling[1];
 8054|  1.70k|    else
 8055|  1.70k|        rowblock = 1;
 8056|  1.83k|    rowblockbytes = TIFFVTileSize64(tif, rowblock);
 8057|       |    /*
 8058|       |     * Make the rows hold at least one scanline, but fill specified amount
 8059|       |     * of data if possible.
 8060|       |     */
 8061|  1.83k|    if (rowblockbytes > STRIP_SIZE_DEFAULT)
  ------------------
  |  |  119|  1.83k|#define STRIP_SIZE_DEFAULT 8192
  ------------------
  |  Branch (8061:9): [True: 755, False: 1.08k]
  ------------------
 8062|    755|    {
 8063|    755|        stripbytes = rowblockbytes;
 8064|    755|        rowsperstrip = rowblock;
 8065|    755|    }
 8066|  1.08k|    else if (rowblockbytes > 0)
  ------------------
  |  Branch (8066:14): [True: 727, False: 356]
  ------------------
 8067|    727|    {
 8068|    727|        uint32_t rowblocksperstrip;
 8069|    727|        rowblocksperstrip = (uint32_t)(STRIP_SIZE_DEFAULT / rowblockbytes);
  ------------------
  |  |  119|    727|#define STRIP_SIZE_DEFAULT 8192
  ------------------
 8070|    727|        rowsperstrip = rowblocksperstrip * rowblock;
 8071|    727|        stripbytes = rowblocksperstrip * rowblockbytes;
 8072|    727|    }
 8073|    356|    else
 8074|    356|        return;
 8075|       |
 8076|       |    /*
 8077|       |     * never increase the number of rows per strip
 8078|       |     */
 8079|  1.48k|    if (rowsperstrip >= td->td_rowsperstrip || rowsperstrip == 0)
  ------------------
  |  Branch (8079:9): [True: 480, False: 1.00k]
  |  Branch (8079:48): [True: 0, False: 1.00k]
  ------------------
 8080|    480|        return;
 8081|  1.00k|    nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  316|  1.00k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 993, False: 9]
  |  |  ------------------
  |  |  317|  1.00k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  1.00k|         : 0U)
  ------------------
 8082|  1.00k|    if (nstrips == 0)
  ------------------
  |  Branch (8082:9): [True: 37, False: 965]
  ------------------
 8083|     37|        return;
 8084|       |
 8085|       |    /* If we are going to allocate a lot of memory, make sure that the */
 8086|       |    /* file is as big as needed */
 8087|    965|    if (tif->tif_mode == O_RDONLY && nstrips > 1000000 &&
  ------------------
  |  Branch (8087:9): [True: 965, False: 0]
  |  Branch (8087:38): [True: 506, False: 459]
  ------------------
 8088|    506|        (offset >= TIFFGetFileSize(tif) ||
  ------------------
  |  |  293|  1.01k|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
  |  Branch (8088:10): [True: 202, False: 304]
  ------------------
 8089|    304|         stripbytes > (TIFFGetFileSize(tif) - offset) / (nstrips - 1)))
  ------------------
  |  |  293|    304|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
  |  Branch (8089:10): [True: 304, False: 0]
  ------------------
 8090|    506|    {
 8091|    506|        return;
 8092|    506|    }
 8093|       |
 8094|    459|    allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 8095|    459|}
tif_dirread.c:allocChoppedUpStripArrays:
 7939|    606|{
 7940|    606|    TIFFDirectory *td = &tif->tif_dir;
 7941|    606|    uint64_t bytecount;
 7942|    606|    uint64_t offset;
 7943|    606|    uint64_t last_offset;
 7944|    606|    uint64_t last_bytecount;
 7945|    606|    uint32_t i;
 7946|    606|    uint64_t *newcounts;
 7947|    606|    uint64_t *newoffsets;
 7948|       |
 7949|    606|    offset = TIFFGetStrileOffset(tif, 0);
 7950|    606|    last_offset = TIFFGetStrileOffset(tif, td->td_nstrips - 1);
 7951|    606|    last_bytecount = TIFFGetStrileByteCount(tif, td->td_nstrips - 1);
 7952|    606|    if (last_offset > UINT64_MAX - last_bytecount ||
  ------------------
  |  Branch (7952:9): [True: 42, False: 564]
  ------------------
 7953|    564|        last_offset + last_bytecount < offset)
  ------------------
  |  Branch (7953:9): [True: 2, False: 562]
  ------------------
 7954|     44|    {
 7955|     44|        return;
 7956|     44|    }
 7957|    562|    bytecount = last_offset + last_bytecount - offset;
 7958|       |
 7959|       |    /* Before allocating a huge amount of memory for corrupted files, check if
 7960|       |     * size of StripByteCount and StripOffset tags is not greater than
 7961|       |     * file size.
 7962|       |     */
 7963|    562|    const uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t) * 2;
 7964|    562|    if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (7964:9): [True: 0, False: 562]
  ------------------
 7965|      0|    {
 7966|      0|        const uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 7967|      0|        if (allocsize > filesize)
  ------------------
  |  Branch (7967:13): [True: 0, False: 0]
  ------------------
 7968|      0|        {
 7969|      0|            TIFFWarningExtR(tif, "allocChoppedUpStripArrays",
 7970|      0|                            "Requested memory size for StripByteCount and "
 7971|      0|                            "StripOffsets %" PRIu64
 7972|      0|                            " is greater than filesize %" PRIu64
 7973|      0|                            ". Memory not allocated",
 7974|      0|                            allocsize, filesize);
 7975|      0|            return;
 7976|      0|        }
 7977|      0|    }
 7978|       |
 7979|    562|    newcounts =
 7980|    562|        (uint64_t *)_TIFFCheckMalloc(tif, nstrips, sizeof(uint64_t),
 7981|    562|                                     "for chopped \"StripByteCounts\" array");
 7982|    562|    newoffsets = (uint64_t *)_TIFFCheckMalloc(
 7983|    562|        tif, nstrips, sizeof(uint64_t), "for chopped \"StripOffsets\" array");
 7984|    562|    if (newcounts == NULL || newoffsets == NULL)
  ------------------
  |  Branch (7984:9): [True: 1, False: 561]
  |  Branch (7984:30): [True: 2, False: 559]
  ------------------
 7985|      3|    {
 7986|       |        /*
 7987|       |         * Unable to allocate new strip information, give up and use
 7988|       |         * the original one strip information.
 7989|       |         */
 7990|      3|        if (newcounts != NULL)
  ------------------
  |  Branch (7990:13): [True: 2, False: 1]
  ------------------
 7991|      2|            _TIFFfreeExt(tif, newcounts);
 7992|      3|        if (newoffsets != NULL)
  ------------------
  |  Branch (7992:13): [True: 0, False: 3]
  ------------------
 7993|      0|            _TIFFfreeExt(tif, newoffsets);
 7994|      3|        return;
 7995|      3|    }
 7996|       |
 7997|       |    /*
 7998|       |     * Fill the strip information arrays with new bytecounts and offsets
 7999|       |     * that reflect the broken-up format.
 8000|       |     */
 8001|  58.6M|    for (i = 0; i < nstrips; i++)
  ------------------
  |  Branch (8001:17): [True: 58.6M, False: 559]
  ------------------
 8002|  58.6M|    {
 8003|  58.6M|        if (stripbytes > bytecount)
  ------------------
  |  Branch (8003:13): [True: 501, False: 58.6M]
  ------------------
 8004|    501|            stripbytes = bytecount;
 8005|  58.6M|        newcounts[i] = stripbytes;
 8006|  58.6M|        newoffsets[i] = stripbytes ? offset : 0;
  ------------------
  |  Branch (8006:25): [True: 49.1M, False: 9.42M]
  ------------------
 8007|  58.6M|        offset += stripbytes;
 8008|  58.6M|        bytecount -= stripbytes;
 8009|  58.6M|    }
 8010|       |
 8011|       |    /*
 8012|       |     * Replace old single strip info with multi-strip info.
 8013|       |     */
 8014|    559|    td->td_stripsperimage = td->td_nstrips = nstrips;
 8015|    559|    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
  ------------------
  |  |  258|    559|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 8016|       |
 8017|    559|    _TIFFfreeExt(tif, td->td_stripbytecount_p);
 8018|    559|    _TIFFfreeExt(tif, td->td_stripoffset_p);
 8019|    559|    td->td_stripbytecount_p = newcounts;
 8020|    559|    td->td_stripoffset_p = newoffsets;
 8021|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 8022|       |    td->td_stripbytecountsorted = 1;
 8023|       |#endif
 8024|    559|    tif->tif_flags |= TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  156|    559|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
 8025|    559|}
tif_dirread.c:TryChopUpUncompressedBigTiff:
 8104|    708|{
 8105|    708|    TIFFDirectory *td = &tif->tif_dir;
 8106|    708|    uint32_t rowblock;
 8107|    708|    uint64_t rowblockbytes;
 8108|    708|    uint32_t i;
 8109|    708|    uint64_t stripsize;
 8110|    708|    uint32_t rowblocksperstrip;
 8111|    708|    uint32_t rowsperstrip;
 8112|    708|    uint64_t stripbytes;
 8113|    708|    uint32_t nstrips;
 8114|       |
 8115|    708|    stripsize = TIFFStripSize64(tif);
 8116|       |
 8117|    708|    assert(tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG);
  ------------------
  |  Branch (8117:5): [True: 0, False: 708]
  |  Branch (8117:5): [True: 708, False: 0]
  ------------------
 8118|    708|    assert(tif->tif_dir.td_compression == COMPRESSION_NONE);
  ------------------
  |  Branch (8118:5): [True: 0, False: 708]
  |  Branch (8118:5): [True: 708, False: 0]
  ------------------
 8119|    708|    assert((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) ==
  ------------------
  |  Branch (8119:5): [True: 0, False: 708]
  |  Branch (8119:5): [True: 708, False: 0]
  ------------------
 8120|    708|           TIFF_STRIPCHOP);
 8121|    708|    assert(stripsize > 0x7FFFFFFFUL);
  ------------------
  |  Branch (8121:5): [True: 0, False: 708]
  |  Branch (8121:5): [True: 708, False: 0]
  ------------------
 8122|       |
 8123|       |    /* On a newly created file, just re-opened to be filled, we */
 8124|       |    /* don't want strip chop to trigger as it is going to cause issues */
 8125|       |    /* later ( StripOffsets and StripByteCounts improperly filled) . */
 8126|    708|    if (TIFFGetStrileByteCount(tif, 0) == 0 && tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (8126:9): [True: 37, False: 671]
  |  Branch (8126:48): [True: 0, False: 37]
  ------------------
 8127|      0|        return;
 8128|       |
 8129|    708|    if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|    708|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                  if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  285|      7|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  136|      7|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (8129:9): [True: 7, False: 701]
  |  Branch (8129:54): [True: 7, False: 0]
  ------------------
 8130|      7|        rowblock = td->td_ycbcrsubsampling[1];
 8131|    701|    else
 8132|    701|        rowblock = 1;
 8133|    708|    rowblockbytes = TIFFVStripSize64(tif, rowblock);
 8134|    708|    if (rowblockbytes == 0 || rowblockbytes > 0x7FFFFFFFUL)
  ------------------
  |  Branch (8134:9): [True: 0, False: 708]
  |  Branch (8134:31): [True: 93, False: 615]
  ------------------
 8135|     93|    {
 8136|       |        /* In case of file with gigantic width */
 8137|     93|        return;
 8138|     93|    }
 8139|       |
 8140|       |    /* Check that the strips are contiguous and of the expected size */
 8141|  1.12k|    for (i = 0; i < td->td_nstrips; i++)
  ------------------
  |  Branch (8141:17): [True: 710, False: 415]
  ------------------
 8142|    710|    {
 8143|    710|        if (i == td->td_nstrips - 1)
  ------------------
  |  Branch (8143:13): [True: 446, False: 264]
  ------------------
 8144|    446|        {
 8145|    446|            if (TIFFGetStrileByteCount(tif, i) <
  ------------------
  |  Branch (8145:17): [True: 31, False: 415]
  ------------------
 8146|    446|                TIFFVStripSize64(tif,
 8147|    446|                                 td->td_imagelength - i * td->td_rowsperstrip))
 8148|     31|            {
 8149|     31|                return;
 8150|     31|            }
 8151|    446|        }
 8152|    264|        else
 8153|    264|        {
 8154|    264|            if (TIFFGetStrileByteCount(tif, i) != stripsize)
  ------------------
  |  Branch (8154:17): [True: 77, False: 187]
  ------------------
 8155|     77|            {
 8156|     77|                return;
 8157|     77|            }
 8158|    187|            if (i > 0 && TIFFGetStrileOffset(tif, i) !=
  ------------------
  |  Branch (8158:17): [True: 93, False: 94]
  |  Branch (8158:26): [True: 92, False: 1]
  ------------------
 8159|     93|                             TIFFGetStrileOffset(tif, i - 1) +
 8160|     93|                                 TIFFGetStrileByteCount(tif, i - 1))
 8161|     92|            {
 8162|     92|                return;
 8163|     92|            }
 8164|    187|        }
 8165|    710|    }
 8166|       |
 8167|       |    /* Aim for 512 MB strips (that will still be manageable by 32 bit builds */
 8168|    415|    rowblocksperstrip = (uint32_t)(512 * 1024 * 1024 / rowblockbytes);
 8169|    415|    if (rowblocksperstrip == 0)
  ------------------
  |  Branch (8169:9): [True: 23, False: 392]
  ------------------
 8170|     23|        rowblocksperstrip = 1;
 8171|    415|    rowsperstrip = rowblocksperstrip * rowblock;
 8172|    415|    stripbytes = rowblocksperstrip * rowblockbytes;
 8173|    415|    assert(stripbytes <= 0x7FFFFFFFUL);
  ------------------
  |  Branch (8173:5): [True: 0, False: 415]
  |  Branch (8173:5): [True: 415, False: 0]
  ------------------
 8174|       |
 8175|    415|    if (rowsperstrip == 0)
  ------------------
  |  Branch (8175:9): [True: 0, False: 415]
  ------------------
 8176|      0|        return;
 8177|    415|    nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  316|    415|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 384, False: 31]
  |  |  ------------------
  |  |  317|    415|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|    415|         : 0U)
  ------------------
 8178|    415|    if (nstrips == 0)
  ------------------
  |  Branch (8178:9): [True: 31, False: 384]
  ------------------
 8179|     31|        return;
 8180|       |
 8181|       |    /* If we are going to allocate a lot of memory, make sure that the */
 8182|       |    /* file is as big as needed */
 8183|    384|    if (tif->tif_mode == O_RDONLY && nstrips > 1000000)
  ------------------
  |  Branch (8183:9): [True: 384, False: 0]
  |  Branch (8183:38): [True: 237, False: 147]
  ------------------
 8184|    237|    {
 8185|    237|        uint64_t last_offset = TIFFGetStrileOffset(tif, td->td_nstrips - 1);
 8186|    237|        uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  293|    237|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 8187|    237|        uint64_t last_bytecount =
 8188|    237|            TIFFGetStrileByteCount(tif, td->td_nstrips - 1);
 8189|    237|        if (last_offset > filesize || last_bytecount > filesize - last_offset)
  ------------------
  |  Branch (8189:13): [True: 120, False: 117]
  |  Branch (8189:39): [True: 117, False: 0]
  ------------------
 8190|    237|        {
 8191|    237|            return;
 8192|    237|        }
 8193|    237|    }
 8194|       |
 8195|    147|    allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 8196|    147|}
tif_dirread.c:_TIFFGetStrileOffsetOrByteCountValue:
 8473|  70.4M|{
 8474|  70.4M|    TIFFDirectory *td = &tif->tif_dir;
 8475|  70.4M|    if (pbErr)
  ------------------
  |  Branch (8475:9): [True: 68.4M, False: 1.98M]
  ------------------
 8476|  68.4M|        *pbErr = 0;
 8477|       |
 8478|  70.4M|    if (strile >= td->td_nstrips)
  ------------------
  |  Branch (8478:9): [True: 0, False: 70.4M]
  ------------------
 8479|      0|    {
 8480|      0|        if (pbErr)
  ------------------
  |  Branch (8480:13): [True: 0, False: 0]
  ------------------
 8481|      0|            *pbErr = 1;
 8482|      0|        return 0;
 8483|      0|    }
 8484|       |
 8485|       |    /* Avoid the "dirent->tdir_count <= 4" code path for one of
 8486|       |     * StripOffsets/StripByteCounts, and the other code path for the other one,
 8487|       |     * which will lead to inconsistencies and potential out-of-bounds reads.
 8488|       |     */
 8489|  70.4M|    if ((td->td_stripoffset_entry.tdir_count <= 4) !=
  ------------------
  |  Branch (8489:9): [True: 121k, False: 70.2M]
  ------------------
 8490|  70.4M|        (td->td_stripbytecount_entry.tdir_count <= 4))
 8491|   121k|    {
 8492|   121k|        TIFFErrorExtR(tif, "_TIFFGetStrileOffsetOrByteCountValue",
 8493|   121k|                      "Inconsistent directory count between StripOffsets and "
 8494|   121k|                      "StripByteCounts");
 8495|   121k|        if (pbErr)
  ------------------
  |  Branch (8495:13): [True: 120k, False: 1.12k]
  ------------------
 8496|   120k|            *pbErr = 1;
 8497|   121k|        return 0;
 8498|   121k|    }
 8499|       |
 8500|  70.2M|    if ((tif->tif_flags & TIFF_DEFERSTRILELOAD) &&
  ------------------
  |  |  150|  70.2M|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (8500:9): [True: 0, False: 70.2M]
  ------------------
 8501|      0|        !(tif->tif_flags & TIFF_CHOPPEDUPARRAYS))
  ------------------
  |  |  156|      0|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
  |  Branch (8501:9): [True: 0, False: 0]
  ------------------
 8502|      0|    {
 8503|      0|        if (!(tif->tif_flags & TIFF_LAZYSTRILELOAD_ASKED) ||
  ------------------
  |  |  159|      0|    0x8000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
  |  Branch (8503:13): [True: 0, False: 0]
  ------------------
 8504|       |            /* If the values may fit in the toff_long/toff_long8 member */
 8505|       |            /* then use _TIFFFillStriles to simplify _TIFFFetchStrileValue */
 8506|      0|            dirent->tdir_count <= 4)
  ------------------
  |  Branch (8506:13): [True: 0, False: 0]
  ------------------
 8507|      0|        {
 8508|      0|            if (!_TIFFFillStriles(tif))
  ------------------
  |  Branch (8508:17): [True: 0, False: 0]
  ------------------
 8509|      0|            {
 8510|      0|                if (pbErr)
  ------------------
  |  Branch (8510:21): [True: 0, False: 0]
  ------------------
 8511|      0|                    *pbErr = 1;
 8512|       |                /* Do not return, as we want this function to always */
 8513|       |                /* return the same value if called several times with */
 8514|       |                /* the same arguments */
 8515|      0|            }
 8516|      0|        }
 8517|      0|        else
 8518|      0|        {
 8519|      0|            if (!_TIFFFetchStrileValue(tif, strile, dirent, parray))
  ------------------
  |  Branch (8519:17): [True: 0, False: 0]
  ------------------
 8520|      0|            {
 8521|      0|                if (pbErr)
  ------------------
  |  Branch (8521:21): [True: 0, False: 0]
  ------------------
 8522|      0|                    *pbErr = 1;
 8523|      0|                return 0;
 8524|      0|            }
 8525|      0|        }
 8526|      0|    }
 8527|  70.2M|    if (*parray == NULL)
  ------------------
  |  Branch (8527:9): [True: 1.21k, False: 70.2M]
  ------------------
 8528|  1.21k|    {
 8529|  1.21k|        if (pbErr)
  ------------------
  |  Branch (8529:13): [True: 1.21k, False: 0]
  ------------------
 8530|  1.21k|            *pbErr = 1;
 8531|  1.21k|        return 0;
 8532|  1.21k|    }
 8533|  70.2M|    return (*parray)[strile];
 8534|  70.2M|}
tif_dirread.c:_TIFFFillStrilesInternal:
 8573|  6.00k|{
 8574|  6.00k|    TIFFDirectory *td = &tif->tif_dir;
 8575|  6.00k|    int return_value = 1;
 8576|       |
 8577|       |    /* Do not do anything if TIFF_DEFERSTRILELOAD is not set */
 8578|  6.00k|    if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) ||
  ------------------
  |  |  150|  6.00k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (8578:9): [True: 6.00k, False: 0]
  ------------------
 8579|      0|        (tif->tif_flags & TIFF_CHOPPEDUPARRAYS) != 0)
  ------------------
  |  |  156|      0|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
  |  Branch (8579:9): [True: 0, False: 0]
  ------------------
 8580|  6.00k|        return 1;
 8581|       |
 8582|      0|    if ((tif->tif_flags & TIFF_LAZYSTRILELOAD_ASKED) &&
  ------------------
  |  |  159|      0|    0x8000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
  |  Branch (8582:9): [True: 0, False: 0]
  ------------------
 8583|      0|        !(tif->tif_flags & TIFF_LAZYSTRILELOAD_DONE))
  ------------------
  |  |  152|      0|    0x2000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
  |  Branch (8583:9): [True: 0, False: 0]
  ------------------
 8584|      0|    {
 8585|       |        /* In case of lazy loading, reload completely the arrays */
 8586|      0|        _TIFFfreeExt(tif, td->td_stripoffset_p);
 8587|      0|        _TIFFfreeExt(tif, td->td_stripbytecount_p);
 8588|      0|        td->td_stripoffset_p = NULL;
 8589|      0|        td->td_stripbytecount_p = NULL;
 8590|      0|        td->td_stripoffsetbyteallocsize = 0;
 8591|      0|        tif->tif_flags |= TIFF_LAZYSTRILELOAD_DONE;
  ------------------
  |  |  152|      0|    0x2000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
 8592|      0|    }
 8593|       |
 8594|       |    /* If stripoffset array is already loaded, exit with success */
 8595|      0|    if (td->td_stripoffset_p != NULL)
  ------------------
  |  Branch (8595:9): [True: 0, False: 0]
  ------------------
 8596|      0|        return 1;
 8597|       |
 8598|       |    /* If tdir_count was canceled, then we already got there, but in error */
 8599|      0|    if (td->td_stripoffset_entry.tdir_count == 0)
  ------------------
  |  Branch (8599:9): [True: 0, False: 0]
  ------------------
 8600|      0|        return 0;
 8601|       |
 8602|      0|    if (!TIFFFetchStripThing(tif, &(td->td_stripoffset_entry), td->td_nstrips,
  ------------------
  |  Branch (8602:9): [True: 0, False: 0]
  ------------------
 8603|      0|                             &td->td_stripoffset_p))
 8604|      0|    {
 8605|      0|        return_value = 0;
 8606|      0|    }
 8607|       |
 8608|      0|    if (loadStripByteCount &&
  ------------------
  |  Branch (8608:9): [True: 0, False: 0]
  ------------------
 8609|      0|        !TIFFFetchStripThing(tif, &(td->td_stripbytecount_entry),
  ------------------
  |  Branch (8609:9): [True: 0, False: 0]
  ------------------
 8610|      0|                             td->td_nstrips, &td->td_stripbytecount_p))
 8611|      0|    {
 8612|      0|        return_value = 0;
 8613|      0|    }
 8614|       |
 8615|      0|    _TIFFmemset(&(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
 8616|      0|    _TIFFmemset(&(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
 8617|       |
 8618|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 8619|       |    if (tif->tif_dir.td_nstrips > 1 && return_value == 1)
 8620|       |    {
 8621|       |        uint32_t strip;
 8622|       |
 8623|       |        tif->tif_dir.td_stripbytecountsorted = 1;
 8624|       |        for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++)
 8625|       |        {
 8626|       |            if (tif->tif_dir.td_stripoffset_p[strip - 1] >
 8627|       |                tif->tif_dir.td_stripoffset_p[strip])
 8628|       |            {
 8629|       |                tif->tif_dir.td_stripbytecountsorted = 0;
 8630|       |                break;
 8631|       |            }
 8632|       |        }
 8633|       |    }
 8634|       |#endif
 8635|       |
 8636|      0|    return return_value;
 8637|      0|}

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

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

_TIFFFax3fillruns:
  496|  36.8M|{
  497|  36.8M|    static const unsigned char _fillmasks[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
  498|  36.8M|                                               0xf8, 0xfc, 0xfe, 0xff};
  499|  36.8M|    unsigned char *cp;
  500|  36.8M|    uint32_t x, bx, run;
  501|  36.8M|    int32_t n, nw;
  502|  36.8M|    int64_t *lp;
  503|       |
  504|       |    /* Zero the final partial byte before filling it. */
  505|  36.8M|    if (lastx & 7U)
  ------------------
  |  Branch (505:9): [True: 36.1M, False: 660k]
  ------------------
  506|  36.1M|        buf[lastx >> 3] = 0;
  507|       |
  508|  36.8M|    if ((erun - runs) & 1)
  ------------------
  |  Branch (508:9): [True: 36.6M, False: 186k]
  ------------------
  509|  36.6M|        *erun++ = 0;
  510|  36.8M|    x = 0;
  511|  76.1M|    for (; runs < erun; runs += 2)
  ------------------
  |  Branch (511:12): [True: 39.3M, False: 36.8M]
  ------------------
  512|  39.3M|    {
  513|  39.3M|        run = runs[0];
  514|  39.3M|        if (x + run > lastx || run > lastx)
  ------------------
  |  Branch (514:13): [True: 616k, False: 38.7M]
  |  Branch (514:32): [True: 0, False: 38.7M]
  ------------------
  515|   616k|            run = runs[0] = (uint32_t)(lastx - x);
  516|  39.3M|        if (run)
  ------------------
  |  Branch (516:13): [True: 38.3M, False: 964k]
  ------------------
  517|  38.3M|        {
  518|  38.3M|            cp = buf + (x >> 3);
  519|  38.3M|            bx = x & 7;
  520|  38.3M|            if (run > 8 - bx)
  ------------------
  |  Branch (520:17): [True: 20.3M, False: 17.9M]
  ------------------
  521|  20.3M|            {
  522|  20.3M|                if (bx)
  ------------------
  |  Branch (522:21): [True: 941k, False: 19.4M]
  ------------------
  523|   941k|                { /* align to byte boundary */
  524|   941k|                    *cp++ &= (unsigned char)(0xff << (8 - bx));
  525|   941k|                    run -= 8 - bx;
  526|   941k|                }
  527|  20.3M|                if ((n = (int32_t)(run >> 3)) != 0)
  ------------------
  |  Branch (527:21): [True: 20.0M, False: 373k]
  ------------------
  528|  20.0M|                { /* multiple bytes to fill */
  529|  20.0M|                    if (((size_t)n / sizeof(int64_t)) > 1)
  ------------------
  |  Branch (529:25): [True: 1.77M, False: 18.2M]
  ------------------
  530|  1.77M|                    {
  531|       |                        /*
  532|       |                         * Align to int64_tword boundary and fill.
  533|       |                         */
  534|  5.86M|                        for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |  112|  5.86M|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (534:32): [True: 5.86M, False: 0]
  |  Branch (534:37): [True: 4.09M, False: 1.77M]
  ------------------
  535|  4.09M|                            *cp++ = 0x00;
  536|  1.77M|                        lp = (int64_t *)cp;
  537|  1.77M|                        nw = (int32_t)((size_t)n / sizeof(int64_t));
  538|  1.77M|                        n -= (int32_t)((size_t)nw * sizeof(int64_t));
  539|  1.77M|                        do
  540|   194M|                        {
  541|   194M|                            *lp++ = 0L;
  542|   194M|                        } while (--nw);
  ------------------
  |  Branch (542:34): [True: 192M, False: 1.77M]
  ------------------
  543|  1.77M|                        cp = (unsigned char *)lp;
  544|  1.77M|                    }
  545|  20.0M|                    ZERO(n, cp);
  ------------------
  |  |  484|  64.6M|    for (int32_t izero = 0; izero < (n); ++izero)                              \
  |  |  ------------------
  |  |  |  Branch (484:29): [True: 44.6M, False: 20.0M]
  |  |  ------------------
  |  |  485|  44.6M|    {                                                                          \
  |  |  486|  44.6M|        (cp)[izero] = 0;                                                       \
  |  |  487|  44.6M|    }                                                                          \
  |  |  488|  20.0M|    (cp) += (n);
  ------------------
  546|  20.0M|                    run &= 7;
  547|  20.0M|                }
  548|  20.3M|                if (run)
  ------------------
  |  Branch (548:21): [True: 19.6M, False: 681k]
  ------------------
  549|  19.6M|                    cp[0] &= (unsigned char)(0xff >> run);
  550|  20.3M|            }
  551|  17.9M|            else
  552|  17.9M|                cp[0] &= (unsigned char)~(_fillmasks[run] >> bx);
  553|  38.3M|            x += runs[0];
  554|  38.3M|        }
  555|  39.3M|        run = runs[1];
  556|  39.3M|        if (x + run > lastx || run > lastx)
  ------------------
  |  Branch (556:13): [True: 0, False: 39.3M]
  |  Branch (556:32): [True: 0, False: 39.3M]
  ------------------
  557|      0|            run = runs[1] = lastx - x;
  558|  39.3M|        if (run)
  ------------------
  |  Branch (558:13): [True: 1.55M, False: 37.7M]
  ------------------
  559|  1.55M|        {
  560|  1.55M|            cp = buf + (x >> 3);
  561|  1.55M|            bx = x & 7;
  562|  1.55M|            if (run > 8 - bx)
  ------------------
  |  Branch (562:17): [True: 607k, False: 943k]
  ------------------
  563|   607k|            {
  564|   607k|                if (bx)
  ------------------
  |  Branch (564:21): [True: 586k, False: 20.6k]
  ------------------
  565|   586k|                { /* align to byte boundary */
  566|   586k|                    *cp++ |= (unsigned char)(0xff >> bx);
  567|   586k|                    run -= 8 - bx;
  568|   586k|                }
  569|   607k|                if ((n = (int32_t)(run >> 3)) != 0)
  ------------------
  |  Branch (569:21): [True: 151k, False: 455k]
  ------------------
  570|   151k|                { /* multiple bytes to fill */
  571|   151k|                    if (((size_t)n / sizeof(int64_t)) > 1)
  ------------------
  |  Branch (571:25): [True: 48.9k, False: 102k]
  ------------------
  572|  48.9k|                    {
  573|       |                        /*
  574|       |                         * Align to int64_t boundary and fill.
  575|       |                         */
  576|   248k|                        for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |  112|   248k|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (576:32): [True: 248k, False: 0]
  |  Branch (576:37): [True: 199k, False: 48.9k]
  ------------------
  577|   199k|                            *cp++ = 0xff;
  578|  48.9k|                        lp = (int64_t *)cp;
  579|  48.9k|                        nw = (int32_t)((size_t)n / sizeof(int64_t));
  580|  48.9k|                        n -= (int32_t)((size_t)nw * sizeof(int64_t));
  581|  48.9k|                        do
  582|  11.1M|                        {
  583|  11.1M|                            *lp++ = -1L;
  584|  11.1M|                        } while (--nw);
  ------------------
  |  Branch (584:34): [True: 11.0M, False: 48.9k]
  ------------------
  585|  48.9k|                        cp = (unsigned char *)lp;
  586|  48.9k|                    }
  587|   151k|                    FILL(n, cp);
  ------------------
  |  |  477|   725k|    for (int32_t ifill = 0; ifill < (n); ++ifill)                              \
  |  |  ------------------
  |  |  |  Branch (477:29): [True: 574k, False: 151k]
  |  |  ------------------
  |  |  478|   574k|    {                                                                          \
  |  |  479|   574k|        (cp)[ifill] = 0xff;                                                    \
  |  |  480|   574k|    }                                                                          \
  |  |  481|   151k|    (cp) += (n);
  ------------------
  588|   151k|                    run &= 7;
  589|   151k|                }
  590|       |                /* Explicit 0xff masking to make icc -check=conversions happy */
  591|   607k|                if (run)
  ------------------
  |  Branch (591:21): [True: 586k, False: 20.5k]
  ------------------
  592|   586k|                    cp[0] = (unsigned char)((cp[0] | (0xff00 >> run)) & 0xff);
  593|   607k|            }
  594|   943k|            else
  595|   943k|                cp[0] |= (unsigned char)(_fillmasks[run] >> bx);
  596|  1.55M|            x += runs[1];
  597|  1.55M|        }
  598|  39.3M|    }
  599|       |    assert(x == lastx);
  ------------------
  |  Branch (599:5): [True: 0, False: 36.8M]
  |  Branch (599:5): [True: 36.8M, False: 0]
  ------------------
  600|  36.8M|}
TIFFInitCCITTFax3:
 1644|  1.40k|{
 1645|  1.40k|    (void)scheme;
 1646|  1.40k|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1646:9): [True: 1.40k, False: 0]
  ------------------
 1647|  1.40k|    {
 1648|       |        /*
 1649|       |         * Merge codec-specific tag information.
 1650|       |         */
 1651|  1.40k|        if (!_TIFFMergeFields(tif, fax3Fields, TIFFArrayCount(fax3Fields)))
  ------------------
  |  |  354|  1.40k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1651:13): [True: 0, False: 1.40k]
  ------------------
 1652|      0|        {
 1653|      0|            TIFFErrorExtR(tif, "TIFFInitCCITTFax3",
 1654|      0|                          "Merging CCITT Fax 3 codec-specific tags failed");
 1655|      0|            return 0;
 1656|      0|        }
 1657|       |
 1658|       |        /*
 1659|       |         * The default format is Class/F-style w/o RTC.
 1660|       |         */
 1661|  1.40k|        return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  697|  1.40k|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
                      return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  703|  1.40k|#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
  |  |  ------------------
  |  |  |  |  699|  1.40k|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  |  |  ------------------
  ------------------
 1662|  1.40k|    }
 1663|      0|    else
 1664|      0|        return 0;
 1665|  1.40k|}
TIFFInitCCITTFax4:
 1811|    865|{
 1812|    865|    (void)scheme;
 1813|    865|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1813:9): [True: 865, False: 0]
  ------------------
 1814|    865|    { /* reuse G3 support */
 1815|       |        /*
 1816|       |         * Merge codec-specific tag information.
 1817|       |         */
 1818|    865|        if (!_TIFFMergeFields(tif, fax4Fields, TIFFArrayCount(fax4Fields)))
  ------------------
  |  |  354|    865|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1818:13): [True: 0, False: 865]
  ------------------
 1819|      0|        {
 1820|      0|            TIFFErrorExtR(tif, "TIFFInitCCITTFax4",
 1821|      0|                          "Merging CCITT Fax 4 codec-specific tags failed");
 1822|      0|            return 0;
 1823|      0|        }
 1824|       |
 1825|    865|        tif->tif_decoderow = Fax4Decode;
 1826|    865|        tif->tif_decodestrip = Fax4Decode;
 1827|    865|        tif->tif_decodetile = Fax4Decode;
 1828|    865|        tif->tif_encoderow = Fax4Encode;
 1829|    865|        tif->tif_encodestrip = Fax4Encode;
 1830|    865|        tif->tif_encodetile = Fax4Encode;
 1831|    865|        tif->tif_postencode = Fax4PostEncode;
 1832|    865|        tif->tif_getmaxcompressionratio = Fax4GetMaxCompressionRatio;
 1833|       |        /*
 1834|       |         * Suppress RTC at the end of each strip.
 1835|       |         */
 1836|    865|        return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  697|    865|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
                      return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  699|    865|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
 1837|    865|    }
 1838|      0|    else
 1839|      0|        return (0);
 1840|    865|}
TIFFInitCCITTRLE:
 1928|    248|{
 1929|    248|    (void)scheme;
 1930|    248|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1930:9): [True: 248, False: 0]
  ------------------
 1931|    248|    { /* reuse G3 support */
 1932|    248|        tif->tif_decoderow = Fax3DecodeRLE;
 1933|    248|        tif->tif_decodestrip = Fax3DecodeRLE;
 1934|    248|        tif->tif_decodetile = Fax3DecodeRLE;
 1935|    248|        tif->tif_getmaxcompressionratio = Fax3RLEGetMaxCompressionRatio;
 1936|       |        /*
 1937|       |         * Suppress RTC+EOLs when encoding and byte-align data.
 1938|       |         */
 1939|    248|        return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  697|    248|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
 1940|    248|                            FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  699|    248|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  700|    248|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  701|    248|#define FAXMODE_BYTEALIGN 0x0004     /* byte align row */
  ------------------
 1941|    248|    }
 1942|      0|    else
 1943|      0|        return (0);
 1944|    248|}
TIFFInitCCITTRLEW:
 1947|     95|{
 1948|     95|    (void)scheme;
 1949|     95|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1949:9): [True: 95, False: 0]
  ------------------
 1950|     95|    { /* reuse G3 support */
 1951|     95|        tif->tif_decoderow = Fax3DecodeRLE;
 1952|     95|        tif->tif_decodestrip = Fax3DecodeRLE;
 1953|     95|        tif->tif_decodetile = Fax3DecodeRLE;
 1954|     95|        tif->tif_getmaxcompressionratio = Fax3RLEGetMaxCompressionRatio;
 1955|       |        /*
 1956|       |         * Suppress RTC+EOLs when encoding and word-align data.
 1957|       |         */
 1958|     95|        return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  697|     95|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
 1959|     95|                            FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  699|     95|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  700|     95|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  702|     95|#define FAXMODE_WORDALIGN 0x0008     /* word align row */
  ------------------
 1960|     95|    }
 1961|      0|    else
 1962|      0|        return (0);
 1963|     95|}
tif_fax3.c:InitCCITTFax3:
 1575|  2.61k|{
 1576|  2.61k|    static const char module[] = "InitCCITTFax3";
 1577|  2.61k|    Fax3BaseState *sp;
 1578|       |
 1579|       |    /*
 1580|       |     * Merge codec-specific tag information.
 1581|       |     */
 1582|  2.61k|    if (!_TIFFMergeFields(tif, faxFields, TIFFArrayCount(faxFields)))
  ------------------
  |  |  354|  2.61k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1582:9): [True: 0, False: 2.61k]
  ------------------
 1583|      0|    {
 1584|      0|        TIFFErrorExtR(tif, "InitCCITTFax3",
 1585|      0|                      "Merging common CCITT Fax codec-specific tags failed");
 1586|      0|        return 0;
 1587|      0|    }
 1588|       |
 1589|       |    /*
 1590|       |     * Allocate state block so tag methods have storage to record values.
 1591|       |     */
 1592|  2.61k|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(Fax3CodecState));
 1593|       |
 1594|  2.61k|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1594:9): [True: 0, False: 2.61k]
  ------------------
 1595|      0|    {
 1596|      0|        TIFFErrorExtR(tif, module, "No space for state block");
 1597|      0|        return (0);
 1598|      0|    }
 1599|  2.61k|    _TIFFmemset(tif->tif_data, 0, sizeof(Fax3CodecState));
 1600|       |
 1601|  2.61k|    sp = Fax3State(tif);
  ------------------
  |  |   72|  2.61k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1602|  2.61k|    sp->rw_mode = tif->tif_mode;
 1603|       |
 1604|       |    /*
 1605|       |     * Override parent get/set field methods.
 1606|       |     */
 1607|  2.61k|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1608|  2.61k|    tif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */
 1609|  2.61k|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1610|  2.61k|    tif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */
 1611|  2.61k|    sp->printdir = tif->tif_tagmethods.printdir;
 1612|  2.61k|    tif->tif_tagmethods.printdir = Fax3PrintDir; /* hook for codec tags */
 1613|  2.61k|    sp->groupoptions = 0;
 1614|       |
 1615|  2.61k|    if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */
  ------------------
  |  Branch (1615:9): [True: 2.61k, False: 0]
  ------------------
 1616|  2.61k|        tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
  ------------------
  |  |  130|  2.61k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 1617|  2.61k|    DecoderState(tif)->runs = NULL;
  ------------------
  |  |  108|  2.61k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|  2.61k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1618|  2.61k|    TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
  ------------------
  |  |  713|  2.61k|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
 1619|  2.61k|    EncoderState(tif)->refline = NULL;
  ------------------
  |  |  109|  2.61k|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|  2.61k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1620|       |
 1621|       |    /*
 1622|       |     * Install codec methods.
 1623|       |     */
 1624|  2.61k|    tif->tif_fixuptags = Fax3FixupTags;
 1625|  2.61k|    tif->tif_setupdecode = Fax3SetupState;
 1626|  2.61k|    tif->tif_predecode = Fax3PreDecode;
 1627|  2.61k|    tif->tif_decoderow = Fax3Decode1D;
 1628|  2.61k|    tif->tif_decodestrip = Fax3Decode1D;
 1629|  2.61k|    tif->tif_decodetile = Fax3Decode1D;
 1630|  2.61k|    tif->tif_setupencode = Fax3SetupState;
 1631|  2.61k|    tif->tif_preencode = Fax3PreEncode;
 1632|  2.61k|    tif->tif_postencode = Fax3PostEncode;
 1633|  2.61k|    tif->tif_encoderow = Fax3Encode;
 1634|  2.61k|    tif->tif_encodestrip = Fax3Encode;
 1635|  2.61k|    tif->tif_encodetile = Fax3Encode;
 1636|  2.61k|    tif->tif_close = Fax3Close;
 1637|  2.61k|    tif->tif_cleanup = Fax3Cleanup;
 1638|  2.61k|    tif->tif_getmaxcompressionratio = Fax3GetMaxCompressionRatio;
 1639|       |
 1640|  2.61k|    return (1);
 1641|  2.61k|}
tif_fax3.c:Fax3VGetField:
 1461|  24.8k|{
 1462|  24.8k|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|  24.8k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1463|       |
 1464|  24.8k|    assert(sp != 0);
  ------------------
  |  Branch (1464:5): [True: 0, False: 24.8k]
  |  Branch (1464:5): [True: 24.8k, False: 0]
  ------------------
 1465|       |
 1466|  24.8k|    switch (tag)
 1467|  24.8k|    {
 1468|      0|        case TIFFTAG_FAXMODE:
  ------------------
  |  |  697|      0|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
  |  Branch (1468:9): [True: 0, False: 24.8k]
  ------------------
 1469|      0|            *va_arg(ap, int *) = sp->mode;
 1470|      0|            break;
 1471|      0|        case TIFFTAG_FAXFILLFUNC:
  ------------------
  |  |  713|      0|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
  |  Branch (1471:9): [True: 0, False: 24.8k]
  ------------------
 1472|      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)
  |  |  ------------------
  ------------------
 1473|      0|            break;
 1474|      0|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|      0|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1474:9): [True: 0, False: 24.8k]
  ------------------
 1475|      0|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|      0|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1475:9): [True: 0, False: 24.8k]
  ------------------
 1476|      0|            *va_arg(ap, uint32_t *) = sp->groupoptions;
 1477|      0|            break;
 1478|      0|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      0|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1478:9): [True: 0, False: 24.8k]
  ------------------
 1479|      0|            *va_arg(ap, uint32_t *) = sp->badfaxlines;
 1480|      0|            break;
 1481|      0|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|      0|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1481:9): [True: 0, False: 24.8k]
  ------------------
 1482|      0|            *va_arg(ap, uint16_t *) = sp->cleanfaxdata;
 1483|      0|            break;
 1484|      0|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|      0|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1484:9): [True: 0, False: 24.8k]
  ------------------
 1485|      0|            *va_arg(ap, uint32_t *) = sp->badfaxrun;
 1486|      0|            break;
 1487|  24.8k|        default:
  ------------------
  |  Branch (1487:9): [True: 24.8k, False: 0]
  ------------------
 1488|  24.8k|            return (*sp->vgetparent)(tif, tag, ap);
 1489|  24.8k|    }
 1490|      0|    return (1);
 1491|  24.8k|}
tif_fax3.c:Fax3VSetField:
 1413|  19.7k|{
 1414|  19.7k|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|  19.7k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1415|  19.7k|    const TIFFField *fip;
 1416|       |
 1417|  19.7k|    assert(sp != 0);
  ------------------
  |  Branch (1417:5): [True: 0, False: 19.7k]
  |  Branch (1417:5): [True: 19.7k, False: 0]
  ------------------
 1418|  19.7k|    assert(sp->vsetparent != 0);
  ------------------
  |  Branch (1418:5): [True: 0, False: 19.7k]
  |  Branch (1418:5): [True: 19.7k, False: 0]
  ------------------
 1419|       |
 1420|  19.7k|    switch (tag)
 1421|  19.7k|    {
 1422|  2.61k|        case TIFFTAG_FAXMODE:
  ------------------
  |  |  697|  2.61k|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
  |  Branch (1422:9): [True: 2.61k, False: 17.1k]
  ------------------
 1423|  2.61k|            sp->mode = (int)va_arg(ap, int);
 1424|  2.61k|            return 1; /* NB: pseudo tag */
 1425|  2.61k|        case TIFFTAG_FAXFILLFUNC:
  ------------------
  |  |  713|  2.61k|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
  |  Branch (1425:9): [True: 2.61k, False: 17.1k]
  ------------------
 1426|  2.61k|            DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
  ------------------
  |  |  108|  2.61k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|  2.61k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1427|  2.61k|            return 1; /* NB: pseudo tag */
 1428|    923|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|    923|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1428:9): [True: 923, False: 18.8k]
  ------------------
 1429|       |            /* XXX: avoid reading options if compression mismatches. */
 1430|    923|            if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  184|    923|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1430:17): [True: 923, False: 0]
  ------------------
 1431|    923|                sp->groupoptions = (uint32_t)va_arg(ap, uint32_t);
 1432|    923|            break;
 1433|      1|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|      1|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1433:9): [True: 1, False: 19.7k]
  ------------------
 1434|       |            /* XXX: avoid reading options if compression mismatches. */
 1435|      1|            if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
  ------------------
  |  |  186|      1|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1435:17): [True: 1, False: 0]
  ------------------
 1436|      1|                sp->groupoptions = (uint32_t)va_arg(ap, uint32_t);
 1437|      1|            break;
 1438|      6|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      6|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1438:9): [True: 6, False: 19.7k]
  ------------------
 1439|      6|            sp->badfaxlines = (uint32_t)va_arg(ap, uint32_t);
 1440|      6|            break;
 1441|      7|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|      7|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1441:9): [True: 7, False: 19.7k]
  ------------------
 1442|      7|            sp->cleanfaxdata = (uint16_t)va_arg(ap, uint16_vap);
 1443|      7|            break;
 1444|      4|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|      4|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1444:9): [True: 4, False: 19.7k]
  ------------------
 1445|      4|            sp->badfaxrun = (uint32_t)va_arg(ap, uint32_t);
 1446|      4|            break;
 1447|  13.6k|        default:
  ------------------
  |  Branch (1447:9): [True: 13.6k, False: 6.17k]
  ------------------
 1448|  13.6k|            return (*sp->vsetparent)(tif, tag, ap);
 1449|  19.7k|    }
 1450|       |
 1451|    941|    if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
  ------------------
  |  Branch (1451:9): [True: 941, False: 0]
  ------------------
 1452|    941|        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  268|    941|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|    941|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|    941|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1453|      0|    else
 1454|      0|        return 0;
 1455|       |
 1456|    941|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  125|    941|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1457|    941|    return 1;
 1458|    941|}
tif_fax3.c:Fax3FixupTags:
  605|  2.49k|{
  606|  2.49k|    (void)tif;
  607|  2.49k|    return (1);
  608|  2.49k|}
tif_fax3.c:Fax3SetupState:
  618|  2.46k|{
  619|  2.46k|    static const char module[] = "Fax3SetupState";
  620|  2.46k|    TIFFDirectory *td = &tif->tif_dir;
  621|  2.46k|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|  2.46k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
  622|  2.46k|    int needsRefLine;
  623|  2.46k|    Fax3CodecState *dsp = (Fax3CodecState *)Fax3State(tif);
  ------------------
  |  |   72|  2.46k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
  624|  2.46k|    tmsize_t rowbytes;
  625|  2.46k|    uint32_t rowpixels;
  626|  2.46k|    uint32_t totalRuns;
  627|       |
  628|  2.46k|    if (td->td_bitspersample != 1)
  ------------------
  |  Branch (628:9): [True: 11, False: 2.45k]
  ------------------
  629|     11|    {
  630|     11|        TIFFErrorExtR(tif, module,
  631|     11|                      "Bits/sample must be 1 for Group 3/4 encoding/decoding");
  632|     11|        return (0);
  633|     11|    }
  634|  2.45k|    if (td->td_samplesperpixel != 1 &&
  ------------------
  |  Branch (634:9): [True: 2, False: 2.44k]
  ------------------
  635|      2|        td->td_planarconfig != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|      2|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (635:9): [True: 1, False: 1]
  ------------------
  636|      1|    {
  637|      1|        TIFFErrorExtR(
  638|      1|            tif, module,
  639|      1|            "Samples/pixel shall be 1 for Group 3/4 encoding/decoding, "
  640|      1|            "or PlanarConfiguration must be set to Separate.");
  641|      1|        return 0;
  642|      1|    }
  643|       |    /*
  644|       |     * Calculate the scanline/tile widths.
  645|       |     */
  646|  2.44k|    if (isTiled(tif))
  ------------------
  |  |  282|  2.44k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  2.44k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 1.31k, False: 1.13k]
  |  |  ------------------
  ------------------
  647|  1.31k|    {
  648|  1.31k|        rowbytes = TIFFTileRowSize(tif);
  649|  1.31k|        rowpixels = td->td_tilewidth;
  650|  1.31k|    }
  651|  1.13k|    else
  652|  1.13k|    {
  653|  1.13k|        rowbytes = TIFFScanlineSize(tif);
  654|  1.13k|        rowpixels = td->td_imagewidth;
  655|  1.13k|    }
  656|  2.44k|    if ((int64_t)rowbytes < ((int64_t)rowpixels + 7) / 8)
  ------------------
  |  Branch (656:9): [True: 0, False: 2.44k]
  ------------------
  657|      0|    {
  658|      0|        TIFFErrorExtR(tif, module,
  659|      0|                      "Inconsistent number of bytes per row : rowbytes=%" PRId64
  660|      0|                      " rowpixels=%" PRIu32,
  661|      0|                      (int64_t)rowbytes, rowpixels);
  662|      0|        return (0);
  663|      0|    }
  664|  2.44k|    sp->rowbytes = rowbytes;
  665|  2.44k|    sp->rowpixels = rowpixels;
  666|       |    /*
  667|       |     * Allocate any additional space required for decoding/encoding.
  668|       |     */
  669|  2.44k|    needsRefLine = ((sp->groupoptions & GROUP3OPT_2DENCODING) ||
  ------------------
  |  |  281|  2.44k|#define GROUP3OPT_2DENCODING 0x1           /* 2-dimensional coding */
  ------------------
  |  Branch (669:21): [True: 908, False: 1.54k]
  ------------------
  670|  1.54k|                    td->td_compression == COMPRESSION_CCITTFAX4);
  ------------------
  |  |  186|  1.54k|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (670:21): [True: 810, False: 731]
  ------------------
  671|       |
  672|       |    /*
  673|       |      Assure that allocation computations do not overflow.
  674|       |
  675|       |      TIFFroundup and _TIFFMultiply32 return zero on integer overflow
  676|       |    */
  677|  2.44k|    if (dsp->runs != NULL)
  ------------------
  |  Branch (677:9): [True: 2, False: 2.44k]
  ------------------
  678|      2|    {
  679|      2|        _TIFFfreeExt(tif, dsp->runs);
  680|      2|        dsp->runs = (uint32_t *)NULL;
  681|      2|    }
  682|  2.44k|    dsp->nruns = TIFFroundup_32(rowpixels + 1, 32);
  ------------------
  |  |  326|  2.44k|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  316|  2.44k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (316:6): [True: 2.44k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  317|  2.44k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  318|  2.44k|         : 0U)
  |  |  ------------------
  ------------------
  683|  2.44k|    if (needsRefLine)
  ------------------
  |  Branch (683:9): [True: 1.71k, False: 731]
  ------------------
  684|  1.71k|    {
  685|  1.71k|        dsp->nruns = _TIFFMultiply32(tif, dsp->nruns, 2, module);
  686|  1.71k|    }
  687|       |    /* totalRuns is the size actually allocated and cleared below. */
  688|  2.44k|    totalRuns = _TIFFMultiply32(tif, dsp->nruns, 2, module);
  689|  2.44k|    if ((dsp->nruns == 0) || (totalRuns == 0))
  ------------------
  |  Branch (689:9): [True: 0, False: 2.44k]
  |  Branch (689:30): [True: 0, False: 2.44k]
  ------------------
  690|      0|    {
  691|      0|        TIFFErrorExtR(tif, tif->tif_name,
  692|      0|                      "Row pixels integer overflow (rowpixels %" PRIu32 ")",
  693|      0|                      rowpixels);
  694|      0|        return (0);
  695|      0|    }
  696|  2.44k|    dsp->runs = (uint32_t *)_TIFFCheckMalloc(
  697|  2.44k|        tif, totalRuns, sizeof(uint32_t), "for Group 3/4 run arrays");
  698|  2.44k|    if (dsp->runs == NULL)
  ------------------
  |  Branch (698:9): [True: 18, False: 2.43k]
  ------------------
  699|     18|        return (0);
  700|  2.43k|    memset(dsp->runs, 0, totalRuns * sizeof(uint32_t));
  701|  2.43k|    dsp->curruns = dsp->runs;
  702|  2.43k|    if (needsRefLine)
  ------------------
  |  Branch (702:9): [True: 1.70k, False: 722]
  ------------------
  703|  1.70k|        dsp->refruns = dsp->runs + dsp->nruns;
  704|    722|    else
  705|    722|        dsp->refruns = NULL;
  706|  2.43k|    if (td->td_compression == COMPRESSION_CCITTFAX3 && is2DEncoding(dsp))
  ------------------
  |  |  184|  4.86k|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
                  if (td->td_compression == COMPRESSION_CCITTFAX3 && is2DEncoding(dsp))
  ------------------
  |  |  111|  1.33k|#define is2DEncoding(sp) (sp->b.groupoptions & GROUP3OPT_2DENCODING)
  |  |  ------------------
  |  |  |  |  281|  1.33k|#define GROUP3OPT_2DENCODING 0x1           /* 2-dimensional coding */
  |  |  ------------------
  |  |  |  Branch (111:26): [True: 905, False: 426]
  |  |  ------------------
  ------------------
  |  Branch (706:9): [True: 1.33k, False: 1.10k]
  ------------------
  707|    905|    { /* NB: default is 1D routine */
  708|    905|        tif->tif_decoderow = Fax3Decode2D;
  709|    905|        tif->tif_decodestrip = Fax3Decode2D;
  710|    905|        tif->tif_decodetile = Fax3Decode2D;
  711|    905|    }
  712|       |
  713|  2.43k|    if (needsRefLine)
  ------------------
  |  Branch (713:9): [True: 1.70k, False: 722]
  ------------------
  714|  1.70k|    { /* 2d encoding */
  715|  1.70k|        Fax3CodecState *esp = EncoderState(tif);
  ------------------
  |  |  109|  1.70k|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|  1.70k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  716|       |        /*
  717|       |         * 2d encoding requires a scanline
  718|       |         * buffer for the ``reference line''; the
  719|       |         * scanline against which delta encoding
  720|       |         * is referenced.  The reference line must
  721|       |         * be initialized to be ``white'' (done elsewhere).
  722|       |         */
  723|  1.70k|        if (esp->refline != NULL)
  ------------------
  |  Branch (723:13): [True: 0, False: 1.70k]
  ------------------
  724|      0|        {
  725|      0|            _TIFFfreeExt(tif, esp->refline);
  726|      0|        }
  727|  1.70k|        esp->refline = (unsigned char *)_TIFFmallocExt(tif, rowbytes);
  728|  1.70k|        if (esp->refline == NULL)
  ------------------
  |  Branch (728:13): [True: 5, False: 1.70k]
  ------------------
  729|      5|        {
  730|      5|            TIFFErrorExtR(tif, module, "No space for Group 3/4 reference line");
  731|      5|            return (0);
  732|      5|        }
  733|  1.70k|    }
  734|    722|    else /* 1d encoding */
  735|    722|        EncoderState(tif)->refline = NULL;
  ------------------
  |  |  109|    722|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    722|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  736|       |
  737|  2.42k|    return (1);
  738|  2.43k|}
tif_fax3.c:Fax3Decode2D:
  409|  63.4k|{
  410|  63.4k|    DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
  ------------------
  |  |  139|  63.4k|    DECLARE_STATE(tif, sp, mod);                                               \
  |  |  ------------------
  |  |  |  |  123|  63.4k|    static const char module[] = mod;                                          \
  |  |  |  |  124|  63.4k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  63.4k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|  63.4k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  125|  63.4k|    int a0;                                   /* reference element */          \
  |  |  |  |  126|  63.4k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  |  |  127|  63.4k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  |  |  128|  63.4k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  |  |  129|  63.4k|    int RunLength;                            /* length of current run */      \
  |  |  |  |  130|  63.4k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  |  |  131|  63.4k|    unsigned char *ep;                        /* end of input data */          \
  |  |  |  |  132|  63.4k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  |  |  133|  63.4k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  |  |  134|  63.4k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  |  |  135|  63.4k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  |  |  136|  63.4k|    const TIFFFaxTabEnt *TabEnt
  |  |  ------------------
  |  |  140|  63.4k|    int b1; /* next change on prev line */                                     \
  |  |  141|  63.4k|    uint32_t                                                                   \
  |  |  142|  63.4k|        *pb /* next run in reference line */ /*                                \
  ------------------
  411|  63.4k|    int is1D; /* current line is 1d/2d-encoded */
  412|  63.4k|    (void)s;
  413|       |    /* buf is advanced as rows are decoded, so whether the caller supplied a
  414|       |     * buffer at all has to be remembered here. */
  415|  63.4k|    const int has_buf = (buf != NULL);
  416|  63.4k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (416:9): [True: 0, False: 63.4k]
  ------------------
  417|      0|    {
  418|      0|        Fax3ClearUnwritten(has_buf, buf, occ);
  419|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  420|      0|        return (-1);
  421|      0|    }
  422|  63.4k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (422:9): [True: 1, False: 63.4k]
  ------------------
  423|      1|    {
  424|      1|        Fax3ClearUnwritten(has_buf, buf, occ);
  425|      1|        return (-1);
  426|      1|    }
  427|  64.3k|RETRY_WITHOUT_EOL_2D:
  428|  64.3k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  64.3k|    do                                                                         \
  |  |  148|  64.3k|    {                                                                          \
  |  |  149|  64.3k|        BitAcc = sp->data;                                                     \
  |  |  150|  64.3k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  64.3k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  64.3k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  64.3k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  64.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 64.3k]
  |  |  ------------------
  ------------------
  429|  1.60M|    while (occ > 0)
  ------------------
  |  Branch (429:12): [True: 1.58M, False: 27.5k]
  ------------------
  430|  1.58M|    {
  431|  1.58M|        a0 = 0;
  432|  1.58M|        RunLength = 0;
  433|  1.58M|        pa = thisrun = sp->curruns;
  434|       |#ifdef FAX3_DEBUG
  435|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d EOLcnt = %d", BitAcc,
  436|       |               BitsAvail, EOLcnt);
  437|       |#endif
  438|  1.58M|        SYNC_EOL(EOF2D, RETRY_WITHOUT_EOL_2D);
  ------------------
  |  |  293|  1.58M|    do                                                                         \
  |  |  294|  1.58M|    {                                                                          \
  |  |  295|  1.58M|        if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */      \
  |  |  ------------------
  |  |  |  |  700|  1.58M|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  |  Branch (295:13): [True: 35.0k, False: 1.54M]
  |  |  ------------------
  |  |  296|  1.58M|        {                                                                      \
  |  |  297|  35.0k|            if (EOLcnt == 0)                                                   \
  |  |  ------------------
  |  |  |  Branch (297:17): [True: 21.2k, False: 13.7k]
  |  |  ------------------
  |  |  298|  35.0k|            {                                                                  \
  |  |  299|  21.2k|                for (;;)                                                       \
  |  |  300|   117M|                {                                                              \
  |  |  301|   117M|                    NeedBits16(11, eoflab);                                    \
  |  |  ------------------
  |  |  |  |  164|   117M|    do                                                                         \
  |  |  |  |  165|   117M|    {                                                                          \
  |  |  |  |  166|   117M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (166:13): [True: 14.7M, False: 103M]
  |  |  |  |  ------------------
  |  |  |  |  167|   117M|        {                                                                      \
  |  |  |  |  168|  14.7M|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  14.7M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 4.49k, False: 14.7M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  169|  14.7M|            {                                                                  \
  |  |  |  |  170|  4.49k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:21): [True: 289, False: 4.20k]
  |  |  |  |  ------------------
  |  |  |  |  171|  4.49k|                    goto eoflab;                                               \
  |  |  |  |  172|  4.49k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  173|  4.20k|            }                                                                  \
  |  |  |  |  174|  14.7M|            else                                                               \
  |  |  |  |  175|  14.7M|            {                                                                  \
  |  |  |  |  176|  14.7M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  177|  14.7M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:21): [True: 4.28k, False: 14.7M]
  |  |  |  |  ------------------
  |  |  |  |  178|  14.7M|                {                                                              \
  |  |  |  |  179|  4.28k|                    if (EndOfData())                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  4.28k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 81, False: 4.20k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  180|  4.28k|                    {                                                          \
  |  |  |  |  181|     81|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  182|     81|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  183|     81|                    }                                                          \
  |  |  |  |  184|  4.28k|                    else                                                       \
  |  |  |  |  185|  4.28k|                    {                                                          \
  |  |  |  |  186|  4.20k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  187|  4.20k|                        BitsAvail += 8;                                        \
  |  |  |  |  188|  4.20k|                    }                                                          \
  |  |  |  |  189|  4.28k|                }                                                              \
  |  |  |  |  190|  14.7M|            }                                                                  \
  |  |  |  |  191|  14.7M|        }                                                                      \
  |  |  |  |  192|   117M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:14): [Folded, False: 117M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|   117M|                    if (GetBits(11) == 0)                                      \
  |  |  ------------------
  |  |  |  |  194|   117M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (302:25): [True: 20.9k, False: 117M]
  |  |  ------------------
  |  |  303|   117M|                        break; /* EOL found */                                 \
  |  |  304|   117M|                    ClrBits(1);                                                \
  |  |  ------------------
  |  |  |  |  196|   117M|    do                                                                         \
  |  |  |  |  197|   117M|    {                                                                          \
  |  |  |  |  198|   117M|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|   117M|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|   117M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 117M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|   117M|                }                                                              \
  |  |  306|  21.2k|            }                                                                  \
  |  |  307|  35.0k|            /* Now move after EOL or detect missing EOL. */                    \
  |  |  308|  35.0k|            for (;;)                                                           \
  |  |  309|  84.0k|            {                                                                  \
  |  |  310|  84.0k|                NeedBits8(8, noEOLFound);                                      \
  |  |  ------------------
  |  |  |  |  144|  84.0k|    do                                                                         \
  |  |  |  |  145|  84.0k|    {                                                                          \
  |  |  |  |  146|  84.0k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 48.3k, False: 35.6k]
  |  |  |  |  ------------------
  |  |  |  |  147|  84.0k|        {                                                                      \
  |  |  |  |  148|  48.3k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  48.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 1.90k, False: 46.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  48.3k|            {                                                                  \
  |  |  |  |  150|  1.90k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 848, False: 1.05k]
  |  |  |  |  ------------------
  |  |  |  |  151|  1.90k|                    goto eoflab;                                               \
  |  |  |  |  152|  1.90k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|  1.05k|            }                                                                  \
  |  |  |  |  154|  48.3k|            else                                                               \
  |  |  |  |  155|  48.3k|            {                                                                  \
  |  |  |  |  156|  46.4k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  46.4k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  46.4k|            }                                                                  \
  |  |  |  |  159|  48.3k|        }                                                                      \
  |  |  |  |  160|  84.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 83.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|  84.0k|                if (GetBits(8))                                                \
  |  |  ------------------
  |  |  |  |  194|  83.1k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 33.9k, False: 49.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|  83.1k|                    break;                                                     \
  |  |  313|  83.1k|                ClrBits(8);                                                    \
  |  |  ------------------
  |  |  |  |  196|  49.2k|    do                                                                         \
  |  |  |  |  197|  49.2k|    {                                                                          \
  |  |  |  |  198|  49.2k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  49.2k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  49.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 49.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|  49.2k|            }                                                                  \
  |  |  315|   165k|            while (GetBits(1) == 0)                                            \
  |  |  ------------------
  |  |  |  |  194|   165k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (315:20): [True: 131k, False: 33.9k]
  |  |  ------------------
  |  |  316|   131k|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|   165k|    do                                                                         \
  |  |  |  |  197|   165k|    {                                                                          \
  |  |  |  |  198|   131k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|   131k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|   131k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 131k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  33.9k|            ClrBits(1); /* EOL bit */                                          \
  |  |  ------------------
  |  |  |  |  196|  33.9k|    do                                                                         \
  |  |  |  |  197|  33.9k|    {                                                                          \
  |  |  |  |  198|  33.9k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  33.9k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  33.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 33.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  33.9k|            EOLcnt = 0; /* reset EOL counter/flag */                           \
  |  |  319|  33.9k|            break;      /* existing EOL skipped, leave macro */                \
  |  |  320|  34.7k|        noEOLFound:                                                            \
  |  |  321|    848|            sp->b.mode |= FAXMODE_NOEOL;                                       \
  |  |  ------------------
  |  |  |  |  700|    848|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  322|    848|            tryG3WithoutEOL(a0);                                               \
  |  |  ------------------
  |  |  |  |  289|    848|    do                                                                         \
  |  |  |  |  290|    848|    {                                                                          \
  |  |  |  |  291|    848|        Fax3TryG3WithoutEOL(module, tif, (uint32_t)sp->line, (uint32_t)(a0));  \
  |  |  |  |  292|    848|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (292:14): [Folded, False: 848]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|    848|            goto retrywithouteol;                                              \
  |  |  324|  34.7k|        }                                                                      \
  |  |  325|  1.58M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (325:14): [Folded, False: 1.54M]
  |  |  ------------------
  ------------------
  439|  1.58M|        NeedBits8(1, EOF2D);
  ------------------
  |  |  144|  1.58M|    do                                                                         \
  |  |  145|  1.58M|    {                                                                          \
  |  |  146|  1.58M|        if (BitsAvail < (n))                                                   \
  |  |  ------------------
  |  |  |  Branch (146:13): [True: 141k, False: 1.43M]
  |  |  ------------------
  |  |  147|  1.58M|        {                                                                      \
  |  |  148|   141k|            if (EndOfData())                                                   \
  |  |  ------------------
  |  |  |  |  117|   141k|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 3.34k, False: 138k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  149|   141k|            {                                                                  \
  |  |  150|  3.34k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  ------------------
  |  |  |  Branch (150:21): [True: 3.34k, False: 0]
  |  |  ------------------
  |  |  151|  3.34k|                    goto eoflab;                                               \
  |  |  152|  3.34k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  153|      0|            }                                                                  \
  |  |  154|   141k|            else                                                               \
  |  |  155|   141k|            {                                                                  \
  |  |  156|   138k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  157|   138k|                BitsAvail += 8;                                                \
  |  |  158|   138k|            }                                                                  \
  |  |  159|   141k|        }                                                                      \
  |  |  160|  1.58M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (160:14): [Folded, False: 1.57M]
  |  |  ------------------
  ------------------
  440|  1.57M|        is1D = GetBits(1); /* 1D/2D-encoding tag bit */
  ------------------
  |  |  194|  1.57M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  ------------------
  441|  1.57M|        ClrBits(1);
  ------------------
  |  |  196|  1.57M|    do                                                                         \
  |  |  197|  1.57M|    {                                                                          \
  |  |  198|  1.57M|        BitsAvail -= (n);                                                      \
  |  |  199|  1.57M|        BitAcc >>= (n);                                                        \
  |  |  200|  1.57M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 1.57M]
  |  |  ------------------
  ------------------
  442|       |#ifdef FAX3_DEBUG
  443|       |        printf(" %s\n-------------------- %" PRIu32 "\n", is1D ? "1D" : "2D",
  444|       |               tif->tif_dir.td_row);
  445|       |        fflush(stdout);
  446|       |#endif
  447|  1.57M|        pb = sp->refruns;
  448|  1.57M|        b1 = (int)*pb++;
  449|  1.57M|        if (is1D)
  ------------------
  |  Branch (449:13): [True: 467k, False: 1.10M]
  ------------------
  450|   467k|            EXPAND1D(EOF2Da);
  ------------------
  |  |  371|   467k|    do                                                                         \
  |  |  372|   467k|    {                                                                          \
  |  |  373|   467k|        for (;;)                                                               \
  |  |  374|   899k|        {                                                                      \
  |  |  375|   899k|            for (;;)                                                           \
  |  |  376|  11.6M|            {                                                                  \
  |  |  377|  11.6M|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  11.6M|    do                                                                         \
  |  |  |  |  255|  11.6M|    {                                                                          \
  |  |  |  |  256|  11.6M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  11.6M|    do                                                                         \
  |  |  |  |  |  |  165|  11.6M|    {                                                                          \
  |  |  |  |  |  |  166|  11.6M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 11.3M, False: 359k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  11.6M|        {                                                                      \
  |  |  |  |  |  |  168|  11.3M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  11.3M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 10.9k, False: 11.2M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  11.3M|            {                                                                  \
  |  |  |  |  |  |  170|  10.9k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 728, False: 10.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  10.9k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  10.9k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  10.2k|            }                                                                  \
  |  |  |  |  |  |  174|  11.3M|            else                                                               \
  |  |  |  |  |  |  175|  11.3M|            {                                                                  \
  |  |  |  |  |  |  176|  11.2M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  11.2M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 645k, False: 10.6M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  11.2M|                {                                                              \
  |  |  |  |  |  |  179|   645k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   645k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 946, False: 644k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|   645k|                    {                                                          \
  |  |  |  |  |  |  181|    946|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    946|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    946|                    }                                                          \
  |  |  |  |  |  |  184|   645k|                    else                                                       \
  |  |  |  |  |  |  185|   645k|                    {                                                          \
  |  |  |  |  |  |  186|   644k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|   644k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|   644k|                    }                                                          \
  |  |  |  |  |  |  189|   645k|                }                                                              \
  |  |  |  |  |  |  190|  11.2M|            }                                                                  \
  |  |  |  |  |  |  191|  11.3M|        }                                                                      \
  |  |  |  |  |  |  192|  11.6M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 11.6M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  11.6M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  11.6M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  11.6M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  11.6M|    do                                                                         \
  |  |  |  |  |  |  197|  11.6M|    {                                                                          \
  |  |  |  |  |  |  198|  11.6M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  11.6M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  11.6M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 11.6M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  11.6M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 11.6M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  11.6M|                switch (TabEnt->State)                                         \
  |  |  379|  11.6M|                {                                                              \
  |  |  380|  32.7k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  32.7k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 32.7k, False: 11.6M]
  |  |  ------------------
  |  |  381|  32.7k|                        EOLcnt = 1;                                            \
  |  |  382|  32.7k|                        goto done1d;                                           \
  |  |  383|   848k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|   848k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 848k, False: 10.8M]
  |  |  ------------------
  |  |  384|   848k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   848k|    do                                                                         \
  |  |  |  |  267|   848k|    {                                                                          \
  |  |  |  |  268|   848k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 848k]
  |  |  |  |  ------------------
  |  |  |  |  269|   848k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   848k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   848k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   848k|        RunLength = 0;                                                         \
  |  |  |  |  279|   848k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 848k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|   848k|                        goto doneWhite1d;                                      \
  |  |  386|  9.66M|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|  9.66M|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 9.66M, False: 2.00M]
  |  |  ------------------
  |  |  387|  10.7M|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  10.7M|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 1.10M, False: 10.5M]
  |  |  ------------------
  |  |  388|  10.7M|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|  10.7M|                        RunLength =                                            \
  |  |  390|  10.7M|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|  10.7M|                        break;                                                 \
  |  |  392|  9.66M|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 17.8k, False: 11.6M]
  |  |  ------------------
  |  |  393|  17.8k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  17.8k|    do                                                                         \
  |  |  |  |  221|  17.8k|    {                                                                          \
  |  |  |  |  222|  17.8k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  17.8k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  17.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 17.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  17.8k|                        goto done1d;                                           \
  |  |  395|  11.6M|                }                                                              \
  |  |  396|  11.6M|            }                                                                  \
  |  |  397|   899k|        doneWhite1d:                                                           \
  |  |  398|   848k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 303k, False: 544k]
  |  |  ------------------
  |  |  399|   848k|                goto done1d;                                                   \
  |  |  400|   848k|            for (;;)                                                           \
  |  |  401|   556k|            {                                                                  \
  |  |  402|   556k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   556k|    do                                                                         \
  |  |  |  |  255|   556k|    {                                                                          \
  |  |  |  |  256|   556k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   556k|    do                                                                         \
  |  |  |  |  |  |  165|   556k|    {                                                                          \
  |  |  |  |  |  |  166|   556k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 318k, False: 238k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   556k|        {                                                                      \
  |  |  |  |  |  |  168|   318k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   318k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 6.56k, False: 311k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   318k|            {                                                                  \
  |  |  |  |  |  |  170|  6.56k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 310, False: 6.25k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  6.56k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  6.56k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  6.25k|            }                                                                  \
  |  |  |  |  |  |  174|   318k|            else                                                               \
  |  |  |  |  |  |  175|   318k|            {                                                                  \
  |  |  |  |  |  |  176|   311k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   311k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 8.24k, False: 303k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   311k|                {                                                              \
  |  |  |  |  |  |  179|  8.24k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  8.24k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 483, False: 7.75k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  8.24k|                    {                                                          \
  |  |  |  |  |  |  181|    483|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    483|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    483|                    }                                                          \
  |  |  |  |  |  |  184|  8.24k|                    else                                                       \
  |  |  |  |  |  |  185|  8.24k|                    {                                                          \
  |  |  |  |  |  |  186|  7.75k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  7.75k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  7.75k|                    }                                                          \
  |  |  |  |  |  |  189|  8.24k|                }                                                              \
  |  |  |  |  |  |  190|   311k|            }                                                                  \
  |  |  |  |  |  |  191|   318k|        }                                                                      \
  |  |  |  |  |  |  192|   556k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 555k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   556k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   555k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   555k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   555k|    do                                                                         \
  |  |  |  |  |  |  197|   555k|    {                                                                          \
  |  |  |  |  |  |  198|   555k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   555k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   555k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 555k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   555k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 555k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|   556k|                switch (TabEnt->State)                                         \
  |  |  404|   555k|                {                                                              \
  |  |  405|  28.3k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  28.3k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 28.3k, False: 527k]
  |  |  ------------------
  |  |  406|  28.3k|                        EOLcnt = 1;                                            \
  |  |  407|  28.3k|                        goto done1d;                                           \
  |  |  408|   506k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|   506k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 506k, False: 49.3k]
  |  |  ------------------
  |  |  409|   506k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   506k|    do                                                                         \
  |  |  |  |  267|   506k|    {                                                                          \
  |  |  |  |  268|   506k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 506k]
  |  |  |  |  ------------------
  |  |  |  |  269|   506k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   506k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   506k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   506k|        RunLength = 0;                                                         \
  |  |  |  |  279|   506k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 506k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|   506k|                        goto doneBlack1d;                                      \
  |  |  411|   506k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|  3.12k|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 3.12k, False: 552k]
  |  |  ------------------
  |  |  412|  11.4k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  11.4k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 8.35k, False: 547k]
  |  |  ------------------
  |  |  413|  11.4k|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|  11.4k|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|  11.4k|                        break;                                                 \
  |  |  416|  9.60k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 9.60k, False: 546k]
  |  |  ------------------
  |  |  417|  9.60k|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  9.60k|    do                                                                         \
  |  |  |  |  221|  9.60k|    {                                                                          \
  |  |  |  |  222|  9.60k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  9.60k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  9.60k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 9.60k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|  9.60k|                        goto done1d;                                           \
  |  |  419|   555k|                }                                                              \
  |  |  420|   555k|            }                                                                  \
  |  |  421|   544k|        doneBlack1d:                                                           \
  |  |  422|   506k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 74.8k, False: 431k]
  |  |  ------------------
  |  |  423|   506k|                goto done1d;                                                   \
  |  |  424|   506k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 620, False: 431k]
  |  |  |  Branch (424:35): [True: 209, False: 411]
  |  |  ------------------
  |  |  425|   431k|                pa -= 2;                                                       \
  |  |  426|   431k|        }                                                                      \
  |  |  427|   467k|    eof1d:                                                                     \
  |  |  428|  1.03k|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|  1.03k|    do                                                                         \
  |  |  |  |  272|  1.03k|    {                                                                          \
  |  |  |  |  273|  1.03k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  1.03k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  1.03k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 1.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|  1.03k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|  1.03k|    do                                                                         \
  |  |  |  |  334|  1.03k|    {                                                                          \
  |  |  |  |  335|  1.03k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 695, False: 343]
  |  |  |  |  ------------------
  |  |  |  |  336|  1.03k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    695|    do                                                                         \
  |  |  |  |  |  |  267|    695|    {                                                                          \
  |  |  |  |  |  |  268|    695|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 695]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    695|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    695|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    695|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    695|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    695|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 695]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  1.03k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 964, False: 74]
  |  |  |  |  ------------------
  |  |  |  |  338|  1.03k|        {                                                                      \
  |  |  |  |  339|    964|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    964|    do                                                                         \
  |  |  |  |  |  |  254|    964|    {                                                                          \
  |  |  |  |  |  |  255|    964|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    964|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    964|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    964|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 964]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  1.58k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 616, False: 964]
  |  |  |  |  |  Branch (340:39): [True: 616, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    964|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    964|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 964, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    964|            {                                                                  \
  |  |  |  |  344|    964|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 964]
  |  |  |  |  ------------------
  |  |  |  |  345|    964|                    a0 = 0;                                                    \
  |  |  |  |  346|    964|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 233, False: 731]
  |  |  |  |  ------------------
  |  |  |  |  347|    964|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    233|    do                                                                         \
  |  |  |  |  |  |  267|    233|    {                                                                          \
  |  |  |  |  |  |  268|    233|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 233]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    233|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    233|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    233|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    233|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    233|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 233]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    964|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    964|    do                                                                         \
  |  |  |  |  |  |  267|    964|    {                                                                          \
  |  |  |  |  |  |  268|    964|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 964]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    964|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    964|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    964|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    964|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    964|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 964]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    964|            }                                                                  \
  |  |  |  |  350|    964|            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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|    964|        }                                                                      \
  |  |  |  |  356|  1.03k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 1.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|  1.03k|        goto eoflab;                                                           \
  |  |  431|   466k|    done1d:                                                                    \
  |  |  432|   466k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   466k|    do                                                                         \
  |  |  |  |  334|   466k|    {                                                                          \
  |  |  |  |  335|   466k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 9.33k, False: 457k]
  |  |  |  |  ------------------
  |  |  |  |  336|   466k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  9.33k|    do                                                                         \
  |  |  |  |  |  |  267|  9.33k|    {                                                                          \
  |  |  |  |  |  |  268|  9.33k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 9.33k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  9.33k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  9.33k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  9.33k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  9.33k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  9.33k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 9.33k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   466k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 433k, False: 33.1k]
  |  |  |  |  ------------------
  |  |  |  |  338|   466k|        {                                                                      \
  |  |  |  |  339|   433k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   433k|    do                                                                         \
  |  |  |  |  |  |  254|   433k|    {                                                                          \
  |  |  |  |  |  |  255|   433k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   433k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   433k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   433k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 433k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   786k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 352k, False: 433k]
  |  |  |  |  |  Branch (340:39): [True: 352k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   433k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   433k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 433k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|   433k|            {                                                                  \
  |  |  |  |  344|   433k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 433k]
  |  |  |  |  ------------------
  |  |  |  |  345|   433k|                    a0 = 0;                                                    \
  |  |  |  |  346|   433k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 97.6k, False: 336k]
  |  |  |  |  ------------------
  |  |  |  |  347|   433k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  97.6k|    do                                                                         \
  |  |  |  |  |  |  267|  97.6k|    {                                                                          \
  |  |  |  |  |  |  268|  97.6k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 97.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  97.6k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  97.6k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  97.6k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  97.6k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  97.6k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 97.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   433k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   433k|    do                                                                         \
  |  |  |  |  |  |  267|   433k|    {                                                                          \
  |  |  |  |  |  |  268|   433k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 433k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   433k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   433k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   433k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   433k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   433k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 433k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   433k|            }                                                                  \
  |  |  |  |  350|   433k|            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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|   433k|        }                                                                      \
  |  |  |  |  356|   466k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 466k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|   466k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 466k]
  |  |  ------------------
  ------------------
  451|  1.10M|        else
  452|  1.10M|            EXPAND2D(EOF2Da);
  ------------------
  |  |  463|  1.10M|    do                                                                         \
  |  |  464|  1.10M|    {                                                                          \
  |  |  465|  2.83M|        while (a0 < (int)lastx)                                                \
  |  |  ------------------
  |  |  |  Branch (465:16): [True: 2.32M, False: 506k]
  |  |  ------------------
  |  |  466|  2.32M|        {                                                                      \
  |  |  467|  2.32M|            if (pa >= thisrun + sp->nruns)                                     \
  |  |  ------------------
  |  |  |  Branch (467:17): [True: 548, False: 2.32M]
  |  |  ------------------
  |  |  468|  2.32M|            {                                                                  \
  |  |  469|    548|                TIFFErrorExtR(tif, module,                                     \
  |  |  470|    548|                              "Buffer overflow at line %d of %s %u", sp->line, \
  |  |  471|    548|                              isTiled(tif) ? "tile" : "strip",                 \
  |  |  ------------------
  |  |  |  |  282|    548|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    548|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 206, False: 342]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|    548|                              isTiled(tif) ? tif->tif_dir.td_curtile           \
  |  |  ------------------
  |  |  |  |  282|    548|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    548|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 206, False: 342]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|    548|                                           : tif->tif_dir.td_curstrip);        \
  |  |  474|    548|                return (-1);                                                   \
  |  |  475|    548|            }                                                                  \
  |  |  476|  2.32M|            LOOKUP8(7, TIFFFaxMainTable, eof2d);                               \
  |  |  ------------------
  |  |  |  |  247|  2.32M|    do                                                                         \
  |  |  |  |  248|  2.32M|    {                                                                          \
  |  |  |  |  249|  2.32M|        NeedBits8(wid, eoflab);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  2.32M|    do                                                                         \
  |  |  |  |  |  |  145|  2.32M|    {                                                                          \
  |  |  |  |  |  |  146|  2.32M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:13): [True: 1.03M, False: 1.29M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  2.32M|        {                                                                      \
  |  |  |  |  |  |  148|  1.03M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  1.03M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 37.5k, False: 995k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  149|  1.03M|            {                                                                  \
  |  |  |  |  |  |  150|  37.5k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:21): [True: 5.70k, False: 31.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  37.5k|                    goto eoflab;                                               \
  |  |  |  |  |  |  152|  37.5k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  153|  31.8k|            }                                                                  \
  |  |  |  |  |  |  154|  1.03M|            else                                                               \
  |  |  |  |  |  |  155|  1.03M|            {                                                                  \
  |  |  |  |  |  |  156|   995k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  157|   995k|                BitsAvail += 8;                                                \
  |  |  |  |  |  |  158|   995k|            }                                                                  \
  |  |  |  |  |  |  159|  1.03M|        }                                                                      \
  |  |  |  |  |  |  160|  2.32M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (160:14): [Folded, False: 2.31M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  250|  2.32M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  2.31M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  251|  2.31M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  2.31M|    do                                                                         \
  |  |  |  |  |  |  197|  2.31M|    {                                                                          \
  |  |  |  |  |  |  198|  2.31M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  2.31M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  2.31M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 2.31M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|  2.31M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (252:14): [Folded, False: 2.31M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|  2.32M|            switch (TabEnt->State)                                             \
  |  |  478|  2.31M|            {                                                                  \
  |  |  479|   100k|                case S_Pass:                                                   \
  |  |  ------------------
  |  |  |  |   71|   100k|#define S_Pass 1
  |  |  ------------------
  |  |  |  Branch (479:17): [True: 100k, False: 2.21M]
  |  |  ------------------
  |  |  480|   100k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   100k|    do                                                                         \
  |  |  |  |  441|   100k|    {                                                                          \
  |  |  |  |  442|   100k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 24.0k, False: 76.2k]
  |  |  |  |  ------------------
  |  |  |  |  443|   100k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 45.9k, False: 23.4k]
  |  |  |  |  |  Branch (443:32): [True: 45.9k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  45.9k|            {                                                                  \
  |  |  |  |  445|  45.9k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 583, False: 45.3k]
  |  |  |  |  ------------------
  |  |  |  |  446|  45.9k|                {                                                              \
  |  |  |  |  447|    583|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    583|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    583|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    583|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    583|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 228, False: 355]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    583|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    583|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    583|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 228, False: 355]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    583|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    583|                    return (-1);                                               \
  |  |  |  |  453|    583|                }                                                              \
  |  |  |  |  454|  45.9k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  45.3k|                pb += 2;                                                       \
  |  |  |  |  456|  45.3k|            }                                                                  \
  |  |  |  |  457|   100k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 99.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|   100k|                    if (pb + 1 >= sp->refruns + sp->nruns)                     \
  |  |  ------------------
  |  |  |  Branch (481:25): [True: 433, False: 99.2k]
  |  |  ------------------
  |  |  482|  99.7k|                    {                                                          \
  |  |  483|    433|                        TIFFErrorExtR(                                         \
  |  |  484|    433|                            tif, module,                                       \
  |  |  485|    433|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  486|    433|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  282|    433|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    433|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 215, False: 218]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|    433|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  282|    433|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    433|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 215, False: 218]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    433|                                         : tif->tif_dir.td_curstrip);          \
  |  |  489|    433|                        return (-1);                                           \
  |  |  490|    433|                    }                                                          \
  |  |  491|  99.7k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  492|  99.2k|                    RunLength =                                                \
  |  |  493|  99.2k|                        (int)((uint32_t)RunLength + (uint32_t)(b1 - a0));      \
  |  |  494|  99.2k|                    a0 = b1;                                                   \
  |  |  495|  99.2k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  496|  99.2k|                    break;                                                     \
  |  |  497|   164k|                case S_Horiz:                                                  \
  |  |  ------------------
  |  |  |  |   72|   164k|#define S_Horiz 2
  |  |  ------------------
  |  |  |  Branch (497:17): [True: 164k, False: 2.15M]
  |  |  ------------------
  |  |  498|   164k|                    if ((pa - thisrun) & 1)                                    \
  |  |  ------------------
  |  |  |  Branch (498:25): [True: 57.3k, False: 107k]
  |  |  ------------------
  |  |  499|   164k|                    {                                                          \
  |  |  500|  57.3k|                        for (;;)                                               \
  |  |  501|  65.7k|                        { /* black first */                                    \
  |  |  502|  65.7k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  65.7k|    do                                                                         \
  |  |  |  |  255|  65.7k|    {                                                                          \
  |  |  |  |  256|  65.7k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  65.7k|    do                                                                         \
  |  |  |  |  |  |  165|  65.7k|    {                                                                          \
  |  |  |  |  |  |  166|  65.7k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 65.0k, False: 654]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  65.7k|        {                                                                      \
  |  |  |  |  |  |  168|  65.0k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  65.0k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 1.01k, False: 64.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  65.0k|            {                                                                  \
  |  |  |  |  |  |  170|  1.01k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 284, False: 734]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.01k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  1.01k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    734|            }                                                                  \
  |  |  |  |  |  |  174|  65.0k|            else                                                               \
  |  |  |  |  |  |  175|  65.0k|            {                                                                  \
  |  |  |  |  |  |  176|  64.0k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  64.0k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 7.59k, False: 56.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  64.0k|                {                                                              \
  |  |  |  |  |  |  179|  7.59k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  7.59k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 378, False: 7.21k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  7.59k|                    {                                                          \
  |  |  |  |  |  |  181|    378|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    378|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    378|                    }                                                          \
  |  |  |  |  |  |  184|  7.59k|                    else                                                       \
  |  |  |  |  |  |  185|  7.59k|                    {                                                          \
  |  |  |  |  |  |  186|  7.21k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  7.21k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  7.21k|                    }                                                          \
  |  |  |  |  |  |  189|  7.59k|                }                                                              \
  |  |  |  |  |  |  190|  64.0k|            }                                                                  \
  |  |  |  |  |  |  191|  65.0k|        }                                                                      \
  |  |  |  |  |  |  192|  65.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 65.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  65.7k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  65.4k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  65.4k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  65.4k|    do                                                                         \
  |  |  |  |  |  |  197|  65.4k|    {                                                                          \
  |  |  |  |  |  |  198|  65.4k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  65.4k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  65.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 65.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  65.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 65.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  65.7k|                            switch (TabEnt->State)                             \
  |  |  504|  65.4k|                            {                                                  \
  |  |  505|  53.8k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  53.8k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (505:33): [True: 53.8k, False: 11.5k]
  |  |  ------------------
  |  |  506|  53.8k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  53.8k|    do                                                                         \
  |  |  |  |  267|  53.8k|    {                                                                          \
  |  |  |  |  268|  53.8k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 53.8k]
  |  |  |  |  ------------------
  |  |  |  |  269|  53.8k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  53.8k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  53.8k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  53.8k|        RunLength = 0;                                                         \
  |  |  |  |  279|  53.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 53.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  507|  53.8k|                                    goto doneWhite2da;                         \
  |  |  508|  53.8k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|  3.00k|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (508:33): [True: 3.00k, False: 62.4k]
  |  |  ------------------
  |  |  509|  8.38k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  8.38k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (509:33): [True: 5.38k, False: 60.0k]
  |  |  ------------------
  |  |  510|  8.38k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  511|  8.38k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  512|  8.38k|                                                      TabEnt->Param);          \
  |  |  513|  8.38k|                                    break;                                     \
  |  |  514|  3.17k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (514:33): [True: 3.17k, False: 62.2k]
  |  |  ------------------
  |  |  515|  3.17k|                                    goto badBlack2d;                           \
  |  |  516|  65.4k|                            }                                                  \
  |  |  517|  65.4k|                        }                                                      \
  |  |  518|  57.3k|                    doneWhite2da:;                                             \
  |  |  519|  53.8k|                        for (;;)                                               \
  |  |  520|  3.60M|                        { /* then white */                                     \
  |  |  521|  3.60M|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  3.60M|    do                                                                         \
  |  |  |  |  255|  3.60M|    {                                                                          \
  |  |  |  |  256|  3.60M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  3.60M|    do                                                                         \
  |  |  |  |  |  |  165|  3.60M|    {                                                                          \
  |  |  |  |  |  |  166|  3.60M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 3.56M, False: 39.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  3.60M|        {                                                                      \
  |  |  |  |  |  |  168|  3.56M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  3.56M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.10k, False: 3.56M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  3.56M|            {                                                                  \
  |  |  |  |  |  |  170|  2.10k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 683, False: 1.42k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.10k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.10k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  1.42k|            }                                                                  \
  |  |  |  |  |  |  174|  3.56M|            else                                                               \
  |  |  |  |  |  |  175|  3.56M|            {                                                                  \
  |  |  |  |  |  |  176|  3.56M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  3.56M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 190k, False: 3.37M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  3.56M|                {                                                              \
  |  |  |  |  |  |  179|   190k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   190k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 530, False: 189k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|   190k|                    {                                                          \
  |  |  |  |  |  |  181|    530|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    530|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    530|                    }                                                          \
  |  |  |  |  |  |  184|   190k|                    else                                                       \
  |  |  |  |  |  |  185|   190k|                    {                                                          \
  |  |  |  |  |  |  186|   189k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|   189k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|   189k|                    }                                                          \
  |  |  |  |  |  |  189|   190k|                }                                                              \
  |  |  |  |  |  |  190|  3.56M|            }                                                                  \
  |  |  |  |  |  |  191|  3.56M|        }                                                                      \
  |  |  |  |  |  |  192|  3.60M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 3.60M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  3.60M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  3.60M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  3.60M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  3.60M|    do                                                                         \
  |  |  |  |  |  |  197|  3.60M|    {                                                                          \
  |  |  |  |  |  |  198|  3.60M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  3.60M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  3.60M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 3.60M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  3.60M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 3.60M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|  3.60M|                            switch (TabEnt->State)                             \
  |  |  523|  3.60M|                            {                                                  \
  |  |  524|  50.1k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  50.1k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (524:33): [True: 50.1k, False: 3.55M]
  |  |  ------------------
  |  |  525|  50.1k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  50.1k|    do                                                                         \
  |  |  |  |  267|  50.1k|    {                                                                          \
  |  |  |  |  268|  50.1k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 489, False: 49.6k]
  |  |  |  |  ------------------
  |  |  |  |  269|  50.1k|        {                                                                      \
  |  |  |  |  270|    489|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|    489|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    489|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    489|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 235, False: 254]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|    489|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    489|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    489|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 235, False: 254]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|    489|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|    489|            return (-1);                                                       \
  |  |  |  |  275|    489|        }                                                                      \
  |  |  |  |  276|  50.1k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  49.6k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  49.6k|        RunLength = 0;                                                         \
  |  |  |  |  279|  49.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 49.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  50.1k|                                    goto doneBlack2da;                         \
  |  |  527|  3.17M|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  3.17M|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (527:33): [True: 3.17M, False: 428k]
  |  |  ------------------
  |  |  528|  3.55M|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  3.55M|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (528:33): [True: 375k, False: 3.23M]
  |  |  ------------------
  |  |  529|  3.55M|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  530|  3.55M|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  531|  3.55M|                                                      TabEnt->Param);          \
  |  |  532|  3.55M|                                    break;                                     \
  |  |  533|  3.17M|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (533:33): [True: 3.09k, False: 3.60M]
  |  |  ------------------
  |  |  534|  3.09k|                                    goto badWhite2d;                           \
  |  |  535|  3.60M|                            }                                                  \
  |  |  536|  3.60M|                        }                                                      \
  |  |  537|  53.8k|                    doneBlack2da:;                                             \
  |  |  538|  49.6k|                    }                                                          \
  |  |  539|   164k|                    else                                                       \
  |  |  540|   164k|                    {                                                          \
  |  |  541|   107k|                        for (;;)                                               \
  |  |  542|   157k|                        { /* white first */                                    \
  |  |  543|   157k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   157k|    do                                                                         \
  |  |  |  |  255|   157k|    {                                                                          \
  |  |  |  |  256|   157k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   157k|    do                                                                         \
  |  |  |  |  |  |  165|   157k|    {                                                                          \
  |  |  |  |  |  |  166|   157k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 153k, False: 4.19k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   157k|        {                                                                      \
  |  |  |  |  |  |  168|   153k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   153k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.20k, False: 150k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   153k|            {                                                                  \
  |  |  |  |  |  |  170|  2.20k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 212, False: 1.98k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.20k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.20k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  1.98k|            }                                                                  \
  |  |  |  |  |  |  174|   153k|            else                                                               \
  |  |  |  |  |  |  175|   153k|            {                                                                  \
  |  |  |  |  |  |  176|   150k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   150k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 4.13k, False: 146k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   150k|                {                                                              \
  |  |  |  |  |  |  179|  4.13k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  4.13k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 340, False: 3.79k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  4.13k|                    {                                                          \
  |  |  |  |  |  |  181|    340|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    340|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    340|                    }                                                          \
  |  |  |  |  |  |  184|  4.13k|                    else                                                       \
  |  |  |  |  |  |  185|  4.13k|                    {                                                          \
  |  |  |  |  |  |  186|  3.79k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  3.79k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  3.79k|                    }                                                          \
  |  |  |  |  |  |  189|  4.13k|                }                                                              \
  |  |  |  |  |  |  190|   150k|            }                                                                  \
  |  |  |  |  |  |  191|   153k|        }                                                                      \
  |  |  |  |  |  |  192|   157k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 157k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   157k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   157k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   157k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   157k|    do                                                                         \
  |  |  |  |  |  |  197|   157k|    {                                                                          \
  |  |  |  |  |  |  198|   157k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   157k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   157k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 157k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   157k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 157k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|   157k|                            switch (TabEnt->State)                             \
  |  |  545|   157k|                            {                                                  \
  |  |  546|  79.7k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  79.7k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (546:33): [True: 79.7k, False: 77.2k]
  |  |  ------------------
  |  |  547|  79.7k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  79.7k|    do                                                                         \
  |  |  |  |  267|  79.7k|    {                                                                          \
  |  |  |  |  268|  79.7k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 79.7k]
  |  |  |  |  ------------------
  |  |  |  |  269|  79.7k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  79.7k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  79.7k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  79.7k|        RunLength = 0;                                                         \
  |  |  |  |  279|  79.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 79.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|  79.7k|                                    goto doneWhite2db;                         \
  |  |  549|  79.7k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  36.8k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (549:33): [True: 36.8k, False: 120k]
  |  |  ------------------
  |  |  550|  49.9k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  49.9k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (550:33): [True: 13.0k, False: 143k]
  |  |  ------------------
  |  |  551|  49.9k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  552|  49.9k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  553|  49.9k|                                                      TabEnt->Param);          \
  |  |  554|  49.9k|                                    break;                                     \
  |  |  555|  36.8k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (555:33): [True: 27.2k, False: 129k]
  |  |  ------------------
  |  |  556|  27.2k|                                    goto badWhite2d;                           \
  |  |  557|   157k|                            }                                                  \
  |  |  558|   157k|                        }                                                      \
  |  |  559|   107k|                    doneWhite2db:;                                             \
  |  |  560|  79.7k|                        for (;;)                                               \
  |  |  561|  86.2k|                        { /* then black */                                     \
  |  |  562|  86.2k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  86.2k|    do                                                                         \
  |  |  |  |  255|  86.2k|    {                                                                          \
  |  |  |  |  256|  86.2k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  86.2k|    do                                                                         \
  |  |  |  |  |  |  165|  86.2k|    {                                                                          \
  |  |  |  |  |  |  166|  86.2k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 68.9k, False: 17.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  86.2k|        {                                                                      \
  |  |  |  |  |  |  168|  68.9k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  68.9k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.22k, False: 66.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  68.9k|            {                                                                  \
  |  |  |  |  |  |  170|  2.22k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 352, False: 1.87k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.22k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.22k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  1.87k|            }                                                                  \
  |  |  |  |  |  |  174|  68.9k|            else                                                               \
  |  |  |  |  |  |  175|  68.9k|            {                                                                  \
  |  |  |  |  |  |  176|  66.7k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  66.7k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 5.07k, False: 61.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  66.7k|                {                                                              \
  |  |  |  |  |  |  179|  5.07k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  5.07k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 283, False: 4.78k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  5.07k|                    {                                                          \
  |  |  |  |  |  |  181|    283|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    283|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    283|                    }                                                          \
  |  |  |  |  |  |  184|  5.07k|                    else                                                       \
  |  |  |  |  |  |  185|  5.07k|                    {                                                          \
  |  |  |  |  |  |  186|  4.78k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  4.78k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  4.78k|                    }                                                          \
  |  |  |  |  |  |  189|  5.07k|                }                                                              \
  |  |  |  |  |  |  190|  66.7k|            }                                                                  \
  |  |  |  |  |  |  191|  68.9k|        }                                                                      \
  |  |  |  |  |  |  192|  86.2k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 85.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  86.2k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  85.9k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  85.9k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  85.9k|    do                                                                         \
  |  |  |  |  |  |  197|  85.9k|    {                                                                          \
  |  |  |  |  |  |  198|  85.9k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  85.9k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  85.9k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 85.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  85.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 85.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|  86.2k|                            switch (TabEnt->State)                             \
  |  |  564|  85.9k|                            {                                                  \
  |  |  565|  61.2k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  61.2k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (565:33): [True: 61.2k, False: 24.7k]
  |  |  ------------------
  |  |  566|  61.2k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  61.2k|    do                                                                         \
  |  |  |  |  267|  61.2k|    {                                                                          \
  |  |  |  |  268|  61.2k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 61.2k]
  |  |  |  |  ------------------
  |  |  |  |  269|  61.2k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  61.2k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  61.2k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  61.2k|        RunLength = 0;                                                         \
  |  |  |  |  279|  61.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 61.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  567|  61.2k|                                    goto doneBlack2db;                         \
  |  |  568|  61.2k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|  1.75k|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (568:33): [True: 1.75k, False: 84.1k]
  |  |  ------------------
  |  |  569|  6.52k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  6.52k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (569:33): [True: 4.77k, False: 81.1k]
  |  |  ------------------
  |  |  570|  6.52k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  571|  6.52k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  572|  6.52k|                                                      TabEnt->Param);          \
  |  |  573|  6.52k|                                    break;                                     \
  |  |  574|  18.1k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (574:33): [True: 18.1k, False: 67.7k]
  |  |  ------------------
  |  |  575|  18.1k|                                    goto badBlack2d;                           \
  |  |  576|  85.9k|                            }                                                  \
  |  |  577|  85.9k|                        }                                                      \
  |  |  578|  79.7k|                    doneBlack2db:;                                             \
  |  |  579|  61.2k|                    }                                                          \
  |  |  580|   164k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   110k|    do                                                                         \
  |  |  |  |  441|   110k|    {                                                                          \
  |  |  |  |  442|   110k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 110k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  443|   222k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 180k, False: 41.5k]
  |  |  |  |  |  Branch (443:32): [True: 112k, False: 68.7k]
  |  |  |  |  ------------------
  |  |  |  |  444|   112k|            {                                                                  \
  |  |  |  |  445|   112k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 474, False: 111k]
  |  |  |  |  ------------------
  |  |  |  |  446|   112k|                {                                                              \
  |  |  |  |  447|    474|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    474|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    474|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    474|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    474|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 236, False: 238]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    474|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    474|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    474|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 236, False: 238]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    474|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    474|                    return (-1);                                               \
  |  |  |  |  453|    474|                }                                                              \
  |  |  |  |  454|   112k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   111k|                pb += 2;                                                       \
  |  |  |  |  456|   111k|            }                                                                  \
  |  |  |  |  457|   110k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 110k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|   110k|                    break;                                                     \
  |  |  582|   467k|                case S_V0:                                                     \
  |  |  ------------------
  |  |  |  |   73|   467k|#define S_V0 3
  |  |  ------------------
  |  |  |  Branch (582:17): [True: 467k, False: 1.85M]
  |  |  ------------------
  |  |  583|   467k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   467k|    do                                                                         \
  |  |  |  |  441|   467k|    {                                                                          \
  |  |  |  |  442|   467k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 231k, False: 236k]
  |  |  |  |  ------------------
  |  |  |  |  443|   467k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 106k, False: 230k]
  |  |  |  |  |  Branch (443:32): [True: 106k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   231k|            {                                                                  \
  |  |  |  |  445|   106k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 481, False: 106k]
  |  |  |  |  ------------------
  |  |  |  |  446|   106k|                {                                                              \
  |  |  |  |  447|    481|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    481|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    481|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    481|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    481|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 203, False: 278]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    481|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    481|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    481|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 203, False: 278]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    481|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    481|                    return (-1);                                               \
  |  |  |  |  453|    481|                }                                                              \
  |  |  |  |  454|   106k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   106k|                pb += 2;                                                       \
  |  |  |  |  456|   106k|            }                                                                  \
  |  |  |  |  457|   467k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 466k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|   467k|                    SETVALUE(b1 - a0);                                         \
  |  |  ------------------
  |  |  |  |  266|   466k|    do                                                                         \
  |  |  |  |  267|   466k|    {                                                                          \
  |  |  |  |  268|   466k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 466k]
  |  |  |  |  ------------------
  |  |  |  |  269|   466k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   466k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   466k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   466k|        RunLength = 0;                                                         \
  |  |  |  |  279|   466k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 466k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|   466k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (585:25): [True: 423, False: 466k]
  |  |  ------------------
  |  |  586|   466k|                    {                                                          \
  |  |  587|    423|                        TIFFErrorExtR(                                         \
  |  |  588|    423|                            tif, module,                                       \
  |  |  589|    423|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  590|    423|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  282|    423|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    423|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 204, False: 219]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  591|    423|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  282|    423|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    423|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 204, False: 219]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|    423|                                         : tif->tif_dir.td_curstrip);          \
  |  |  593|    423|                        return (-1);                                           \
  |  |  594|    423|                    }                                                          \
  |  |  595|   466k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  596|   466k|                    break;                                                     \
  |  |  597|   466k|                case S_VR:                                                     \
  |  |  ------------------
  |  |  |  |   74|   196k|#define S_VR 4
  |  |  ------------------
  |  |  |  Branch (597:17): [True: 196k, False: 2.12M]
  |  |  ------------------
  |  |  598|   196k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   196k|    do                                                                         \
  |  |  |  |  441|   196k|    {                                                                          \
  |  |  |  |  442|   196k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 89.1k, False: 107k]
  |  |  |  |  ------------------
  |  |  |  |  443|   196k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 75.0k, False: 88.7k]
  |  |  |  |  |  Branch (443:32): [True: 75.0k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  89.1k|            {                                                                  \
  |  |  |  |  445|  75.0k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 459, False: 74.6k]
  |  |  |  |  ------------------
  |  |  |  |  446|  75.0k|                {                                                              \
  |  |  |  |  447|    459|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    459|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    459|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    459|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    459|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 240, False: 219]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    459|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    459|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    459|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 240, False: 219]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    459|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    459|                    return (-1);                                               \
  |  |  |  |  453|    459|                }                                                              \
  |  |  |  |  454|  75.0k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  74.6k|                pb += 2;                                                       \
  |  |  |  |  456|  74.6k|            }                                                                  \
  |  |  |  |  457|   196k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 196k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|   196k|                    SETVALUE((int)((uint32_t)(b1 - a0) + TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   196k|    do                                                                         \
  |  |  |  |  267|   196k|    {                                                                          \
  |  |  |  |  268|   196k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 196k]
  |  |  |  |  ------------------
  |  |  |  |  269|   196k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   196k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   196k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   196k|        RunLength = 0;                                                         \
  |  |  |  |  279|   196k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 196k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|   196k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (600:25): [True: 446, False: 196k]
  |  |  ------------------
  |  |  601|   196k|                    {                                                          \
  |  |  602|    446|                        TIFFErrorExtR(                                         \
  |  |  603|    446|                            tif, module,                                       \
  |  |  604|    446|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  605|    446|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  282|    446|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    446|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 211, False: 235]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  606|    446|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  282|    446|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    446|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 211, False: 235]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  607|    446|                                         : tif->tif_dir.td_curstrip);          \
  |  |  608|    446|                        return (-1);                                           \
  |  |  609|    446|                    }                                                          \
  |  |  610|   196k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  611|   196k|                    break;                                                     \
  |  |  612|   855k|                case S_VL:                                                     \
  |  |  ------------------
  |  |  |  |   75|   855k|#define S_VL 5
  |  |  ------------------
  |  |  |  Branch (612:17): [True: 855k, False: 1.46M]
  |  |  ------------------
  |  |  613|   855k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   855k|    do                                                                         \
  |  |  |  |  441|   855k|    {                                                                          \
  |  |  |  |  442|   855k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 665k, False: 190k]
  |  |  |  |  ------------------
  |  |  |  |  443|  1.02M|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 359k, False: 665k]
  |  |  |  |  |  Branch (443:32): [True: 359k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   665k|            {                                                                  \
  |  |  |  |  445|   359k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 409, False: 359k]
  |  |  |  |  ------------------
  |  |  |  |  446|   359k|                {                                                              \
  |  |  |  |  447|    409|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    409|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    409|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    409|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    409|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 198, False: 211]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    409|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    409|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    409|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 198, False: 211]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    409|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    409|                    return (-1);                                               \
  |  |  |  |  453|    409|                }                                                              \
  |  |  |  |  454|   359k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   359k|                pb += 2;                                                       \
  |  |  |  |  456|   359k|            }                                                                  \
  |  |  |  |  457|   855k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 855k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  614|   855k|                    if (b1 < (int)((uint32_t)a0 + TabEnt->Param))              \
  |  |  ------------------
  |  |  |  Branch (614:25): [True: 5.81k, False: 849k]
  |  |  ------------------
  |  |  615|   855k|                    {                                                          \
  |  |  616|  5.81k|                        unexpected("VL", a0);                                  \
  |  |  ------------------
  |  |  |  |  220|  5.81k|    do                                                                         \
  |  |  |  |  221|  5.81k|    {                                                                          \
  |  |  |  |  222|  5.81k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  5.81k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  5.81k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 5.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  617|  5.81k|                        goto eol2d;                                            \
  |  |  618|  5.81k|                    }                                                          \
  |  |  619|   855k|                    SETVALUE((int)((uint32_t)(b1 - a0) - TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   849k|    do                                                                         \
  |  |  |  |  267|   849k|    {                                                                          \
  |  |  |  |  268|   849k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 849k]
  |  |  |  |  ------------------
  |  |  |  |  269|   849k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   849k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   849k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   849k|        RunLength = 0;                                                         \
  |  |  |  |  279|   849k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 849k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  620|   849k|                    b1 = b1 - (int)*--pb;                                      \
  |  |  621|   849k|                    break;                                                     \
  |  |  622|   849k|                case S_Ext:                                                    \
  |  |  ------------------
  |  |  |  |   76|  71.8k|#define S_Ext 6
  |  |  ------------------
  |  |  |  Branch (622:17): [True: 71.8k, False: 2.24M]
  |  |  ------------------
  |  |  623|  71.8k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  624|  71.8k|                    extension(a0);                                             \
  |  |  ------------------
  |  |  |  |  238|  71.8k|    Fax3Extension(module, tif, (uint32_t)sp->line, (uint32_t)(a0))
  |  |  ------------------
  |  |  625|  71.8k|                    goto eol2d;                                                \
  |  |  626|   849k|                case S_EOL:                                                    \
  |  |  ------------------
  |  |  |  |   82|   462k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (626:17): [True: 462k, False: 1.85M]
  |  |  ------------------
  |  |  627|   462k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  628|   462k|                    NeedBits8(4, eof2d);                                       \
  |  |  ------------------
  |  |  |  |  144|   462k|    do                                                                         \
  |  |  |  |  145|   462k|    {                                                                          \
  |  |  |  |  146|   462k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 254k, False: 207k]
  |  |  |  |  ------------------
  |  |  |  |  147|   462k|        {                                                                      \
  |  |  |  |  148|   254k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|   254k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 19.8k, False: 235k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|   254k|            {                                                                  \
  |  |  |  |  150|  19.8k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 17.9k, False: 1.84k]
  |  |  |  |  ------------------
  |  |  |  |  151|  19.8k|                    goto eoflab;                                               \
  |  |  |  |  152|  19.8k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|  1.84k|            }                                                                  \
  |  |  |  |  154|   254k|            else                                                               \
  |  |  |  |  155|   254k|            {                                                                  \
  |  |  |  |  156|   235k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|   235k|                BitsAvail += 8;                                                \
  |  |  |  |  158|   235k|            }                                                                  \
  |  |  |  |  159|   254k|        }                                                                      \
  |  |  |  |  160|   462k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 444k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|   462k|                    if (GetBits(4))                                            \
  |  |  ------------------
  |  |  |  |  194|   444k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 137k, False: 307k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  630|   444k|                        unexpected("EOL", a0);                                 \
  |  |  ------------------
  |  |  |  |  220|   137k|    do                                                                         \
  |  |  |  |  221|   137k|    {                                                                          \
  |  |  |  |  222|   137k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|   137k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|   137k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 137k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  631|   444k|                    ClrBits(4);                                                \
  |  |  ------------------
  |  |  |  |  196|   444k|    do                                                                         \
  |  |  |  |  197|   444k|    {                                                                          \
  |  |  |  |  198|   444k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|   444k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|   444k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 444k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|   444k|                    EOLcnt = 1;                                                \
  |  |  633|   444k|                    goto eol2d;                                                \
  |  |  634|   462k|                default:                                                       \
  |  |  ------------------
  |  |  |  Branch (634:17): [True: 0, False: 2.31M]
  |  |  ------------------
  |  |  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|  21.3k|                badBlack2d:                                                    \
  |  |  639|  21.3k|                    unexpected("BlackTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  21.3k|    do                                                                         \
  |  |  |  |  221|  21.3k|    {                                                                          \
  |  |  |  |  222|  21.3k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  21.3k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  21.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 21.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  640|  21.3k|                    goto eol2d;                                                \
  |  |  641|  30.3k|                badWhite2d:                                                    \
  |  |  642|  30.3k|                    unexpected("WhiteTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  30.3k|    do                                                                         \
  |  |  |  |  221|  30.3k|    {                                                                          \
  |  |  |  |  222|  30.3k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  30.3k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  30.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 30.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  643|  30.3k|                    goto eol2d;                                                \
  |  |  644|  25.2k|                eof2d:                                                         \
  |  |  645|  25.2k|                    prematureEOF(a0);                                          \
  |  |  ------------------
  |  |  |  |  271|  25.2k|    do                                                                         \
  |  |  |  |  272|  25.2k|    {                                                                          \
  |  |  |  |  273|  25.2k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  25.2k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  25.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 25.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  646|  25.2k|                    CLEANUP_RUNS();                                            \
  |  |  ------------------
  |  |  |  |  333|  25.2k|    do                                                                         \
  |  |  |  |  334|  25.2k|    {                                                                          \
  |  |  |  |  335|  25.2k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 1.67k, False: 23.5k]
  |  |  |  |  ------------------
  |  |  |  |  336|  25.2k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.67k|    do                                                                         \
  |  |  |  |  |  |  267|  1.67k|    {                                                                          \
  |  |  |  |  |  |  268|  1.67k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 454, False: 1.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.67k|        {                                                                      \
  |  |  |  |  |  |  270|    454|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    454|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    454|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    454|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 213, False: 241]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    454|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    454|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    454|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 213, False: 241]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    454|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    454|            return (-1);                                                       \
  |  |  |  |  |  |  275|    454|        }                                                                      \
  |  |  |  |  |  |  276|  1.67k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  1.21k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  1.21k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  1.21k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  25.2k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 24.6k, False: 75]
  |  |  |  |  ------------------
  |  |  |  |  338|  24.7k|        {                                                                      \
  |  |  |  |  339|  24.6k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  24.6k|    do                                                                         \
  |  |  |  |  |  |  254|  24.6k|    {                                                                          \
  |  |  |  |  |  |  255|  24.6k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  24.6k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  24.6k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  24.6k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 24.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  25.9k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 1.23k, False: 24.6k]
  |  |  |  |  |  Branch (340:39): [True: 1.23k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  24.6k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  24.6k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 24.4k, False: 216]
  |  |  |  |  ------------------
  |  |  |  |  343|  24.6k|            {                                                                  \
  |  |  |  |  344|  24.4k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 24.4k]
  |  |  |  |  ------------------
  |  |  |  |  345|  24.4k|                    a0 = 0;                                                    \
  |  |  |  |  346|  24.4k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 14.7k, False: 9.72k]
  |  |  |  |  ------------------
  |  |  |  |  347|  24.4k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  14.7k|    do                                                                         \
  |  |  |  |  |  |  267|  14.7k|    {                                                                          \
  |  |  |  |  |  |  268|  14.7k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 14.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  14.7k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  14.7k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  14.7k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  14.7k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  14.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 14.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  24.4k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  24.4k|    do                                                                         \
  |  |  |  |  |  |  267|  24.4k|    {                                                                          \
  |  |  |  |  |  |  268|  24.4k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 469, False: 24.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  24.4k|        {                                                                      \
  |  |  |  |  |  |  270|    469|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    469|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    469|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    469|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 211, False: 258]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    469|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    469|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    469|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 211, False: 258]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    469|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    469|            return (-1);                                                       \
  |  |  |  |  |  |  275|    469|        }                                                                      \
  |  |  |  |  |  |  276|  24.4k|        *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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  24.4k|            }                                                                  \
  |  |  |  |  350|  24.6k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 216]
  |  |  |  |  ------------------
  |  |  |  |  351|    216|            {                                                                  \
  |  |  |  |  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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|  24.6k|        }                                                                      \
  |  |  |  |  356|  24.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 24.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  647|  25.2k|                    goto eoflab;                                               \
  |  |  648|  2.31M|            }                                                                  \
  |  |  649|  2.31M|        }                                                                      \
  |  |  650|  1.10M|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (650:13): [True: 77.1k, False: 429k]
  |  |  ------------------
  |  |  651|   506k|        {                                                                      \
  |  |  652|  77.1k|            if (RunLength + a0 < lastx)                                        \
  |  |  ------------------
  |  |  |  Branch (652:17): [True: 0, False: 77.1k]
  |  |  ------------------
  |  |  653|  77.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|  77.1k|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|  77.1k|    do                                                                         \
  |  |  |  |  267|  77.1k|    {                                                                          \
  |  |  |  |  268|  77.1k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 77.1k]
  |  |  |  |  ------------------
  |  |  |  |  269|  77.1k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  77.1k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  77.1k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  77.1k|        RunLength = 0;                                                         \
  |  |  |  |  279|  77.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 77.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  661|  77.1k|        }                                                                      \
  |  |  662|  1.07M|    eol2d:                                                                     \
  |  |  663|  1.07M|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|  1.07M|    do                                                                         \
  |  |  |  |  334|  1.07M|    {                                                                          \
  |  |  |  |  335|  1.07M|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 10.4k, False: 1.06M]
  |  |  |  |  ------------------
  |  |  |  |  336|  1.07M|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  10.4k|    do                                                                         \
  |  |  |  |  |  |  267|  10.4k|    {                                                                          \
  |  |  |  |  |  |  268|  10.4k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 659, False: 9.74k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  10.4k|        {                                                                      \
  |  |  |  |  |  |  270|    659|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    659|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    659|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    659|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 418, False: 241]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    659|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    659|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    659|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 418, False: 241]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    659|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    659|            return (-1);                                                       \
  |  |  |  |  |  |  275|    659|        }                                                                      \
  |  |  |  |  |  |  276|  10.4k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  9.74k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  9.74k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  9.74k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 9.74k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  1.07M|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 762k, False: 317k]
  |  |  |  |  ------------------
  |  |  |  |  338|  1.07M|        {                                                                      \
  |  |  |  |  339|   762k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   762k|    do                                                                         \
  |  |  |  |  |  |  254|   762k|    {                                                                          \
  |  |  |  |  |  |  255|   762k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   762k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   762k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   762k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 762k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  1.01M|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 248k, False: 762k]
  |  |  |  |  |  Branch (340:39): [True: 248k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   762k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   762k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 754k, False: 7.42k]
  |  |  |  |  ------------------
  |  |  |  |  343|   762k|            {                                                                  \
  |  |  |  |  344|   754k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 754k]
  |  |  |  |  ------------------
  |  |  |  |  345|   754k|                    a0 = 0;                                                    \
  |  |  |  |  346|   754k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 518k, False: 235k]
  |  |  |  |  ------------------
  |  |  |  |  347|   754k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   518k|    do                                                                         \
  |  |  |  |  |  |  267|   518k|    {                                                                          \
  |  |  |  |  |  |  268|   518k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 518k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   518k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   518k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   518k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   518k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   518k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 518k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   754k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   754k|    do                                                                         \
  |  |  |  |  |  |  267|   754k|    {                                                                          \
  |  |  |  |  |  |  268|   754k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 643, False: 753k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   754k|        {                                                                      \
  |  |  |  |  |  |  270|    643|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    643|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    643|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    643|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 214, False: 429]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    643|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    643|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    643|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 214, False: 429]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    643|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    643|            return (-1);                                                       \
  |  |  |  |  |  |  275|    643|        }                                                                      \
  |  |  |  |  |  |  276|   754k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   753k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   753k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   753k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 753k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   754k|            }                                                                  \
  |  |  |  |  350|   762k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 7.42k]
  |  |  |  |  ------------------
  |  |  |  |  351|  7.42k|            {                                                                  \
  |  |  |  |  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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|   762k|        }                                                                      \
  |  |  |  |  356|  1.07M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 1.07M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  664|  1.07M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (664:14): [Folded, False: 1.07M]
  |  |  ------------------
  ------------------
  453|  1.54M|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  454|  1.54M|        if (pa < thisrun + sp->nruns)
  ------------------
  |  Branch (454:13): [True: 1.54M, False: 3.26k]
  ------------------
  455|  1.54M|        {
  456|  1.54M|            SETVALUE(0); /* imaginary change for reference */
  ------------------
  |  |  266|  1.54M|    do                                                                         \
  |  |  267|  1.54M|    {                                                                          \
  |  |  268|  1.54M|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  ------------------
  |  |  |  Branch (268:13): [True: 0, False: 1.54M]
  |  |  ------------------
  |  |  269|  1.54M|        {                                                                      \
  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  ------------------
  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  ------------------
  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  274|      0|            return (-1);                                                       \
  |  |  275|      0|        }                                                                      \
  |  |  276|  1.54M|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  277|  1.54M|        a0 += (int)(uint32_t)(x);                                              \
  |  |  278|  1.54M|        RunLength = 0;                                                         \
  |  |  279|  1.54M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (279:14): [Folded, False: 1.54M]
  |  |  ------------------
  ------------------
  457|  1.54M|        }
  458|  1.54M|        SWAP(uint32_t *, sp->curruns, sp->refruns);
  ------------------
  |  |  399|  1.54M|    {                                                                          \
  |  |  400|  1.54M|        t x;                                                                   \
  |  |  401|  1.54M|        x = (a);                                                               \
  |  |  402|  1.54M|        (a) = (b);                                                             \
  |  |  403|  1.54M|        (b) = x;                                                               \
  |  |  404|  1.54M|    }
  ------------------
  459|  1.54M|        buf += sp->b.rowbytes;
  460|  1.54M|        occ -= sp->b.rowbytes;
  461|  1.54M|        sp->line++;
  462|  1.54M|        continue;
  463|  3.63k|    EOF2D: /* premature EOF */
  464|  3.63k|        CLEANUP_RUNS();
  ------------------
  |  |  333|  3.63k|    do                                                                         \
  |  |  334|  3.63k|    {                                                                          \
  |  |  335|  3.63k|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (335:13): [True: 0, False: 3.63k]
  |  |  ------------------
  |  |  336|  3.63k|            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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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|  3.63k|        if (a0 != (int)lastx)                                                  \
  |  |  ------------------
  |  |  |  Branch (337:13): [True: 3.63k, False: 0]
  |  |  ------------------
  |  |  338|  3.63k|        {                                                                      \
  |  |  339|  3.63k|            badlength(a0, lastx);                                              \
  |  |  ------------------
  |  |  |  |  253|  3.63k|    do                                                                         \
  |  |  |  |  254|  3.63k|    {                                                                          \
  |  |  |  |  255|  3.63k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  256|  3.63k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  257|  3.63k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  258|  3.63k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:14): [Folded, False: 3.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|  3.63k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  ------------------
  |  |  |  Branch (340:20): [True: 0, False: 3.63k]
  |  |  |  Branch (340:39): [True: 0, False: 0]
  |  |  ------------------
  |  |  341|  3.63k|                a0 -= (int)*--pa;                                              \
  |  |  342|  3.63k|            if (a0 < (int)lastx)                                               \
  |  |  ------------------
  |  |  |  Branch (342:17): [True: 3.63k, False: 0]
  |  |  ------------------
  |  |  343|  3.63k|            {                                                                  \
  |  |  344|  3.63k|                if (a0 < 0)                                                    \
  |  |  ------------------
  |  |  |  Branch (344:21): [True: 0, False: 3.63k]
  |  |  ------------------
  |  |  345|  3.63k|                    a0 = 0;                                                    \
  |  |  346|  3.63k|                if ((pa - thisrun) & 1)                                        \
  |  |  ------------------
  |  |  |  Branch (346:21): [True: 0, False: 3.63k]
  |  |  ------------------
  |  |  347|  3.63k|                    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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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|  3.63k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  ------------------
  |  |  |  |  266|  3.63k|    do                                                                         \
  |  |  |  |  267|  3.63k|    {                                                                          \
  |  |  |  |  268|  3.63k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 3.63k]
  |  |  |  |  ------------------
  |  |  |  |  269|  3.63k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  3.63k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  3.63k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  3.63k|        RunLength = 0;                                                         \
  |  |  |  |  279|  3.63k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 3.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  349|  3.63k|            }                                                                  \
  |  |  350|  3.63k|            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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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|  3.63k|        }                                                                      \
  |  |  356|  3.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (356:14): [Folded, False: 3.63k]
  |  |  ------------------
  ------------------
  465|  28.9k|    EOF2Da: /* premature EOF */
  466|  28.9k|        Fax3ClearUnwritten(has_buf, buf, occ);
  467|  28.9k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  468|  28.9k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  28.9k|    do                                                                         \
  |  |  160|  28.9k|    {                                                                          \
  |  |  161|  28.9k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  28.9k|        sp->data = BitAcc;                                                     \
  |  |  163|  28.9k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  28.9k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  28.9k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  28.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  469|  28.9k|        return (-1);
  470|  3.63k|    }
  471|  27.5k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  27.5k|    do                                                                         \
  |  |  160|  27.5k|    {                                                                          \
  |  |  161|  27.5k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  27.5k|        sp->data = BitAcc;                                                     \
  |  |  163|  27.5k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  27.5k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  27.5k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  27.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 27.5k]
  |  |  ------------------
  ------------------
  472|  27.5k|    return (1);
  473|  64.3k|}
tif_fax3.c:Fax3ClearUnwritten:
  336|   106k|{
  337|   106k|    if (has_buf)
  ------------------
  |  Branch (337:9): [True: 106k, False: 0]
  ------------------
  338|   106k|        memset(buf, 0, (size_t)occ);
  339|   106k|}
tif_fax3.c:CheckReachedCounters:
  296|   249k|{
  297|   249k|    if (sp->eofReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|   249k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (297:9): [True: 0, False: 249k]
  ------------------
  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");
  ------------------
  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  303|      0|        return (-1);
  304|      0|    }
  305|   249k|    if (sp->eolReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|   249k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (305:9): [True: 3, False: 249k]
  ------------------
  306|      3|    {
  307|      3|        TIFFErrorExtR(tif, module,
  308|      3|                      "Bad line length (EOL) has already been reached %d times "
  309|      3|                      "within that %s",
  310|      3|                      sp->eolReachedCount, isTiled(tif) ? "tile" : "strip");
  ------------------
  |  |  282|      3|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|      3|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  311|      3|        return (-1);
  312|      3|    }
  313|   249k|    if (sp->unexpectedReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|   249k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (313:9): [True: 1, False: 249k]
  ------------------
  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");
  ------------------
  |  |  282|      1|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|      1|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  320|      1|        return (-1);
  321|      1|    }
  322|   249k|    return (0);
  323|   249k|}
tif_fax3.c:Fax3TryG3WithoutEOL:
  279|  1.17k|{
  280|  1.17k|    TIFFWarningExtR(
  281|  1.17k|        tif, module,
  282|  1.17k|        "Try to decode (read) fax Group 3 data without EOL at line %" PRIu32
  283|  1.17k|        " of %s %" PRIu32 " (x %" PRIu32 "). Please check result",
  284|  1.17k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  282|  1.17k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  1.17k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 600, False: 571]
  |  |  ------------------
  ------------------
  285|  1.17k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  282|  1.17k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  1.17k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 600, False: 571]
  |  |  ------------------
  ------------------
  286|  1.17k|        a0);
  287|  1.17k|}
tif_fax3.c:Fax3Unexpected:
  211|  34.4M|{
  212|  34.4M|    TIFFErrorExtR(
  213|  34.4M|        tif, module,
  214|  34.4M|        "Bad code word at line %" PRIu32 " of %s %" PRIu32 " (x %" PRIu32 ")",
  215|  34.4M|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  282|  34.4M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  34.4M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 34.1M, False: 303k]
  |  |  ------------------
  ------------------
  216|  34.4M|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  282|  34.4M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  34.4M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 34.1M, False: 303k]
  |  |  ------------------
  ------------------
  217|  34.4M|        a0);
  218|  34.4M|}
tif_fax3.c:Fax3PrematureEOF:
  262|  40.2k|{
  263|  40.2k|    TIFFWarningExtR(
  264|  40.2k|        tif, module,
  265|  40.2k|        "Premature EOF at line %" PRIu32 " of %s %" PRIu32 " (x %" PRIu32 ")",
  266|  40.2k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  282|  40.2k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  40.2k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 28.6k, False: 11.5k]
  |  |  ------------------
  ------------------
  267|  40.2k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  282|  40.2k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  40.2k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 28.6k, False: 11.5k]
  |  |  ------------------
  ------------------
  268|  40.2k|        a0);
  269|  40.2k|}
tif_fax3.c:Fax3BadLength:
  242|  36.1M|{
  243|  36.1M|    TIFFWarningExtR(
  244|  36.1M|        tif, module,
  245|  36.1M|        "%s at line %" PRIu32 " of %s %" PRIu32 " (got %" PRIu32
  246|  36.1M|        ", expected %" PRIu32 ")",
  247|  36.1M|        a0 < lastx ? "Premature EOL" : "Line length mismatch", line,
  ------------------
  |  Branch (247:9): [True: 35.3M, False: 828k]
  ------------------
  248|  36.1M|        isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  282|  36.1M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  36.1M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 35.2M, False: 902k]
  |  |  ------------------
  ------------------
  249|  36.1M|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip), a0,
  ------------------
  |  |  282|  36.1M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  36.1M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 35.2M, False: 902k]
  |  |  ------------------
  ------------------
  250|  36.1M|        lastx);
  251|  36.1M|}
tif_fax3.c:Fax3Extension:
  228|  83.2k|{
  229|  83.2k|    TIFFErrorExtR(
  230|  83.2k|        tif, module,
  231|  83.2k|        "Uncompressed data (not supported) at line %" PRIu32 " of %s %" PRIu32
  232|  83.2k|        " (x %" PRIu32 ")",
  233|  83.2k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  282|  83.2k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  83.2k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 52.3k, False: 30.8k]
  |  |  ------------------
  ------------------
  234|  83.2k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  282|  83.2k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  83.2k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 52.3k, False: 30.8k]
  |  |  ------------------
  ------------------
  235|  83.2k|        a0);
  236|  83.2k|}
tif_fax3.c:Fax3PreDecode:
  172|   127k|{
  173|   127k|    Fax3CodecState *sp = DecoderState(tif);
  ------------------
  |  |  108|   127k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|   127k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  174|       |
  175|   127k|    (void)s;
  176|   127k|    assert(sp != NULL);
  ------------------
  |  Branch (176:5): [True: 0, False: 127k]
  |  Branch (176:5): [True: 127k, False: 0]
  ------------------
  177|   127k|    sp->bit = 0; /* force initial read */
  178|   127k|    sp->data = 0;
  179|   127k|    sp->EOLcnt = 0; /* force initial scan for EOL */
  180|   127k|    sp->eofReachedCount = 0;
  181|   127k|    sp->eolReachedCount = 0;
  182|   127k|    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|   127k|    sp->bitmap =
  191|   127k|        TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB);
  ------------------
  |  |  242|   127k|#define FILLORDER_LSB2MSB 2                /* least significant -> most */
  ------------------
  192|   127k|    sp->curruns = sp->runs;
  193|   127k|    if (sp->refruns)
  ------------------
  |  Branch (193:9): [True: 117k, False: 10.4k]
  ------------------
  194|   117k|    { /* init reference line to white */
  195|   117k|        sp->refruns = sp->runs + sp->nruns;
  196|   117k|        sp->refruns[0] = (uint32_t)sp->b.rowpixels;
  197|   117k|        sp->refruns[1] = 0;
  198|   117k|    }
  199|   127k|    sp->line = 0;
  200|   127k|    return (1);
  201|   127k|}
tif_fax3.c:Fax3Decode1D:
  349|  91.4k|{
  350|  91.4k|    DECLARE_STATE(tif, sp, "Fax3Decode1D");
  ------------------
  |  |  123|  91.4k|    static const char module[] = mod;                                          \
  |  |  124|  91.4k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  ------------------
  |  |  |  |  108|  91.4k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  91.4k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  125|  91.4k|    int a0;                                   /* reference element */          \
  |  |  126|  91.4k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  127|  91.4k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  128|  91.4k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  129|  91.4k|    int RunLength;                            /* length of current run */      \
  |  |  130|  91.4k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  131|  91.4k|    unsigned char *ep;                        /* end of input data */          \
  |  |  132|  91.4k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  133|  91.4k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  134|  91.4k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  135|  91.4k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  136|  91.4k|    const TIFFFaxTabEnt *TabEnt
  ------------------
  351|  91.4k|    (void)s;
  352|       |    /* buf is advanced as rows are decoded, so whether the caller supplied a
  353|       |     * buffer at all has to be remembered here. */
  354|  91.4k|    const int has_buf = (buf != NULL);
  355|  91.4k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (355:9): [True: 0, False: 91.4k]
  ------------------
  356|      0|    {
  357|      0|        Fax3ClearUnwritten(has_buf, buf, occ);
  358|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  359|      0|        return (-1);
  360|      0|    }
  361|  91.4k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (361:9): [True: 2, False: 91.4k]
  ------------------
  362|      2|    {
  363|      2|        Fax3ClearUnwritten(has_buf, buf, occ);
  364|      2|        return (-1);
  365|      2|    }
  366|  91.8k|RETRY_WITHOUT_EOL_1D:
  367|  91.8k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  91.8k|    do                                                                         \
  |  |  148|  91.8k|    {                                                                          \
  |  |  149|  91.8k|        BitAcc = sp->data;                                                     \
  |  |  150|  91.8k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  91.8k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  91.8k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  91.8k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  91.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 91.8k]
  |  |  ------------------
  ------------------
  368|  91.8k|    thisrun = sp->curruns;
  369|  34.3M|    while (occ > 0)
  ------------------
  |  Branch (369:12): [True: 34.2M, False: 90.4k]
  ------------------
  370|  34.2M|    {
  371|  34.2M|        a0 = 0;
  372|  34.2M|        RunLength = 0;
  373|  34.2M|        pa = thisrun;
  374|       |#ifdef FAX3_DEBUG
  375|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d\n", BitAcc, BitsAvail);
  376|       |        printf("-------------------- %" PRIu32 "\n", tif->tif_dir.td_row);
  377|       |        fflush(stdout);
  378|       |#endif
  379|  34.2M|        SYNC_EOL(EOF1D, RETRY_WITHOUT_EOL_1D);
  ------------------
  |  |  293|  34.2M|    do                                                                         \
  |  |  294|  34.2M|    {                                                                          \
  |  |  295|  34.2M|        if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */      \
  |  |  ------------------
  |  |  |  |  700|  34.2M|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  |  Branch (295:13): [True: 17.0k, False: 34.2M]
  |  |  ------------------
  |  |  296|  34.2M|        {                                                                      \
  |  |  297|  17.0k|            if (EOLcnt == 0)                                                   \
  |  |  ------------------
  |  |  |  Branch (297:17): [True: 7.41k, False: 9.67k]
  |  |  ------------------
  |  |  298|  17.0k|            {                                                                  \
  |  |  299|  7.41k|                for (;;)                                                       \
  |  |  300|  2.15M|                {                                                              \
  |  |  301|  2.15M|                    NeedBits16(11, eoflab);                                    \
  |  |  ------------------
  |  |  |  |  164|  2.15M|    do                                                                         \
  |  |  |  |  165|  2.15M|    {                                                                          \
  |  |  |  |  166|  2.15M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (166:13): [True: 273k, False: 1.87M]
  |  |  |  |  ------------------
  |  |  |  |  167|  2.15M|        {                                                                      \
  |  |  |  |  168|   273k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|   273k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 884, False: 273k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  169|   273k|            {                                                                  \
  |  |  |  |  170|    884|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:21): [True: 2, False: 882]
  |  |  |  |  ------------------
  |  |  |  |  171|    884|                    goto eoflab;                                               \
  |  |  |  |  172|    884|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  173|    882|            }                                                                  \
  |  |  |  |  174|   273k|            else                                                               \
  |  |  |  |  175|   273k|            {                                                                  \
  |  |  |  |  176|   273k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  177|   273k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:21): [True: 1.61k, False: 271k]
  |  |  |  |  ------------------
  |  |  |  |  178|   273k|                {                                                              \
  |  |  |  |  179|  1.61k|                    if (EndOfData())                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  1.61k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 17, False: 1.59k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  180|  1.61k|                    {                                                          \
  |  |  |  |  181|     17|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  182|     17|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  183|     17|                    }                                                          \
  |  |  |  |  184|  1.61k|                    else                                                       \
  |  |  |  |  185|  1.61k|                    {                                                          \
  |  |  |  |  186|  1.59k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  187|  1.59k|                        BitsAvail += 8;                                        \
  |  |  |  |  188|  1.59k|                    }                                                          \
  |  |  |  |  189|  1.61k|                }                                                              \
  |  |  |  |  190|   273k|            }                                                                  \
  |  |  |  |  191|   273k|        }                                                                      \
  |  |  |  |  192|  2.15M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:14): [Folded, False: 2.15M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  2.15M|                    if (GetBits(11) == 0)                                      \
  |  |  ------------------
  |  |  |  |  194|  2.15M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (302:25): [True: 7.41k, False: 2.14M]
  |  |  ------------------
  |  |  303|  2.15M|                        break; /* EOL found */                                 \
  |  |  304|  2.15M|                    ClrBits(1);                                                \
  |  |  ------------------
  |  |  |  |  196|  2.14M|    do                                                                         \
  |  |  |  |  197|  2.14M|    {                                                                          \
  |  |  |  |  198|  2.14M|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  2.14M|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  2.14M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 2.14M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  2.14M|                }                                                              \
  |  |  306|  7.41k|            }                                                                  \
  |  |  307|  17.0k|            /* Now move after EOL or detect missing EOL. */                    \
  |  |  308|  17.0k|            for (;;)                                                           \
  |  |  309|  46.5k|            {                                                                  \
  |  |  310|  46.5k|                NeedBits8(8, noEOLFound);                                      \
  |  |  ------------------
  |  |  |  |  144|  46.5k|    do                                                                         \
  |  |  |  |  145|  46.5k|    {                                                                          \
  |  |  |  |  146|  46.5k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 32.5k, False: 14.0k]
  |  |  |  |  ------------------
  |  |  |  |  147|  46.5k|        {                                                                      \
  |  |  |  |  148|  32.5k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  32.5k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 902, False: 31.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  32.5k|            {                                                                  \
  |  |  |  |  150|    902|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 323, False: 579]
  |  |  |  |  ------------------
  |  |  |  |  151|    902|                    goto eoflab;                                               \
  |  |  |  |  152|    902|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|    579|            }                                                                  \
  |  |  |  |  154|  32.5k|            else                                                               \
  |  |  |  |  155|  32.5k|            {                                                                  \
  |  |  |  |  156|  31.6k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  31.6k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  31.6k|            }                                                                  \
  |  |  |  |  159|  32.5k|        }                                                                      \
  |  |  |  |  160|  46.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 46.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|  46.5k|                if (GetBits(8))                                                \
  |  |  ------------------
  |  |  |  |  194|  46.2k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 16.7k, False: 29.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|  46.2k|                    break;                                                     \
  |  |  313|  46.2k|                ClrBits(8);                                                    \
  |  |  ------------------
  |  |  |  |  196|  29.4k|    do                                                                         \
  |  |  |  |  197|  29.4k|    {                                                                          \
  |  |  |  |  198|  29.4k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  29.4k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  29.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 29.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|  29.4k|            }                                                                  \
  |  |  315|  72.9k|            while (GetBits(1) == 0)                                            \
  |  |  ------------------
  |  |  |  |  194|  72.9k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (315:20): [True: 56.1k, False: 16.7k]
  |  |  ------------------
  |  |  316|  56.1k|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|  72.9k|    do                                                                         \
  |  |  |  |  197|  72.9k|    {                                                                          \
  |  |  |  |  198|  56.1k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  56.1k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  56.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 56.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  16.7k|            ClrBits(1); /* EOL bit */                                          \
  |  |  ------------------
  |  |  |  |  196|  16.7k|    do                                                                         \
  |  |  |  |  197|  16.7k|    {                                                                          \
  |  |  |  |  198|  16.7k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  16.7k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  16.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 16.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  16.7k|            EOLcnt = 0; /* reset EOL counter/flag */                           \
  |  |  319|  16.7k|            break;      /* existing EOL skipped, leave macro */                \
  |  |  320|  17.0k|        noEOLFound:                                                            \
  |  |  321|    323|            sp->b.mode |= FAXMODE_NOEOL;                                       \
  |  |  ------------------
  |  |  |  |  700|    323|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  322|    323|            tryG3WithoutEOL(a0);                                               \
  |  |  ------------------
  |  |  |  |  289|    323|    do                                                                         \
  |  |  |  |  290|    323|    {                                                                          \
  |  |  |  |  291|    323|        Fax3TryG3WithoutEOL(module, tif, (uint32_t)sp->line, (uint32_t)(a0));  \
  |  |  |  |  292|    323|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (292:14): [Folded, False: 323]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|    323|            goto retrywithouteol;                                              \
  |  |  324|  17.0k|        }                                                                      \
  |  |  325|  34.2M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (325:14): [Folded, False: 34.2M]
  |  |  ------------------
  ------------------
  380|  34.2M|        EXPAND1D(EOF1Da);
  ------------------
  |  |  371|  34.2M|    do                                                                         \
  |  |  372|  34.2M|    {                                                                          \
  |  |  373|  34.2M|        for (;;)                                                               \
  |  |  374|  34.3M|        {                                                                      \
  |  |  375|  34.3M|            for (;;)                                                           \
  |  |  376|  39.1M|            {                                                                  \
  |  |  377|  39.1M|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  39.1M|    do                                                                         \
  |  |  |  |  255|  39.1M|    {                                                                          \
  |  |  |  |  256|  39.1M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  39.1M|    do                                                                         \
  |  |  |  |  |  |  165|  39.1M|    {                                                                          \
  |  |  |  |  |  |  166|  39.1M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 5.19M, False: 33.9M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  39.1M|        {                                                                      \
  |  |  |  |  |  |  168|  5.19M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  5.19M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 371k, False: 4.81M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  5.19M|            {                                                                  \
  |  |  |  |  |  |  170|   371k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 597, False: 371k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|   371k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|   371k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|   371k|            }                                                                  \
  |  |  |  |  |  |  174|  5.19M|            else                                                               \
  |  |  |  |  |  |  175|  5.19M|            {                                                                  \
  |  |  |  |  |  |  176|  4.81M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  4.81M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 239k, False: 4.57M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  4.81M|                {                                                              \
  |  |  |  |  |  |  179|   239k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   239k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 803, False: 238k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|   239k|                    {                                                          \
  |  |  |  |  |  |  181|    803|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    803|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    803|                    }                                                          \
  |  |  |  |  |  |  184|   239k|                    else                                                       \
  |  |  |  |  |  |  185|   239k|                    {                                                          \
  |  |  |  |  |  |  186|   238k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|   238k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|   238k|                    }                                                          \
  |  |  |  |  |  |  189|   239k|                }                                                              \
  |  |  |  |  |  |  190|  4.81M|            }                                                                  \
  |  |  |  |  |  |  191|  5.19M|        }                                                                      \
  |  |  |  |  |  |  192|  39.1M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 39.1M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  39.1M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  39.1M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  39.1M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  39.1M|    do                                                                         \
  |  |  |  |  |  |  197|  39.1M|    {                                                                          \
  |  |  |  |  |  |  198|  39.1M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  39.1M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  39.1M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 39.1M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  39.1M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 39.1M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  39.1M|                switch (TabEnt->State)                                         \
  |  |  379|  39.1M|                {                                                              \
  |  |  380|   387k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|   387k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 387k, False: 38.7M]
  |  |  ------------------
  |  |  381|   387k|                        EOLcnt = 1;                                            \
  |  |  382|   387k|                        goto done1d;                                           \
  |  |  383|   181k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|   181k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 181k, False: 38.9M]
  |  |  ------------------
  |  |  384|   181k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   181k|    do                                                                         \
  |  |  |  |  267|   181k|    {                                                                          \
  |  |  |  |  268|   181k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 181k]
  |  |  |  |  ------------------
  |  |  |  |  269|   181k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   181k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   181k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   181k|        RunLength = 0;                                                         \
  |  |  |  |  279|   181k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 181k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|   181k|                        goto doneWhite1d;                                      \
  |  |  386|  4.30M|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|  4.30M|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 4.30M, False: 34.8M]
  |  |  ------------------
  |  |  387|  4.75M|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  4.75M|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 450k, False: 38.6M]
  |  |  ------------------
  |  |  388|  4.75M|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|  4.75M|                        RunLength =                                            \
  |  |  390|  4.75M|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|  4.75M|                        break;                                                 \
  |  |  392|  33.8M|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 33.8M, False: 5.32M]
  |  |  ------------------
  |  |  393|  33.8M|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  33.8M|    do                                                                         \
  |  |  |  |  221|  33.8M|    {                                                                          \
  |  |  |  |  222|  33.8M|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  33.8M|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  33.8M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 33.8M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  33.8M|                        goto done1d;                                           \
  |  |  395|  39.1M|                }                                                              \
  |  |  396|  39.1M|            }                                                                  \
  |  |  397|  34.3M|        doneWhite1d:                                                           \
  |  |  398|   181k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 17.7k, False: 163k]
  |  |  ------------------
  |  |  399|   181k|                goto done1d;                                                   \
  |  |  400|   181k|            for (;;)                                                           \
  |  |  401|   168k|            {                                                                  \
  |  |  402|   168k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   168k|    do                                                                         \
  |  |  |  |  255|   168k|    {                                                                          \
  |  |  |  |  256|   168k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   168k|    do                                                                         \
  |  |  |  |  |  |  165|   168k|    {                                                                          \
  |  |  |  |  |  |  166|   168k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 150k, False: 17.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   168k|        {                                                                      \
  |  |  |  |  |  |  168|   150k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   150k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.42k, False: 148k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   150k|            {                                                                  \
  |  |  |  |  |  |  170|  2.42k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 438, False: 1.99k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.42k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.42k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  1.99k|            }                                                                  \
  |  |  |  |  |  |  174|   150k|            else                                                               \
  |  |  |  |  |  |  175|   150k|            {                                                                  \
  |  |  |  |  |  |  176|   148k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   148k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2.69k, False: 145k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   148k|                {                                                              \
  |  |  |  |  |  |  179|  2.69k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.69k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 232, False: 2.46k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  2.69k|                    {                                                          \
  |  |  |  |  |  |  181|    232|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    232|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    232|                    }                                                          \
  |  |  |  |  |  |  184|  2.69k|                    else                                                       \
  |  |  |  |  |  |  185|  2.69k|                    {                                                          \
  |  |  |  |  |  |  186|  2.46k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  2.46k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  2.46k|                    }                                                          \
  |  |  |  |  |  |  189|  2.69k|                }                                                              \
  |  |  |  |  |  |  190|   148k|            }                                                                  \
  |  |  |  |  |  |  191|   150k|        }                                                                      \
  |  |  |  |  |  |  192|   168k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 167k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   168k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   167k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   167k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   167k|    do                                                                         \
  |  |  |  |  |  |  197|   167k|    {                                                                          \
  |  |  |  |  |  |  198|   167k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   167k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   167k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 167k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   167k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 167k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|   168k|                switch (TabEnt->State)                                         \
  |  |  404|   167k|                {                                                              \
  |  |  405|  10.4k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  10.4k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 10.4k, False: 157k]
  |  |  ------------------
  |  |  406|  10.4k|                        EOLcnt = 1;                                            \
  |  |  407|  10.4k|                        goto done1d;                                           \
  |  |  408|   151k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|   151k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 151k, False: 16.5k]
  |  |  ------------------
  |  |  409|   151k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   151k|    do                                                                         \
  |  |  |  |  267|   151k|    {                                                                          \
  |  |  |  |  268|   151k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 151k]
  |  |  |  |  ------------------
  |  |  |  |  269|   151k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   151k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   151k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   151k|        RunLength = 0;                                                         \
  |  |  |  |  279|   151k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 151k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|   151k|                        goto doneBlack1d;                                      \
  |  |  411|   151k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|  1.95k|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 1.95k, False: 165k]
  |  |  ------------------
  |  |  412|  4.51k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  4.51k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 2.56k, False: 165k]
  |  |  ------------------
  |  |  413|  4.51k|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|  4.51k|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|  4.51k|                        break;                                                 \
  |  |  416|  1.95k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 1.64k, False: 166k]
  |  |  ------------------
  |  |  417|  1.64k|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  1.64k|    do                                                                         \
  |  |  |  |  221|  1.64k|    {                                                                          \
  |  |  |  |  222|  1.64k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  1.64k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  1.64k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 1.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|  1.64k|                        goto done1d;                                           \
  |  |  419|   167k|                }                                                              \
  |  |  420|   167k|            }                                                                  \
  |  |  421|   163k|        doneBlack1d:                                                           \
  |  |  422|   151k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 7.19k, False: 143k]
  |  |  ------------------
  |  |  423|   151k|                goto done1d;                                                   \
  |  |  424|   151k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 609, False: 143k]
  |  |  |  Branch (424:35): [True: 217, False: 392]
  |  |  ------------------
  |  |  425|   143k|                pa -= 2;                                                       \
  |  |  426|   143k|        }                                                                      \
  |  |  427|  34.2M|    eof1d:                                                                     \
  |  |  428|  1.03k|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|  1.03k|    do                                                                         \
  |  |  |  |  272|  1.03k|    {                                                                          \
  |  |  |  |  273|  1.03k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  1.03k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  1.03k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 1.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|  1.03k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|  1.03k|    do                                                                         \
  |  |  |  |  334|  1.03k|    {                                                                          \
  |  |  |  |  335|  1.03k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 634, False: 401]
  |  |  |  |  ------------------
  |  |  |  |  336|  1.03k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    634|    do                                                                         \
  |  |  |  |  |  |  267|    634|    {                                                                          \
  |  |  |  |  |  |  268|    634|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 634]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    634|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    634|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    634|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    634|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    634|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 634]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  1.03k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 830, False: 205]
  |  |  |  |  ------------------
  |  |  |  |  338|  1.03k|        {                                                                      \
  |  |  |  |  339|    830|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    830|    do                                                                         \
  |  |  |  |  |  |  254|    830|    {                                                                          \
  |  |  |  |  |  |  255|    830|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    830|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    830|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    830|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 830]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  1.24k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 413, False: 830]
  |  |  |  |  |  Branch (340:39): [True: 413, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    830|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    830|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 830, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    830|            {                                                                  \
  |  |  |  |  344|    830|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 830]
  |  |  |  |  ------------------
  |  |  |  |  345|    830|                    a0 = 0;                                                    \
  |  |  |  |  346|    830|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 245, False: 585]
  |  |  |  |  ------------------
  |  |  |  |  347|    830|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    245|    do                                                                         \
  |  |  |  |  |  |  267|    245|    {                                                                          \
  |  |  |  |  |  |  268|    245|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 245]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    245|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    245|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    245|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    245|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    245|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 245]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    830|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    830|    do                                                                         \
  |  |  |  |  |  |  267|    830|    {                                                                          \
  |  |  |  |  |  |  268|    830|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 830]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    830|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    830|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    830|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    830|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    830|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 830]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    830|            }                                                                  \
  |  |  |  |  350|    830|            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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|    830|        }                                                                      \
  |  |  |  |  356|  1.03k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 1.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|  1.03k|        goto eoflab;                                                           \
  |  |  431|  34.2M|    done1d:                                                                    \
  |  |  432|  34.2M|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|  34.2M|    do                                                                         \
  |  |  |  |  334|  34.2M|    {                                                                          \
  |  |  |  |  335|  34.2M|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 1.63k, False: 34.2M]
  |  |  |  |  ------------------
  |  |  |  |  336|  34.2M|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.63k|    do                                                                         \
  |  |  |  |  |  |  267|  1.63k|    {                                                                          \
  |  |  |  |  |  |  268|  1.63k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 1.63k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.63k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  1.63k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  1.63k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  1.63k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  1.63k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1.63k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  34.2M|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 34.2M, False: 3.57k]
  |  |  |  |  ------------------
  |  |  |  |  338|  34.2M|        {                                                                      \
  |  |  |  |  339|  34.2M|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  34.2M|    do                                                                         \
  |  |  |  |  |  |  254|  34.2M|    {                                                                          \
  |  |  |  |  |  |  255|  34.2M|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  34.2M|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  34.2M|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  34.2M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 34.2M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  34.2M|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 22.2k, False: 34.2M]
  |  |  |  |  |  Branch (340:39): [True: 22.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  34.2M|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  34.2M|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 34.2M, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|  34.2M|            {                                                                  \
  |  |  |  |  344|  34.2M|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 34.2M]
  |  |  |  |  ------------------
  |  |  |  |  345|  34.2M|                    a0 = 0;                                                    \
  |  |  |  |  346|  34.2M|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 16.9k, False: 34.2M]
  |  |  |  |  ------------------
  |  |  |  |  347|  34.2M|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  16.9k|    do                                                                         \
  |  |  |  |  |  |  267|  16.9k|    {                                                                          \
  |  |  |  |  |  |  268|  16.9k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 16.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  16.9k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  16.9k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  16.9k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  16.9k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  16.9k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 16.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  34.2M|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  34.2M|    do                                                                         \
  |  |  |  |  |  |  267|  34.2M|    {                                                                          \
  |  |  |  |  |  |  268|  34.2M|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 34.2M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  34.2M|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  34.2M|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  34.2M|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  34.2M|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  34.2M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 34.2M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  34.2M|            }                                                                  \
  |  |  |  |  350|  34.2M|            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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|  34.2M|        }                                                                      \
  |  |  |  |  356|  34.2M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 34.2M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|  34.2M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 34.2M]
  |  |  ------------------
  ------------------
  381|  34.2M|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  382|  34.2M|        buf += sp->b.rowbytes;
  383|  34.2M|        occ -= sp->b.rowbytes;
  384|  34.2M|        sp->line++;
  385|  34.2M|        continue;
  386|      2|    EOF1D: /* premature EOF */
  387|      2|        CLEANUP_RUNS();
  ------------------
  |  |  333|      2|    do                                                                         \
  |  |  334|      2|    {                                                                          \
  |  |  335|      2|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (335:13): [True: 0, False: 2]
  |  |  ------------------
  |  |  336|      2|            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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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|      2|        if (a0 != (int)lastx)                                                  \
  |  |  ------------------
  |  |  |  Branch (337:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  338|      2|        {                                                                      \
  |  |  339|      2|            badlength(a0, lastx);                                              \
  |  |  ------------------
  |  |  |  |  253|      2|    do                                                                         \
  |  |  |  |  254|      2|    {                                                                          \
  |  |  |  |  255|      2|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  256|      2|                      (uint32_t)(lastx));                                      \
  |  |  |  |  257|      2|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  258|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|      2|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  ------------------
  |  |  |  Branch (340:20): [True: 0, False: 2]
  |  |  |  Branch (340:39): [True: 0, False: 0]
  |  |  ------------------
  |  |  341|      2|                a0 -= (int)*--pa;                                              \
  |  |  342|      2|            if (a0 < (int)lastx)                                               \
  |  |  ------------------
  |  |  |  Branch (342:17): [True: 2, False: 0]
  |  |  ------------------
  |  |  343|      2|            {                                                                  \
  |  |  344|      2|                if (a0 < 0)                                                    \
  |  |  ------------------
  |  |  |  Branch (344:21): [True: 0, False: 2]
  |  |  ------------------
  |  |  345|      2|                    a0 = 0;                                                    \
  |  |  346|      2|                if ((pa - thisrun) & 1)                                        \
  |  |  ------------------
  |  |  |  Branch (346:21): [True: 0, False: 2]
  |  |  ------------------
  |  |  347|      2|                    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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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|      2|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  ------------------
  |  |  |  |  266|      2|    do                                                                         \
  |  |  |  |  267|      2|    {                                                                          \
  |  |  |  |  268|      2|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  269|      2|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      2|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      2|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      2|        RunLength = 0;                                                         \
  |  |  |  |  279|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  349|      2|            }                                                                  \
  |  |  350|      2|            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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282: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|        }                                                                      \
  |  |  356|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (356:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  388|  1.03k|    EOF1Da: /* premature EOF */
  389|  1.03k|        Fax3ClearUnwritten(has_buf, buf, occ);
  390|  1.03k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  391|  1.03k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  1.03k|    do                                                                         \
  |  |  160|  1.03k|    {                                                                          \
  |  |  161|  1.03k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  1.03k|        sp->data = BitAcc;                                                     \
  |  |  163|  1.03k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  1.03k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  1.03k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  1.03k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 1.03k]
  |  |  ------------------
  ------------------
  392|  1.03k|        return (-1);
  393|      2|    }
  394|  90.4k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  90.4k|    do                                                                         \
  |  |  160|  90.4k|    {                                                                          \
  |  |  161|  90.4k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  90.4k|        sp->data = BitAcc;                                                     \
  |  |  163|  90.4k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  90.4k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  90.4k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  90.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 90.4k]
  |  |  ------------------
  ------------------
  395|  90.4k|    return (1);
  396|  91.8k|}
tif_fax3.c:Fax3Cleanup:
 1366|  2.61k|{
 1367|  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)
  |  |  ------------------
  ------------------
 1368|       |
 1369|  2.61k|    assert(sp != 0);
  ------------------
  |  Branch (1369:5): [True: 0, False: 2.61k]
  |  Branch (1369:5): [True: 2.61k, False: 0]
  ------------------
 1370|       |
 1371|  2.61k|    tif->tif_tagmethods.vgetfield = sp->b.vgetparent;
 1372|  2.61k|    tif->tif_tagmethods.vsetfield = sp->b.vsetparent;
 1373|  2.61k|    tif->tif_tagmethods.printdir = sp->b.printdir;
 1374|       |
 1375|  2.61k|    if (sp->runs)
  ------------------
  |  Branch (1375:9): [True: 2.42k, False: 188]
  ------------------
 1376|  2.42k|        _TIFFfreeExt(tif, sp->runs);
 1377|  2.61k|    if (sp->refline)
  ------------------
  |  Branch (1377:9): [True: 1.70k, False: 913]
  ------------------
 1378|  1.70k|        _TIFFfreeExt(tif, sp->refline);
 1379|       |
 1380|  2.61k|    _TIFFfreeExt(tif, tif->tif_data);
 1381|  2.61k|    tif->tif_data = NULL;
 1382|       |
 1383|  2.61k|    _TIFFSetDefaultCompressionState(tif);
 1384|  2.61k|}
tif_fax3.c:Fax4Decode:
 1683|  82.2k|{
 1684|  82.2k|    DECLARE_STATE_2D(tif, sp, "Fax4Decode");
  ------------------
  |  |  139|  82.2k|    DECLARE_STATE(tif, sp, mod);                                               \
  |  |  ------------------
  |  |  |  |  123|  82.2k|    static const char module[] = mod;                                          \
  |  |  |  |  124|  82.2k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  82.2k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|  82.2k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  125|  82.2k|    int a0;                                   /* reference element */          \
  |  |  |  |  126|  82.2k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  |  |  127|  82.2k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  |  |  128|  82.2k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  |  |  129|  82.2k|    int RunLength;                            /* length of current run */      \
  |  |  |  |  130|  82.2k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  |  |  131|  82.2k|    unsigned char *ep;                        /* end of input data */          \
  |  |  |  |  132|  82.2k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  |  |  133|  82.2k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  |  |  134|  82.2k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  |  |  135|  82.2k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  |  |  136|  82.2k|    const TIFFFaxTabEnt *TabEnt
  |  |  ------------------
  |  |  140|  82.2k|    int b1; /* next change on prev line */                                     \
  |  |  141|  82.2k|    uint32_t                                                                   \
  |  |  142|  82.2k|        *pb /* next run in reference line */ /*                                \
  ------------------
 1685|  82.2k|    (void)s;
 1686|       |    /* buf is advanced as rows are decoded, so whether the caller supplied a
 1687|       |     * buffer at all has to be remembered here. */
 1688|  82.2k|    const int has_buf = (buf != NULL);
 1689|  82.2k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1689:9): [True: 0, False: 82.2k]
  ------------------
 1690|      0|    {
 1691|      0|        Fax3ClearUnwritten(has_buf, buf, occ);
 1692|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1693|      0|        return (-1);
 1694|      0|    }
 1695|  82.2k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (1695:9): [True: 0, False: 82.2k]
  ------------------
 1696|      0|    {
 1697|      0|        Fax3ClearUnwritten(has_buf, buf, occ);
 1698|      0|        return (-1);
 1699|      0|    }
 1700|  82.2k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  82.2k|    do                                                                         \
  |  |  148|  82.2k|    {                                                                          \
  |  |  149|  82.2k|        BitAcc = sp->data;                                                     \
  |  |  150|  82.2k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  82.2k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  82.2k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  82.2k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  82.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 82.2k]
  |  |  ------------------
  ------------------
 1701|  82.2k|    int start = sp->line;
 1702|   639k|    while (occ > 0)
  ------------------
  |  Branch (1702:12): [True: 635k, False: 4.33k]
  ------------------
 1703|   635k|    {
 1704|   635k|        a0 = 0;
 1705|   635k|        RunLength = 0;
 1706|   635k|        pa = thisrun = sp->curruns;
 1707|   635k|        pb = sp->refruns;
 1708|   635k|        b1 = (int)*pb++;
 1709|       |#ifdef FAX3_DEBUG
 1710|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d\n", BitAcc, BitsAvail);
 1711|       |        printf("-------------------- %d\n", tif->tif_dir.td_row);
 1712|       |        fflush(stdout);
 1713|       |#endif
 1714|   635k|        EXPAND2D(EOFG4);
  ------------------
  |  |  463|   635k|    do                                                                         \
  |  |  464|   635k|    {                                                                          \
  |  |  465|  2.40M|        while (a0 < (int)lastx)                                                \
  |  |  ------------------
  |  |  |  Branch (465:16): [True: 1.87M, False: 528k]
  |  |  ------------------
  |  |  466|  1.87M|        {                                                                      \
  |  |  467|  1.87M|            if (pa >= thisrun + sp->nruns)                                     \
  |  |  ------------------
  |  |  |  Branch (467:17): [True: 621, False: 1.87M]
  |  |  ------------------
  |  |  468|  1.87M|            {                                                                  \
  |  |  469|    621|                TIFFErrorExtR(tif, module,                                     \
  |  |  470|    621|                              "Buffer overflow at line %d of %s %u", sp->line, \
  |  |  471|    621|                              isTiled(tif) ? "tile" : "strip",                 \
  |  |  ------------------
  |  |  |  |  282|    621|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    621|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 259, False: 362]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|    621|                              isTiled(tif) ? tif->tif_dir.td_curtile           \
  |  |  ------------------
  |  |  |  |  282|    621|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    621|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 259, False: 362]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|    621|                                           : tif->tif_dir.td_curstrip);        \
  |  |  474|    621|                return (-1);                                                   \
  |  |  475|    621|            }                                                                  \
  |  |  476|  1.87M|            LOOKUP8(7, TIFFFaxMainTable, eof2d);                               \
  |  |  ------------------
  |  |  |  |  247|  1.87M|    do                                                                         \
  |  |  |  |  248|  1.87M|    {                                                                          \
  |  |  |  |  249|  1.87M|        NeedBits8(wid, eoflab);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  1.87M|    do                                                                         \
  |  |  |  |  |  |  145|  1.87M|    {                                                                          \
  |  |  |  |  |  |  146|  1.87M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:13): [True: 481k, False: 1.39M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.87M|        {                                                                      \
  |  |  |  |  |  |  148|   481k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   481k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 17.5k, False: 463k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  149|   481k|            {                                                                  \
  |  |  |  |  |  |  150|  17.5k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:21): [True: 395, False: 17.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  17.5k|                    goto eoflab;                                               \
  |  |  |  |  |  |  152|  17.5k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  153|  17.1k|            }                                                                  \
  |  |  |  |  |  |  154|   481k|            else                                                               \
  |  |  |  |  |  |  155|   481k|            {                                                                  \
  |  |  |  |  |  |  156|   463k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  157|   463k|                BitsAvail += 8;                                                \
  |  |  |  |  |  |  158|   463k|            }                                                                  \
  |  |  |  |  |  |  159|   481k|        }                                                                      \
  |  |  |  |  |  |  160|  1.87M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (160:14): [Folded, False: 1.87M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  250|  1.87M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  1.87M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  251|  1.87M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  1.87M|    do                                                                         \
  |  |  |  |  |  |  197|  1.87M|    {                                                                          \
  |  |  |  |  |  |  198|  1.87M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  1.87M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  1.87M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 1.87M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|  1.87M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (252:14): [Folded, False: 1.87M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|  1.87M|            switch (TabEnt->State)                                             \
  |  |  478|  1.87M|            {                                                                  \
  |  |  479|   113k|                case S_Pass:                                                   \
  |  |  ------------------
  |  |  |  |   71|   113k|#define S_Pass 1
  |  |  ------------------
  |  |  |  Branch (479:17): [True: 113k, False: 1.76M]
  |  |  ------------------
  |  |  480|   113k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   113k|    do                                                                         \
  |  |  |  |  441|   113k|    {                                                                          \
  |  |  |  |  442|   113k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 91.3k, False: 21.8k]
  |  |  |  |  ------------------
  |  |  |  |  443|   113k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 20.9k, False: 91.3k]
  |  |  |  |  |  Branch (443:32): [True: 20.9k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  91.3k|            {                                                                  \
  |  |  |  |  445|  20.9k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 20.9k]
  |  |  |  |  ------------------
  |  |  |  |  446|  20.9k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|  20.9k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  20.9k|                pb += 2;                                                       \
  |  |  |  |  456|  20.9k|            }                                                                  \
  |  |  |  |  457|   113k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 113k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|   113k|                    if (pb + 1 >= sp->refruns + sp->nruns)                     \
  |  |  ------------------
  |  |  |  Branch (481:25): [True: 439, False: 112k]
  |  |  ------------------
  |  |  482|   113k|                    {                                                          \
  |  |  483|    439|                        TIFFErrorExtR(                                         \
  |  |  484|    439|                            tif, module,                                       \
  |  |  485|    439|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  486|    439|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  282|    439|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    439|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 229, False: 210]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|    439|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  282|    439|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    439|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 229, False: 210]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    439|                                         : tif->tif_dir.td_curstrip);          \
  |  |  489|    439|                        return (-1);                                           \
  |  |  490|    439|                    }                                                          \
  |  |  491|   113k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  492|   112k|                    RunLength =                                                \
  |  |  493|   112k|                        (int)((uint32_t)RunLength + (uint32_t)(b1 - a0));      \
  |  |  494|   112k|                    a0 = b1;                                                   \
  |  |  495|   112k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  496|   112k|                    break;                                                     \
  |  |  497|   326k|                case S_Horiz:                                                  \
  |  |  ------------------
  |  |  |  |   72|   326k|#define S_Horiz 2
  |  |  ------------------
  |  |  |  Branch (497:17): [True: 326k, False: 1.54M]
  |  |  ------------------
  |  |  498|   326k|                    if ((pa - thisrun) & 1)                                    \
  |  |  ------------------
  |  |  |  Branch (498:25): [True: 52.8k, False: 274k]
  |  |  ------------------
  |  |  499|   326k|                    {                                                          \
  |  |  500|  52.8k|                        for (;;)                                               \
  |  |  501|  54.7k|                        { /* black first */                                    \
  |  |  502|  54.7k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  54.7k|    do                                                                         \
  |  |  |  |  255|  54.7k|    {                                                                          \
  |  |  |  |  256|  54.7k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  54.7k|    do                                                                         \
  |  |  |  |  |  |  165|  54.7k|    {                                                                          \
  |  |  |  |  |  |  166|  54.7k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 54.0k, False: 671]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  54.7k|        {                                                                      \
  |  |  |  |  |  |  168|  54.0k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  54.0k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 1.22k, False: 52.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  54.0k|            {                                                                  \
  |  |  |  |  |  |  170|  1.22k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 227, False: 999]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.22k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  1.22k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    999|            }                                                                  \
  |  |  |  |  |  |  174|  54.0k|            else                                                               \
  |  |  |  |  |  |  175|  54.0k|            {                                                                  \
  |  |  |  |  |  |  176|  52.8k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  52.8k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 7.35k, False: 45.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  52.8k|                {                                                              \
  |  |  |  |  |  |  179|  7.35k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  7.35k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 494, False: 6.85k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  7.35k|                    {                                                          \
  |  |  |  |  |  |  181|    494|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    494|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    494|                    }                                                          \
  |  |  |  |  |  |  184|  7.35k|                    else                                                       \
  |  |  |  |  |  |  185|  7.35k|                    {                                                          \
  |  |  |  |  |  |  186|  6.85k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  6.85k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  6.85k|                    }                                                          \
  |  |  |  |  |  |  189|  7.35k|                }                                                              \
  |  |  |  |  |  |  190|  52.8k|            }                                                                  \
  |  |  |  |  |  |  191|  54.0k|        }                                                                      \
  |  |  |  |  |  |  192|  54.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 54.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  54.7k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  54.5k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  54.5k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  54.5k|    do                                                                         \
  |  |  |  |  |  |  197|  54.5k|    {                                                                          \
  |  |  |  |  |  |  198|  54.5k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  54.5k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  54.5k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 54.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  54.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 54.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  54.7k|                            switch (TabEnt->State)                             \
  |  |  504|  54.5k|                            {                                                  \
  |  |  505|  51.5k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  51.5k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (505:33): [True: 51.5k, False: 2.96k]
  |  |  ------------------
  |  |  506|  51.5k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  51.5k|    do                                                                         \
  |  |  |  |  267|  51.5k|    {                                                                          \
  |  |  |  |  268|  51.5k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 51.5k]
  |  |  |  |  ------------------
  |  |  |  |  269|  51.5k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  51.5k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  51.5k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  51.5k|        RunLength = 0;                                                         \
  |  |  |  |  279|  51.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 51.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  507|  51.5k|                                    goto doneWhite2da;                         \
  |  |  508|  51.5k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|    700|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (508:33): [True: 700, False: 53.8k]
  |  |  ------------------
  |  |  509|  1.90k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  1.90k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (509:33): [True: 1.20k, False: 53.3k]
  |  |  ------------------
  |  |  510|  1.90k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  511|  1.90k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  512|  1.90k|                                                      TabEnt->Param);          \
  |  |  513|  1.90k|                                    break;                                     \
  |  |  514|  1.05k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (514:33): [True: 1.05k, False: 53.4k]
  |  |  ------------------
  |  |  515|  1.05k|                                    goto badBlack2d;                           \
  |  |  516|  54.5k|                            }                                                  \
  |  |  517|  54.5k|                        }                                                      \
  |  |  518|  52.8k|                    doneWhite2da:;                                             \
  |  |  519|  51.5k|                        for (;;)                                               \
  |  |  520|  79.3k|                        { /* then white */                                     \
  |  |  521|  79.3k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  79.3k|    do                                                                         \
  |  |  |  |  255|  79.3k|    {                                                                          \
  |  |  |  |  256|  79.3k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  79.3k|    do                                                                         \
  |  |  |  |  |  |  165|  79.3k|    {                                                                          \
  |  |  |  |  |  |  166|  79.3k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 32.8k, False: 46.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  79.3k|        {                                                                      \
  |  |  |  |  |  |  168|  32.8k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  32.8k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 1.66k, False: 31.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  32.8k|            {                                                                  \
  |  |  |  |  |  |  170|  1.66k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 579, False: 1.08k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.66k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  1.66k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  1.08k|            }                                                                  \
  |  |  |  |  |  |  174|  32.8k|            else                                                               \
  |  |  |  |  |  |  175|  32.8k|            {                                                                  \
  |  |  |  |  |  |  176|  31.2k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  31.2k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 3.77k, False: 27.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  31.2k|                {                                                              \
  |  |  |  |  |  |  179|  3.77k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  3.77k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 252, False: 3.52k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  3.77k|                    {                                                          \
  |  |  |  |  |  |  181|    252|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    252|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    252|                    }                                                          \
  |  |  |  |  |  |  184|  3.77k|                    else                                                       \
  |  |  |  |  |  |  185|  3.77k|                    {                                                          \
  |  |  |  |  |  |  186|  3.52k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  3.52k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  3.52k|                    }                                                          \
  |  |  |  |  |  |  189|  3.77k|                }                                                              \
  |  |  |  |  |  |  190|  31.2k|            }                                                                  \
  |  |  |  |  |  |  191|  32.8k|        }                                                                      \
  |  |  |  |  |  |  192|  79.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 78.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  79.3k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  78.8k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  78.8k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  78.8k|    do                                                                         \
  |  |  |  |  |  |  197|  78.8k|    {                                                                          \
  |  |  |  |  |  |  198|  78.8k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  78.8k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  78.8k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 78.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  78.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 78.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|  79.3k|                            switch (TabEnt->State)                             \
  |  |  523|  78.8k|                            {                                                  \
  |  |  524|  49.6k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  49.6k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (524:33): [True: 49.6k, False: 29.1k]
  |  |  ------------------
  |  |  525|  49.6k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  49.6k|    do                                                                         \
  |  |  |  |  267|  49.6k|    {                                                                          \
  |  |  |  |  268|  49.6k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 500, False: 49.1k]
  |  |  |  |  ------------------
  |  |  |  |  269|  49.6k|        {                                                                      \
  |  |  |  |  270|    500|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|    500|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    500|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    500|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 233, False: 267]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|    500|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|    500|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|    500|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 233, False: 267]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|    500|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|    500|            return (-1);                                                       \
  |  |  |  |  275|    500|        }                                                                      \
  |  |  |  |  276|  49.6k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  49.1k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  49.1k|        RunLength = 0;                                                         \
  |  |  |  |  279|  49.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 49.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  49.6k|                                    goto doneBlack2da;                         \
  |  |  527|  49.6k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  25.8k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (527:33): [True: 25.8k, False: 52.9k]
  |  |  ------------------
  |  |  528|  27.8k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  27.8k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (528:33): [True: 1.96k, False: 76.8k]
  |  |  ------------------
  |  |  529|  27.8k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  530|  27.8k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  531|  27.8k|                                                      TabEnt->Param);          \
  |  |  532|  27.8k|                                    break;                                     \
  |  |  533|  25.8k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (533:33): [True: 1.35k, False: 77.4k]
  |  |  ------------------
  |  |  534|  1.35k|                                    goto badWhite2d;                           \
  |  |  535|  78.8k|                            }                                                  \
  |  |  536|  78.8k|                        }                                                      \
  |  |  537|  51.5k|                    doneBlack2da:;                                             \
  |  |  538|  49.1k|                    }                                                          \
  |  |  539|   326k|                    else                                                       \
  |  |  540|   326k|                    {                                                          \
  |  |  541|   274k|                        for (;;)                                               \
  |  |  542|   324k|                        { /* white first */                                    \
  |  |  543|   324k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   324k|    do                                                                         \
  |  |  |  |  255|   324k|    {                                                                          \
  |  |  |  |  256|   324k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   324k|    do                                                                         \
  |  |  |  |  |  |  165|   324k|    {                                                                          \
  |  |  |  |  |  |  166|   324k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 309k, False: 15.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   324k|        {                                                                      \
  |  |  |  |  |  |  168|   309k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   309k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.81k, False: 306k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   309k|            {                                                                  \
  |  |  |  |  |  |  170|  2.81k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 224, False: 2.58k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.81k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.81k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  2.58k|            }                                                                  \
  |  |  |  |  |  |  174|   309k|            else                                                               \
  |  |  |  |  |  |  175|   309k|            {                                                                  \
  |  |  |  |  |  |  176|   306k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   306k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2.62k, False: 304k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   306k|                {                                                              \
  |  |  |  |  |  |  179|  2.62k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.62k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 254, False: 2.37k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  2.62k|                    {                                                          \
  |  |  |  |  |  |  181|    254|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    254|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    254|                    }                                                          \
  |  |  |  |  |  |  184|  2.62k|                    else                                                       \
  |  |  |  |  |  |  185|  2.62k|                    {                                                          \
  |  |  |  |  |  |  186|  2.37k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  2.37k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  2.37k|                    }                                                          \
  |  |  |  |  |  |  189|  2.62k|                }                                                              \
  |  |  |  |  |  |  190|   306k|            }                                                                  \
  |  |  |  |  |  |  191|   309k|        }                                                                      \
  |  |  |  |  |  |  192|   324k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 324k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   324k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   324k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   324k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   324k|    do                                                                         \
  |  |  |  |  |  |  197|   324k|    {                                                                          \
  |  |  |  |  |  |  198|   324k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   324k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   324k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 324k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   324k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 324k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|   324k|                            switch (TabEnt->State)                             \
  |  |  545|   324k|                            {                                                  \
  |  |  546|   271k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|   271k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (546:33): [True: 271k, False: 52.7k]
  |  |  ------------------
  |  |  547|   271k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|   271k|    do                                                                         \
  |  |  |  |  267|   271k|    {                                                                          \
  |  |  |  |  268|   271k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 271k]
  |  |  |  |  ------------------
  |  |  |  |  269|   271k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   271k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   271k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   271k|        RunLength = 0;                                                         \
  |  |  |  |  279|   271k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 271k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|   271k|                                    goto doneWhite2db;                         \
  |  |  549|   271k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  45.3k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (549:33): [True: 45.3k, False: 279k]
  |  |  ------------------
  |  |  550|  50.6k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  50.6k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (550:33): [True: 5.28k, False: 319k]
  |  |  ------------------
  |  |  551|  50.6k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  552|  50.6k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  553|  50.6k|                                                      TabEnt->Param);          \
  |  |  554|  50.6k|                                    break;                                     \
  |  |  555|  45.3k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (555:33): [True: 2.12k, False: 322k]
  |  |  ------------------
  |  |  556|  2.12k|                                    goto badWhite2d;                           \
  |  |  557|   324k|                            }                                                  \
  |  |  558|   324k|                        }                                                      \
  |  |  559|   274k|                    doneWhite2db:;                                             \
  |  |  560|   271k|                        for (;;)                                               \
  |  |  561|   274k|                        { /* then black */                                     \
  |  |  562|   274k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   274k|    do                                                                         \
  |  |  |  |  255|   274k|    {                                                                          \
  |  |  |  |  256|   274k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   274k|    do                                                                         \
  |  |  |  |  |  |  165|   274k|    {                                                                          \
  |  |  |  |  |  |  166|   274k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 227k, False: 47.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   274k|        {                                                                      \
  |  |  |  |  |  |  168|   227k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   227k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 3.15k, False: 224k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   227k|            {                                                                  \
  |  |  |  |  |  |  170|  3.15k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 452, False: 2.70k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  3.15k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  3.15k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  2.70k|            }                                                                  \
  |  |  |  |  |  |  174|   227k|            else                                                               \
  |  |  |  |  |  |  175|   227k|            {                                                                  \
  |  |  |  |  |  |  176|   224k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   224k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 7.45k, False: 216k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   224k|                {                                                              \
  |  |  |  |  |  |  179|  7.45k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  7.45k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 268, False: 7.19k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  7.45k|                    {                                                          \
  |  |  |  |  |  |  181|    268|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    268|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    268|                    }                                                          \
  |  |  |  |  |  |  184|  7.45k|                    else                                                       \
  |  |  |  |  |  |  185|  7.45k|                    {                                                          \
  |  |  |  |  |  |  186|  7.19k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  7.19k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  7.19k|                    }                                                          \
  |  |  |  |  |  |  189|  7.45k|                }                                                              \
  |  |  |  |  |  |  190|   224k|            }                                                                  \
  |  |  |  |  |  |  191|   227k|        }                                                                      \
  |  |  |  |  |  |  192|   274k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 274k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   274k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   274k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   274k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   274k|    do                                                                         \
  |  |  |  |  |  |  197|   274k|    {                                                                          \
  |  |  |  |  |  |  198|   274k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   274k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   274k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 274k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   274k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 274k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|   274k|                            switch (TabEnt->State)                             \
  |  |  564|   274k|                            {                                                  \
  |  |  565|   267k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|   267k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (565:33): [True: 267k, False: 6.96k]
  |  |  ------------------
  |  |  566|   267k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|   267k|    do                                                                         \
  |  |  |  |  267|   267k|    {                                                                          \
  |  |  |  |  268|   267k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 267k]
  |  |  |  |  ------------------
  |  |  |  |  269|   267k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   267k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   267k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   267k|        RunLength = 0;                                                         \
  |  |  |  |  279|   267k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 267k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  567|   267k|                                    goto doneBlack2db;                         \
  |  |  568|   267k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|  1.94k|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (568:33): [True: 1.94k, False: 272k]
  |  |  ------------------
  |  |  569|  3.12k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  3.12k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (569:33): [True: 1.17k, False: 273k]
  |  |  ------------------
  |  |  570|  3.12k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  571|  3.12k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  572|  3.12k|                                                      TabEnt->Param);          \
  |  |  573|  3.12k|                                    break;                                     \
  |  |  574|  3.84k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (574:33): [True: 3.84k, False: 270k]
  |  |  ------------------
  |  |  575|  3.84k|                                    goto badBlack2d;                           \
  |  |  576|   274k|                            }                                                  \
  |  |  577|   274k|                        }                                                      \
  |  |  578|   271k|                    doneBlack2db:;                                             \
  |  |  579|   267k|                    }                                                          \
  |  |  580|   326k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   316k|    do                                                                         \
  |  |  |  |  441|   316k|    {                                                                          \
  |  |  |  |  442|   316k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 316k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  443|   529k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 327k, False: 202k]
  |  |  |  |  |  Branch (443:32): [True: 213k, False: 113k]
  |  |  |  |  ------------------
  |  |  |  |  444|   316k|            {                                                                  \
  |  |  |  |  445|   213k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 213k]
  |  |  |  |  ------------------
  |  |  |  |  446|   213k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|   213k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   213k|                pb += 2;                                                       \
  |  |  |  |  456|   213k|            }                                                                  \
  |  |  |  |  457|   316k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 316k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|   316k|                    break;                                                     \
  |  |  582|   550k|                case S_V0:                                                     \
  |  |  ------------------
  |  |  |  |   73|   550k|#define S_V0 3
  |  |  ------------------
  |  |  |  Branch (582:17): [True: 550k, False: 1.32M]
  |  |  ------------------
  |  |  583|   550k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   550k|    do                                                                         \
  |  |  |  |  441|   550k|    {                                                                          \
  |  |  |  |  442|   550k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 330k, False: 219k]
  |  |  |  |  ------------------
  |  |  |  |  443|   550k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 103k, False: 330k]
  |  |  |  |  |  Branch (443:32): [True: 103k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   330k|            {                                                                  \
  |  |  |  |  445|   103k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 103k]
  |  |  |  |  ------------------
  |  |  |  |  446|   103k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|   103k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   103k|                pb += 2;                                                       \
  |  |  |  |  456|   103k|            }                                                                  \
  |  |  |  |  457|   550k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 550k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|   550k|                    SETVALUE(b1 - a0);                                         \
  |  |  ------------------
  |  |  |  |  266|   550k|    do                                                                         \
  |  |  |  |  267|   550k|    {                                                                          \
  |  |  |  |  268|   550k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 550k]
  |  |  |  |  ------------------
  |  |  |  |  269|   550k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   550k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   550k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   550k|        RunLength = 0;                                                         \
  |  |  |  |  279|   550k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 550k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|   550k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (585:25): [True: 439, False: 549k]
  |  |  ------------------
  |  |  586|   550k|                    {                                                          \
  |  |  587|    439|                        TIFFErrorExtR(                                         \
  |  |  588|    439|                            tif, module,                                       \
  |  |  589|    439|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  590|    439|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  282|    439|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    439|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 207, False: 232]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  591|    439|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  282|    439|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    439|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 207, False: 232]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|    439|                                         : tif->tif_dir.td_curstrip);          \
  |  |  593|    439|                        return (-1);                                           \
  |  |  594|    439|                    }                                                          \
  |  |  595|   550k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  596|   549k|                    break;                                                     \
  |  |  597|   550k|                case S_VR:                                                     \
  |  |  ------------------
  |  |  |  |   74|   212k|#define S_VR 4
  |  |  ------------------
  |  |  |  Branch (597:17): [True: 212k, False: 1.66M]
  |  |  ------------------
  |  |  598|   212k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   212k|    do                                                                         \
  |  |  |  |  441|   212k|    {                                                                          \
  |  |  |  |  442|   212k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 139k, False: 72.8k]
  |  |  |  |  ------------------
  |  |  |  |  443|   212k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 52.8k, False: 139k]
  |  |  |  |  |  Branch (443:32): [True: 52.8k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   139k|            {                                                                  \
  |  |  |  |  445|  52.8k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 52.8k]
  |  |  |  |  ------------------
  |  |  |  |  446|  52.8k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|  52.8k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  52.8k|                pb += 2;                                                       \
  |  |  |  |  456|  52.8k|            }                                                                  \
  |  |  |  |  457|   212k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 212k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|   212k|                    SETVALUE((int)((uint32_t)(b1 - a0) + TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   212k|    do                                                                         \
  |  |  |  |  267|   212k|    {                                                                          \
  |  |  |  |  268|   212k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 212k]
  |  |  |  |  ------------------
  |  |  |  |  269|   212k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   212k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   212k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   212k|        RunLength = 0;                                                         \
  |  |  |  |  279|   212k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 212k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|   212k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (600:25): [True: 414, False: 212k]
  |  |  ------------------
  |  |  601|   212k|                    {                                                          \
  |  |  602|    414|                        TIFFErrorExtR(                                         \
  |  |  603|    414|                            tif, module,                                       \
  |  |  604|    414|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  605|    414|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  282|    414|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    414|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 209, False: 205]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  606|    414|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  282|    414|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    414|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 209, False: 205]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  607|    414|                                         : tif->tif_dir.td_curstrip);          \
  |  |  608|    414|                        return (-1);                                           \
  |  |  609|    414|                    }                                                          \
  |  |  610|   212k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  611|   212k|                    break;                                                     \
  |  |  612|   589k|                case S_VL:                                                     \
  |  |  ------------------
  |  |  |  |   75|   589k|#define S_VL 5
  |  |  ------------------
  |  |  |  Branch (612:17): [True: 589k, False: 1.28M]
  |  |  ------------------
  |  |  613|   589k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   589k|    do                                                                         \
  |  |  |  |  441|   589k|    {                                                                          \
  |  |  |  |  442|   589k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 491k, False: 97.7k]
  |  |  |  |  ------------------
  |  |  |  |  443|   732k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 241k, False: 491k]
  |  |  |  |  |  Branch (443:32): [True: 241k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   491k|            {                                                                  \
  |  |  |  |  445|   241k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 241k]
  |  |  |  |  ------------------
  |  |  |  |  446|   241k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|   241k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   241k|                pb += 2;                                                       \
  |  |  |  |  456|   241k|            }                                                                  \
  |  |  |  |  457|   589k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 589k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  614|   589k|                    if (b1 < (int)((uint32_t)a0 + TabEnt->Param))              \
  |  |  ------------------
  |  |  |  Branch (614:25): [True: 10.8k, False: 578k]
  |  |  ------------------
  |  |  615|   589k|                    {                                                          \
  |  |  616|  10.8k|                        unexpected("VL", a0);                                  \
  |  |  ------------------
  |  |  |  |  220|  10.8k|    do                                                                         \
  |  |  |  |  221|  10.8k|    {                                                                          \
  |  |  |  |  222|  10.8k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  10.8k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  10.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 10.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  617|  10.8k|                        goto eol2d;                                            \
  |  |  618|  10.8k|                    }                                                          \
  |  |  619|   589k|                    SETVALUE((int)((uint32_t)(b1 - a0) - TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   578k|    do                                                                         \
  |  |  |  |  267|   578k|    {                                                                          \
  |  |  |  |  268|   578k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 578k]
  |  |  |  |  ------------------
  |  |  |  |  269|   578k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   578k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   578k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   578k|        RunLength = 0;                                                         \
  |  |  |  |  279|   578k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 578k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  620|   578k|                    b1 = b1 - (int)*--pb;                                      \
  |  |  621|   578k|                    break;                                                     \
  |  |  622|   578k|                case S_Ext:                                                    \
  |  |  ------------------
  |  |  |  |   76|  11.4k|#define S_Ext 6
  |  |  ------------------
  |  |  |  Branch (622:17): [True: 11.4k, False: 1.86M]
  |  |  ------------------
  |  |  623|  11.4k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  624|  11.4k|                    extension(a0);                                             \
  |  |  ------------------
  |  |  |  |  238|  11.4k|    Fax3Extension(module, tif, (uint32_t)sp->line, (uint32_t)(a0))
  |  |  ------------------
  |  |  625|  11.4k|                    goto eol2d;                                                \
  |  |  626|   578k|                case S_EOL:                                                    \
  |  |  ------------------
  |  |  |  |   82|  72.2k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (626:17): [True: 72.2k, False: 1.80M]
  |  |  ------------------
  |  |  627|  72.2k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  628|  72.2k|                    NeedBits8(4, eof2d);                                       \
  |  |  ------------------
  |  |  |  |  144|  72.2k|    do                                                                         \
  |  |  |  |  145|  72.2k|    {                                                                          \
  |  |  |  |  146|  72.2k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 49.6k, False: 22.6k]
  |  |  |  |  ------------------
  |  |  |  |  147|  72.2k|        {                                                                      \
  |  |  |  |  148|  49.6k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  49.6k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 10.2k, False: 39.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  49.6k|            {                                                                  \
  |  |  |  |  150|  10.2k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 7.79k, False: 2.43k]
  |  |  |  |  ------------------
  |  |  |  |  151|  10.2k|                    goto eoflab;                                               \
  |  |  |  |  152|  10.2k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|  2.43k|            }                                                                  \
  |  |  |  |  154|  49.6k|            else                                                               \
  |  |  |  |  155|  49.6k|            {                                                                  \
  |  |  |  |  156|  39.3k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  39.3k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  39.3k|            }                                                                  \
  |  |  |  |  159|  49.6k|        }                                                                      \
  |  |  |  |  160|  72.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 64.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|  72.2k|                    if (GetBits(4))                                            \
  |  |  ------------------
  |  |  |  |  194|  64.4k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 19.2k, False: 45.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  630|  64.4k|                        unexpected("EOL", a0);                                 \
  |  |  ------------------
  |  |  |  |  220|  19.2k|    do                                                                         \
  |  |  |  |  221|  19.2k|    {                                                                          \
  |  |  |  |  222|  19.2k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  19.2k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  19.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 19.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  631|  64.4k|                    ClrBits(4);                                                \
  |  |  ------------------
  |  |  |  |  196|  64.4k|    do                                                                         \
  |  |  |  |  197|  64.4k|    {                                                                          \
  |  |  |  |  198|  64.4k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  64.4k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  64.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 64.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|  64.4k|                    EOLcnt = 1;                                                \
  |  |  633|  64.4k|                    goto eol2d;                                                \
  |  |  634|  72.2k|                default:                                                       \
  |  |  ------------------
  |  |  |  Branch (634:17): [True: 0, False: 1.87M]
  |  |  ------------------
  |  |  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|  4.90k|                badBlack2d:                                                    \
  |  |  639|  4.90k|                    unexpected("BlackTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  4.90k|    do                                                                         \
  |  |  |  |  221|  4.90k|    {                                                                          \
  |  |  |  |  222|  4.90k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  4.90k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  4.90k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 4.90k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  640|  4.90k|                    goto eol2d;                                                \
  |  |  641|  3.47k|                badWhite2d:                                                    \
  |  |  642|  3.47k|                    unexpected("WhiteTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  3.47k|    do                                                                         \
  |  |  |  |  221|  3.47k|    {                                                                          \
  |  |  |  |  222|  3.47k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  3.47k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  3.47k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 3.47k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  643|  3.47k|                    goto eol2d;                                                \
  |  |  644|  9.66k|                eof2d:                                                         \
  |  |  645|  9.66k|                    prematureEOF(a0);                                          \
  |  |  ------------------
  |  |  |  |  271|  9.66k|    do                                                                         \
  |  |  |  |  272|  9.66k|    {                                                                          \
  |  |  |  |  273|  9.66k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  9.66k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  9.66k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 9.66k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  646|  9.66k|                    CLEANUP_RUNS();                                            \
  |  |  ------------------
  |  |  |  |  333|  9.66k|    do                                                                         \
  |  |  |  |  334|  9.66k|    {                                                                          \
  |  |  |  |  335|  9.66k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 1.57k, False: 8.09k]
  |  |  |  |  ------------------
  |  |  |  |  336|  9.66k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.57k|    do                                                                         \
  |  |  |  |  |  |  267|  1.57k|    {                                                                          \
  |  |  |  |  |  |  268|  1.57k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 301, False: 1.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.57k|        {                                                                      \
  |  |  |  |  |  |  270|    301|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    301|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    301|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    301|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 221, False: 80]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    301|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    301|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    301|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 221, False: 80]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    301|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    301|            return (-1);                                                       \
  |  |  |  |  |  |  275|    301|        }                                                                      \
  |  |  |  |  |  |  276|  1.57k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  1.27k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  1.27k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  1.27k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  9.66k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 9.29k, False: 72]
  |  |  |  |  ------------------
  |  |  |  |  338|  9.36k|        {                                                                      \
  |  |  |  |  339|  9.29k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  9.29k|    do                                                                         \
  |  |  |  |  |  |  254|  9.29k|    {                                                                          \
  |  |  |  |  |  |  255|  9.29k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  9.29k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  9.29k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  9.29k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 9.29k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  10.7k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 1.50k, False: 9.29k]
  |  |  |  |  |  Branch (340:39): [True: 1.50k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  9.29k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  9.29k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 9.07k, False: 219]
  |  |  |  |  ------------------
  |  |  |  |  343|  9.29k|            {                                                                  \
  |  |  |  |  344|  9.07k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 9.07k]
  |  |  |  |  ------------------
  |  |  |  |  345|  9.07k|                    a0 = 0;                                                    \
  |  |  |  |  346|  9.07k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 4.51k, False: 4.55k]
  |  |  |  |  ------------------
  |  |  |  |  347|  9.07k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  4.51k|    do                                                                         \
  |  |  |  |  |  |  267|  4.51k|    {                                                                          \
  |  |  |  |  |  |  268|  4.51k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 4.51k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  4.51k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  4.51k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  4.51k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  4.51k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  4.51k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 4.51k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  9.07k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  9.07k|    do                                                                         \
  |  |  |  |  |  |  267|  9.07k|    {                                                                          \
  |  |  |  |  |  |  268|  9.07k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 315, False: 8.76k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  9.07k|        {                                                                      \
  |  |  |  |  |  |  270|    315|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    315|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    315|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    315|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 215, False: 100]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    315|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    315|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    315|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 215, False: 100]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    315|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    315|            return (-1);                                                       \
  |  |  |  |  |  |  275|    315|        }                                                                      \
  |  |  |  |  |  |  276|  9.07k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  8.76k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  8.76k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  8.76k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 8.76k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  9.07k|            }                                                                  \
  |  |  |  |  350|  9.29k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 219]
  |  |  |  |  ------------------
  |  |  |  |  351|    219|            {                                                                  \
  |  |  |  |  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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|  9.29k|        }                                                                      \
  |  |  |  |  356|  9.36k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 9.05k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  647|  9.66k|                    goto eoflab;                                               \
  |  |  648|  1.87M|            }                                                                  \
  |  |  649|  1.87M|        }                                                                      \
  |  |  650|   635k|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (650:13): [True: 69.8k, False: 458k]
  |  |  ------------------
  |  |  651|   528k|        {                                                                      \
  |  |  652|  69.8k|            if (RunLength + a0 < lastx)                                        \
  |  |  ------------------
  |  |  |  Branch (652:17): [True: 0, False: 69.8k]
  |  |  ------------------
  |  |  653|  69.8k|            {                                                                  \
  |  |  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|  69.8k|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|  69.8k|    do                                                                         \
  |  |  |  |  267|  69.8k|    {                                                                          \
  |  |  |  |  268|  69.8k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 69.8k]
  |  |  |  |  ------------------
  |  |  |  |  269|  69.8k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  69.8k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  69.8k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  69.8k|        RunLength = 0;                                                         \
  |  |  |  |  279|  69.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 69.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  661|  69.8k|        }                                                                      \
  |  |  662|   623k|    eol2d:                                                                     \
  |  |  663|   623k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   623k|    do                                                                         \
  |  |  |  |  334|   623k|    {                                                                          \
  |  |  |  |  335|   623k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 2.77k, False: 620k]
  |  |  |  |  ------------------
  |  |  |  |  336|   623k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  2.77k|    do                                                                         \
  |  |  |  |  |  |  267|  2.77k|    {                                                                          \
  |  |  |  |  |  |  268|  2.77k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 699, False: 2.07k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  2.77k|        {                                                                      \
  |  |  |  |  |  |  270|    699|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    699|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    699|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    699|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 224, False: 475]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    699|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    699|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    699|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 224, False: 475]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    699|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    699|            return (-1);                                                       \
  |  |  |  |  |  |  275|    699|        }                                                                      \
  |  |  |  |  |  |  276|  2.77k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  2.07k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  2.07k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  2.07k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 2.07k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   623k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 301k, False: 320k]
  |  |  |  |  ------------------
  |  |  |  |  338|   622k|        {                                                                      \
  |  |  |  |  339|   301k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   301k|    do                                                                         \
  |  |  |  |  |  |  254|   301k|    {                                                                          \
  |  |  |  |  |  |  255|   301k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   301k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   301k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   301k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 301k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   614k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 312k, False: 301k]
  |  |  |  |  |  Branch (340:39): [True: 312k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   312k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   301k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 299k, False: 2.00k]
  |  |  |  |  ------------------
  |  |  |  |  343|   301k|            {                                                                  \
  |  |  |  |  344|   299k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 299k]
  |  |  |  |  ------------------
  |  |  |  |  345|   299k|                    a0 = 0;                                                    \
  |  |  |  |  346|   299k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 116k, False: 183k]
  |  |  |  |  ------------------
  |  |  |  |  347|   299k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   116k|    do                                                                         \
  |  |  |  |  |  |  267|   116k|    {                                                                          \
  |  |  |  |  |  |  268|   116k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 116k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   116k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   116k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   116k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   116k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   116k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 116k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   299k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   299k|    do                                                                         \
  |  |  |  |  |  |  267|   299k|    {                                                                          \
  |  |  |  |  |  |  268|   299k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 418, False: 299k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   299k|        {                                                                      \
  |  |  |  |  |  |  270|    418|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    418|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    418|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    418|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 209, False: 209]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    418|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|    418|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|    418|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 209, False: 209]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    418|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    418|            return (-1);                                                       \
  |  |  |  |  |  |  275|    418|        }                                                                      \
  |  |  |  |  |  |  276|   299k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   299k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   299k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   299k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 299k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   299k|            }                                                                  \
  |  |  |  |  350|   301k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 2.00k]
  |  |  |  |  ------------------
  |  |  |  |  351|  2.00k|            {                                                                  \
  |  |  |  |  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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|   301k|        }                                                                      \
  |  |  |  |  356|   622k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 622k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  664|   623k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (664:14): [Folded, False: 622k]
  |  |  ------------------
  ------------------
 1715|   622k|        if (EOLcnt)
  ------------------
  |  Branch (1715:13): [True: 64.3k, False: 558k]
  ------------------
 1716|  64.3k|            goto EOFG4;
 1717|   558k|        if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
  ------------------
  |  Branch (1717:13): [True: 0, False: 558k]
  ------------------
 1718|      0|        {
 1719|      0|            Fax3ClearUnwritten(has_buf, buf, occ);
 1720|      0|            TIFFErrorExtR(tif, module,
 1721|      0|                          "Buffer overrun detected : %" TIFF_SSIZE_FORMAT
 1722|      0|                          " bytes available, %d bits needed",
 1723|      0|                          occ, lastx);
 1724|      0|            return -1;
 1725|      0|        }
 1726|   558k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1727|   558k|        SETVALUE(0); /* imaginary change for reference */
  ------------------
  |  |  266|   558k|    do                                                                         \
  |  |  267|   558k|    {                                                                          \
  |  |  268|   558k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  ------------------
  |  |  |  Branch (268:13): [True: 430, False: 557k]
  |  |  ------------------
  |  |  269|   558k|        {                                                                      \
  |  |  270|    430|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  271|    430|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  ------------------
  |  |  |  |  282|    430|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    430|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 213, False: 217]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  272|    430|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  ------------------
  |  |  |  |  282|    430|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|    430|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (282:22): [True: 213, False: 217]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  273|    430|                                       : tif->tif_dir.td_curstrip);            \
  |  |  274|    430|            return (-1);                                                       \
  |  |  275|    430|        }                                                                      \
  |  |  276|   558k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  277|   557k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  278|   557k|        RunLength = 0;                                                         \
  |  |  279|   557k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (279:14): [Folded, False: 557k]
  |  |  ------------------
  ------------------
 1728|   557k|        SWAP(uint32_t *, sp->curruns, sp->refruns);
  ------------------
  |  | 1673|   557k|    {                                                                          \
  |  | 1674|   557k|        t x;                                                                   \
  |  | 1675|   557k|        x = (a);                                                               \
  |  | 1676|   557k|        (a) = (b);                                                             \
  |  | 1677|   557k|        (b) = x;                                                               \
  |  | 1678|   557k|    }
  ------------------
 1729|   557k|        buf += sp->b.rowbytes;
 1730|   557k|        occ -= sp->b.rowbytes;
 1731|   557k|        sp->line++;
 1732|   557k|        continue;
 1733|  73.3k|    EOFG4:
 1734|  73.3k|        NeedBits16(13, BADG4);
  ------------------
  |  |  164|  73.3k|    do                                                                         \
  |  |  165|  73.3k|    {                                                                          \
  |  |  166|  73.3k|        if (BitsAvail < (n))                                                   \
  |  |  ------------------
  |  |  |  Branch (166:13): [True: 73.3k, False: 1]
  |  |  ------------------
  |  |  167|  73.3k|        {                                                                      \
  |  |  168|  73.3k|            if (EndOfData())                                                   \
  |  |  ------------------
  |  |  |  |  117|  73.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 12.2k, False: 61.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  169|  73.3k|            {                                                                  \
  |  |  170|  12.2k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  ------------------
  |  |  |  Branch (170:21): [True: 11.7k, False: 525]
  |  |  ------------------
  |  |  171|  12.2k|                    goto eoflab;                                               \
  |  |  172|  12.2k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  173|    525|            }                                                                  \
  |  |  174|  73.3k|            else                                                               \
  |  |  175|  73.3k|            {                                                                  \
  |  |  176|  61.0k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  177|  61.0k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  ------------------
  |  |  |  Branch (177:21): [True: 3.52k, False: 57.5k]
  |  |  ------------------
  |  |  178|  61.0k|                {                                                              \
  |  |  179|  3.52k|                    if (EndOfData())                                           \
  |  |  ------------------
  |  |  |  |  117|  3.52k|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 235, False: 3.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  180|  3.52k|                    {                                                          \
  |  |  181|    235|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  182|    235|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  183|    235|                    }                                                          \
  |  |  184|  3.52k|                    else                                                       \
  |  |  185|  3.52k|                    {                                                          \
  |  |  186|  3.29k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  187|  3.29k|                        BitsAvail += 8;                                        \
  |  |  188|  3.29k|                    }                                                          \
  |  |  189|  3.52k|                }                                                              \
  |  |  190|  61.0k|            }                                                                  \
  |  |  191|  73.3k|        }                                                                      \
  |  |  192|  73.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (192:14): [Folded, False: 61.5k]
  |  |  ------------------
  ------------------
 1735|  73.3k|    BADG4:
 1736|       |#ifdef FAX3_DEBUG
 1737|       |        if (GetBits(13) != 0x1001)
 1738|       |            fputs("Bad EOFB\n", stderr);
 1739|       |#endif
 1740|  73.3k|        ClrBits(13);
  ------------------
  |  |  196|  73.3k|    do                                                                         \
  |  |  197|  73.3k|    {                                                                          \
  |  |  198|  73.3k|        BitsAvail -= (n);                                                      \
  |  |  199|  73.3k|        BitAcc >>= (n);                                                        \
  |  |  200|  73.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 73.3k]
  |  |  ------------------
  ------------------
 1741|  73.3k|        if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
  ------------------
  |  Branch (1741:13): [True: 0, False: 73.3k]
  ------------------
 1742|      0|        {
 1743|      0|            Fax3ClearUnwritten(has_buf, buf, occ);
 1744|      0|            TIFFErrorExtR(tif, module,
 1745|      0|                          "Buffer overrun detected : %" TIFF_SSIZE_FORMAT
 1746|      0|                          " bytes available, %d bits needed",
 1747|      0|                          occ, lastx);
 1748|      0|            return -1;
 1749|      0|        }
 1750|       |        /* This path may return 1, so the caller is not told that the
 1751|       |         * remaining rows were never decoded. */
 1752|  73.3k|        Fax3ClearUnwritten(has_buf, buf, occ);
 1753|  73.3k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1754|  73.3k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  73.3k|    do                                                                         \
  |  |  160|  73.3k|    {                                                                          \
  |  |  161|  73.3k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  73.3k|        sp->data = BitAcc;                                                     \
  |  |  163|  73.3k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  73.3k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  73.3k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  73.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 73.3k]
  |  |  ------------------
  ------------------
 1755|  73.3k|        return (sp->line != start
  ------------------
  |  Branch (1755:17): [True: 45.6k, False: 27.7k]
  ------------------
 1756|  73.3k|                    ? 1
 1757|  73.3k|                    : -1); /* don't error on badly-terminated strips */
 1758|  73.3k|    }
 1759|  4.33k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  4.33k|    do                                                                         \
  |  |  160|  4.33k|    {                                                                          \
  |  |  161|  4.33k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  4.33k|        sp->data = BitAcc;                                                     \
  |  |  163|  4.33k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  4.33k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  4.33k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  4.33k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 4.33k]
  |  |  ------------------
  ------------------
 1760|  4.33k|    return (1);
 1761|  82.2k|}
tif_fax3.c:Fax3DecodeRLE:
 1851|  11.8k|{
 1852|  11.8k|    DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
  ------------------
  |  |  123|  11.8k|    static const char module[] = mod;                                          \
  |  |  124|  11.8k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  ------------------
  |  |  |  |  108|  11.8k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  11.8k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  125|  11.8k|    int a0;                                   /* reference element */          \
  |  |  126|  11.8k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  127|  11.8k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  128|  11.8k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  129|  11.8k|    int RunLength;                            /* length of current run */      \
  |  |  130|  11.8k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  131|  11.8k|    unsigned char *ep;                        /* end of input data */          \
  |  |  132|  11.8k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  133|  11.8k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  134|  11.8k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  135|  11.8k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  136|  11.8k|    const TIFFFaxTabEnt *TabEnt
  ------------------
 1853|  11.8k|    int mode = sp->b.mode;
 1854|  11.8k|    (void)s;
 1855|       |    /* buf is advanced as rows are decoded, so whether the caller supplied a
 1856|       |     * buffer at all has to be remembered here. */
 1857|  11.8k|    const int has_buf = (buf != NULL);
 1858|  11.8k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1858:9): [True: 0, False: 11.8k]
  ------------------
 1859|      0|    {
 1860|      0|        Fax3ClearUnwritten(has_buf, buf, occ);
 1861|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1862|      0|        return (-1);
 1863|      0|    }
 1864|  11.8k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (1864:9): [True: 1, False: 11.8k]
  ------------------
 1865|      1|    {
 1866|      1|        Fax3ClearUnwritten(has_buf, buf, occ);
 1867|      1|        return (-1);
 1868|      1|    }
 1869|  11.8k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  11.8k|    do                                                                         \
  |  |  148|  11.8k|    {                                                                          \
  |  |  149|  11.8k|        BitAcc = sp->data;                                                     \
  |  |  150|  11.8k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  11.8k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  11.8k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  11.8k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  11.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 11.8k]
  |  |  ------------------
  ------------------
 1870|  11.8k|    thisrun = sp->curruns;
 1871|   433k|    while (occ > 0)
  ------------------
  |  Branch (1871:12): [True: 425k, False: 8.52k]
  ------------------
 1872|   425k|    {
 1873|   425k|        a0 = 0;
 1874|   425k|        RunLength = 0;
 1875|   425k|        pa = thisrun;
 1876|       |#ifdef FAX3_DEBUG
 1877|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d\n", BitAcc, BitsAvail);
 1878|       |        printf("-------------------- %" PRIu32 "\n", tif->tif_dir.td_row);
 1879|       |        fflush(stdout);
 1880|       |#endif
 1881|   425k|        EXPAND1D(EOFRLE);
  ------------------
  |  |  371|   425k|    do                                                                         \
  |  |  372|   425k|    {                                                                          \
  |  |  373|   425k|        for (;;)                                                               \
  |  |  374|   503k|        {                                                                      \
  |  |  375|   503k|            for (;;)                                                           \
  |  |  376|  6.49M|            {                                                                  \
  |  |  377|  6.49M|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  6.49M|    do                                                                         \
  |  |  |  |  255|  6.49M|    {                                                                          \
  |  |  |  |  256|  6.49M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  6.49M|    do                                                                         \
  |  |  |  |  |  |  165|  6.49M|    {                                                                          \
  |  |  |  |  |  |  166|  6.49M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 6.05M, False: 433k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  6.49M|        {                                                                      \
  |  |  |  |  |  |  168|  6.05M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  6.05M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 5.94k, False: 6.05M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  6.05M|            {                                                                  \
  |  |  |  |  |  |  170|  5.94k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 3.00k, False: 2.94k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  5.94k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  5.94k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  2.94k|            }                                                                  \
  |  |  |  |  |  |  174|  6.05M|            else                                                               \
  |  |  |  |  |  |  175|  6.05M|            {                                                                  \
  |  |  |  |  |  |  176|  6.05M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  6.05M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 333k, False: 5.72M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  6.05M|                {                                                              \
  |  |  |  |  |  |  179|   333k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   333k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 1.59k, False: 331k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|   333k|                    {                                                          \
  |  |  |  |  |  |  181|  1.59k|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|  1.59k|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|  1.59k|                    }                                                          \
  |  |  |  |  |  |  184|   333k|                    else                                                       \
  |  |  |  |  |  |  185|   333k|                    {                                                          \
  |  |  |  |  |  |  186|   331k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|   331k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|   331k|                    }                                                          \
  |  |  |  |  |  |  189|   333k|                }                                                              \
  |  |  |  |  |  |  190|  6.05M|            }                                                                  \
  |  |  |  |  |  |  191|  6.05M|        }                                                                      \
  |  |  |  |  |  |  192|  6.49M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 6.49M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  6.49M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  6.49M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  6.49M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  6.49M|    do                                                                         \
  |  |  |  |  |  |  197|  6.49M|    {                                                                          \
  |  |  |  |  |  |  198|  6.49M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  6.49M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  6.49M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 6.49M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  6.49M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 6.49M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  6.49M|                switch (TabEnt->State)                                         \
  |  |  379|  6.49M|                {                                                              \
  |  |  380|  20.6k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  20.6k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 20.6k, False: 6.46M]
  |  |  ------------------
  |  |  381|  20.6k|                        EOLcnt = 1;                                            \
  |  |  382|  20.6k|                        goto done1d;                                           \
  |  |  383|   123k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|   123k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 123k, False: 6.36M]
  |  |  ------------------
  |  |  384|   123k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   123k|    do                                                                         \
  |  |  |  |  267|   123k|    {                                                                          \
  |  |  |  |  268|   123k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 123k]
  |  |  |  |  ------------------
  |  |  |  |  269|   123k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   123k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   123k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   123k|        RunLength = 0;                                                         \
  |  |  |  |  279|   123k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 123k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|   123k|                        goto doneWhite1d;                                      \
  |  |  386|  5.37M|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|  5.37M|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 5.37M, False: 1.11M]
  |  |  ------------------
  |  |  387|  5.98M|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  5.98M|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 613k, False: 5.87M]
  |  |  ------------------
  |  |  388|  5.98M|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|  5.98M|                        RunLength =                                            \
  |  |  390|  5.98M|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|  5.98M|                        break;                                                 \
  |  |  392|  5.37M|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 356k, False: 6.13M]
  |  |  ------------------
  |  |  393|   356k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|   356k|    do                                                                         \
  |  |  |  |  221|   356k|    {                                                                          \
  |  |  |  |  222|   356k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|   356k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|   356k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 356k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|   356k|                        goto done1d;                                           \
  |  |  395|  6.49M|                }                                                              \
  |  |  396|  6.49M|            }                                                                  \
  |  |  397|   503k|        doneWhite1d:                                                           \
  |  |  398|   123k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 30.6k, False: 92.5k]
  |  |  ------------------
  |  |  399|   123k|                goto done1d;                                                   \
  |  |  400|   123k|            for (;;)                                                           \
  |  |  401|  97.0k|            {                                                                  \
  |  |  402|  97.0k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  97.0k|    do                                                                         \
  |  |  |  |  255|  97.0k|    {                                                                          \
  |  |  |  |  256|  97.0k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  97.0k|    do                                                                         \
  |  |  |  |  |  |  165|  97.0k|    {                                                                          \
  |  |  |  |  |  |  166|  97.0k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 86.6k, False: 10.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  97.0k|        {                                                                      \
  |  |  |  |  |  |  168|  86.6k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  86.6k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.63k, False: 84.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  86.6k|            {                                                                  \
  |  |  |  |  |  |  170|  2.63k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 295, False: 2.34k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.63k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.63k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  2.34k|            }                                                                  \
  |  |  |  |  |  |  174|  86.6k|            else                                                               \
  |  |  |  |  |  |  175|  86.6k|            {                                                                  \
  |  |  |  |  |  |  176|  84.0k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  84.0k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 3.58k, False: 80.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  84.0k|                {                                                              \
  |  |  |  |  |  |  179|  3.58k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  3.58k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 270, False: 3.31k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  3.58k|                    {                                                          \
  |  |  |  |  |  |  181|    270|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    270|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    270|                    }                                                          \
  |  |  |  |  |  |  184|  3.58k|                    else                                                       \
  |  |  |  |  |  |  185|  3.58k|                    {                                                          \
  |  |  |  |  |  |  186|  3.31k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  3.31k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  3.31k|                    }                                                          \
  |  |  |  |  |  |  189|  3.58k|                }                                                              \
  |  |  |  |  |  |  190|  84.0k|            }                                                                  \
  |  |  |  |  |  |  191|  86.6k|        }                                                                      \
  |  |  |  |  |  |  192|  97.0k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 96.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  97.0k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  96.7k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  96.7k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  96.7k|    do                                                                         \
  |  |  |  |  |  |  197|  96.7k|    {                                                                          \
  |  |  |  |  |  |  198|  96.7k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  96.7k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  96.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 96.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  96.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 96.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|  97.0k|                switch (TabEnt->State)                                         \
  |  |  404|  96.7k|                {                                                              \
  |  |  405|  3.61k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  3.61k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 3.61k, False: 93.1k]
  |  |  ------------------
  |  |  406|  3.61k|                        EOLcnt = 1;                                            \
  |  |  407|  3.61k|                        goto done1d;                                           \
  |  |  408|  87.8k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|  87.8k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 87.8k, False: 8.96k]
  |  |  ------------------
  |  |  409|  87.8k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|  87.8k|    do                                                                         \
  |  |  |  |  267|  87.8k|    {                                                                          \
  |  |  |  |  268|  87.8k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 87.8k]
  |  |  |  |  ------------------
  |  |  |  |  269|  87.8k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  87.8k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  87.8k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  87.8k|        RunLength = 0;                                                         \
  |  |  |  |  279|  87.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 87.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|  87.8k|                        goto doneBlack1d;                                      \
  |  |  411|  87.8k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|  2.07k|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 2.07k, False: 94.7k]
  |  |  ------------------
  |  |  412|  4.59k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  4.59k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 2.51k, False: 94.2k]
  |  |  ------------------
  |  |  413|  4.59k|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|  4.59k|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|  4.59k|                        break;                                                 \
  |  |  416|  2.07k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 762, False: 96.0k]
  |  |  ------------------
  |  |  417|    762|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|    762|    do                                                                         \
  |  |  |  |  221|    762|    {                                                                          \
  |  |  |  |  222|    762|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|    762|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|    762|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 762]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|    762|                        goto done1d;                                           \
  |  |  419|  96.7k|                }                                                              \
  |  |  420|  96.7k|            }                                                                  \
  |  |  421|  92.5k|        doneBlack1d:                                                           \
  |  |  422|  87.8k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 9.33k, False: 78.4k]
  |  |  ------------------
  |  |  423|  87.8k|                goto done1d;                                                   \
  |  |  424|  87.8k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 574, False: 77.9k]
  |  |  |  Branch (424:35): [True: 275, False: 299]
  |  |  ------------------
  |  |  425|  78.4k|                pa -= 2;                                                       \
  |  |  426|  78.4k|        }                                                                      \
  |  |  427|   425k|    eof1d:                                                                     \
  |  |  428|  3.29k|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|  3.29k|    do                                                                         \
  |  |  |  |  272|  3.29k|    {                                                                          \
  |  |  |  |  273|  3.29k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  3.29k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  3.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 3.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|  3.29k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|  3.29k|    do                                                                         \
  |  |  |  |  334|  3.29k|    {                                                                          \
  |  |  |  |  335|  3.29k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 387, False: 2.90k]
  |  |  |  |  ------------------
  |  |  |  |  336|  3.29k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    387|    do                                                                         \
  |  |  |  |  |  |  267|    387|    {                                                                          \
  |  |  |  |  |  |  268|    387|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 387]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    387|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    387|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    387|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    387|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    387|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 387]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  3.29k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 3.21k, False: 84]
  |  |  |  |  ------------------
  |  |  |  |  338|  3.29k|        {                                                                      \
  |  |  |  |  339|  3.21k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  3.21k|    do                                                                         \
  |  |  |  |  |  |  254|  3.21k|    {                                                                          \
  |  |  |  |  |  |  255|  3.21k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  3.21k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  3.21k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  3.21k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 3.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  3.50k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 291, False: 3.21k]
  |  |  |  |  |  Branch (340:39): [True: 291, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  3.21k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  3.21k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 3.21k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|  3.21k|            {                                                                  \
  |  |  |  |  344|  3.21k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 3.21k]
  |  |  |  |  ------------------
  |  |  |  |  345|  3.21k|                    a0 = 0;                                                    \
  |  |  |  |  346|  3.21k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 222, False: 2.99k]
  |  |  |  |  ------------------
  |  |  |  |  347|  3.21k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    222|    do                                                                         \
  |  |  |  |  |  |  267|    222|    {                                                                          \
  |  |  |  |  |  |  268|    222|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 222]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    222|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    222|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    222|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    222|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    222|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 222]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  3.21k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  3.21k|    do                                                                         \
  |  |  |  |  |  |  267|  3.21k|    {                                                                          \
  |  |  |  |  |  |  268|  3.21k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 3.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  3.21k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  3.21k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  3.21k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  3.21k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  3.21k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 3.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  3.21k|            }                                                                  \
  |  |  |  |  350|  3.21k|            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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|  3.21k|        }                                                                      \
  |  |  |  |  356|  3.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 3.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|  3.29k|        goto eoflab;                                                           \
  |  |  431|   421k|    done1d:                                                                    \
  |  |  432|   421k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   421k|    do                                                                         \
  |  |  |  |  334|   421k|    {                                                                          \
  |  |  |  |  335|   421k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 3.51k, False: 418k]
  |  |  |  |  ------------------
  |  |  |  |  336|   421k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  3.51k|    do                                                                         \
  |  |  |  |  |  |  267|  3.51k|    {                                                                          \
  |  |  |  |  |  |  268|  3.51k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 3.51k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  3.51k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  3.51k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  3.51k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  3.51k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  3.51k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 3.51k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   421k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 416k, False: 5.54k]
  |  |  |  |  ------------------
  |  |  |  |  338|   421k|        {                                                                      \
  |  |  |  |  339|   416k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   416k|    do                                                                         \
  |  |  |  |  |  |  254|   416k|    {                                                                          \
  |  |  |  |  |  |  255|   416k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   416k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   416k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   416k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 416k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   453k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 37.2k, False: 416k]
  |  |  |  |  |  Branch (340:39): [True: 37.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   416k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   416k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 416k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|   416k|            {                                                                  \
  |  |  |  |  344|   416k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 416k]
  |  |  |  |  ------------------
  |  |  |  |  345|   416k|                    a0 = 0;                                                    \
  |  |  |  |  346|   416k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 14.1k, False: 402k]
  |  |  |  |  ------------------
  |  |  |  |  347|   416k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  14.1k|    do                                                                         \
  |  |  |  |  |  |  267|  14.1k|    {                                                                          \
  |  |  |  |  |  |  268|  14.1k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 14.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  14.1k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  14.1k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  14.1k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  14.1k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  14.1k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 14.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   416k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   416k|    do                                                                         \
  |  |  |  |  |  |  267|   416k|    {                                                                          \
  |  |  |  |  |  |  268|   416k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 416k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   416k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   416k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   416k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   416k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   416k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 416k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   416k|            }                                                                  \
  |  |  |  |  350|   416k|            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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (282: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|   416k|        }                                                                      \
  |  |  |  |  356|   421k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 421k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|   421k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 421k]
  |  |  ------------------
  ------------------
 1882|   421k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1883|       |        /*
 1884|       |         * Cleanup at the end of the row.
 1885|       |         */
 1886|   421k|        if (mode & FAXMODE_BYTEALIGN)
  ------------------
  |  |  701|   421k|#define FAXMODE_BYTEALIGN 0x0004     /* byte align row */
  ------------------
  |  Branch (1886:13): [True: 414k, False: 7.53k]
  ------------------
 1887|   414k|        {
 1888|   414k|            int n = BitsAvail - (BitsAvail & ~7);
 1889|   414k|            ClrBits(n);
  ------------------
  |  |  196|   414k|    do                                                                         \
  |  |  197|   414k|    {                                                                          \
  |  |  198|   414k|        BitsAvail -= (n);                                                      \
  |  |  199|   414k|        BitAcc >>= (n);                                                        \
  |  |  200|   414k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 414k]
  |  |  ------------------
  ------------------
 1890|   414k|        }
 1891|  7.53k|        else if (mode & FAXMODE_WORDALIGN)
  ------------------
  |  |  702|  7.53k|#define FAXMODE_WORDALIGN 0x0008     /* word align row */
  ------------------
  |  Branch (1891:18): [True: 7.53k, False: 0]
  ------------------
 1892|  7.53k|        {
 1893|  7.53k|            int n = BitsAvail - (BitsAvail & ~15);
 1894|  7.53k|            ClrBits(n);
  ------------------
  |  |  196|  7.53k|    do                                                                         \
  |  |  197|  7.53k|    {                                                                          \
  |  |  198|  7.53k|        BitsAvail -= (n);                                                      \
  |  |  199|  7.53k|        BitAcc >>= (n);                                                        \
  |  |  200|  7.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 7.53k]
  |  |  ------------------
  ------------------
 1895|  7.53k|            if (BitsAvail == 0 && !isAligned(cp, uint16_t))
  ------------------
  |  |  112|  2.13k|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (1895:17): [True: 2.13k, False: 5.40k]
  |  Branch (1895:35): [True: 1.13k, False: 1.00k]
  ------------------
 1896|  1.13k|                cp++;
 1897|  7.53k|        }
 1898|   421k|        buf += sp->b.rowbytes;
 1899|   421k|        occ -= sp->b.rowbytes;
 1900|   421k|        sp->line++;
 1901|   421k|        continue;
 1902|  3.29k|    EOFRLE: /* premature EOF */
 1903|  3.29k|        Fax3ClearUnwritten(has_buf, buf, occ);
 1904|  3.29k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1905|  3.29k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  3.29k|    do                                                                         \
  |  |  160|  3.29k|    {                                                                          \
  |  |  161|  3.29k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  3.29k|        sp->data = BitAcc;                                                     \
  |  |  163|  3.29k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  3.29k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  3.29k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  3.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 3.29k]
  |  |  ------------------
  ------------------
 1906|  3.29k|        return (-1);
 1907|   425k|    }
 1908|  8.52k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  8.52k|    do                                                                         \
  |  |  160|  8.52k|    {                                                                          \
  |  |  161|  8.52k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  8.52k|        sp->data = BitAcc;                                                     \
  |  |  163|  8.52k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  8.52k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  8.52k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  8.52k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 8.52k]
  |  |  ------------------
  ------------------
 1909|  8.52k|    return (1);
 1910|  11.8k|}

TIFFRGBAImageOK:
  103|  14.9k|{
  104|  14.9k|    TIFFDirectory *td = &tif->tif_dir;
  105|  14.9k|    uint16_t photometric;
  106|  14.9k|    int colorchannels;
  107|       |
  108|  14.9k|    if (!tif->tif_decodestatus)
  ------------------
  |  Branch (108:9): [True: 2, False: 14.9k]
  ------------------
  109|      2|    {
  110|      2|        snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      2|#define EMSG_BUF_SIZE 1024
  ------------------
  111|      2|                 "Sorry, requested compression method is not configured");
  112|      2|        return 0;
  113|      2|    }
  114|  14.9k|    switch (td->td_bitspersample)
  115|  14.9k|    {
  116|  5.00k|        case 1:
  ------------------
  |  Branch (116:9): [True: 5.00k, False: 9.92k]
  ------------------
  117|  5.21k|        case 2:
  ------------------
  |  Branch (117:9): [True: 209, False: 14.7k]
  ------------------
  118|  5.40k|        case 4:
  ------------------
  |  Branch (118:9): [True: 197, False: 14.7k]
  ------------------
  119|  12.8k|        case 8:
  ------------------
  |  Branch (119:9): [True: 7.45k, False: 7.47k]
  ------------------
  120|  13.4k|        case 16:
  ------------------
  |  Branch (120:9): [True: 541, False: 14.3k]
  ------------------
  121|  13.4k|            break;
  122|  1.52k|        default:
  ------------------
  |  Branch (122:9): [True: 1.52k, False: 13.4k]
  ------------------
  123|  1.52k|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|  1.52k|#define EMSG_BUF_SIZE 1024
  ------------------
  124|  1.52k|                     "Sorry, can not handle images with %" PRIu16
  125|  1.52k|                     "-bit samples",
  126|  1.52k|                     td->td_bitspersample);
  127|  1.52k|            return 0;
  128|  14.9k|    }
  129|  13.4k|    if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|  13.4k|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (129:9): [True: 49, False: 13.3k]
  ------------------
  130|     49|    {
  131|     49|        snprintf(
  132|     49|            emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     49|#define EMSG_BUF_SIZE 1024
  ------------------
  133|     49|            "Sorry, can not handle images with IEEE floating-point samples");
  134|     49|        return 0;
  135|     49|    }
  136|  13.3k|    colorchannels = td->td_samplesperpixel - td->td_extrasamples;
  137|  13.3k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric))
  ------------------
  |  |  220|  13.3k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (137:9): [True: 8.35k, False: 5.00k]
  ------------------
  138|  8.35k|    {
  139|  8.35k|        switch (colorchannels)
  140|  8.35k|        {
  141|  8.35k|            case 1:
  ------------------
  |  Branch (141:13): [True: 8.35k, False: 3]
  ------------------
  142|  8.35k|                photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|  8.35k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  143|  8.35k|                break;
  144|      0|            case 3:
  ------------------
  |  Branch (144:13): [True: 0, False: 8.35k]
  ------------------
  145|      0|                photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  146|      0|                break;
  147|      3|            default:
  ------------------
  |  Branch (147:13): [True: 3, False: 8.35k]
  ------------------
  148|      3|                snprintf(emsg, EMSG_BUF_SIZE, "Missing needed %s tag",
  ------------------
  |  |   53|      3|#define EMSG_BUF_SIZE 1024
  ------------------
  149|      3|                         photoTag);
  150|      3|                return 0;
  151|  8.35k|        }
  152|  8.35k|    }
  153|  13.3k|    switch (photometric)
  154|  13.3k|    {
  155|     71|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|     71|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (155:9): [True: 71, False: 13.2k]
  ------------------
  156|  8.49k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  8.49k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (156:9): [True: 8.42k, False: 4.93k]
  ------------------
  157|  8.62k|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|  8.62k|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (157:9): [True: 133, False: 13.2k]
  ------------------
  158|  8.62k|            if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  17.2k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (158:17): [True: 8.19k, False: 430]
  ------------------
  159|  8.19k|                td->td_samplesperpixel != 1 && td->td_bitspersample < 8)
  ------------------
  |  Branch (159:17): [True: 552, False: 7.64k]
  |  Branch (159:48): [True: 10, False: 542]
  ------------------
  160|     10|            {
  161|     10|                snprintf(
  162|     10|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     10|#define EMSG_BUF_SIZE 1024
  ------------------
  163|     10|                    "Sorry, can not handle contiguous data with %s=%" PRIu16
  164|     10|                    ", "
  165|     10|                    "and %s=%" PRIu16 " and Bits/Sample=%" PRIu16 "",
  166|     10|                    photoTag, photometric, "Samples/pixel",
  167|     10|                    td->td_samplesperpixel, td->td_bitspersample);
  168|     10|                return 0;
  169|     10|            }
  170|       |            /*
  171|       |             * We should likely validate that any extra samples are either
  172|       |             * to be ignored, or are alpha, and if alpha we should try to use
  173|       |             * them.  But for now we won't bother with this.
  174|       |             */
  175|  8.61k|            break;
  176|  8.61k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  3.76k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (176:9): [True: 3.76k, False: 9.59k]
  ------------------
  177|       |            /*
  178|       |             * TODO: if at all meaningful and useful, make more complete
  179|       |             * support check here, or better still, refactor to let supporting
  180|       |             * code decide whether there is support and what meaningful
  181|       |             * error to return
  182|       |             */
  183|  3.76k|            break;
  184|    231|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|    231|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (184:9): [True: 231, False: 13.1k]
  ------------------
  185|    231|            if (colorchannels < 3)
  ------------------
  |  Branch (185:17): [True: 22, False: 209]
  ------------------
  186|     22|            {
  187|     22|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     22|#define EMSG_BUF_SIZE 1024
  ------------------
  188|     22|                         "Sorry, can not handle RGB image with %s=%d",
  189|     22|                         "Color channels", colorchannels);
  190|     22|                return 0;
  191|     22|            }
  192|    209|            break;
  193|    209|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|    150|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (193:9): [True: 150, False: 13.2k]
  ------------------
  194|    150|        {
  195|    150|            uint16_t inkset;
  196|    150|            TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  322|    150|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  197|    150|            if (inkset != INKSET_CMYK)
  ------------------
  |  |  323|    150|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (197:17): [True: 1, False: 149]
  ------------------
  198|      1|            {
  199|      1|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  200|      1|                         "Sorry, can not handle separated image with %s=%d",
  201|      1|                         "InkSet", inkset);
  202|      1|                return 0;
  203|      1|            }
  204|    149|            if (td->td_samplesperpixel < 4)
  ------------------
  |  Branch (204:17): [True: 3, False: 146]
  ------------------
  205|      3|            {
  206|      3|                snprintf(
  207|      3|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      3|#define EMSG_BUF_SIZE 1024
  ------------------
  208|      3|                    "Sorry, can not handle separated image with %s=%" PRIu16,
  209|      3|                    "Samples/pixel", td->td_samplesperpixel);
  210|      3|                return 0;
  211|      3|            }
  212|    146|            break;
  213|    149|        }
  214|    160|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|    160|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (214:9): [True: 160, False: 13.1k]
  ------------------
  215|    160|            if (td->td_compression != COMPRESSION_SGILOG)
  ------------------
  |  |  210|    160|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (215:17): [True: 22, False: 138]
  ------------------
  216|     22|            {
  217|     22|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     22|#define EMSG_BUF_SIZE 1024
  ------------------
  218|     22|                         "Sorry, LogL data must have %s=%d", "Compression",
  219|     22|                         COMPRESSION_SGILOG);
  ------------------
  |  |  210|     22|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  220|     22|                return 0;
  221|     22|            }
  222|    138|            break;
  223|    254|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|    254|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (223:9): [True: 254, False: 13.0k]
  ------------------
  224|    254|            if (td->td_compression != COMPRESSION_SGILOG &&
  ------------------
  |  |  210|    508|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (224:17): [True: 130, False: 124]
  ------------------
  225|    130|                td->td_compression != COMPRESSION_SGILOG24)
  ------------------
  |  |  211|    130|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (225:17): [True: 6, False: 124]
  ------------------
  226|      6|            {
  227|      6|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      6|#define EMSG_BUF_SIZE 1024
  ------------------
  228|      6|                         "Sorry, LogLuv data must have %s=%d or %d",
  229|      6|                         "Compression", COMPRESSION_SGILOG,
  ------------------
  |  |  210|      6|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  230|      6|                         COMPRESSION_SGILOG24);
  ------------------
  |  |  211|      6|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  231|      6|                return 0;
  232|      6|            }
  233|    248|            if (td->td_planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|    248|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (233:17): [True: 2, False: 246]
  ------------------
  234|      2|            {
  235|      2|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      2|#define EMSG_BUF_SIZE 1024
  ------------------
  236|      2|                         "Sorry, can not handle LogLuv images with %s=%" PRIu16,
  237|      2|                         "Planarconfiguration", td->td_planarconfig);
  238|      2|                return 0;
  239|      2|            }
  240|    246|            if (td->td_samplesperpixel != 3 || colorchannels != 3)
  ------------------
  |  Branch (240:17): [True: 7, False: 239]
  |  Branch (240:48): [True: 56, False: 183]
  ------------------
  241|     63|            {
  242|     63|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     63|#define EMSG_BUF_SIZE 1024
  ------------------
  243|     63|                         "Sorry, can not handle image with %s=%" PRIu16
  244|     63|                         ", %s=%d",
  245|     63|                         "Samples/pixel", td->td_samplesperpixel,
  246|     63|                         "colorchannels", colorchannels);
  247|     63|                return 0;
  248|     63|            }
  249|    183|            break;
  250|    183|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|     87|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (250:9): [True: 87, False: 13.2k]
  ------------------
  251|     87|            if (td->td_samplesperpixel != 3 || colorchannels != 3 ||
  ------------------
  |  Branch (251:17): [True: 2, False: 85]
  |  Branch (251:48): [True: 1, False: 84]
  ------------------
  252|     84|                (td->td_bitspersample != 8 && td->td_bitspersample != 16))
  ------------------
  |  Branch (252:18): [True: 29, False: 55]
  |  Branch (252:47): [True: 1, False: 28]
  ------------------
  253|      4|            {
  254|      4|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      4|#define EMSG_BUF_SIZE 1024
  ------------------
  255|      4|                         "Sorry, can not handle image with %s=%" PRIu16
  256|      4|                         ", %s=%d and %s=%" PRIu16,
  257|      4|                         "Samples/pixel", td->td_samplesperpixel,
  258|      4|                         "colorchannels", colorchannels, "Bits/sample",
  259|      4|                         td->td_bitspersample);
  260|      4|                return 0;
  261|      4|            }
  262|     83|            break;
  263|     84|        default:
  ------------------
  |  Branch (263:9): [True: 84, False: 13.2k]
  ------------------
  264|     84|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     84|#define EMSG_BUF_SIZE 1024
  ------------------
  265|     84|                     "Sorry, can not handle image with %s=%" PRIu16, photoTag,
  266|     84|                     photometric);
  267|     84|            return 0;
  268|  13.3k|    }
  269|  13.1k|    return 1;
  270|  13.3k|}
TIFFRGBAImageEnd:
  273|  13.1k|{
  274|  13.1k|    if (img->Map)
  ------------------
  |  Branch (274:9): [True: 3, False: 13.1k]
  ------------------
  275|      3|    {
  276|      3|        _TIFFfreeExt(img->tif, img->Map);
  277|      3|        img->Map = NULL;
  278|      3|    }
  279|  13.1k|    if (img->BWmap)
  ------------------
  |  Branch (279:9): [True: 8.25k, False: 4.87k]
  ------------------
  280|  8.25k|    {
  281|  8.25k|        _TIFFfreeExt(img->tif, img->BWmap);
  282|  8.25k|        img->BWmap = NULL;
  283|  8.25k|    }
  284|  13.1k|    if (img->PALmap)
  ------------------
  |  Branch (284:9): [True: 133, False: 13.0k]
  ------------------
  285|    133|    {
  286|    133|        _TIFFfreeExt(img->tif, img->PALmap);
  287|    133|        img->PALmap = NULL;
  288|    133|    }
  289|  13.1k|    if (img->ycbcr)
  ------------------
  |  Branch (289:9): [True: 2.09k, False: 11.0k]
  ------------------
  290|  2.09k|    {
  291|  2.09k|        _TIFFfreeExt(img->tif, img->ycbcr);
  292|  2.09k|        img->ycbcr = NULL;
  293|  2.09k|    }
  294|  13.1k|    if (img->cielab)
  ------------------
  |  Branch (294:9): [True: 81, False: 13.0k]
  ------------------
  295|     81|    {
  296|     81|        _TIFFfreeExt(img->tif, img->cielab);
  297|     81|        img->cielab = NULL;
  298|     81|    }
  299|  13.1k|    if (img->UaToAa)
  ------------------
  |  Branch (299:9): [True: 75, False: 13.0k]
  ------------------
  300|     75|    {
  301|     75|        _TIFFfreeExt(img->tif, img->UaToAa);
  302|     75|        img->UaToAa = NULL;
  303|     75|    }
  304|  13.1k|    if (img->Bitdepth16To8)
  ------------------
  |  Branch (304:9): [True: 139, False: 12.9k]
  ------------------
  305|    139|    {
  306|    139|        _TIFFfreeExt(img->tif, img->Bitdepth16To8);
  307|    139|        img->Bitdepth16To8 = NULL;
  308|    139|    }
  309|       |
  310|  13.1k|    if (img->redcmap)
  ------------------
  |  Branch (310:9): [True: 133, False: 13.0k]
  ------------------
  311|    133|    {
  312|    133|        _TIFFfreeExt(img->tif, img->redcmap);
  313|    133|        _TIFFfreeExt(img->tif, img->greencmap);
  314|    133|        _TIFFfreeExt(img->tif, img->bluecmap);
  315|       |        img->redcmap = img->greencmap = img->bluecmap = NULL;
  316|    133|    }
  317|  13.1k|}
TIFFRGBAImageBegin:
  331|  14.9k|{
  332|  14.9k|    uint16_t *sampleinfo;
  333|  14.9k|    uint16_t extrasamples;
  334|  14.9k|    uint16_t planarconfig;
  335|  14.9k|    uint16_t compress;
  336|  14.9k|    int colorchannels;
  337|  14.9k|    uint16_t *red_orig, *green_orig, *blue_orig;
  338|  14.9k|    uint32_t n_color;
  339|       |
  340|  14.9k|    if (!TIFFRGBAImageOK(tif, emsg))
  ------------------
  |  Branch (340:9): [True: 1.79k, False: 13.1k]
  ------------------
  341|  1.79k|        return 0;
  342|       |
  343|       |    /* Initialize to normal values */
  344|  13.1k|    img->row_offset = 0;
  345|  13.1k|    img->col_offset = 0;
  346|  13.1k|    img->redcmap = NULL;
  347|  13.1k|    img->greencmap = NULL;
  348|  13.1k|    img->bluecmap = NULL;
  349|  13.1k|    img->Map = NULL;
  350|  13.1k|    img->BWmap = NULL;
  351|  13.1k|    img->PALmap = NULL;
  352|  13.1k|    img->ycbcr = NULL;
  353|  13.1k|    img->cielab = NULL;
  354|  13.1k|    img->UaToAa = NULL;
  355|  13.1k|    img->Bitdepth16To8 = NULL;
  356|  13.1k|    img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
  ------------------
  |  |  252|  13.1k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  357|       |
  358|  13.1k|    img->tif = tif;
  359|  13.1k|    img->stoponerr = stop;
  360|  13.1k|    TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
  ------------------
  |  |  180|  13.1k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  361|  13.1k|    switch (img->bitspersample)
  362|  13.1k|    {
  363|  4.91k|        case 1:
  ------------------
  |  Branch (363:9): [True: 4.91k, False: 8.21k]
  ------------------
  364|  5.12k|        case 2:
  ------------------
  |  Branch (364:9): [True: 207, False: 12.9k]
  ------------------
  365|  5.31k|        case 4:
  ------------------
  |  Branch (365:9): [True: 192, False: 12.9k]
  ------------------
  366|  12.7k|        case 8:
  ------------------
  |  Branch (366:9): [True: 7.41k, False: 5.71k]
  ------------------
  367|  13.1k|        case 16:
  ------------------
  |  Branch (367:9): [True: 405, False: 12.7k]
  ------------------
  368|  13.1k|            break;
  369|      0|        default:
  ------------------
  |  Branch (369:9): [True: 0, False: 13.1k]
  ------------------
  370|      0|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  371|      0|                     "Sorry, can not handle images with %" PRIu16
  372|      0|                     "-bit samples",
  373|      0|                     img->bitspersample);
  374|      0|            goto fail_return;
  375|  13.1k|    }
  376|  13.1k|    img->alpha = 0;
  377|  13.1k|    TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
  ------------------
  |  |  257|  13.1k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  378|  13.1k|    TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, &extrasamples,
  ------------------
  |  |  329|  13.1k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  379|  13.1k|                          &sampleinfo);
  380|  13.1k|    if (extrasamples >= 1)
  ------------------
  |  Branch (380:9): [True: 1.17k, False: 11.9k]
  ------------------
  381|  1.17k|    {
  382|  1.17k|        switch (sampleinfo[0])
  383|  1.17k|        {
  384|    992|            case EXTRASAMPLE_UNSPECIFIED: /* Workaround for some images without
  ------------------
  |  |  330|    992|#define EXTRASAMPLE_UNSPECIFIED 0          /* !unspecified data */
  ------------------
  |  Branch (384:13): [True: 992, False: 184]
  ------------------
  385|       |                                           */
  386|    992|                if (img->samplesperpixel >
  ------------------
  |  Branch (386:21): [True: 492, False: 500]
  ------------------
  387|    992|                    3) /* correct info about alpha channel */
  388|    492|                    img->alpha = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|    492|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  389|    992|                break;
  390|     72|            case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */
  ------------------
  |  |  331|     72|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (390:13): [True: 72, False: 1.10k]
  ------------------
  391|    184|            case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */
  ------------------
  |  |  332|    184|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (391:13): [True: 112, False: 1.06k]
  ------------------
  392|    184|                img->alpha = sampleinfo[0];
  393|    184|                break;
  394|      0|            default:
  ------------------
  |  Branch (394:13): [True: 0, False: 1.17k]
  ------------------
  395|      0|                break;
  396|  1.17k|        }
  397|  1.17k|    }
  398|       |
  399|  13.1k|#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA
  400|  13.1k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
  ------------------
  |  |  220|  13.1k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (400:9): [True: 8.34k, False: 4.79k]
  ------------------
  401|  8.34k|        img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  221|  8.34k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  402|       |
  403|  13.1k|    if (extrasamples == 0 && img->samplesperpixel == 4 &&
  ------------------
  |  Branch (403:9): [True: 11.9k, False: 1.17k]
  |  Branch (403:30): [True: 39, False: 11.9k]
  ------------------
  404|     39|        img->photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|     39|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (404:9): [True: 0, False: 39]
  ------------------
  405|      0|    {
  406|      0|        img->alpha = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|      0|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  407|      0|        extrasamples = 1;
  408|      0|    }
  409|  13.1k|#endif
  410|       |
  411|  13.1k|    colorchannels = img->samplesperpixel - extrasamples;
  412|  13.1k|    TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  181|  13.1k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  413|  13.1k|    TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
  ------------------
  |  |  264|  13.1k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  414|  13.1k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
  ------------------
  |  |  220|  13.1k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (414:9): [True: 8.34k, False: 4.79k]
  ------------------
  415|  8.34k|    {
  416|  8.34k|        switch (colorchannels)
  417|  8.34k|        {
  418|  8.34k|            case 1:
  ------------------
  |  Branch (418:13): [True: 8.34k, False: 0]
  ------------------
  419|  8.34k|                if (isCCITTCompression(tif))
  ------------------
  |  Branch (419:21): [True: 2.44k, False: 5.89k]
  ------------------
  420|  2.44k|                    img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  221|  2.44k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  421|  5.89k|                else
  422|  5.89k|                    img->photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|  5.89k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  423|  8.34k|                break;
  424|      0|            case 3:
  ------------------
  |  Branch (424:13): [True: 0, False: 8.34k]
  ------------------
  425|      0|                img->photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  426|      0|                break;
  427|      0|            default:
  ------------------
  |  Branch (427:13): [True: 0, False: 8.34k]
  ------------------
  428|      0|                snprintf(emsg, EMSG_BUF_SIZE, "Missing needed %s tag",
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  429|      0|                         photoTag);
  430|      0|                goto fail_return;
  431|  8.34k|        }
  432|  8.34k|    }
  433|  13.1k|    switch (img->photometric)
  434|  13.1k|    {
  435|    133|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|    133|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (435:9): [True: 133, False: 13.0k]
  ------------------
  436|    133|            if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &red_orig, &green_orig,
  ------------------
  |  |  309|    133|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (436:17): [True: 0, False: 133]
  ------------------
  437|    133|                              &blue_orig))
  438|      0|            {
  439|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  440|      0|                         "Missing required \"Colormap\" tag");
  441|      0|                goto fail_return;
  442|      0|            }
  443|       |
  444|       |            /* copy the colormaps so we can modify them */
  445|    133|            n_color = tif->tif_dir.td_colormap_count;
  446|    133|            img->redcmap = (uint16_t *)_TIFFmallocExt(
  447|    133|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  448|    133|            img->greencmap = (uint16_t *)_TIFFmallocExt(
  449|    133|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  450|    133|            img->bluecmap = (uint16_t *)_TIFFmallocExt(
  451|    133|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  452|    133|            if (!img->redcmap || !img->greencmap || !img->bluecmap)
  ------------------
  |  Branch (452:17): [True: 0, False: 133]
  |  Branch (452:34): [True: 0, False: 133]
  |  Branch (452:53): [True: 0, False: 133]
  ------------------
  453|      0|            {
  454|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  455|      0|                         "Out of memory for colormap copy");
  456|      0|                goto fail_return;
  457|      0|            }
  458|       |
  459|    133|            _TIFFmemcpy(img->redcmap, red_orig, n_color * 2);
  460|    133|            _TIFFmemcpy(img->greencmap, green_orig, n_color * 2);
  461|    133|            _TIFFmemcpy(img->bluecmap, blue_orig, n_color * 2);
  462|       |
  463|       |            /* fall through... */
  464|  2.64k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  2.64k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (464:9): [True: 2.51k, False: 10.6k]
  ------------------
  465|  8.61k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  8.61k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (465:9): [True: 5.96k, False: 7.16k]
  ------------------
  466|  8.61k|            if (planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  17.2k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (466:17): [True: 8.18k, False: 430]
  ------------------
  467|  8.18k|                img->samplesperpixel != 1 && img->bitspersample < 8)
  ------------------
  |  Branch (467:17): [True: 542, False: 7.64k]
  |  Branch (467:46): [True: 0, False: 542]
  ------------------
  468|      0|            {
  469|      0|                snprintf(
  470|      0|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  471|      0|                    "Sorry, can not handle contiguous data with %s=%" PRIu16
  472|      0|                    ", "
  473|      0|                    "and %s=%" PRIu16 " and Bits/Sample=%" PRIu16,
  474|      0|                    photoTag, img->photometric, "Samples/pixel",
  475|      0|                    img->samplesperpixel, img->bitspersample);
  476|      0|                goto fail_return;
  477|      0|            }
  478|  8.61k|            break;
  479|  8.61k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  3.76k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (479:9): [True: 3.76k, False: 9.37k]
  ------------------
  480|       |            /* It would probably be nice to have a reality check here. */
  481|  3.76k|            if (planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  3.76k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (481:17): [True: 2.93k, False: 822]
  ------------------
  482|       |                /* can rely on libjpeg to convert to RGB */
  483|       |                /* XXX should restore current state on exit */
  484|  2.93k|                switch (compress)
  485|  2.93k|                {
  486|  1.65k|                    case COMPRESSION_JPEG:
  ------------------
  |  |  190|  1.65k|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
  |  Branch (486:21): [True: 1.65k, False: 1.28k]
  ------------------
  487|       |                        /*
  488|       |                         * TODO: when complete tests verify complete
  489|       |                         * desubsampling and YCbCr handling, remove use of
  490|       |                         * TIFFTAG_JPEGCOLORMODE in favor of tif_getimage.c
  491|       |                         * native handling
  492|       |                         */
  493|  1.65k|                        TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE,
  ------------------
  |  |  706|  1.65k|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  494|  1.65k|                                     JPEGCOLORMODE_RGB);
  ------------------
  |  |  708|  1.65k|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  495|  1.65k|                        img->photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|  1.65k|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  496|  1.65k|                        break;
  497|  1.28k|                    default:
  ------------------
  |  Branch (497:21): [True: 1.28k, False: 1.65k]
  ------------------
  498|  1.28k|                        /* do nothing */;
  499|  1.28k|                        break;
  500|  2.93k|                }
  501|       |            /*
  502|       |             * TODO: if at all meaningful and useful, make more complete
  503|       |             * support check here, or better still, refactor to let supporting
  504|       |             * code decide whether there is support and what meaningful
  505|       |             * error to return
  506|       |             */
  507|  3.76k|            break;
  508|  3.76k|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|    209|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (508:9): [True: 209, False: 12.9k]
  ------------------
  509|    209|            if (colorchannels < 3)
  ------------------
  |  Branch (509:17): [True: 0, False: 209]
  ------------------
  510|      0|            {
  511|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  512|      0|                         "Sorry, can not handle RGB image with %s=%d",
  513|      0|                         "Color channels", colorchannels);
  514|      0|                goto fail_return;
  515|      0|            }
  516|    209|            break;
  517|    209|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|    146|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (517:9): [True: 146, False: 12.9k]
  ------------------
  518|    146|        {
  519|    146|            uint16_t inkset;
  520|    146|            TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  322|    146|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  521|    146|            if (inkset != INKSET_CMYK)
  ------------------
  |  |  323|    146|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (521:17): [True: 0, False: 146]
  ------------------
  522|      0|            {
  523|      0|                snprintf(
  524|      0|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  525|      0|                    "Sorry, can not handle separated image with %s=%" PRIu16,
  526|      0|                    "InkSet", inkset);
  527|      0|                goto fail_return;
  528|      0|            }
  529|    146|            if (img->samplesperpixel < 4)
  ------------------
  |  Branch (529:17): [True: 0, False: 146]
  ------------------
  530|      0|            {
  531|      0|                snprintf(
  532|      0|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  533|      0|                    "Sorry, can not handle separated image with %s=%" PRIu16,
  534|      0|                    "Samples/pixel", img->samplesperpixel);
  535|      0|                goto fail_return;
  536|      0|            }
  537|    146|        }
  538|    146|        break;
  539|    146|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|    138|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (539:9): [True: 138, False: 12.9k]
  ------------------
  540|    138|            if (compress != COMPRESSION_SGILOG)
  ------------------
  |  |  210|    138|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (540:17): [True: 0, False: 138]
  ------------------
  541|      0|            {
  542|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  543|      0|                         "Sorry, LogL data must have %s=%d", "Compression",
  544|      0|                         COMPRESSION_SGILOG);
  ------------------
  |  |  210|      0|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  545|      0|                goto fail_return;
  546|      0|            }
  547|    138|            TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  743|    138|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
                          TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|    138|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  548|    138|            img->photometric = PHOTOMETRIC_MINISBLACK; /* little white lie */
  ------------------
  |  |  222|    138|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  549|    138|            img->bitspersample = 8;
  550|    138|            break;
  551|    183|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|    183|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (551:9): [True: 183, False: 12.9k]
  ------------------
  552|    183|            if (compress != COMPRESSION_SGILOG &&
  ------------------
  |  |  210|    366|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (552:17): [True: 73, False: 110]
  ------------------
  553|     73|                compress != COMPRESSION_SGILOG24)
  ------------------
  |  |  211|     73|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (553:17): [True: 0, False: 73]
  ------------------
  554|      0|            {
  555|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  556|      0|                         "Sorry, LogLuv data must have %s=%d or %d",
  557|      0|                         "Compression", COMPRESSION_SGILOG,
  ------------------
  |  |  210|      0|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  558|      0|                         COMPRESSION_SGILOG24);
  ------------------
  |  |  211|      0|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  559|      0|                goto fail_return;
  560|      0|            }
  561|    183|            if (planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|    183|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (561:17): [True: 0, False: 183]
  ------------------
  562|      0|            {
  563|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  564|      0|                         "Sorry, can not handle LogLuv images with %s=%" PRIu16,
  565|      0|                         "Planarconfiguration", planarconfig);
  566|      0|                return 0;
  567|      0|            }
  568|    183|            TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  743|    183|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
                          TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|    183|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  569|    183|            img->photometric = PHOTOMETRIC_RGB; /* little white lie */
  ------------------
  |  |  223|    183|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  570|    183|            img->bitspersample = 8;
  571|    183|            break;
  572|     83|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|     83|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (572:9): [True: 83, False: 13.0k]
  ------------------
  573|     83|            break;
  574|      0|        default:
  ------------------
  |  Branch (574:9): [True: 0, False: 13.1k]
  ------------------
  575|      0|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  576|      0|                     "Sorry, can not handle image with %s=%" PRIu16, photoTag,
  577|      0|                     img->photometric);
  578|      0|            goto fail_return;
  579|  13.1k|    }
  580|  13.1k|    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
  ------------------
  |  |  178|  13.1k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  581|  13.1k|    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
  ------------------
  |  |  179|  13.1k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  582|  13.1k|    TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
  ------------------
  |  |  248|  13.1k|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  583|  13.1k|    img->isContig =
  584|  13.1k|        !(planarconfig == PLANARCONFIG_SEPARATE && img->samplesperpixel > 1);
  ------------------
  |  |  266|  26.2k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (584:11): [True: 1.31k, False: 11.8k]
  |  Branch (584:52): [True: 1.24k, False: 70]
  ------------------
  585|  13.1k|    if (img->isContig)
  ------------------
  |  Branch (585:9): [True: 11.8k, False: 1.24k]
  ------------------
  586|  11.8k|    {
  587|  11.8k|        if (!PickContigCase(img))
  ------------------
  |  Branch (587:13): [True: 59, False: 11.8k]
  ------------------
  588|     59|        {
  589|     59|            snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   53|     59|#define EMSG_BUF_SIZE 1024
  ------------------
  590|     59|            goto fail_return;
  591|     59|        }
  592|  11.8k|    }
  593|  1.24k|    else
  594|  1.24k|    {
  595|  1.24k|        if (!PickSeparateCase(img))
  ------------------
  |  Branch (595:13): [True: 26, False: 1.22k]
  ------------------
  596|     26|        {
  597|     26|            snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   53|     26|#define EMSG_BUF_SIZE 1024
  ------------------
  598|     26|            goto fail_return;
  599|     26|        }
  600|  1.24k|    }
  601|  13.0k|    return 1;
  602|       |
  603|     85|fail_return:
  604|     85|    TIFFRGBAImageEnd(img);
  605|     85|    return 0;
  606|  13.1k|}
TIFFRGBAImageGet:
  610|  13.0k|{
  611|  13.0k|    if (img->get == NULL)
  ------------------
  |  Branch (611:9): [True: 0, False: 13.0k]
  ------------------
  612|      0|    {
  613|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  614|      0|                      "No \"get\" routine setup");
  615|      0|        return 0;
  616|      0|    }
  617|  13.0k|    if (img->put.any == NULL)
  ------------------
  |  Branch (617:9): [True: 0, False: 13.0k]
  ------------------
  618|      0|    {
  619|      0|        TIFFErrorExtR(
  620|      0|            img->tif, TIFFFileName(img->tif),
  621|      0|            "No \"put\" routine setupl; probably can not handle image format");
  622|      0|        return 0;
  623|      0|    }
  624|       |    /* Check and adaptation of parameters is done within (img->get) function. */
  625|  13.0k|    return (*img->get)(img, raster, rwidth, rheight);
  626|  13.0k|}
TIFFReadRGBAImageOriented:
  634|  14.9k|{
  635|  14.9k|    char emsg[EMSG_BUF_SIZE] = "";
  636|  14.9k|    TIFFRGBAImage img;
  637|  14.9k|    int ok;
  638|       |
  639|  14.9k|    if (TIFFRGBAImageBegin(&img, tif, stop, emsg))
  ------------------
  |  Branch (639:9): [True: 13.0k, False: 1.87k]
  ------------------
  640|  13.0k|    {
  641|  13.0k|        img.req_orientation = (uint16_t)orientation;
  642|  13.0k|        ok = TIFFRGBAImageGet(&img, raster, rwidth, rheight);
  643|  13.0k|        TIFFRGBAImageEnd(&img);
  644|  13.0k|    }
  645|  1.87k|    else
  646|  1.87k|    {
  647|  1.87k|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s", emsg);
  648|  1.87k|        ok = 0;
  649|  1.87k|    }
  650|  14.9k|    return ok;
  651|  14.9k|}
TIFFReadRGBAImage:
  659|  14.9k|{
  660|  14.9k|    return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
  661|  14.9k|                                     ORIENTATION_BOTLEFT, stop);
  ------------------
  |  |  252|  14.9k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  662|  14.9k|}
tif_getimage.c:isCCITTCompression:
  320|  8.34k|{
  321|  8.34k|    uint16_t compress;
  322|  8.34k|    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  181|  8.34k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  323|  8.34k|    return (compress == COMPRESSION_CCITTFAX3 ||
  ------------------
  |  |  184|  16.6k|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (323:13): [True: 1.33k, False: 7.00k]
  ------------------
  324|  7.00k|            compress == COMPRESSION_CCITTFAX4 ||
  ------------------
  |  |  186|  15.3k|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (324:13): [True: 809, False: 6.20k]
  ------------------
  325|  6.20k|            compress == COMPRESSION_CCITTRLE ||
  ------------------
  |  |  183|  14.5k|#define COMPRESSION_CCITTRLE 2        /* CCITT modified Huffman RLE */
  ------------------
  |  Branch (325:13): [True: 218, False: 5.98k]
  ------------------
  326|  5.98k|            compress == COMPRESSION_CCITTRLEW);
  ------------------
  |  |  194|  5.98k|#define COMPRESSION_CCITTRLEW 32771   /* #1 w/ word alignment */
  ------------------
  |  Branch (326:13): [True: 84, False: 5.89k]
  ------------------
  327|  8.34k|}
tif_getimage.c:PickContigCase:
 3329|  11.8k|{
 3330|  11.8k|    img->get = TIFFIsTiled(img->tif) ? gtTileContig : gtStripContig;
  ------------------
  |  Branch (3330:16): [True: 9.44k, False: 2.44k]
  ------------------
 3331|  11.8k|    img->put.contig = NULL;
 3332|  11.8k|    switch (img->photometric)
 3333|  11.8k|    {
 3334|  2.04k|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|  2.04k|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3334:9): [True: 2.04k, False: 9.84k]
  ------------------
 3335|  2.04k|            switch (img->bitspersample)
 3336|  2.04k|            {
 3337|  1.97k|                case 8:
  ------------------
  |  Branch (3337:17): [True: 1.97k, False: 70]
  ------------------
 3338|  1.97k|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  331|  3.94k|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3338:25): [True: 83, False: 1.88k]
  ------------------
 3339|     83|                        img->samplesperpixel >= 4)
  ------------------
  |  Branch (3339:25): [True: 82, False: 1]
  ------------------
 3340|     82|                        img->put.contig = putRGBAAcontig8bittile;
 3341|  1.89k|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  332|  3.78k|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3341:30): [True: 15, False: 1.87k]
  ------------------
 3342|     15|                             img->samplesperpixel >= 4)
  ------------------
  |  Branch (3342:30): [True: 14, False: 1]
  ------------------
 3343|     14|                    {
 3344|     14|                        if (BuildMapUaToAa(img))
  ------------------
  |  Branch (3344:29): [True: 14, False: 0]
  ------------------
 3345|     14|                            img->put.contig = putRGBUAcontig8bittile;
 3346|     14|                    }
 3347|  1.87k|                    else if (img->samplesperpixel >= 3)
  ------------------
  |  Branch (3347:30): [True: 1.87k, False: 0]
  ------------------
 3348|  1.87k|                        img->put.contig = putRGBcontig8bittile;
 3349|  1.97k|                    break;
 3350|     63|                case 16:
  ------------------
  |  Branch (3350:17): [True: 63, False: 1.97k]
  ------------------
 3351|     63|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  331|    126|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3351:25): [True: 21, False: 42]
  ------------------
 3352|     21|                        img->samplesperpixel >= 4)
  ------------------
  |  Branch (3352:25): [True: 20, False: 1]
  ------------------
 3353|     20|                    {
 3354|     20|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3354:29): [True: 20, False: 0]
  ------------------
 3355|     20|                            img->put.contig = putRGBAAcontig16bittile;
 3356|     20|                    }
 3357|     43|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  332|     86|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3357:30): [True: 16, False: 27]
  ------------------
 3358|     16|                             img->samplesperpixel >= 4)
  ------------------
  |  Branch (3358:30): [True: 15, False: 1]
  ------------------
 3359|     15|                    {
 3360|     15|                        if (BuildMapBitdepth16To8(img) && BuildMapUaToAa(img))
  ------------------
  |  Branch (3360:29): [True: 15, False: 0]
  |  Branch (3360:59): [True: 15, False: 0]
  ------------------
 3361|     15|                            img->put.contig = putRGBUAcontig16bittile;
 3362|     15|                    }
 3363|     28|                    else if (img->samplesperpixel >= 3)
  ------------------
  |  Branch (3363:30): [True: 28, False: 0]
  ------------------
 3364|     28|                    {
 3365|     28|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3365:29): [True: 28, False: 0]
  ------------------
 3366|     28|                            img->put.contig = putRGBcontig16bittile;
 3367|     28|                    }
 3368|     63|                    break;
 3369|      7|                default:
  ------------------
  |  Branch (3369:17): [True: 7, False: 2.03k]
  ------------------
 3370|      7|                    break;
 3371|  2.04k|            }
 3372|  2.04k|            break;
 3373|  2.04k|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     87|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3373:9): [True: 87, False: 11.8k]
  ------------------
 3374|     87|            if (img->samplesperpixel >= 4 && buildMap(img))
  ------------------
  |  Branch (3374:17): [True: 87, False: 0]
  |  Branch (3374:46): [True: 87, False: 0]
  ------------------
 3375|     87|            {
 3376|     87|                if (img->bitspersample == 8)
  ------------------
  |  Branch (3376:21): [True: 84, False: 3]
  ------------------
 3377|     84|                {
 3378|     84|                    if (!img->Map)
  ------------------
  |  Branch (3378:25): [True: 84, False: 0]
  ------------------
 3379|     84|                        img->put.contig = putRGBcontig8bitCMYKtile;
 3380|      0|                    else
 3381|      0|                        img->put.contig = putRGBcontig8bitCMYKMaptile;
 3382|     84|                }
 3383|     87|            }
 3384|     87|            break;
 3385|    133|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|    133|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (3385:9): [True: 133, False: 11.7k]
  ------------------
 3386|    133|            if (buildMap(img))
  ------------------
  |  Branch (3386:17): [True: 133, False: 0]
  ------------------
 3387|    133|            {
 3388|    133|                switch (img->bitspersample)
 3389|    133|                {
 3390|     14|                    case 8:
  ------------------
  |  Branch (3390:21): [True: 14, False: 119]
  ------------------
 3391|     14|                        img->put.contig = put8bitcmaptile;
 3392|     14|                        break;
 3393|     25|                    case 4:
  ------------------
  |  Branch (3393:21): [True: 25, False: 108]
  ------------------
 3394|     25|                        img->put.contig = put4bitcmaptile;
 3395|     25|                        break;
 3396|     40|                    case 2:
  ------------------
  |  Branch (3396:21): [True: 40, False: 93]
  ------------------
 3397|     40|                        img->put.contig = put2bitcmaptile;
 3398|     40|                        break;
 3399|     54|                    case 1:
  ------------------
  |  Branch (3399:21): [True: 54, False: 79]
  ------------------
 3400|     54|                        img->put.contig = put1bitcmaptile;
 3401|     54|                        break;
 3402|      0|                    default:
  ------------------
  |  Branch (3402:21): [True: 0, False: 133]
  ------------------
 3403|      0|                        break;
 3404|    133|                }
 3405|    133|            }
 3406|    133|            break;
 3407|  2.50k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  2.50k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3407:9): [True: 2.50k, False: 9.38k]
  ------------------
 3408|  8.25k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  8.25k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3408:9): [True: 5.75k, False: 6.13k]
  ------------------
 3409|  8.25k|            if (buildMap(img))
  ------------------
  |  Branch (3409:17): [True: 8.25k, False: 0]
  ------------------
 3410|  8.25k|            {
 3411|  8.25k|                switch (img->bitspersample)
 3412|  8.25k|                {
 3413|    228|                    case 16:
  ------------------
  |  Branch (3413:21): [True: 228, False: 8.03k]
  ------------------
 3414|    228|                        img->put.contig = put16bitbwtile;
 3415|    228|                        break;
 3416|  3.16k|                    case 8:
  ------------------
  |  Branch (3416:21): [True: 3.16k, False: 5.09k]
  ------------------
 3417|  3.16k|                        if (img->alpha && img->samplesperpixel == 2)
  ------------------
  |  Branch (3417:29): [True: 135, False: 3.03k]
  |  Branch (3417:43): [True: 27, False: 108]
  ------------------
 3418|     27|                            img->put.contig = putagreytile;
 3419|  3.14k|                        else
 3420|  3.14k|                            img->put.contig = putgreytile;
 3421|  3.16k|                        break;
 3422|    166|                    case 4:
  ------------------
  |  Branch (3422:21): [True: 166, False: 8.09k]
  ------------------
 3423|    166|                        img->put.contig = put4bitbwtile;
 3424|    166|                        break;
 3425|    163|                    case 2:
  ------------------
  |  Branch (3425:21): [True: 163, False: 8.09k]
  ------------------
 3426|    163|                        img->put.contig = put2bitbwtile;
 3427|    163|                        break;
 3428|  4.53k|                    case 1:
  ------------------
  |  Branch (3428:21): [True: 4.53k, False: 3.72k]
  ------------------
 3429|  4.53k|                        img->put.contig = put1bitbwtile;
 3430|  4.53k|                        break;
 3431|      0|                    default:
  ------------------
  |  Branch (3431:21): [True: 0, False: 8.25k]
  ------------------
 3432|      0|                        break;
 3433|  8.25k|                }
 3434|  8.25k|            }
 3435|  8.25k|            break;
 3436|  8.25k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  1.28k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3436:9): [True: 1.28k, False: 10.6k]
  ------------------
 3437|  1.28k|            if ((img->bitspersample == 8) && (img->samplesperpixel == 3))
  ------------------
  |  Branch (3437:17): [True: 1.28k, False: 5]
  |  Branch (3437:46): [True: 1.27k, False: 1]
  ------------------
 3438|  1.27k|            {
 3439|  1.27k|                if (initYCbCrConversion(img) != 0)
  ------------------
  |  Branch (3439:21): [True: 1.26k, False: 10]
  ------------------
 3440|  1.26k|                {
 3441|       |                    /*
 3442|       |                     * The 6.0 spec says that subsampling must be
 3443|       |                     * one of 1, 2, or 4, and that vertical subsampling
 3444|       |                     * must always be <= horizontal subsampling; so
 3445|       |                     * there are only a few possibilities and we just
 3446|       |                     * enumerate the cases.
 3447|       |                     * Joris: added support for the [1,2] case, nonetheless, to
 3448|       |                     * accommodate some OJPEG files
 3449|       |                     */
 3450|  1.26k|                    uint16_t SubsamplingHor;
 3451|  1.26k|                    uint16_t SubsamplingVer;
 3452|  1.26k|                    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|  1.26k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 3453|  1.26k|                                          &SubsamplingHor, &SubsamplingVer);
 3454|       |                    /* Validate that the image dimensions are compatible with
 3455|       |                    the subsampling block. All putcontig8bitYCbCrXYtile routines
 3456|       |                    assume width >= X and height >= Y. */
 3457|  1.26k|                    if (img->width < SubsamplingHor ||
  ------------------
  |  Branch (3457:25): [True: 13, False: 1.25k]
  ------------------
 3458|  1.25k|                        img->height < SubsamplingVer)
  ------------------
  |  Branch (3458:25): [True: 17, False: 1.23k]
  ------------------
 3459|     30|                    {
 3460|     30|                        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 3461|     30|                                      "YCbCr subsampling (%u,%u) incompatible "
 3462|     30|                                      "with image size %ux%u",
 3463|     30|                                      SubsamplingHor, SubsamplingVer,
 3464|     30|                                      img->width, img->height);
 3465|     30|                        return 0;
 3466|     30|                    }
 3467|  1.23k|                    switch ((SubsamplingHor << 4) | SubsamplingVer)
 3468|  1.23k|                    {
 3469|     69|                        case 0x44:
  ------------------
  |  Branch (3469:25): [True: 69, False: 1.17k]
  ------------------
 3470|     69|                            img->put.contig = putcontig8bitYCbCr44tile;
 3471|     69|                            break;
 3472|     54|                        case 0x42:
  ------------------
  |  Branch (3472:25): [True: 54, False: 1.18k]
  ------------------
 3473|     54|                            img->put.contig = putcontig8bitYCbCr42tile;
 3474|     54|                            break;
 3475|     51|                        case 0x41:
  ------------------
  |  Branch (3475:25): [True: 51, False: 1.18k]
  ------------------
 3476|     51|                            img->put.contig = putcontig8bitYCbCr41tile;
 3477|     51|                            break;
 3478|    866|                        case 0x22:
  ------------------
  |  Branch (3478:25): [True: 866, False: 373]
  ------------------
 3479|    866|                            img->put.contig = putcontig8bitYCbCr22tile;
 3480|    866|                            break;
 3481|     34|                        case 0x21:
  ------------------
  |  Branch (3481:25): [True: 34, False: 1.20k]
  ------------------
 3482|     34|                            img->put.contig = putcontig8bitYCbCr21tile;
 3483|     34|                            break;
 3484|     36|                        case 0x12:
  ------------------
  |  Branch (3484:25): [True: 36, False: 1.20k]
  ------------------
 3485|     36|                            img->put.contig = putcontig8bitYCbCr12tile;
 3486|     36|                            break;
 3487|    127|                        case 0x11:
  ------------------
  |  Branch (3487:25): [True: 127, False: 1.11k]
  ------------------
 3488|    127|                            img->put.contig = putcontig8bitYCbCr11tile;
 3489|    127|                            break;
 3490|      2|                        default:
  ------------------
  |  Branch (3490:25): [True: 2, False: 1.23k]
  ------------------
 3491|      2|                            break;
 3492|  1.23k|                    }
 3493|  1.23k|                }
 3494|  1.27k|            }
 3495|  1.25k|            break;
 3496|  1.25k|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|     82|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (3496:9): [True: 82, False: 11.8k]
  ------------------
 3497|     82|            if (img->samplesperpixel == 3 && buildMap(img))
  ------------------
  |  Branch (3497:17): [True: 82, False: 0]
  |  Branch (3497:46): [True: 82, False: 0]
  ------------------
 3498|     82|            {
 3499|     82|                if (img->bitspersample == 8 || img->bitspersample == 16)
  ------------------
  |  Branch (3499:21): [True: 54, False: 28]
  |  Branch (3499:48): [True: 28, False: 0]
  ------------------
 3500|     82|                    img->put.contig = initCIELabConversion(img);
 3501|     82|                break;
 3502|     82|            }
 3503|      0|            break;
 3504|      0|        default:
  ------------------
  |  Branch (3504:9): [True: 0, False: 11.8k]
  ------------------
 3505|      0|            break;
 3506|  11.8k|    }
 3507|  11.8k|    return ((img->get != NULL) && (img->put.contig != NULL));
  ------------------
  |  Branch (3507:13): [True: 11.8k, False: 0]
  |  Branch (3507:35): [True: 11.8k, False: 29]
  ------------------
 3508|  11.8k|}
tif_getimage.c:gtTileContig:
  912|  9.40k|{
  913|  9.40k|    TIFF *tif = img->tif;
  914|  9.40k|    tileContigRoutine put = img->put.contig;
  915|  9.40k|    uint32_t col, row, y, rowstoread;
  916|  9.40k|    tmsize_t pos;
  917|  9.40k|    uint32_t tw, th;
  918|  9.40k|    unsigned char *buf = NULL;
  919|  9.40k|    int32_t fromskew, toskew;
  920|  9.40k|    uint32_t nrow;
  921|  9.40k|    int ret = 1, flip;
  922|  9.40k|    uint32_t this_tw, tocol;
  923|  9.40k|    int32_t this_toskew, leftmost_toskew;
  924|  9.40k|    int32_t leftmost_fromskew;
  925|  9.40k|    uint32_t leftmost_tw;
  926|  9.40k|    tmsize_t bufsize;
  927|       |
  928|  9.40k|    uint32_t wcpy;            /* samples to copy in raster width direction */
  929|  9.40k|    uint32_t hcpy;            /* lines to copy in raster height direction */
  930|  9.40k|    uint32_t *p_raster_start; /* pointer into raster where imagedata shall start
  931|       |                                 to be written */
  932|       |
  933|       |    /* For explanation of some local parameters refer to gtStripContig() */
  934|       |
  935|  9.40k|    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  311|  9.40k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  936|  9.40k|    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  312|  9.40k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  937|       |
  938|  9.40k|    if (tw == 0 || th == 0)
  ------------------
  |  Branch (938:9): [True: 0, False: 9.40k]
  |  Branch (938:20): [True: 0, False: 9.40k]
  ------------------
  939|      0|    {
  940|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "tile width or height is zero");
  941|      0|        return 0;
  942|      0|    }
  943|       |
  944|  9.40k|    if (!calcCopyToRasterParameter(img, raster, rwidth, rheight, &wcpy, &hcpy,
  ------------------
  |  Branch (944:9): [True: 0, False: 9.40k]
  ------------------
  945|  9.40k|                                   &flip, &p_raster_start, &toskew, &y, true,
  946|  9.40k|                                   tw, "gtTileContig"))
  947|      0|    {
  948|      0|        return 0;
  949|      0|    }
  950|       |
  951|  9.40k|    bufsize = TIFFTileSize(tif);
  952|  9.40k|    if (bufsize == 0)
  ------------------
  |  Branch (952:9): [True: 0, False: 9.40k]
  ------------------
  953|      0|    {
  954|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "No space for tile buffer");
  955|      0|        return 0;
  956|      0|    }
  957|       |
  958|       |    /*
  959|       |     * Reading the image data tile by tile.
  960|       |     * Leftmost tile is clipped on left side if col_offset > 0.
  961|       |     */
  962|  9.40k|    leftmost_fromskew = (int32_t)((uint32_t)img->col_offset % tw);
  963|  9.40k|    leftmost_tw = (uint32_t)((int32_t)tw - leftmost_fromskew);
  964|  9.40k|    int64_t skew_i64 = (int64_t)toskew + (int64_t)(int32_t)leftmost_fromskew;
  965|  9.40k|    if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
  ------------------
  |  Branch (965:9): [True: 0, False: 9.40k]
  |  Branch (965:31): [True: 0, False: 9.40k]
  ------------------
  966|      0|    {
  967|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
  968|      0|                      skew_i64);
  969|      0|        return 0;
  970|      0|    }
  971|  9.40k|    leftmost_toskew = (int32_t)skew_i64;
  972|  9.40k|    if (!checkColOffsetByteAligned(img, "gtTileContig",
  ------------------
  |  Branch (972:9): [True: 0, False: 9.40k]
  ------------------
  973|  9.40k|                                   (tmsize_t)leftmost_fromskew *
  974|  9.40k|                                       img->samplesperpixel *
  975|  9.40k|                                       img->bitspersample))
  976|      0|        return 0;
  977|       |
  978|       |    /* Determine if YCbCr subsampling requires block-aware pos calculation. */
  979|  9.40k|    int ycbcr_subsampled = 0;
  980|  9.40k|    uint16_t ycbcr_ss_h = 1, ycbcr_ss_v = 1;
  981|  9.40k|    uint32_t ycbcr_bpr = 0; /* blocks per tile row */
  982|  9.40k|    uint32_t ycbcr_bsz = 0; /* bytes per block */
  983|  9.40k|    if (img->photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif))
  ------------------
  |  |  227|  18.8k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                  if (img->photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif))
  ------------------
  |  |  285|  1.02k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  136|  1.02k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (983:9): [True: 1.02k, False: 8.38k]
  |  Branch (983:50): [True: 1.02k, False: 0]
  ------------------
  984|  1.02k|    {
  985|  1.02k|        TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &ycbcr_ss_h,
  ------------------
  |  |  388|  1.02k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  986|  1.02k|                              &ycbcr_ss_v);
  987|  1.02k|        if (ycbcr_ss_h == 0 || ycbcr_ss_v == 0)
  ------------------
  |  Branch (987:13): [True: 0, False: 1.02k]
  |  Branch (987:32): [True: 0, False: 1.02k]
  ------------------
  988|      0|        {
  989|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
  990|      0|                          "Invalid YCbCr subsampling (%d, %d)", (int)ycbcr_ss_h,
  991|      0|                          (int)ycbcr_ss_v);
  992|      0|            return 0;
  993|      0|        }
  994|  1.02k|        if (ycbcr_ss_h > 1 || ycbcr_ss_v > 1)
  ------------------
  |  Branch (994:13): [True: 904, False: 117]
  |  Branch (994:31): [True: 18, False: 99]
  ------------------
  995|    922|        {
  996|    922|            ycbcr_subsampled = 1;
  997|    922|            ycbcr_bpr = TIFFhowmany_32(tw, ycbcr_ss_h);
  ------------------
  |  |  316|    922|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 922, False: 0]
  |  |  ------------------
  |  |  317|    922|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|    922|         : 0U)
  ------------------
  998|    922|            ycbcr_bsz = (uint32_t)ycbcr_ss_h * ycbcr_ss_v + 2;
  999|       |            /* A column offset inside a sampling block cannot be
 1000|       |             * represented by the packed YCbCr put routines. */
 1001|    922|            if (((uint32_t)img->col_offset % ycbcr_ss_h) != 0)
  ------------------
  |  Branch (1001:17): [True: 0, False: 922]
  ------------------
 1002|      0|            {
 1003|      0|                TIFFErrorExtR(tif, TIFFFileName(tif),
 1004|      0|                              "gtTileContig: column offset %d does not align "
 1005|      0|                              "to the YCbCr subsampling block",
 1006|      0|                              img->col_offset);
 1007|      0|                return 0;
 1008|      0|            }
 1009|    922|        }
 1010|  1.02k|    }
 1011|       |
 1012|   251k|    for (row = 0; ret != 0 && row < hcpy; row += nrow)
  ------------------
  |  Branch (1012:19): [True: 249k, False: 1.73k]
  |  Branch (1012:31): [True: 242k, False: 7.67k]
  ------------------
 1013|   242k|    {
 1014|   242k|        rowstoread = th - ((uint32_t)row + (uint32_t)img->row_offset) % th;
 1015|   242k|        nrow = row + rowstoread > hcpy ? hcpy - row : rowstoread;
  ------------------
  |  Branch (1015:16): [True: 8.45k, False: 233k]
  ------------------
 1016|   242k|        fromskew = leftmost_fromskew;
 1017|   242k|        this_tw = leftmost_tw;
 1018|   242k|        this_toskew = leftmost_toskew;
 1019|   242k|        tocol = 0;
 1020|   242k|        col = (uint32_t)img->col_offset;
 1021|       |        /* wcpy: only write imagewidth if raster is bigger. */
 1022|  1.29M|        while (tocol < wcpy)
  ------------------
  |  Branch (1022:16): [True: 1.05M, False: 240k]
  ------------------
 1023|  1.05M|        {
 1024|  1.05M|            if (_TIFFReadTileAndAllocBuffer(tif, (void **)&buf, bufsize, col,
  ------------------
  |  Branch (1024:17): [True: 958k, False: 91.6k]
  ------------------
 1025|  1.05M|                                            (uint32_t)row +
 1026|  1.05M|                                                (uint32_t)img->row_offset,
 1027|  1.05M|                                            0, 0) == (tmsize_t)(-1) &&
 1028|   958k|                (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1028:18): [True: 1.73k, False: 956k]
  |  Branch (1028:33): [True: 0, False: 956k]
  ------------------
 1029|  1.73k|            {
 1030|  1.73k|                ret = 0;
 1031|  1.73k|                break;
 1032|  1.73k|            }
 1033|  1.04M|            if (ycbcr_subsampled)
  ------------------
  |  Branch (1033:17): [True: 298k, False: 750k]
  ------------------
 1034|   298k|            {
 1035|   298k|                uint32_t rit =
 1036|   298k|                    ((uint32_t)row + (uint32_t)img->row_offset) % th;
 1037|   298k|                pos = (tmsize_t)(rit / ycbcr_ss_v) * ycbcr_bpr * ycbcr_bsz +
 1038|   298k|                      (tmsize_t)(fromskew / ycbcr_ss_h) * ycbcr_bsz;
 1039|   298k|            }
 1040|   750k|            else
 1041|   750k|            {
 1042|   750k|                pos =
 1043|   750k|                    (((uint32_t)row + (uint32_t)img->row_offset) % th) *
 1044|   750k|                        TIFFTileRowSize(tif) +
 1045|   750k|                    (((tmsize_t)fromskew * img->samplesperpixel *
 1046|   750k|                      img->bitspersample) /
 1047|   750k|                     8);
 1048|   750k|            }
 1049|  1.04M|            if (tocol + this_tw > wcpy)
  ------------------
  |  Branch (1049:17): [True: 219k, False: 829k]
  ------------------
 1050|   219k|            {
 1051|       |                /*
 1052|       |                 * Rightmost tile is clipped on right side.
 1053|       |                 */
 1054|   219k|                fromskew = (int32_t)(tw - (wcpy - tocol));
 1055|   219k|                this_tw = (uint32_t)((int32_t)tw - fromskew);
 1056|   219k|                this_toskew = (int32_t)(toskew + (int32_t)(uint32_t)fromskew);
 1057|   219k|            }
 1058|  1.04M|            tmsize_t roffset = (tmsize_t)y * rwidth + tocol;
 1059|  1.04M|            (*put)(img, p_raster_start + roffset, tocol, y, this_tw, nrow,
 1060|  1.04M|                   fromskew, this_toskew, buf + pos);
 1061|  1.04M|            tocol += this_tw;
 1062|  1.04M|            col += this_tw;
 1063|       |            /*
 1064|       |             * After the leftmost tile, tiles are no longer clipped on left
 1065|       |             * side.
 1066|       |             */
 1067|  1.04M|            fromskew = 0;
 1068|  1.04M|            this_tw = tw;
 1069|  1.04M|            this_toskew = toskew;
 1070|  1.04M|        }
 1071|       |
 1072|   242k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|   242k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1072:25): [True: 241k, False: 483]
  ------------------
 1073|   242k|                                                 : (int32_t)nrow);
 1074|   242k|    }
 1075|  9.40k|    _TIFFfreeExt(img->tif, buf);
 1076|       |
 1077|  9.40k|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|  9.40k|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1077:9): [True: 46, False: 9.36k]
  ------------------
 1078|     46|    {
 1079|     46|        uint32_t line;
 1080|       |
 1081|  29.5k|        for (line = 0; line < hcpy; line++)
  ------------------
  |  Branch (1081:24): [True: 29.5k, False: 46]
  ------------------
 1082|  29.5k|        {
 1083|  29.5k|            uint32_t *left = p_raster_start + (size_t)line * rwidth;
 1084|       |            /* Use wcpy to only flip horizontally data in place and not complete
 1085|       |             * raster-row. */
 1086|  29.5k|            uint32_t *right = left + wcpy - 1;
 1087|       |
 1088|  57.6M|            while (left < right)
  ------------------
  |  Branch (1088:20): [True: 57.5M, False: 29.5k]
  ------------------
 1089|  57.5M|            {
 1090|  57.5M|                uint32_t temp = *left;
 1091|  57.5M|                *left = *right;
 1092|  57.5M|                *right = temp;
 1093|  57.5M|                left++;
 1094|  57.5M|                right--;
 1095|  57.5M|            }
 1096|  29.5k|        }
 1097|     46|    }
 1098|       |
 1099|  9.40k|    return ret;
 1100|  9.40k|}
tif_getimage.c:calcCopyToRasterParameter:
  784|  13.0k|{
  785|       |    /* If the raster height is smaller than the image height,
  786|       |     * or if there is a row_offset, adapt the number of lines to be copied. */
  787|  13.0k|    if (img->row_offset < 0 || (uint32_t)img->row_offset >= img->height)
  ------------------
  |  Branch (787:9): [True: 0, False: 13.0k]
  |  Branch (787:32): [True: 0, False: 13.0k]
  ------------------
  788|      0|    {
  789|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  790|      0|                      "Error in %s: row offset %d exceeds "
  791|      0|                      "image height %u",
  792|      0|                      funcName, img->row_offset, img->height);
  793|      0|        return 0;
  794|      0|    }
  795|  13.0k|    *phcpy = TIFFmin(rheight, img->height - (uint32_t)img->row_offset);
  ------------------
  |  |  352|  13.0k|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 0, False: 13.0k]
  |  |  ------------------
  ------------------
  796|       |
  797|       |    /* If the raster is smaller than the image,
  798|       |     * or if there is a col_offset, adapt the number of samples to be copied per
  799|       |     * row. */
  800|  13.0k|    if (img->col_offset < 0 || (uint32_t)img->col_offset >= img->width)
  ------------------
  |  Branch (800:9): [True: 0, False: 13.0k]
  |  Branch (800:32): [True: 0, False: 13.0k]
  ------------------
  801|      0|    {
  802|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  803|      0|                      "Error in %s: column offset %d exceeds "
  804|      0|                      "image width %u",
  805|      0|                      funcName, img->col_offset, img->width);
  806|      0|        return 0;
  807|      0|    }
  808|  13.0k|    *pwcpy = TIFFmin(rwidth, img->width - (uint32_t)img->col_offset);
  ------------------
  |  |  352|  13.0k|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (352:24): [True: 0, False: 13.0k]
  |  |  ------------------
  ------------------
  809|       |
  810|       |    /* Determine flipping and check req_orientation value. */
  811|  13.0k|    *pflip = setorientation(img);
  812|       |
  813|       |    /* -- Set raster-origin --
  814|       |     * Set pointer into raster buffer according img->req_orientation, which
  815|       |     * defines in which corner of the two dimensional "raster" matrix the image
  816|       |     * will be moved (i.e. which raster-corner will be the raster origin).
  817|       |     * Furthermore, if vertical flipping is required adapt pointer into raster
  818|       |     * to the last line. Then, write the lines from the bottom line to the top
  819|       |     * line of the image area within the raster buffer.
  820|       |     */
  821|  13.0k|    switch (img->req_orientation)
  822|  13.0k|    {
  823|      0|        case ORIENTATION_TOPLEFT:
  ------------------
  |  |  249|      0|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (823:9): [True: 0, False: 13.0k]
  ------------------
  824|      0|        case ORIENTATION_LEFTTOP:
  ------------------
  |  |  253|      0|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (824:9): [True: 0, False: 13.0k]
  ------------------
  825|      0|            *pp_raster_start = raster;
  826|      0|            break;
  827|      0|        case ORIENTATION_TOPRIGHT:
  ------------------
  |  |  250|      0|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (827:9): [True: 0, False: 13.0k]
  ------------------
  828|      0|        case ORIENTATION_RIGHTTOP:
  ------------------
  |  |  254|      0|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (828:9): [True: 0, False: 13.0k]
  ------------------
  829|      0|            *pp_raster_start = raster + ((size_t)rwidth - *pwcpy);
  830|      0|            break;
  831|      0|        case ORIENTATION_BOTRIGHT:
  ------------------
  |  |  251|      0|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (831:9): [True: 0, False: 13.0k]
  ------------------
  832|      0|        case ORIENTATION_RIGHTBOT:
  ------------------
  |  |  255|      0|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (832:9): [True: 0, False: 13.0k]
  ------------------
  833|      0|            *pp_raster_start = raster + ((size_t)rheight - *phcpy) * rwidth +
  834|      0|                               ((size_t)rwidth - *pwcpy);
  835|      0|            break;
  836|  13.0k|        case ORIENTATION_BOTLEFT:
  ------------------
  |  |  252|  13.0k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (836:9): [True: 13.0k, False: 0]
  ------------------
  837|  13.0k|        case ORIENTATION_LEFTBOT:
  ------------------
  |  |  256|  13.0k|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (837:9): [True: 0, False: 13.0k]
  ------------------
  838|  13.0k|            *pp_raster_start = raster + ((size_t)rheight - *phcpy) * rwidth;
  839|  13.0k|            break;
  840|      0|        default: /* NOTREACHED */
  ------------------
  |  Branch (840:9): [True: 0, False: 13.0k]
  ------------------
  841|      0|            return 0;
  842|      0|            break;
  843|  13.0k|    }
  844|       |
  845|       |    /* Set increment (toskew) to next or previous line in raster.
  846|       |     * And initialize row index (y) of the image area within the raster
  847|       |     * buffer.
  848|       |     * Tiled images are read tile by tile and therefore toskew has to be
  849|       |     * calculated using tile-width.
  850|       |     */
  851|  13.0k|    const uint32_t cpywidth = isTiled ? tilewidth : *pwcpy;
  ------------------
  |  Branch (851:31): [True: 10.4k, False: 2.60k]
  ------------------
  852|  13.0k|    if (*pflip & FLIP_VERTICALLY)
  ------------------
  |  |   50|  13.0k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (852:9): [True: 12.9k, False: 144]
  ------------------
  853|  12.9k|    {
  854|  12.9k|        if ((int64_t)rwidth + cpywidth > INT_MAX)
  ------------------
  |  Branch (854:13): [True: 0, False: 12.9k]
  ------------------
  855|      0|        {
  856|      0|            TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  857|      0|                          "Width overflow in %s", funcName);
  858|      0|            return 0;
  859|      0|        }
  860|       |        /* Skew back to the raster row before the currently written row
  861|       |         * -> one raster width plus copied image pixels. */
  862|  12.9k|        *ptoskew = -(int32_t)(rwidth + cpywidth);
  863|  12.9k|        *py = *phcpy - 1; /* start with last image line in raster */
  864|  12.9k|    }
  865|    144|    else
  866|    144|    {
  867|       |        /* Skew forward to the end of the raster width of the row currently
  868|       |         * copied. */
  869|    144|        if (cpywidth > ((int64_t)INT_MAX + rwidth) ||
  ------------------
  |  Branch (869:13): [True: 0, False: 144]
  ------------------
  870|    144|            rwidth > ((int64_t)INT_MAX + cpywidth))
  ------------------
  |  Branch (870:13): [True: 0, False: 144]
  ------------------
  871|      0|        {
  872|      0|            TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  873|      0|                          "Width underflow in %s", funcName);
  874|      0|            return 0;
  875|      0|        }
  876|    144|        *ptoskew = (int32_t)(rwidth - cpywidth);
  877|    144|        *py = 0; /* start with first image line in raster */
  878|    144|    }
  879|  13.0k|    return 1;
  880|  13.0k|}
tif_getimage.c:setorientation:
  665|  13.0k|{
  666|  13.0k|    int flip_ret = 0;
  667|  13.0k|    if (checkedOrientation(img->req_orientation) == 0)
  ------------------
  |  Branch (667:9): [True: 0, False: 13.0k]
  ------------------
  668|      0|    {
  669|      0|        TIFFWarningExtR(img->tif, TIFFFileName(img->tif),
  670|      0|                        "TIFFRGBAImage ERROR: Requested orientation %d is not "
  671|      0|                        "within allowed range of image orientations 1 to 8. "
  672|      0|                        "Using default",
  673|      0|                        img->req_orientation);
  674|      0|        img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
  ------------------
  |  |  252|      0|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  675|      0|    }
  676|  13.0k|    switch (img->orientation)
  677|  13.0k|    {
  678|  12.8k|        case ORIENTATION_TOPLEFT:
  ------------------
  |  |  249|  12.8k|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (678:9): [True: 12.8k, False: 195]
  ------------------
  679|  12.8k|        case ORIENTATION_LEFTTOP:
  ------------------
  |  |  253|  12.8k|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (679:9): [True: 3, False: 13.0k]
  ------------------
  680|  12.8k|            if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|  25.7k|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (680:17): [True: 0, False: 12.8k]
  ------------------
  681|  12.8k|                img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|  12.8k|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (681:17): [True: 0, False: 12.8k]
  ------------------
  682|      0|                flip_ret = FLIP_HORIZONTALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  683|  12.8k|            else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  251|  25.7k|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (683:22): [True: 0, False: 12.8k]
  ------------------
  684|  12.8k|                     img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  255|  12.8k|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (684:22): [True: 0, False: 12.8k]
  ------------------
  685|      0|                flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  686|  12.8k|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|  25.7k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (686:22): [True: 12.8k, False: 0]
  ------------------
  687|      0|                     img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  256|      0|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (687:22): [True: 0, False: 0]
  ------------------
  688|  12.8k|                flip_ret = FLIP_VERTICALLY;
  ------------------
  |  |   50|  12.8k|#define FLIP_VERTICALLY 0x01
  ------------------
  689|      0|            else
  690|      0|                flip_ret = 0;
  691|  12.8k|            break;
  692|     25|        case ORIENTATION_TOPRIGHT:
  ------------------
  |  |  250|     25|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (692:9): [True: 25, False: 13.0k]
  ------------------
  693|     48|        case ORIENTATION_RIGHTTOP:
  ------------------
  |  |  254|     48|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (693:9): [True: 23, False: 13.0k]
  ------------------
  694|     48|            if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  249|     96|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (694:17): [True: 0, False: 48]
  ------------------
  695|     48|                img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  253|     48|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (695:17): [True: 0, False: 48]
  ------------------
  696|      0|                flip_ret = FLIP_HORIZONTALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  697|     48|            else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  251|     96|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (697:22): [True: 0, False: 48]
  ------------------
  698|     48|                     img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  255|     48|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (698:22): [True: 0, False: 48]
  ------------------
  699|      0|                flip_ret = FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  700|     48|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|     96|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (700:22): [True: 48, False: 0]
  ------------------
  701|      0|                     img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  256|      0|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (701:22): [True: 0, False: 0]
  ------------------
  702|     48|                flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|     48|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|     48|#define FLIP_VERTICALLY 0x01
  ------------------
  703|      0|            else
  704|      0|                flip_ret = 0;
  705|     48|            break;
  706|     79|        case ORIENTATION_BOTRIGHT:
  ------------------
  |  |  251|     79|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (706:9): [True: 79, False: 12.9k]
  ------------------
  707|    118|        case ORIENTATION_RIGHTBOT:
  ------------------
  |  |  255|    118|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (707:9): [True: 39, False: 13.0k]
  ------------------
  708|    118|            if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  249|    236|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (708:17): [True: 0, False: 118]
  ------------------
  709|    118|                img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  253|    118|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (709:17): [True: 0, False: 118]
  ------------------
  710|      0|                flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  711|    118|            else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|    236|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (711:22): [True: 0, False: 118]
  ------------------
  712|    118|                     img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|    118|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (712:22): [True: 0, False: 118]
  ------------------
  713|      0|                flip_ret = FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  714|    118|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|    236|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (714:22): [True: 118, False: 0]
  ------------------
  715|      0|                     img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  256|      0|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (715:22): [True: 0, False: 0]
  ------------------
  716|    118|                flip_ret = FLIP_HORIZONTALLY;
  ------------------
  |  |   51|    118|#define FLIP_HORIZONTALLY 0x02
  ------------------
  717|      0|            else
  718|      0|                flip_ret = 0;
  719|    118|            break;
  720|     15|        case ORIENTATION_BOTLEFT:
  ------------------
  |  |  252|     15|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (720:9): [True: 15, False: 13.0k]
  ------------------
  721|     26|        case ORIENTATION_LEFTBOT:
  ------------------
  |  |  256|     26|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (721:9): [True: 11, False: 13.0k]
  ------------------
  722|     26|            if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  249|     52|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (722:17): [True: 0, False: 26]
  ------------------
  723|     26|                img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  253|     26|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (723:17): [True: 0, False: 26]
  ------------------
  724|      0|                flip_ret = FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  725|     26|            else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|     52|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (725:22): [True: 0, False: 26]
  ------------------
  726|     26|                     img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|     26|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (726:22): [True: 0, False: 26]
  ------------------
  727|      0|                flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              flip_ret = FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  728|     26|            else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  251|     52|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (728:22): [True: 0, False: 26]
  ------------------
  729|     26|                     img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  255|     26|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (729:22): [True: 0, False: 26]
  ------------------
  730|      0|                flip_ret = FLIP_HORIZONTALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  731|     26|            else
  732|     26|                flip_ret = 0;
  733|     26|            break;
  734|      0|        default: /* NOTREACHED */
  ------------------
  |  Branch (734:9): [True: 0, False: 13.0k]
  ------------------
  735|      0|            flip_ret = 0;
  736|      0|            break;
  737|  13.0k|    }
  738|       |    /*
  739|       |     * TIFFRGBAImage cannot rotate images because of its interface restrictions.
  740|       |     * (see last comment in issue #29)
  741|       |     * Therefore, check for allowed combinations of img->orientation and
  742|       |     * img->req_orientation (requested orientation from the user).
  743|       |     *  The img->req_orientation also defines in which corner of the
  744|       |     * two dimensional "raster" matrix the image will be moved
  745|       |     * (i.e. which raster-corner will be the raster origin).
  746|       |     */
  747|  13.0k|    static const char warnMsg[] =
  748|  13.0k|        "TIFFRGBAImage cannot rotate but only flip. Therefore, image "
  749|  13.0k|        "pixel will be moved to %s corner of the raster matrix as origin "
  750|  13.0k|        "but the image pixel orientation will result in %s";
  751|  13.0k|    if ((img->req_orientation <= ORIENTATION_BOTLEFT) &&
  ------------------
  |  |  252|  13.0k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (751:9): [True: 13.0k, False: 0]
  ------------------
  752|  13.0k|        (img->orientation >= ORIENTATION_LEFTTOP))
  ------------------
  |  |  253|  13.0k|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (752:9): [True: 76, False: 12.9k]
  ------------------
  753|     76|    {
  754|     76|        TIFFWarningExtR(
  755|     76|            img->tif, TIFFFileName(img->tif), warnMsg,
  756|     76|            orientationStrings[checkedOrientation(img->req_orientation)],
  757|     76|            orientationStrings[checkedOrientation(
  758|     76|                (uint16_t)(img->req_orientation + 4))]);
  759|     76|    }
  760|  12.9k|    else if ((img->req_orientation >= ORIENTATION_LEFTTOP) &&
  ------------------
  |  |  253|  12.9k|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (760:14): [True: 0, False: 12.9k]
  ------------------
  761|      0|             (img->orientation <= ORIENTATION_BOTLEFT))
  ------------------
  |  |  252|      0|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (761:14): [True: 0, False: 0]
  ------------------
  762|      0|    {
  763|      0|        TIFFWarningExtR(
  764|      0|            img->tif, TIFFFileName(img->tif), warnMsg,
  765|      0|            orientationStrings[checkedOrientation(img->req_orientation)],
  766|      0|            orientationStrings[checkedOrientation(
  767|      0|                (uint16_t)(img->req_orientation - 4))]);
  768|      0|    }
  769|  13.0k|    return flip_ret;
  770|  13.0k|}
tif_getimage.c:checkedOrientation:
   90|  13.2k|{
   91|  13.2k|    if (orientation < 1 || orientation > 8)
  ------------------
  |  Branch (91:9): [True: 0, False: 13.2k]
  |  Branch (91:28): [True: 0, False: 13.2k]
  ------------------
   92|      0|        return 0;
   93|  13.2k|    return orientation;
   94|  13.2k|}
tif_getimage.c:checkColOffsetByteAligned:
  891|  13.0k|{
  892|  13.0k|    if ((bitoffset % 8) != 0)
  ------------------
  |  Branch (892:9): [True: 0, False: 13.0k]
  ------------------
  893|      0|    {
  894|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  895|      0|                      "%s: column offset %d does not align to a byte boundary "
  896|      0|                      "for bitspersample %u / samplesperpixel %u",
  897|      0|                      module, img->col_offset, (unsigned)img->bitspersample,
  898|      0|                      (unsigned)img->samplesperpixel);
  899|      0|        return 0;
  900|      0|    }
  901|  13.0k|    return 1;
  902|  13.0k|}
tif_getimage.c:gtStripContig:
 1331|  2.42k|{
 1332|  2.42k|    TIFF *tif = img->tif;
 1333|  2.42k|    tileContigRoutine put = img->put.contig;
 1334|  2.42k|    uint32_t row, y, nrow, nrowsub, rowstoread;
 1335|  2.42k|    tmsize_t pos;
 1336|  2.42k|    unsigned char *buf = NULL;
 1337|  2.42k|    uint32_t rowsperstrip;
 1338|  2.42k|    uint16_t subsamplinghor, subsamplingver;
 1339|  2.42k|    tmsize_t scanline;
 1340|       |    /* fromskew, toskew are the increments within the input image or the raster
 1341|       |     * from the end of a line to the start of the next line to read or write. */
 1342|  2.42k|    int32_t fromskew, toskew;
 1343|  2.42k|    int ret = 1, flip;
 1344|  2.42k|    tmsize_t maxstripsize;
 1345|  2.42k|    int ycbcr_subsampled = 0;
 1346|  2.42k|    uint32_t ycbcr_bpr = 0; /* blocks per strip row */
 1347|  2.42k|    uint32_t ycbcr_bsz = 0; /* bytes per block */
 1348|  2.42k|    tmsize_t size_to_read;
 1349|       |
 1350|  2.42k|    uint32_t wcpy;            /* samples to copy in raster width direction */
 1351|  2.42k|    uint32_t hcpy;            /* lines to copy in raster height direction */
 1352|  2.42k|    uint32_t *p_raster_start; /* pointer into raster where imagedata shall start
 1353|       |                                 to be written (image area within raster) */
 1354|       |
 1355|  2.42k|    if (!calcCopyToRasterParameter(img, raster, rwidth, rheight, &wcpy, &hcpy,
  ------------------
  |  Branch (1355:9): [True: 0, False: 2.42k]
  ------------------
 1356|  2.42k|                                   &flip, &p_raster_start, &toskew, &y, false,
 1357|  2.42k|                                   0, "gtStripContig"))
 1358|      0|    {
 1359|      0|        return 0;
 1360|      0|    }
 1361|       |
 1362|  2.42k|    if (!checkColOffsetByteAligned(img, "gtStripContig",
  ------------------
  |  Branch (1362:9): [True: 0, False: 2.42k]
  ------------------
 1363|  2.42k|                                   (tmsize_t)img->col_offset *
 1364|  2.42k|                                       img->samplesperpixel *
 1365|  2.42k|                                       img->bitspersample))
 1366|      0|        return 0;
 1367|       |
 1368|  2.42k|    TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor,
  ------------------
  |  |  388|  2.42k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 1369|  2.42k|                          &subsamplingver);
 1370|  2.42k|    if (subsamplinghor == 0 || subsamplingver == 0)
  ------------------
  |  Branch (1370:9): [True: 2, False: 2.41k]
  |  Branch (1370:32): [True: 2, False: 2.41k]
  ------------------
 1371|      4|    {
 1372|      4|        TIFFErrorExtR(tif, TIFFFileName(tif),
 1373|      4|                      "Invalid YCbCr subsampling");
 1374|      4|        return 0;
 1375|      4|    }
 1376|  2.41k|    if (img->photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif) &&
  ------------------
  |  |  227|  4.83k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                  if (img->photometric == PHOTOMETRIC_YCBCR && !isUpSampled(tif) &&
  ------------------
  |  |  285|  2.63k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  136|    216|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (1376:9): [True: 216, False: 2.20k]
  |  Branch (1376:50): [True: 216, False: 0]
  ------------------
 1377|    216|        (subsamplinghor > 1 || subsamplingver > 1))
  ------------------
  |  Branch (1377:10): [True: 170, False: 46]
  |  Branch (1377:32): [True: 18, False: 28]
  ------------------
 1378|    188|    {
 1379|    188|        ycbcr_subsampled = 1;
 1380|    188|        ycbcr_bpr = TIFFhowmany_32(img->width, subsamplinghor);
  ------------------
  |  |  316|    188|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 188, False: 0]
  |  |  ------------------
  |  |  317|    188|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|    188|         : 0U)
  ------------------
 1381|    188|        ycbcr_bsz = (uint32_t)subsamplinghor * subsamplingver + 2;
 1382|       |        /* A column offset inside a sampling block cannot be represented by
 1383|       |         * the packed YCbCr put routines. */
 1384|    188|        if (((uint32_t)img->col_offset % subsamplinghor) != 0)
  ------------------
  |  Branch (1384:13): [True: 0, False: 188]
  ------------------
 1385|      0|        {
 1386|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1387|      0|                          "gtStripContig: column offset %d does not align to "
 1388|      0|                          "the YCbCr subsampling block",
 1389|      0|                          img->col_offset);
 1390|      0|            return 0;
 1391|      0|        }
 1392|    188|    }
 1393|       |
 1394|  2.41k|    maxstripsize = TIFFStripSize(tif);
 1395|       |
 1396|  2.41k|    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
  ------------------
  |  |  258|  2.41k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 1397|  2.41k|    if (rowsperstrip == 0)
  ------------------
  |  Branch (1397:9): [True: 0, False: 2.41k]
  ------------------
 1398|      0|    {
 1399|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
 1400|      0|        return 0;
 1401|      0|    }
 1402|       |
 1403|  2.41k|    scanline = TIFFScanlineSize(tif);
 1404|  2.41k|    if (wcpy < img->width && (img->width - wcpy) > (uint32_t)INT32_MAX)
  ------------------
  |  Branch (1404:9): [True: 0, False: 2.41k]
  |  Branch (1404:30): [True: 0, False: 0]
  ------------------
 1405|      0|    {
 1406|      0|        TIFFErrorExtR(tif, TIFFFileName(tif),
 1407|      0|                      "Too large fromskew value (width=%" PRIu32 ")",
 1408|      0|                      img->width);
 1409|      0|        return 0;
 1410|      0|    }
 1411|  2.41k|    fromskew = (int32_t)(wcpy < img->width ? img->width - wcpy : 0);
  ------------------
  |  Branch (1411:26): [True: 0, False: 2.41k]
  ------------------
 1412|       |
 1413|   214k|    for (row = 0; row < hcpy; row += nrow)
  ------------------
  |  Branch (1413:19): [True: 212k, False: 2.06k]
  ------------------
 1414|   212k|    {
 1415|   212k|        uint32_t temp;
 1416|       |        /* rowstoread = number of rows within current strip from
 1417|       |         * current row till end of strip.
 1418|       |         * -> rowsFromRowToStripEnd */
 1419|   212k|        rowstoread = rowsperstrip -
 1420|   212k|                     (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip;
 1421|       |        /* nrow, nrowsub = number of rows to read within current row-loop.
 1422|       |         * -> rowsToRead, rowsToReadSub */
 1423|   212k|        nrow = row + rowstoread > hcpy ? hcpy - row : rowstoread;
  ------------------
  |  Branch (1423:16): [True: 2.13k, False: 210k]
  ------------------
 1424|   212k|        nrowsub = nrow;
 1425|   212k|        if ((nrowsub % subsamplingver) != 0)
  ------------------
  |  Branch (1425:13): [True: 28.8k, False: 183k]
  ------------------
 1426|  28.8k|            nrowsub += subsamplingver - nrowsub % subsamplingver;
 1427|       |        /* temp = number of rows to read from beginning of current strip over
 1428|       |         * current row till last row to read within current strip.
 1429|       |         * -> rowsToReadFromStripStart */
 1430|   212k|        temp =
 1431|   212k|            (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip + nrowsub;
 1432|   212k|        size_to_read = TIFFVStripSize(tif, temp);
 1433|   212k|        if (size_to_read <= 0)
  ------------------
  |  Branch (1433:13): [True: 0, False: 212k]
  ------------------
 1434|      0|        {
 1435|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1436|      0|                          "Invalid strip read size in gtStripContig");
 1437|      0|            return 0;
 1438|      0|        }
 1439|   212k|        if (_TIFFReadEncodedStripAndAllocBuffer(
  ------------------
  |  Branch (1439:13): [True: 201k, False: 11.4k]
  ------------------
 1440|   212k|                tif,
 1441|   212k|                TIFFComputeStrip(tif,
 1442|   212k|                                 (uint32_t)((int32_t)row + img->row_offset), 0),
 1443|   212k|                (void **)(&buf), maxstripsize,
 1444|   212k|                size_to_read) == (tmsize_t)(-1) &&
 1445|   201k|            (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1445:14): [True: 351, False: 200k]
  |  Branch (1445:29): [True: 0, False: 200k]
  ------------------
 1446|    351|        {
 1447|    351|            ret = 0;
 1448|    351|            break;
 1449|    351|        }
 1450|       |        /* pos = read offset into strip-buffer where to start reading. */
 1451|   212k|        if (ycbcr_subsampled)
  ------------------
  |  Branch (1451:13): [True: 142k, False: 70.0k]
  ------------------
 1452|   142k|        {
 1453|   142k|            uint32_t row_in_strip =
 1454|   142k|                (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip;
 1455|   142k|            tmsize_t row_byte_offset =
 1456|   142k|                (tmsize_t)(row_in_strip / subsamplingver) * ycbcr_bpr *
 1457|   142k|                ycbcr_bsz;
 1458|   142k|            tmsize_t col_byte_offset =
 1459|   142k|                (img->col_offset != 0)
  ------------------
  |  Branch (1459:17): [True: 0, False: 142k]
  ------------------
 1460|   142k|                    ? (tmsize_t)((uint32_t)img->col_offset / subsamplinghor) *
 1461|      0|                          ycbcr_bsz
 1462|   142k|                    : 0;
 1463|   142k|            pos = row_byte_offset + col_byte_offset;
 1464|   142k|        }
 1465|  70.0k|        else
 1466|  70.0k|        {
 1467|  70.0k|            pos =
 1468|  70.0k|                (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) %
 1469|  70.0k|                           rowsperstrip) *
 1470|  70.0k|                    scanline +
 1471|  70.0k|                (((tmsize_t)img->col_offset * img->samplesperpixel *
 1472|  70.0k|                  img->bitspersample) /
 1473|  70.0k|                 8);
 1474|  70.0k|        }
 1475|       |        /* roffset = offset into raster, where to write. */
 1476|   212k|        tmsize_t roffset = (tmsize_t)y * rwidth;
 1477|   212k|        (*put)(img, p_raster_start + roffset, 0, y, wcpy, nrow, fromskew,
 1478|   212k|               toskew, buf + pos);
 1479|       |        /* y = row-index into image area within raster where to write
 1480|       |         * (i.e. for offset calculations). */
 1481|   212k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|   212k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1481:25): [True: 207k, False: 5.11k]
  ------------------
 1482|   212k|                                                 : (int32_t)nrow);
 1483|   212k|    }
 1484|       |
 1485|  2.41k|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|  2.41k|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1485:9): [True: 39, False: 2.37k]
  ------------------
 1486|     39|    {
 1487|       |        /* Flips the image area within the raster buffer horizontally.
 1488|       |         * Use wcpy to only flip data in place. */
 1489|     39|        uint32_t line;
 1490|       |
 1491|   116k|        for (line = 0; line < hcpy; line++)
  ------------------
  |  Branch (1491:24): [True: 116k, False: 39]
  ------------------
 1492|   116k|        {
 1493|   116k|            uint32_t *left = p_raster_start + (size_t)line * rwidth;
 1494|       |            /* Use wcpy to only flip horizontally data in place and not complete
 1495|       |             * raster-row. */
 1496|   116k|            uint32_t *right = left + wcpy - 1;
 1497|       |
 1498|  13.8M|            while (left < right)
  ------------------
  |  Branch (1498:20): [True: 13.6M, False: 116k]
  ------------------
 1499|  13.6M|            {
 1500|  13.6M|                uint32_t temp = *left;
 1501|  13.6M|                *left = *right;
 1502|  13.6M|                *right = temp;
 1503|  13.6M|                left++;
 1504|  13.6M|                right--;
 1505|  13.6M|            }
 1506|   116k|        }
 1507|     39|    }
 1508|       |
 1509|  2.41k|    _TIFFfreeExt(img->tif, buf);
 1510|  2.41k|    return ret;
 1511|  2.41k|}
tif_getimage.c:putRGBAAcontig8bittile:
 2066|    857|{
 2067|    857|    int samplesperpixel = img->samplesperpixel;
 2068|       |
 2069|    857|    (void)x;
 2070|    857|    (void)y;
 2071|    857|    const tmsize_t fromskewLocal =
 2072|    857|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 2073|   279k|    for (; h > 0; --h)
  ------------------
  |  Branch (2073:12): [True: 278k, False: 857]
  ------------------
 2074|   278k|    {
 2075|   278k|        UNROLL8(w, NOP, *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]);
  ------------------
  |  | 1758|   278k|    {                                                                          \
  |  | 1759|   278k|        uint32_t _x;                                                           \
  |  | 1760|  4.01M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1760:22): [True: 3.73M, False: 278k]
  |  |  ------------------
  |  | 1761|  3.73M|        {                                                                      \
  |  | 1762|  3.73M|            op1;                                                               \
  |  | 1763|  3.73M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1713|  3.73M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|  3.73M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  3.73M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  3.73M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|  3.73M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  3.73M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  3.73M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1714|  3.73M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|  3.73M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  3.73M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  3.73M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|  3.73M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  3.73M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  3.73M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1764|  3.73M|        }                                                                      \
  |  | 1765|   278k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1765:13): [True: 80.9k, False: 197k]
  |  |  ------------------
  |  | 1766|   278k|        {                                                                      \
  |  | 1767|  80.9k|            op1;                                                               \
  |  | 1768|  80.9k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1722|  80.9k|    switch (x)                                                                 \
  |  |  |  | 1723|  80.9k|    {                                                                          \
  |  |  |  | 1724|  7.78k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1724:9): [True: 7.78k, False: 73.1k]
  |  |  |  |  ------------------
  |  |  |  | 1725|  7.78k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1726|  17.8k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1726:9): [True: 10.0k, False: 70.8k]
  |  |  |  |  ------------------
  |  |  |  | 1727|  17.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1728|  38.0k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1728:9): [True: 20.2k, False: 60.6k]
  |  |  |  |  ------------------
  |  |  |  | 1729|  38.0k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1730|  38.4k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1730:9): [True: 387, False: 80.5k]
  |  |  |  |  ------------------
  |  |  |  | 1731|  38.4k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1732|  55.6k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1732:9): [True: 17.1k, False: 63.7k]
  |  |  |  |  ------------------
  |  |  |  | 1733|  55.6k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1734|  71.5k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1734:9): [True: 15.9k, False: 64.9k]
  |  |  |  |  ------------------
  |  |  |  | 1735|  71.5k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1736|  80.9k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1736:9): [True: 9.31k, False: 71.5k]
  |  |  |  |  ------------------
  |  |  |  | 1737|  80.9k|            op;                                                                \
  |  |  |  | 1738|  80.9k|            break;                                                             \
  |  |  |  | 1739|  71.5k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1739:9): [True: 0, False: 80.9k]
  |  |  |  |  ------------------
  |  |  |  | 1740|      0|            break;                                                             \
  |  |  |  | 1741|  80.9k|    }
  |  |  ------------------
  |  | 1769|  80.9k|        }                                                                      \
  |  | 1770|   278k|    }
  ------------------
 2076|   278k|                pp += samplesperpixel);
 2077|   278k|        cp += toskew;
 2078|   278k|        pp += fromskewLocal;
 2079|   278k|    }
 2080|    857|}
tif_getimage.c:BuildMapUaToAa:
 3596|     75|{
 3597|     75|    static const char module[] = "BuildMapUaToAa";
 3598|     75|    uint8_t *m;
 3599|     75|    uint16_t na, nv;
 3600|     75|    assert(img->UaToAa == NULL);
  ------------------
  |  Branch (3600:5): [True: 0, False: 75]
  |  Branch (3600:5): [True: 75, False: 0]
  ------------------
 3601|     75|    img->UaToAa = (uint8_t *)_TIFFmallocExt(img->tif, 65536);
 3602|     75|    if (img->UaToAa == NULL)
  ------------------
  |  Branch (3602:9): [True: 0, False: 75]
  ------------------
 3603|      0|    {
 3604|      0|        TIFFErrorExtR(img->tif, module, "Out of memory");
 3605|      0|        return 0;
 3606|      0|    }
 3607|     75|    m = img->UaToAa;
 3608|  19.2k|    for (na = 0; na < 256; na++)
  ------------------
  |  Branch (3608:18): [True: 19.2k, False: 75]
  ------------------
 3609|  19.2k|    {
 3610|  4.93M|        for (nv = 0; nv < 256; nv++)
  ------------------
  |  Branch (3610:22): [True: 4.91M, False: 19.2k]
  ------------------
 3611|  4.91M|            *m++ = (uint8_t)((nv * na + 127) / 255);
 3612|  19.2k|    }
 3613|     75|    return 1;
 3614|     75|}
tif_getimage.c:putRGBUAcontig8bittile:
 2087|    396|{
 2088|    396|    int samplesperpixel = img->samplesperpixel;
 2089|    396|    (void)y;
 2090|    396|    const tmsize_t fromskewLocal =
 2091|    396|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 2092|  1.55k|    for (; h > 0; --h)
  ------------------
  |  Branch (2092:12): [True: 1.16k, False: 396]
  ------------------
 2093|  1.16k|    {
 2094|  1.16k|        uint32_t r, g, b, a;
 2095|  1.16k|        uint8_t *m;
 2096|   360k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2096:21): [True: 359k, False: 1.16k]
  ------------------
 2097|   359k|        {
 2098|   359k|            a = pp[3];
 2099|   359k|            m = img->UaToAa + ((size_t)a << 8);
 2100|   359k|            r = m[pp[0]];
 2101|   359k|            g = m[pp[1]];
 2102|   359k|            b = m[pp[2]];
 2103|   359k|            *cp++ = PACK4(r, g, b, a);
  ------------------
  |  | 1818|   359k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1819|   359k|     ((uint32_t)(a) << 24))
  ------------------
 2104|   359k|            pp += samplesperpixel;
 2105|   359k|        }
 2106|  1.16k|        cp += toskew;
 2107|  1.16k|        pp += fromskewLocal;
 2108|  1.16k|    }
 2109|    396|}
tif_getimage.c:putRGBcontig8bittile:
 2045|  96.9k|{
 2046|  96.9k|    int samplesperpixel = img->samplesperpixel;
 2047|       |
 2048|  96.9k|    (void)x;
 2049|  96.9k|    (void)y;
 2050|  96.9k|    const tmsize_t fromskewLocal =
 2051|  96.9k|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 2052|  11.7M|    for (; h > 0; --h)
  ------------------
  |  Branch (2052:12): [True: 11.6M, False: 96.9k]
  ------------------
 2053|  11.6M|    {
 2054|  11.6M|        UNROLL8(w, NOP, *cp++ = PACK(pp[0], pp[1], pp[2]);
  ------------------
  |  | 1758|  11.6M|    {                                                                          \
  |  | 1759|  11.6M|        uint32_t _x;                                                           \
  |  | 1760|   176M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1760:22): [True: 164M, False: 11.6M]
  |  |  ------------------
  |  | 1761|   164M|        {                                                                      \
  |  | 1762|   164M|            op1;                                                               \
  |  | 1763|   164M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1713|   164M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   164M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   164M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   164M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   164M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   164M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   164M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1714|   164M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   164M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   164M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   164M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   164M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   164M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   164M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1764|   164M|        }                                                                      \
  |  | 1765|  11.6M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1765:13): [True: 11.4M, False: 259k]
  |  |  ------------------
  |  | 1766|  11.6M|        {                                                                      \
  |  | 1767|  11.4M|            op1;                                                               \
  |  | 1768|  11.4M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1722|  11.4M|    switch (x)                                                                 \
  |  |  |  | 1723|  11.4M|    {                                                                          \
  |  |  |  | 1724|  1.11M|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1724:9): [True: 1.11M, False: 10.3M]
  |  |  |  |  ------------------
  |  |  |  | 1725|  1.11M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1726|  4.22M|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1726:9): [True: 3.10M, False: 8.31M]
  |  |  |  |  ------------------
  |  |  |  | 1727|  4.22M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1728|  6.33M|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1728:9): [True: 2.11M, False: 9.31M]
  |  |  |  |  ------------------
  |  |  |  | 1729|  6.33M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1730|  6.70M|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1730:9): [True: 370k, False: 11.0M]
  |  |  |  |  ------------------
  |  |  |  | 1731|  6.70M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1732|  7.35M|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1732:9): [True: 650k, False: 10.7M]
  |  |  |  |  ------------------
  |  |  |  | 1733|  7.35M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1734|  10.4M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1734:9): [True: 3.10M, False: 8.32M]
  |  |  |  |  ------------------
  |  |  |  | 1735|  10.4M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1736|  11.4M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1736:9): [True: 965k, False: 10.4M]
  |  |  |  |  ------------------
  |  |  |  | 1737|  11.4M|            op;                                                                \
  |  |  |  | 1738|  11.4M|            break;                                                             \
  |  |  |  | 1739|  10.4M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1739:9): [True: 0, False: 11.4M]
  |  |  |  |  ------------------
  |  |  |  | 1740|      0|            break;                                                             \
  |  |  |  | 1741|  11.4M|    }
  |  |  ------------------
  |  | 1769|  11.4M|        }                                                                      \
  |  | 1770|  11.6M|    }
  ------------------
 2055|  11.6M|                pp += samplesperpixel);
 2056|  11.6M|        cp += toskew;
 2057|  11.6M|        pp += fromskewLocal;
 2058|  11.6M|    }
 2059|  96.9k|}
tif_getimage.c:BuildMapBitdepth16To8:
 3617|    139|{
 3618|    139|    static const char module[] = "BuildMapBitdepth16To8";
 3619|    139|    uint8_t *m;
 3620|    139|    uint32_t n;
 3621|    139|    assert(img->Bitdepth16To8 == NULL);
  ------------------
  |  Branch (3621:5): [True: 0, False: 139]
  |  Branch (3621:5): [True: 139, False: 0]
  ------------------
 3622|    139|    img->Bitdepth16To8 = (uint8_t *)_TIFFmallocExt(img->tif, 65536);
 3623|    139|    if (img->Bitdepth16To8 == NULL)
  ------------------
  |  Branch (3623:9): [True: 0, False: 139]
  ------------------
 3624|      0|    {
 3625|      0|        TIFFErrorExtR(img->tif, module, "Out of memory");
 3626|      0|        return 0;
 3627|      0|    }
 3628|    139|    m = img->Bitdepth16To8;
 3629|  9.10M|    for (n = 0; n < 65536; n++)
  ------------------
  |  Branch (3629:17): [True: 9.10M, False: 139]
  ------------------
 3630|  9.10M|        *m++ = (uint8_t)((n + 128) / 257);
 3631|    139|    return 1;
 3632|    139|}
tif_getimage.c:putRGBAAcontig16bittile:
 2139|    249|{
 2140|    249|    int samplesperpixel = img->samplesperpixel;
 2141|    249|    uint16_t *wp = (uint16_t *)pp;
 2142|    249|    (void)y;
 2143|    249|    const tmsize_t fromskewLocal =
 2144|    249|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 2145|  4.59k|    for (; h > 0; --h)
  ------------------
  |  Branch (2145:12): [True: 4.35k, False: 249]
  ------------------
 2146|  4.35k|    {
 2147|   349k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2147:21): [True: 345k, False: 4.35k]
  ------------------
 2148|   345k|        {
 2149|   345k|            *cp++ = PACK4(img->Bitdepth16To8[wp[0]], img->Bitdepth16To8[wp[1]],
  ------------------
  |  | 1818|   345k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1819|   345k|     ((uint32_t)(a) << 24))
  ------------------
 2150|   345k|                          img->Bitdepth16To8[wp[2]], img->Bitdepth16To8[wp[3]]);
 2151|   345k|            wp += samplesperpixel;
 2152|   345k|        }
 2153|  4.35k|        cp += toskew;
 2154|  4.35k|        wp += fromskewLocal;
 2155|  4.35k|    }
 2156|    249|}
tif_getimage.c:putRGBUAcontig16bittile:
 2163|      8|{
 2164|      8|    int samplesperpixel = img->samplesperpixel;
 2165|      8|    uint16_t *wp = (uint16_t *)pp;
 2166|      8|    (void)y;
 2167|      8|    const tmsize_t fromskewLocal =
 2168|      8|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 2169|     78|    for (; h > 0; --h)
  ------------------
  |  Branch (2169:12): [True: 70, False: 8]
  ------------------
 2170|     70|    {
 2171|     70|        uint32_t r, g, b, a;
 2172|     70|        uint8_t *m;
 2173|    236|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2173:21): [True: 166, False: 70]
  ------------------
 2174|    166|        {
 2175|    166|            a = img->Bitdepth16To8[wp[3]];
 2176|    166|            m = img->UaToAa + ((size_t)a << 8);
 2177|    166|            r = m[img->Bitdepth16To8[wp[0]]];
 2178|    166|            g = m[img->Bitdepth16To8[wp[1]]];
 2179|    166|            b = m[img->Bitdepth16To8[wp[2]]];
 2180|    166|            *cp++ = PACK4(r, g, b, a);
  ------------------
  |  | 1818|    166|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1819|    166|     ((uint32_t)(a) << 24))
  ------------------
 2181|    166|            wp += samplesperpixel;
 2182|    166|        }
 2183|     70|        cp += toskew;
 2184|     70|        wp += fromskewLocal;
 2185|     70|    }
 2186|      8|}
tif_getimage.c:putRGBcontig16bittile:
 2115|    414|{
 2116|    414|    int samplesperpixel = img->samplesperpixel;
 2117|    414|    uint16_t *wp = (uint16_t *)pp;
 2118|    414|    (void)y;
 2119|    414|    const tmsize_t fromskewLocal =
 2120|    414|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 2121|  19.9k|    for (; h > 0; --h)
  ------------------
  |  Branch (2121:12): [True: 19.4k, False: 414]
  ------------------
 2122|  19.4k|    {
 2123|  8.77M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2123:21): [True: 8.75M, False: 19.4k]
  ------------------
 2124|  8.75M|        {
 2125|  8.75M|            *cp++ = PACK(img->Bitdepth16To8[wp[0]], img->Bitdepth16To8[wp[1]],
  ------------------
  |  | 1816|  8.75M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1814|  8.75M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2126|  8.75M|                         img->Bitdepth16To8[wp[2]]);
 2127|  8.75M|            wp += samplesperpixel;
 2128|  8.75M|        }
 2129|  19.4k|        cp += toskew;
 2130|  19.4k|        wp += fromskewLocal;
 2131|  19.4k|    }
 2132|    414|}
tif_getimage.c:buildMap:
 3288|  8.56k|{
 3289|  8.56k|    switch (img->photometric)
 3290|  8.56k|    {
 3291|      0|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3291:9): [True: 0, False: 8.56k]
  ------------------
 3292|      0|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|      0|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3292:9): [True: 0, False: 8.56k]
  ------------------
 3293|     87|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     87|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3293:9): [True: 87, False: 8.47k]
  ------------------
 3294|     87|            if (img->bitspersample == 8)
  ------------------
  |  Branch (3294:17): [True: 84, False: 3]
  ------------------
 3295|     84|                break;
 3296|       |            /* fall through... */
 3297|  5.75k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  5.75k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3297:9): [True: 5.75k, False: 2.81k]
  ------------------
 3298|  8.26k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  8.26k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3298:9): [True: 2.50k, False: 6.05k]
  ------------------
 3299|  8.26k|            if (!setupMap(img))
  ------------------
  |  Branch (3299:17): [True: 0, False: 8.26k]
  ------------------
 3300|      0|                return 0;
 3301|  8.26k|            break;
 3302|  8.26k|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|    133|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (3302:9): [True: 133, False: 8.42k]
  ------------------
 3303|       |            /*
 3304|       |             * Convert 16-bit colormap to 8-bit (unless it looks
 3305|       |             * like an old-style 8-bit colormap).
 3306|       |             */
 3307|    133|            if (checkcmap(img) == 16)
  ------------------
  |  Branch (3307:17): [True: 112, False: 21]
  ------------------
 3308|    112|                cvtcmap(img);
 3309|     21|            else
 3310|     21|                TIFFWarningExtR(img->tif, TIFFFileName(img->tif),
 3311|     21|                                "Assuming 8-bit colormap");
 3312|       |            /*
 3313|       |             * Use mapping table and colormap to construct
 3314|       |             * unpacking tables for samples < 8 bits.
 3315|       |             */
 3316|    133|            if (img->bitspersample <= 8 && !makecmap(img))
  ------------------
  |  Branch (3316:17): [True: 133, False: 0]
  |  Branch (3316:44): [True: 0, False: 133]
  ------------------
 3317|      0|                return 0;
 3318|    133|            break;
 3319|    133|        default:
  ------------------
  |  Branch (3319:9): [True: 82, False: 8.47k]
  ------------------
 3320|     82|            break;
 3321|  8.56k|    }
 3322|  8.56k|    return 1;
 3323|  8.56k|}
tif_getimage.c:setupMap:
 3139|  8.26k|{
 3140|  8.26k|    int32_t x, range;
 3141|       |
 3142|  8.26k|    range = (int32_t)((1U << img->bitspersample) - 1U);
 3143|       |
 3144|       |    /* treat 16 bit the same as eight bit */
 3145|  8.26k|    if (img->bitspersample == 16)
  ------------------
  |  Branch (3145:9): [True: 228, False: 8.03k]
  ------------------
 3146|    228|        range = 255;
 3147|       |
 3148|  8.26k|    img->Map = (TIFFRGBValue *)_TIFFmallocExt(
 3149|  8.26k|        img->tif, (tmsize_t)((size_t)(range + 1) * sizeof(TIFFRGBValue)));
 3150|  8.26k|    if (img->Map == NULL)
  ------------------
  |  Branch (3150:9): [True: 0, False: 8.26k]
  ------------------
 3151|      0|    {
 3152|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 3153|      0|                      "No space for photometric conversion table");
 3154|      0|        return 0;
 3155|      0|    }
 3156|  8.26k|    if (img->photometric == PHOTOMETRIC_MINISWHITE)
  ------------------
  |  |  221|  8.26k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3156:9): [True: 2.50k, False: 5.75k]
  ------------------
 3157|  2.50k|    {
 3158|  15.2k|        for (x = 0; x <= range; x++)
  ------------------
  |  Branch (3158:21): [True: 12.7k, False: 2.50k]
  ------------------
 3159|  12.7k|            img->Map[x] = (TIFFRGBValue)(((range - x) * 255) / range);
 3160|  2.50k|    }
 3161|  5.75k|    else
 3162|  5.75k|    {
 3163|   874k|        for (x = 0; x <= range; x++)
  ------------------
  |  Branch (3163:21): [True: 868k, False: 5.75k]
  ------------------
 3164|   868k|            img->Map[x] = (TIFFRGBValue)((x * 255) / range);
 3165|  5.75k|    }
 3166|  8.26k|    if (img->bitspersample <= 16 &&
  ------------------
  |  Branch (3166:9): [True: 8.26k, False: 0]
  ------------------
 3167|  8.26k|        (img->photometric == PHOTOMETRIC_MINISBLACK ||
  ------------------
  |  |  222|  16.5k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3167:10): [True: 5.75k, False: 2.51k]
  ------------------
 3168|  2.51k|         img->photometric == PHOTOMETRIC_MINISWHITE))
  ------------------
  |  |  221|  2.51k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3168:10): [True: 2.50k, False: 3]
  ------------------
 3169|  8.25k|    {
 3170|       |        /*
 3171|       |         * Use photometric mapping table to construct
 3172|       |         * unpacking tables for samples <= 8 bits.
 3173|       |         */
 3174|  8.25k|        if (!makebwmap(img))
  ------------------
  |  Branch (3174:13): [True: 0, False: 8.25k]
  ------------------
 3175|      0|            return 0;
 3176|       |        /* no longer need Map, free it */
 3177|  8.25k|        _TIFFfreeExt(img->tif, img->Map);
 3178|  8.25k|        img->Map = NULL;
 3179|  8.25k|    }
 3180|  8.26k|    return 1;
 3181|  8.26k|}
tif_getimage.c:makebwmap:
 3071|  8.25k|{
 3072|  8.25k|    TIFFRGBValue *Map = img->Map;
 3073|  8.25k|    int bitspersample = img->bitspersample;
 3074|  8.25k|    int nsamples = 8 / bitspersample;
 3075|  8.25k|    int i;
 3076|  8.25k|    uint32_t *p;
 3077|       |
 3078|  8.25k|    if (nsamples == 0)
  ------------------
  |  Branch (3078:9): [True: 228, False: 8.03k]
  ------------------
 3079|    228|        nsamples = 1;
 3080|       |
 3081|  8.25k|    img->BWmap = (uint32_t **)_TIFFmallocExt(
 3082|  8.25k|        img->tif,
 3083|  8.25k|        (tmsize_t)((size_t)256 * sizeof(uint32_t *) +
 3084|  8.25k|                   ((size_t)256 * (size_t)nsamples * sizeof(uint32_t))));
 3085|  8.25k|    if (img->BWmap == NULL)
  ------------------
  |  Branch (3085:9): [True: 0, False: 8.25k]
  ------------------
 3086|      0|    {
 3087|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 3088|      0|                      "No space for B&W mapping table");
 3089|      0|        return 0;
 3090|      0|    }
 3091|  8.25k|    p = (uint32_t *)(img->BWmap + 256);
 3092|  2.12M|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (3092:17): [True: 2.11M, False: 8.25k]
  ------------------
 3093|  2.11M|    {
 3094|  2.11M|        TIFFRGBValue c;
 3095|  2.11M|        img->BWmap[i] = p;
 3096|  2.11M|        switch (bitspersample)
 3097|  2.11M|        {
 3098|      0|#define GREY(x)                                                                \
 3099|      0|    c = Map[x];                                                                \
 3100|      0|    *p++ = PACK(c, c, c);
 3101|  1.16M|            case 1:
  ------------------
  |  Branch (3101:13): [True: 1.16M, False: 953k]
  ------------------
 3102|  1.16M|                GREY(i >> 7);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3103|  1.16M|                GREY((i >> 6) & 1);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3104|  1.16M|                GREY((i >> 5) & 1);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3105|  1.16M|                GREY((i >> 4) & 1);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3106|  1.16M|                GREY((i >> 3) & 1);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3107|  1.16M|                GREY((i >> 2) & 1);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3108|  1.16M|                GREY((i >> 1) & 1);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3109|  1.16M|                GREY(i & 1);
  ------------------
  |  | 3099|  1.16M|    c = Map[x];                                                                \
  |  | 3100|  1.16M|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  1.16M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  1.16M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3110|  1.16M|                break;
 3111|  41.7k|            case 2:
  ------------------
  |  Branch (3111:13): [True: 41.7k, False: 2.07M]
  ------------------
 3112|  41.7k|                GREY(i >> 6);
  ------------------
  |  | 3099|  41.7k|    c = Map[x];                                                                \
  |  | 3100|  41.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  41.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  41.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3113|  41.7k|                GREY((i >> 4) & 3);
  ------------------
  |  | 3099|  41.7k|    c = Map[x];                                                                \
  |  | 3100|  41.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  41.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  41.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3114|  41.7k|                GREY((i >> 2) & 3);
  ------------------
  |  | 3099|  41.7k|    c = Map[x];                                                                \
  |  | 3100|  41.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  41.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  41.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3115|  41.7k|                GREY(i & 3);
  ------------------
  |  | 3099|  41.7k|    c = Map[x];                                                                \
  |  | 3100|  41.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  41.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  41.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3116|  41.7k|                break;
 3117|  42.4k|            case 4:
  ------------------
  |  Branch (3117:13): [True: 42.4k, False: 2.07M]
  ------------------
 3118|  42.4k|                GREY(i >> 4);
  ------------------
  |  | 3099|  42.4k|    c = Map[x];                                                                \
  |  | 3100|  42.4k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  42.4k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  42.4k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3119|  42.4k|                GREY(i & 0xf);
  ------------------
  |  | 3099|  42.4k|    c = Map[x];                                                                \
  |  | 3100|  42.4k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|  42.4k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  42.4k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3120|  42.4k|                break;
 3121|   811k|            case 8:
  ------------------
  |  Branch (3121:13): [True: 811k, False: 1.30M]
  ------------------
 3122|   869k|            case 16:
  ------------------
  |  Branch (3122:13): [True: 58.3k, False: 2.05M]
  ------------------
 3123|   869k|                GREY(i);
  ------------------
  |  | 3099|   869k|    c = Map[x];                                                                \
  |  | 3100|   869k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1816|   869k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   869k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3124|   869k|                break;
 3125|      0|            default:
  ------------------
  |  Branch (3125:13): [True: 0, False: 2.11M]
  ------------------
 3126|      0|                break;
 3127|  2.11M|        }
 3128|  2.11M|#undef GREY
 3129|  2.11M|    }
 3130|  8.25k|    return 1;
 3131|  8.25k|}
tif_getimage.c:checkcmap:
 3184|    133|{
 3185|    133|    uint16_t *r = img->redcmap;
 3186|    133|    uint16_t *g = img->greencmap;
 3187|    133|    uint16_t *b = img->bluecmap;
 3188|       |    /* The three copies were made with td_colormap_count entries each in
 3189|       |     * TIFFRGBAImageBegin(); that is how many there are to look at. */
 3190|    133|    uint32_t n = img->tif->tif_dir.td_colormap_count;
 3191|       |
 3192|  3.37k|    while (n-- > 0)
  ------------------
  |  Branch (3192:12): [True: 3.35k, False: 21]
  ------------------
 3193|  3.35k|        if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
  ------------------
  |  Branch (3193:13): [True: 80, False: 3.27k]
  |  Branch (3193:28): [True: 12, False: 3.26k]
  |  Branch (3193:43): [True: 20, False: 3.24k]
  ------------------
 3194|    112|            return 16;
 3195|     21|    return 8;
 3196|    133|}
tif_getimage.c:cvtcmap:
 3199|    112|{
 3200|    112|    uint16_t *r = img->redcmap;
 3201|    112|    uint16_t *g = img->greencmap;
 3202|    112|    uint16_t *b = img->bluecmap;
 3203|    112|    uint32_t i;
 3204|       |
 3205|  1.18k|    for (i = img->tif->tif_dir.td_colormap_count; i-- > 0;)
  ------------------
  |  Branch (3205:51): [True: 1.07k, False: 112]
  ------------------
 3206|  1.07k|    {
 3207|  1.07k|#define CVT(x) ((uint16_t)((x) >> 8))
 3208|  1.07k|        r[i] = CVT(r[i]);
  ------------------
  |  | 3207|  1.07k|#define CVT(x) ((uint16_t)((x) >> 8))
  ------------------
 3209|  1.07k|        g[i] = CVT(g[i]);
  ------------------
  |  | 3207|  1.07k|#define CVT(x) ((uint16_t)((x) >> 8))
  ------------------
 3210|  1.07k|        b[i] = CVT(b[i]);
  ------------------
  |  | 3207|  1.07k|#define CVT(x) ((uint16_t)((x) >> 8))
  ------------------
 3211|  1.07k|#undef CVT
 3212|  1.07k|    }
 3213|    112|}
tif_getimage.c:makecmap:
 3223|    133|{
 3224|    133|    int bitspersample = img->bitspersample;
 3225|    133|    int nsamples = 8 / bitspersample;
 3226|    133|    uint16_t *r = img->redcmap;
 3227|    133|    uint16_t *g = img->greencmap;
 3228|    133|    uint16_t *b = img->bluecmap;
 3229|    133|    uint32_t *p;
 3230|    133|    int i;
 3231|       |
 3232|    133|    img->PALmap = (uint32_t **)_TIFFmallocExt(
 3233|    133|        img->tif,
 3234|    133|        (tmsize_t)((size_t)256 * sizeof(uint32_t *) +
 3235|    133|                   ((size_t)256 * (size_t)nsamples * sizeof(uint32_t))));
 3236|    133|    if (img->PALmap == NULL)
  ------------------
  |  Branch (3236:9): [True: 0, False: 133]
  ------------------
 3237|      0|    {
 3238|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 3239|      0|                      "No space for Palette mapping table");
 3240|      0|        return 0;
 3241|      0|    }
 3242|    133|    p = (uint32_t *)(img->PALmap + 256);
 3243|  34.1k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (3243:17): [True: 34.0k, False: 133]
  ------------------
 3244|  34.0k|    {
 3245|  34.0k|        TIFFRGBValue c;
 3246|  34.0k|        img->PALmap[i] = p;
 3247|  34.0k|#define CMAP(x)                                                                \
 3248|  34.0k|    c = (TIFFRGBValue)x;                                                       \
 3249|  34.0k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
 3250|  34.0k|        switch (bitspersample)
 3251|  34.0k|        {
 3252|  13.8k|            case 1:
  ------------------
  |  Branch (3252:13): [True: 13.8k, False: 20.2k]
  ------------------
 3253|  13.8k|                CMAP(i >> 7);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3254|  13.8k|                CMAP((i >> 6) & 1);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3255|  13.8k|                CMAP((i >> 5) & 1);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3256|  13.8k|                CMAP((i >> 4) & 1);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3257|  13.8k|                CMAP((i >> 3) & 1);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3258|  13.8k|                CMAP((i >> 2) & 1);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3259|  13.8k|                CMAP((i >> 1) & 1);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3260|  13.8k|                CMAP(i & 1);
  ------------------
  |  | 3248|  13.8k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  13.8k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  13.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  13.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3261|  13.8k|                break;
 3262|  10.2k|            case 2:
  ------------------
  |  Branch (3262:13): [True: 10.2k, False: 23.8k]
  ------------------
 3263|  10.2k|                CMAP(i >> 6);
  ------------------
  |  | 3248|  10.2k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  10.2k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  10.2k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  10.2k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3264|  10.2k|                CMAP((i >> 4) & 3);
  ------------------
  |  | 3248|  10.2k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  10.2k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  10.2k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  10.2k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3265|  10.2k|                CMAP((i >> 2) & 3);
  ------------------
  |  | 3248|  10.2k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  10.2k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  10.2k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  10.2k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3266|  10.2k|                CMAP(i & 3);
  ------------------
  |  | 3248|  10.2k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  10.2k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  10.2k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  10.2k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3267|  10.2k|                break;
 3268|  6.40k|            case 4:
  ------------------
  |  Branch (3268:13): [True: 6.40k, False: 27.6k]
  ------------------
 3269|  6.40k|                CMAP(i >> 4);
  ------------------
  |  | 3248|  6.40k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  6.40k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  6.40k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  6.40k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3270|  6.40k|                CMAP(i & 0xf);
  ------------------
  |  | 3248|  6.40k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  6.40k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  6.40k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  6.40k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3271|  6.40k|                break;
 3272|  3.58k|            case 8:
  ------------------
  |  Branch (3272:13): [True: 3.58k, False: 30.4k]
  ------------------
 3273|  3.58k|                CMAP(i);
  ------------------
  |  | 3248|  3.58k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3249|  3.58k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1816|  3.58k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  3.58k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3274|  3.58k|                break;
 3275|      0|            default:
  ------------------
  |  Branch (3275:13): [True: 0, False: 34.0k]
  ------------------
 3276|      0|                break;
 3277|  34.0k|        }
 3278|  34.0k|#undef CMAP
 3279|  34.0k|    }
 3280|    133|    return 1;
 3281|    133|}
tif_getimage.c:putRGBcontig8bitCMYKtile:
 2194|    317|{
 2195|    317|    int samplesperpixel = img->samplesperpixel;
 2196|    317|    uint16_t r, g, b, k;
 2197|       |
 2198|    317|    (void)x;
 2199|    317|    (void)y;
 2200|    317|    const tmsize_t fromskewLocal =
 2201|    317|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 2202|  23.8k|    for (; h > 0; --h)
  ------------------
  |  Branch (2202:12): [True: 23.5k, False: 317]
  ------------------
 2203|  23.5k|    {
 2204|  23.5k|        UNROLL8(w, NOP, k = (uint16_t)(255 - pp[3]);
  ------------------
  |  | 1758|  23.5k|    {                                                                          \
  |  | 1759|  23.5k|        uint32_t _x;                                                           \
  |  | 1760|   616k|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1760:22): [True: 593k, False: 23.5k]
  |  |  ------------------
  |  | 1761|   593k|        {                                                                      \
  |  | 1762|   593k|            op1;                                                               \
  |  | 1763|   593k|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1713|   593k|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   593k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   593k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   593k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   593k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   593k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   593k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1714|   593k|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   593k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   593k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   593k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   593k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   593k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   593k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1764|   593k|        }                                                                      \
  |  | 1765|  23.5k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1765:13): [True: 23.1k, False: 400]
  |  |  ------------------
  |  | 1766|  23.5k|        {                                                                      \
  |  | 1767|  23.1k|            op1;                                                               \
  |  | 1768|  23.1k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1722|  23.1k|    switch (x)                                                                 \
  |  |  |  | 1723|  23.1k|    {                                                                          \
  |  |  |  | 1724|  3.57k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1724:9): [True: 3.57k, False: 19.5k]
  |  |  |  |  ------------------
  |  |  |  | 1725|  3.57k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1726|  5.43k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1726:9): [True: 1.85k, False: 21.2k]
  |  |  |  |  ------------------
  |  |  |  | 1727|  5.43k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1728|  6.06k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1728:9): [True: 627, False: 22.5k]
  |  |  |  |  ------------------
  |  |  |  | 1729|  6.06k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1730|  7.12k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1730:9): [True: 1.06k, False: 22.0k]
  |  |  |  |  ------------------
  |  |  |  | 1731|  7.12k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1732|  7.81k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1732:9): [True: 691, False: 22.4k]
  |  |  |  |  ------------------
  |  |  |  | 1733|  7.81k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1734|  22.0k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1734:9): [True: 14.2k, False: 8.88k]
  |  |  |  |  ------------------
  |  |  |  | 1735|  22.0k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1736|  23.1k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1736:9): [True: 1.07k, False: 22.0k]
  |  |  |  |  ------------------
  |  |  |  | 1737|  23.1k|            op;                                                                \
  |  |  |  | 1738|  23.1k|            break;                                                             \
  |  |  |  | 1739|  22.0k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1739:9): [True: 0, False: 23.1k]
  |  |  |  |  ------------------
  |  |  |  | 1740|      0|            break;                                                             \
  |  |  |  | 1741|  23.1k|    }
  |  |  ------------------
  |  | 1769|  23.1k|        }                                                                      \
  |  | 1770|  23.5k|    }
  ------------------
 2205|  23.5k|                r = (uint16_t)((k * (uint16_t)(255 - pp[0])) / 255);
 2206|  23.5k|                g = (uint16_t)((k * (uint16_t)(255 - pp[1])) / 255);
 2207|  23.5k|                b = (uint16_t)((k * (uint16_t)(255 - pp[2])) / 255);
 2208|  23.5k|                *cp++ = PACK(r, g, b); pp += samplesperpixel);
 2209|  23.5k|        cp += toskew;
 2210|  23.5k|        pp += fromskewLocal;
 2211|  23.5k|    }
 2212|    317|}
tif_getimage.c:put8bitcmaptile:
 1830|    323|{
 1831|    323|    uint32_t **PALmap = img->PALmap;
 1832|    323|    int samplesperpixel = img->samplesperpixel;
 1833|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1834|    323|    const tmsize_t fromskewLocal =
 1835|    323|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1836|       |
 1837|    323|    (void)y;
 1838|    998|    for (; h > 0; --h)
  ------------------
  |  Branch (1838:12): [True: 675, False: 323]
  ------------------
 1839|    675|    {
 1840|   128k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1840:21): [True: 127k, False: 675]
  ------------------
 1841|   127k|        {
 1842|   127k|            *cp++ = PALmap[*pp][0];
 1843|   127k|            pp += samplesperpixel;
 1844|   127k|        }
 1845|    675|        cp += toskew;
 1846|    675|        pp += fromskewLocal;
 1847|    675|    }
 1848|    323|}
tif_getimage.c:put4bitcmaptile:
 1854|  58.7k|{
 1855|  58.7k|    uint32_t **PALmap = img->PALmap;
 1856|       |
 1857|  58.7k|    (void)x;
 1858|  58.7k|    (void)y;
 1859|  58.7k|    fromskew /= 2;
 1860|  1.58M|    for (; h > 0; --h)
  ------------------
  |  Branch (1860:12): [True: 1.53M, False: 58.7k]
  ------------------
 1861|  1.53M|    {
 1862|  1.53M|        uint32_t *bw;
 1863|  1.53M|        UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1786|  1.53M|    {                                                                          \
  |  | 1787|  1.53M|        uint32_t _x;                                                           \
  |  | 1788|  17.5M|        for (_x = w; _x >= 2; _x -= 2)                                         \
  |  |  ------------------
  |  |  |  Branch (1788:22): [True: 16.0M, False: 1.53M]
  |  |  ------------------
  |  | 1789|  16.0M|        {                                                                      \
  |  | 1790|  16.0M|            op1;                                                               \
  |  | 1791|  16.0M|            REPEAT2(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1719|  16.0M|    op;                                                                        \
  |  |  |  | 1720|  16.0M|    op
  |  |  ------------------
  |  | 1792|  16.0M|        }                                                                      \
  |  | 1793|  1.53M|        if (_x)                                                                \
  |  |  ------------------
  |  |  |  Branch (1793:13): [True: 1.30M, False: 227k]
  |  |  ------------------
  |  | 1794|  1.53M|        {                                                                      \
  |  | 1795|  1.30M|            op1;                                                               \
  |  | 1796|  1.30M|            op2;                                                               \
  |  | 1797|  1.30M|        }                                                                      \
  |  | 1798|  1.53M|    }
  ------------------
 1864|  1.53M|        cp += toskew;
 1865|  1.53M|        pp += fromskew;
 1866|  1.53M|    }
 1867|  58.7k|}
tif_getimage.c:put2bitcmaptile:
 1873|  26.0k|{
 1874|  26.0k|    uint32_t **PALmap = img->PALmap;
 1875|       |
 1876|  26.0k|    (void)x;
 1877|  26.0k|    (void)y;
 1878|  26.0k|    fromskew /= 4;
 1879|  1.06M|    for (; h > 0; --h)
  ------------------
  |  Branch (1879:12): [True: 1.03M, False: 26.0k]
  ------------------
 1880|  1.03M|    {
 1881|  1.03M|        uint32_t *bw;
 1882|  1.03M|        UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1772|  1.03M|    {                                                                          \
  |  | 1773|  1.03M|        uint32_t _x;                                                           \
  |  | 1774|  4.56M|        for (_x = w; _x >= 4; _x -= 4)                                         \
  |  |  ------------------
  |  |  |  Branch (1774:22): [True: 3.52M, False: 1.03M]
  |  |  ------------------
  |  | 1775|  3.52M|        {                                                                      \
  |  | 1776|  3.52M|            op1;                                                               \
  |  | 1777|  3.52M|            REPEAT4(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1716|  3.52M|    REPEAT2(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1719|  3.52M|    op;                                                                        \
  |  |  |  |  |  | 1720|  3.52M|    op
  |  |  |  |  ------------------
  |  |  |  | 1717|  3.52M|    REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1719|  3.52M|    op;                                                                        \
  |  |  |  |  |  | 1720|  3.52M|    op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1778|  3.52M|        }                                                                      \
  |  | 1779|  1.03M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1779:13): [True: 420k, False: 617k]
  |  |  ------------------
  |  | 1780|  1.03M|        {                                                                      \
  |  | 1781|   420k|            op1;                                                               \
  |  | 1782|   420k|            CASE4(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1743|   420k|    switch (x)                                                                 \
  |  |  |  | 1744|   420k|    {                                                                          \
  |  |  |  | 1745|  18.2k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1745:9): [True: 18.2k, False: 402k]
  |  |  |  |  ------------------
  |  |  |  | 1746|  18.2k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1747|  39.2k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1747:9): [True: 21.0k, False: 399k]
  |  |  |  |  ------------------
  |  |  |  | 1748|  39.2k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1749|   420k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1749:9): [True: 381k, False: 39.2k]
  |  |  |  |  ------------------
  |  |  |  | 1750|   420k|            op;                                                                \
  |  |  |  | 1751|   420k|            break;                                                             \
  |  |  |  | 1752|  39.2k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1752:9): [True: 0, False: 420k]
  |  |  |  |  ------------------
  |  |  |  | 1753|      0|            break;                                                             \
  |  |  |  | 1754|   420k|    }
  |  |  ------------------
  |  | 1783|   420k|        }                                                                      \
  |  | 1784|  1.03M|    }
  ------------------
 1883|  1.03M|        cp += toskew;
 1884|  1.03M|        pp += fromskew;
 1885|  1.03M|    }
 1886|  26.0k|}
tif_getimage.c:put1bitcmaptile:
 1892|  16.6k|{
 1893|  16.6k|    uint32_t **PALmap = img->PALmap;
 1894|       |
 1895|  16.6k|    (void)x;
 1896|  16.6k|    (void)y;
 1897|  16.6k|    fromskew /= 8;
 1898|  72.0k|    for (; h > 0; --h)
  ------------------
  |  Branch (1898:12): [True: 55.4k, False: 16.6k]
  ------------------
 1899|  55.4k|    {
 1900|  55.4k|        uint32_t *bw;
 1901|  55.4k|        UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1758|  55.4k|    {                                                                          \
  |  | 1759|  55.4k|        uint32_t _x;                                                           \
  |  | 1760|   227k|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1760:22): [True: 172k, False: 55.4k]
  |  |  ------------------
  |  | 1761|   172k|        {                                                                      \
  |  | 1762|   172k|            op1;                                                               \
  |  | 1763|   172k|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1713|   172k|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   172k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   172k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   172k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   172k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   172k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   172k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1714|   172k|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   172k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   172k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   172k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   172k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   172k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   172k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1764|   172k|        }                                                                      \
  |  | 1765|  55.4k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1765:13): [True: 49.5k, False: 5.88k]
  |  |  ------------------
  |  | 1766|  55.4k|        {                                                                      \
  |  | 1767|  49.5k|            op1;                                                               \
  |  | 1768|  49.5k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1722|  49.5k|    switch (x)                                                                 \
  |  |  |  | 1723|  49.5k|    {                                                                          \
  |  |  |  | 1724|  1.62k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1724:9): [True: 1.62k, False: 47.9k]
  |  |  |  |  ------------------
  |  |  |  | 1725|  1.62k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1726|  3.73k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1726:9): [True: 2.11k, False: 47.4k]
  |  |  |  |  ------------------
  |  |  |  | 1727|  3.73k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1728|  8.77k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1728:9): [True: 5.04k, False: 44.5k]
  |  |  |  |  ------------------
  |  |  |  | 1729|  8.77k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1730|  12.9k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1730:9): [True: 4.18k, False: 45.3k]
  |  |  |  |  ------------------
  |  |  |  | 1731|  12.9k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1732|  14.9k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1732:9): [True: 1.94k, False: 47.6k]
  |  |  |  |  ------------------
  |  |  |  | 1733|  14.9k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1734|  46.8k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1734:9): [True: 31.9k, False: 17.5k]
  |  |  |  |  ------------------
  |  |  |  | 1735|  46.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1736|  49.5k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1736:9): [True: 2.68k, False: 46.8k]
  |  |  |  |  ------------------
  |  |  |  | 1737|  49.5k|            op;                                                                \
  |  |  |  | 1738|  49.5k|            break;                                                             \
  |  |  |  | 1739|  46.8k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1739:9): [True: 0, False: 49.5k]
  |  |  |  |  ------------------
  |  |  |  | 1740|      0|            break;                                                             \
  |  |  |  | 1741|  49.5k|    }
  |  |  ------------------
  |  | 1769|  49.5k|        }                                                                      \
  |  | 1770|  55.4k|    }
  ------------------
 1902|  55.4k|        cp += toskew;
 1903|  55.4k|        pp += fromskew;
 1904|  55.4k|    }
 1905|  16.6k|}
tif_getimage.c:put16bitbwtile:
 1959|  5.65k|{
 1960|  5.65k|    int samplesperpixel = img->samplesperpixel;
 1961|  5.65k|    uint32_t **BWmap = img->BWmap;
 1962|       |    /* Convert pixel skew to byte skew (16-bit samples) */
 1963|  5.65k|    const tmsize_t fromskewLocal =
 1964|  5.65k|        (tmsize_t)fromskew * (tmsize_t)(2 * samplesperpixel);
 1965|       |
 1966|  5.65k|    (void)y;
 1967|   429k|    for (; h > 0; --h)
  ------------------
  |  Branch (1967:12): [True: 423k, False: 5.65k]
  ------------------
 1968|   423k|    {
 1969|   423k|        uint16_t *wp = (uint16_t *)pp;
 1970|       |
 1971|  55.1M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1971:21): [True: 54.7M, False: 423k]
  ------------------
 1972|  54.7M|        {
 1973|       |            /* use high order byte of 16bit value */
 1974|       |
 1975|  54.7M|            *cp++ = BWmap[*wp >> 8][0];
 1976|  54.7M|            pp += 2 * samplesperpixel;
 1977|  54.7M|            wp += samplesperpixel;
 1978|  54.7M|        }
 1979|   423k|        cp += toskew;
 1980|   423k|        pp += fromskewLocal;
 1981|   423k|    }
 1982|  5.65k|}
tif_getimage.c:putagreytile:
 1935|  1.97k|{
 1936|  1.97k|    int samplesperpixel = img->samplesperpixel;
 1937|  1.97k|    uint32_t **BWmap = img->BWmap;
 1938|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1939|  1.97k|    const tmsize_t fromskewLocal =
 1940|  1.97k|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1941|       |
 1942|  1.97k|    (void)y;
 1943|   198k|    for (; h > 0; --h)
  ------------------
  |  Branch (1943:12): [True: 196k, False: 1.97k]
  ------------------
 1944|   196k|    {
 1945|  34.5M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1945:21): [True: 34.3M, False: 196k]
  ------------------
 1946|  34.3M|        {
 1947|  34.3M|            *cp++ = BWmap[*pp][0] & ((uint32_t)*(pp + 1) << 24 | ~A1);
  ------------------
  |  | 1814|  34.3M|#define A1 (((uint32_t)0xffL) << 24)
  ------------------
 1948|  34.3M|            pp += samplesperpixel;
 1949|  34.3M|        }
 1950|   196k|        cp += toskew;
 1951|   196k|        pp += fromskewLocal;
 1952|   196k|    }
 1953|  1.97k|}
tif_getimage.c:putgreytile:
 1911|   250k|{
 1912|   250k|    int samplesperpixel = img->samplesperpixel;
 1913|   250k|    uint32_t **BWmap = img->BWmap;
 1914|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1915|   250k|    const tmsize_t fromskewLocal =
 1916|   250k|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1917|       |
 1918|   250k|    (void)y;
 1919|  59.5M|    for (; h > 0; --h)
  ------------------
  |  Branch (1919:12): [True: 59.3M, False: 250k]
  ------------------
 1920|  59.3M|    {
 1921|  3.52G|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1921:21): [True: 3.46G, False: 59.3M]
  ------------------
 1922|  3.46G|        {
 1923|  3.46G|            *cp++ = BWmap[*pp][0];
 1924|  3.46G|            pp += samplesperpixel;
 1925|  3.46G|        }
 1926|  59.3M|        cp += toskew;
 1927|  59.3M|        pp += fromskewLocal;
 1928|  59.3M|    }
 1929|   250k|}
tif_getimage.c:put4bitbwtile:
 2026|  1.88k|{
 2027|  1.88k|    uint32_t **BWmap = img->BWmap;
 2028|       |
 2029|  1.88k|    (void)x;
 2030|  1.88k|    (void)y;
 2031|  1.88k|    fromskew /= 2;
 2032|   337k|    for (; h > 0; --h)
  ------------------
  |  Branch (2032:12): [True: 335k, False: 1.88k]
  ------------------
 2033|   335k|    {
 2034|   335k|        uint32_t *bw;
 2035|   335k|        UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1786|   335k|    {                                                                          \
  |  | 1787|   335k|        uint32_t _x;                                                           \
  |  | 1788|  21.9M|        for (_x = w; _x >= 2; _x -= 2)                                         \
  |  |  ------------------
  |  |  |  Branch (1788:22): [True: 21.6M, False: 335k]
  |  |  ------------------
  |  | 1789|  21.6M|        {                                                                      \
  |  | 1790|  21.6M|            op1;                                                               \
  |  | 1791|  21.6M|            REPEAT2(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1719|  21.6M|    op;                                                                        \
  |  |  |  | 1720|  21.6M|    op
  |  |  ------------------
  |  | 1792|  21.6M|        }                                                                      \
  |  | 1793|   335k|        if (_x)                                                                \
  |  |  ------------------
  |  |  |  Branch (1793:13): [True: 102k, False: 232k]
  |  |  ------------------
  |  | 1794|   335k|        {                                                                      \
  |  | 1795|   102k|            op1;                                                               \
  |  | 1796|   102k|            op2;                                                               \
  |  | 1797|   102k|        }                                                                      \
  |  | 1798|   335k|    }
  ------------------
 2036|   335k|        cp += toskew;
 2037|   335k|        pp += fromskew;
 2038|   335k|    }
 2039|  1.88k|}
tif_getimage.c:put2bitbwtile:
 2007|  5.74k|{
 2008|  5.74k|    uint32_t **BWmap = img->BWmap;
 2009|       |
 2010|  5.74k|    (void)x;
 2011|  5.74k|    (void)y;
 2012|  5.74k|    fromskew /= 4;
 2013|   825k|    for (; h > 0; --h)
  ------------------
  |  Branch (2013:12): [True: 819k, False: 5.74k]
  ------------------
 2014|   819k|    {
 2015|   819k|        uint32_t *bw;
 2016|   819k|        UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1772|   819k|    {                                                                          \
  |  | 1773|   819k|        uint32_t _x;                                                           \
  |  | 1774|  16.2M|        for (_x = w; _x >= 4; _x -= 4)                                         \
  |  |  ------------------
  |  |  |  Branch (1774:22): [True: 15.4M, False: 819k]
  |  |  ------------------
  |  | 1775|  15.4M|        {                                                                      \
  |  | 1776|  15.4M|            op1;                                                               \
  |  | 1777|  15.4M|            REPEAT4(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1716|  15.4M|    REPEAT2(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1719|  15.4M|    op;                                                                        \
  |  |  |  |  |  | 1720|  15.4M|    op
  |  |  |  |  ------------------
  |  |  |  | 1717|  15.4M|    REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1719|  15.4M|    op;                                                                        \
  |  |  |  |  |  | 1720|  15.4M|    op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1778|  15.4M|        }                                                                      \
  |  | 1779|   819k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1779:13): [True: 735k, False: 83.9k]
  |  |  ------------------
  |  | 1780|   819k|        {                                                                      \
  |  | 1781|   735k|            op1;                                                               \
  |  | 1782|   735k|            CASE4(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1743|   735k|    switch (x)                                                                 \
  |  |  |  | 1744|   735k|    {                                                                          \
  |  |  |  | 1745|  79.2k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1745:9): [True: 79.2k, False: 656k]
  |  |  |  |  ------------------
  |  |  |  | 1746|  79.2k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1747|   255k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1747:9): [True: 176k, False: 559k]
  |  |  |  |  ------------------
  |  |  |  | 1748|   255k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1749|   735k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1749:9): [True: 480k, False: 255k]
  |  |  |  |  ------------------
  |  |  |  | 1750|   735k|            op;                                                                \
  |  |  |  | 1751|   735k|            break;                                                             \
  |  |  |  | 1752|   255k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1752:9): [True: 0, False: 735k]
  |  |  |  |  ------------------
  |  |  |  | 1753|      0|            break;                                                             \
  |  |  |  | 1754|   735k|    }
  |  |  ------------------
  |  | 1783|   735k|        }                                                                      \
  |  | 1784|   819k|    }
  ------------------
 2017|   819k|        cp += toskew;
 2018|   819k|        pp += fromskew;
 2019|   819k|    }
 2020|  5.74k|}
tif_getimage.c:put1bitbwtile:
 1988|   293k|{
 1989|   293k|    uint32_t **BWmap = img->BWmap;
 1990|       |
 1991|   293k|    (void)x;
 1992|   293k|    (void)y;
 1993|   293k|    fromskew /= 8;
 1994|  16.0M|    for (; h > 0; --h)
  ------------------
  |  Branch (1994:12): [True: 15.7M, False: 293k]
  ------------------
 1995|  15.7M|    {
 1996|  15.7M|        uint32_t *bw;
 1997|  15.7M|        UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1758|  15.7M|    {                                                                          \
  |  | 1759|  15.7M|        uint32_t _x;                                                           \
  |  | 1760|   324M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1760:22): [True: 308M, False: 15.7M]
  |  |  ------------------
  |  | 1761|   308M|        {                                                                      \
  |  | 1762|   308M|            op1;                                                               \
  |  | 1763|   308M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1713|   308M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   308M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   308M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   308M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   308M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   308M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   308M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1714|   308M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|   308M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   308M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   308M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|   308M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|   308M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|   308M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1764|   308M|        }                                                                      \
  |  | 1765|  15.7M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1765:13): [True: 15.1M, False: 579k]
  |  |  ------------------
  |  | 1766|  15.7M|        {                                                                      \
  |  | 1767|  15.1M|            op1;                                                               \
  |  | 1768|  15.1M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1722|  15.1M|    switch (x)                                                                 \
  |  |  |  | 1723|  15.1M|    {                                                                          \
  |  |  |  | 1724|   480k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1724:9): [True: 480k, False: 14.6M]
  |  |  |  |  ------------------
  |  |  |  | 1725|   480k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1726|   988k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1726:9): [True: 508k, False: 14.6M]
  |  |  |  |  ------------------
  |  |  |  | 1727|   988k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1728|  1.49M|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1728:9): [True: 501k, False: 14.6M]
  |  |  |  |  ------------------
  |  |  |  | 1729|  1.49M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1730|  10.4M|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1730:9): [True: 8.97M, False: 6.19M]
  |  |  |  |  ------------------
  |  |  |  | 1731|  10.4M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1732|  12.1M|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1732:9): [True: 1.69M, False: 13.4M]
  |  |  |  |  ------------------
  |  |  |  | 1733|  12.1M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1734|  12.5M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1734:9): [True: 340k, False: 14.8M]
  |  |  |  |  ------------------
  |  |  |  | 1735|  12.5M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1736|  15.1M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1736:9): [True: 2.66M, False: 12.5M]
  |  |  |  |  ------------------
  |  |  |  | 1737|  15.1M|            op;                                                                \
  |  |  |  | 1738|  15.1M|            break;                                                             \
  |  |  |  | 1739|  12.5M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1739:9): [True: 0, False: 15.1M]
  |  |  |  |  ------------------
  |  |  |  | 1740|      0|            break;                                                             \
  |  |  |  | 1741|  15.1M|    }
  |  |  ------------------
  |  | 1769|  15.1M|        }                                                                      \
  |  | 1770|  15.7M|    }
  ------------------
 1998|  15.7M|        cp += toskew;
 1999|  15.7M|        pp += fromskew;
 2000|  15.7M|    }
 2001|   293k|}
tif_getimage.c:initYCbCrConversion:
 2968|  2.09k|{
 2969|  2.09k|    static const char module[] = "initYCbCrConversion";
 2970|       |
 2971|  2.09k|    float *luma, *refBlackWhite;
 2972|       |
 2973|  2.09k|    if (img->ycbcr == NULL)
  ------------------
  |  Branch (2973:9): [True: 2.09k, False: 0]
  ------------------
 2974|  2.09k|    {
 2975|  2.09k|        img->ycbcr = (TIFFYCbCrToRGB *)_TIFFmallocExt(
 2976|  2.09k|            img->tif, TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long)) +
  ------------------
  |  |  326|  2.09k|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  316|  2.09k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (316:6): [True: 2.09k, Folded]
  |  |  |  |  ------------------
  |  |  |  |  317|  2.09k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  318|  2.09k|         : 0U)
  |  |  ------------------
  ------------------
 2977|  2.09k|                          4 * 256 * sizeof(TIFFRGBValue) +
 2978|  2.09k|                          2 * 256 * sizeof(int) + 3 * 256 * sizeof(int32_t));
 2979|  2.09k|        if (img->ycbcr == NULL)
  ------------------
  |  Branch (2979:13): [True: 0, False: 2.09k]
  ------------------
 2980|      0|        {
 2981|      0|            TIFFErrorExtR(img->tif, module,
 2982|      0|                          "No space for YCbCr->RGB conversion state");
 2983|      0|            return 0;
 2984|      0|        }
 2985|  2.09k|    }
 2986|       |
 2987|  2.09k|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
  ------------------
  |  |  387|  2.09k|#define TIFFTAG_YCBCRCOEFFICIENTS 529      /* !RGB -> YCbCr transform */
  ------------------
 2988|  2.09k|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,
  ------------------
  |  |  392|  2.09k|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
 2989|  2.09k|                          &refBlackWhite);
 2990|       |
 2991|       |    /* Do some validation to avoid later issues. Detect NaN for now */
 2992|       |    /* and also if lumaGreen is zero since we divide by it later */
 2993|  2.09k|    if (isnan(luma[0]) || isnan(luma[1]) || TIFF_FLOAT_EQ(luma[1], 0.0f) ||
  ------------------
  |  |  357|  4.19k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (357:29): [True: 2, False: 2.09k]
  |  |  ------------------
  ------------------
  |  Branch (2993:9): [True: 1, False: 2.09k]
  |  Branch (2993:27): [True: 1, False: 2.09k]
  ------------------
 2994|  2.09k|        isnan(luma[2]))
  ------------------
  |  Branch (2994:9): [True: 1, False: 2.09k]
  ------------------
 2995|      5|    {
 2996|      5|        TIFFErrorExtR(img->tif, module,
 2997|      5|                      "Invalid values for YCbCrCoefficients tag");
 2998|      5|        return 0;
 2999|      5|    }
 3000|       |
 3001|  2.09k|    if (!isInRefBlackWhiteRange(refBlackWhite[0]) ||
  ------------------
  |  Branch (3001:9): [True: 1, False: 2.09k]
  ------------------
 3002|  2.09k|        !isInRefBlackWhiteRange(refBlackWhite[1]) ||
  ------------------
  |  Branch (3002:9): [True: 1, False: 2.08k]
  ------------------
 3003|  2.08k|        !isInRefBlackWhiteRange(refBlackWhite[2]) ||
  ------------------
  |  Branch (3003:9): [True: 1, False: 2.08k]
  ------------------
 3004|  2.08k|        !isInRefBlackWhiteRange(refBlackWhite[3]) ||
  ------------------
  |  Branch (3004:9): [True: 1, False: 2.08k]
  ------------------
 3005|  2.08k|        !isInRefBlackWhiteRange(refBlackWhite[4]) ||
  ------------------
  |  Branch (3005:9): [True: 1, False: 2.08k]
  ------------------
 3006|  2.08k|        !isInRefBlackWhiteRange(refBlackWhite[5]))
  ------------------
  |  Branch (3006:9): [True: 1, False: 2.08k]
  ------------------
 3007|      6|    {
 3008|      6|        TIFFErrorExtR(img->tif, module,
 3009|      6|                      "Invalid values for ReferenceBlackWhite tag");
 3010|      6|        return 0;
 3011|      6|    }
 3012|       |
 3013|  2.08k|    if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)
  ------------------
  |  Branch (3013:9): [True: 0, False: 2.08k]
  ------------------
 3014|      0|        return 0;
 3015|  2.08k|    return 1;
 3016|  2.08k|}
tif_getimage.c:isInRefBlackWhiteRange:
 2963|  12.5k|{
 2964|  12.5k|    return (f > (float)(-0x7FFFFFFF + 128) && f < (float)0x7FFFFFFF);
  ------------------
  |  Branch (2964:13): [True: 12.5k, False: 6]
  |  Branch (2964:47): [True: 12.5k, False: 0]
  ------------------
 2965|  12.5k|}
tif_getimage.c:putcontig8bitYCbCr44tile:
 2466|  12.8k|{
 2467|  12.8k|    uint32_t *cp1 = cp + w + toskew;
 2468|  12.8k|    uint32_t *cp2 = cp1 + w + toskew;
 2469|  12.8k|    uint32_t *cp3 = cp2 + w + toskew;
 2470|  12.8k|    const tmsize_t incr = 3 * (tmsize_t)w + 4 * (tmsize_t)toskew;
 2471|       |
 2472|  12.8k|    (void)y;
 2473|       |    /* adjust fromskew */
 2474|  12.8k|    const tmsize_t fromskewLocal =
 2475|  12.8k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 4 + 2);
 2476|  12.8k|    if ((h & 3) == 0 && (w & 3) == 0)
  ------------------
  |  Branch (2476:9): [True: 5.42k, False: 7.38k]
  |  Branch (2476:25): [True: 2.60k, False: 2.82k]
  ------------------
 2477|  2.60k|    {
 2478|  35.1k|        for (; h >= 4; h -= 4)
  ------------------
  |  Branch (2478:16): [True: 32.5k, False: 2.60k]
  ------------------
 2479|  32.5k|        {
 2480|  32.5k|            x = w >> 2;
 2481|  32.5k|            do
 2482|   789k|            {
 2483|   789k|                int32_t Cb = pp[16];
 2484|   789k|                int32_t Cr = pp[17];
 2485|       |
 2486|   789k|                YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2487|   789k|                YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2488|   789k|                YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2489|   789k|                YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2490|   789k|                YCbCrtoRGB(cp1[0], pp[4]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2491|   789k|                YCbCrtoRGB(cp1[1], pp[5]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2492|   789k|                YCbCrtoRGB(cp1[2], pp[6]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2493|   789k|                YCbCrtoRGB(cp1[3], pp[7]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2494|   789k|                YCbCrtoRGB(cp2[0], pp[8]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2495|   789k|                YCbCrtoRGB(cp2[1], pp[9]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2496|   789k|                YCbCrtoRGB(cp2[2], pp[10]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2497|   789k|                YCbCrtoRGB(cp2[3], pp[11]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2498|   789k|                YCbCrtoRGB(cp3[0], pp[12]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2499|   789k|                YCbCrtoRGB(cp3[1], pp[13]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2500|   789k|                YCbCrtoRGB(cp3[2], pp[14]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2501|   789k|                YCbCrtoRGB(cp3[3], pp[15]);
  ------------------
  |  | 2456|   789k|    {                                                                          \
  |  | 2457|   789k|        uint32_t r, g, b;                                                      \
  |  | 2458|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   789k|    }
  ------------------
 2502|       |
 2503|   789k|                cp += 4;
 2504|   789k|                cp1 += 4;
 2505|   789k|                cp2 += 4;
 2506|   789k|                cp3 += 4;
 2507|   789k|                pp += 18;
 2508|   789k|            } while (--x);
  ------------------
  |  Branch (2508:22): [True: 756k, False: 32.5k]
  ------------------
 2509|  32.5k|            cp += incr;
 2510|  32.5k|            cp1 += incr;
 2511|  32.5k|            cp2 += incr;
 2512|  32.5k|            cp3 += incr;
 2513|  32.5k|            pp += fromskewLocal;
 2514|  32.5k|        }
 2515|  2.60k|    }
 2516|  10.2k|    else
 2517|  10.2k|    {
 2518|   147k|        while (h > 0)
  ------------------
  |  Branch (2518:16): [True: 147k, False: 0]
  ------------------
 2519|   147k|        {
 2520|  5.03M|            for (x = w; x > 0;)
  ------------------
  |  Branch (2520:25): [True: 4.88M, False: 147k]
  ------------------
 2521|  4.88M|            {
 2522|  4.88M|                int32_t Cb = pp[16];
 2523|  4.88M|                int32_t Cr = pp[17];
 2524|  4.88M|                switch (x)
 2525|  4.88M|                {
 2526|  4.76M|                    default:
  ------------------
  |  Branch (2526:21): [True: 4.76M, False: 129k]
  ------------------
 2527|  4.76M|                        switch (h)
 2528|  4.76M|                        {
 2529|  4.68M|                            default:
  ------------------
  |  Branch (2529:29): [True: 4.68M, False: 76.0k]
  ------------------
 2530|  4.68M|                                YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.68M|    {                                                                          \
  |  | 2457|  4.68M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.68M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.68M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.68M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.68M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.68M|    }
  ------------------
 2531|  4.68M|                            case 3:
  ------------------
  |  Branch (2531:29): [True: 1.09k, False: 4.75M]
  ------------------
 2532|  4.68M|                                YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.68M|    {                                                                          \
  |  | 2457|  4.68M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.68M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.68M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.68M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.68M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.68M|    }
  ------------------
 2533|  4.71M|                            case 2:
  ------------------
  |  Branch (2533:29): [True: 28.3k, False: 4.73M]
  ------------------
 2534|  4.71M|                                YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.71M|    {                                                                          \
  |  | 2457|  4.71M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.71M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.71M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.71M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.71M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.71M|    }
  ------------------
 2535|  4.76M|                            case 1:
  ------------------
  |  Branch (2535:29): [True: 46.6k, False: 4.71M]
  ------------------
 2536|  4.76M|                                YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.76M|    {                                                                          \
  |  | 2457|  4.76M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.76M|    }
  ------------------
 2537|  4.76M|                        } /* FALLTHROUGH */
 2538|  4.80M|                    case 3:
  ------------------
  |  Branch (2538:21): [True: 40.8k, False: 4.84M]
  ------------------
 2539|  4.80M|                        switch (h)
 2540|  4.80M|                        {
 2541|  4.72M|                            default:
  ------------------
  |  Branch (2541:29): [True: 4.72M, False: 76.0k]
  ------------------
 2542|  4.72M|                                YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.72M|    {                                                                          \
  |  | 2457|  4.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.72M|    }
  ------------------
 2543|  4.72M|                            case 3:
  ------------------
  |  Branch (2543:29): [True: 1.09k, False: 4.79M]
  ------------------
 2544|  4.72M|                                YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.72M|    {                                                                          \
  |  | 2457|  4.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.72M|    }
  ------------------
 2545|  4.75M|                            case 2:
  ------------------
  |  Branch (2545:29): [True: 28.3k, False: 4.77M]
  ------------------
 2546|  4.75M|                                YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.75M|    {                                                                          \
  |  | 2457|  4.75M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.75M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.75M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.75M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.75M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.75M|    }
  ------------------
 2547|  4.80M|                            case 1:
  ------------------
  |  Branch (2547:29): [True: 46.6k, False: 4.75M]
  ------------------
 2548|  4.80M|                                YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.80M|    {                                                                          \
  |  | 2457|  4.80M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.80M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.80M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.80M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.80M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.80M|    }
  ------------------
 2549|  4.80M|                        } /* FALLTHROUGH */
 2550|  4.86M|                    case 2:
  ------------------
  |  Branch (2550:21): [True: 59.4k, False: 4.83M]
  ------------------
 2551|  4.86M|                        switch (h)
 2552|  4.86M|                        {
 2553|  4.78M|                            default:
  ------------------
  |  Branch (2553:29): [True: 4.78M, False: 80.0k]
  ------------------
 2554|  4.78M|                                YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.78M|    {                                                                          \
  |  | 2457|  4.78M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.78M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.78M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.78M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.78M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.78M|    }
  ------------------
 2555|  4.78M|                            case 3:
  ------------------
  |  Branch (2555:29): [True: 1.10k, False: 4.85M]
  ------------------
 2556|  4.78M|                                YCbCrtoRGB(cp2[1], pp[9]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.78M|    {                                                                          \
  |  | 2457|  4.78M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.78M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.78M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.78M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.78M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.78M|    }
  ------------------
 2557|  4.80M|                            case 2:
  ------------------
  |  Branch (2557:29): [True: 28.3k, False: 4.83M]
  ------------------
 2558|  4.80M|                                YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.80M|    {                                                                          \
  |  | 2457|  4.80M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.80M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.80M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.80M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.80M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.80M|    }
  ------------------
 2559|  4.86M|                            case 1:
  ------------------
  |  Branch (2559:29): [True: 50.6k, False: 4.80M]
  ------------------
 2560|  4.86M|                                YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.86M|    {                                                                          \
  |  | 2457|  4.86M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.86M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.86M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.86M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.86M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.86M|    }
  ------------------
 2561|  4.86M|                        } /* FALLTHROUGH */
 2562|  4.88M|                    case 1:
  ------------------
  |  Branch (2562:21): [True: 28.9k, False: 4.86M]
  ------------------
 2563|  4.88M|                        switch (h)
 2564|  4.88M|                        {
 2565|  4.80M|                            default:
  ------------------
  |  Branch (2565:29): [True: 4.80M, False: 81.2k]
  ------------------
 2566|  4.80M|                                YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.80M|    {                                                                          \
  |  | 2457|  4.80M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.80M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.80M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.80M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.80M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.80M|    }
  ------------------
 2567|  4.80M|                            case 3:
  ------------------
  |  Branch (2567:29): [True: 1.10k, False: 4.88M]
  ------------------
 2568|  4.80M|                                YCbCrtoRGB(cp2[0], pp[8]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.80M|    {                                                                          \
  |  | 2457|  4.80M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.80M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.80M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.80M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.80M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.80M|    }
  ------------------
 2569|  4.83M|                            case 2:
  ------------------
  |  Branch (2569:29): [True: 28.3k, False: 4.86M]
  ------------------
 2570|  4.83M|                                YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.83M|    {                                                                          \
  |  | 2457|  4.83M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.83M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.83M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.83M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.83M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.83M|    }
  ------------------
 2571|  4.88M|                            case 1:
  ------------------
  |  Branch (2571:29): [True: 51.7k, False: 4.83M]
  ------------------
 2572|  4.88M|                                YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  4.88M|    {                                                                          \
  |  | 2457|  4.88M|        uint32_t r, g, b;                                                      \
  |  | 2458|  4.88M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  4.88M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  4.88M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  4.88M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  4.88M|    }
  ------------------
 2573|  4.88M|                        } /* FALLTHROUGH */
 2574|  4.88M|                }
 2575|  4.88M|                if (x < 4)
  ------------------
  |  Branch (2575:21): [True: 129k, False: 4.76M]
  ------------------
 2576|   129k|                {
 2577|   129k|                    cp += x;
 2578|   129k|                    cp1 += x;
 2579|   129k|                    cp2 += x;
 2580|   129k|                    cp3 += x;
 2581|   129k|                    x = 0;
 2582|   129k|                }
 2583|  4.76M|                else
 2584|  4.76M|                {
 2585|  4.76M|                    cp += 4;
 2586|  4.76M|                    cp1 += 4;
 2587|  4.76M|                    cp2 += 4;
 2588|  4.76M|                    cp3 += 4;
 2589|  4.76M|                    x -= 4;
 2590|  4.76M|                }
 2591|  4.88M|                pp += 18;
 2592|  4.88M|            }
 2593|   147k|            if (h <= 4)
  ------------------
  |  Branch (2593:17): [True: 10.2k, False: 137k]
  ------------------
 2594|  10.2k|                break;
 2595|   137k|            h -= 4;
 2596|   137k|            cp += incr;
 2597|   137k|            cp1 += incr;
 2598|   137k|            cp2 += incr;
 2599|   137k|            cp3 += incr;
 2600|   137k|            pp += fromskewLocal;
 2601|   137k|        }
 2602|  10.2k|    }
 2603|  12.8k|}
tif_getimage.c:putcontig8bitYCbCr42tile:
 2609|   186k|{
 2610|   186k|    uint32_t *cp1 = cp + w + toskew;
 2611|   186k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2612|       |
 2613|   186k|    (void)y;
 2614|   186k|    const tmsize_t fromskewLocal =
 2615|   186k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 2 + 2);
 2616|   186k|    if ((w & 3) == 0 && (h & 1) == 0)
  ------------------
  |  Branch (2616:9): [True: 183k, False: 2.14k]
  |  Branch (2616:25): [True: 178k, False: 5.53k]
  ------------------
 2617|   178k|    {
 2618|  3.38M|        for (; h >= 2; h -= 2)
  ------------------
  |  Branch (2618:16): [True: 3.21M, False: 178k]
  ------------------
 2619|  3.21M|        {
 2620|  3.21M|            x = w >> 2;
 2621|  3.21M|            do
 2622|  5.72M|            {
 2623|  5.72M|                int32_t Cb = pp[8];
 2624|  5.72M|                int32_t Cr = pp[9];
 2625|       |
 2626|  5.72M|                YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2627|  5.72M|                YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2628|  5.72M|                YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2629|  5.72M|                YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2630|  5.72M|                YCbCrtoRGB(cp1[0], pp[4]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2631|  5.72M|                YCbCrtoRGB(cp1[1], pp[5]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2632|  5.72M|                YCbCrtoRGB(cp1[2], pp[6]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2633|  5.72M|                YCbCrtoRGB(cp1[3], pp[7]);
  ------------------
  |  | 2456|  5.72M|    {                                                                          \
  |  | 2457|  5.72M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.72M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.72M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.72M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.72M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.72M|    }
  ------------------
 2634|       |
 2635|  5.72M|                cp += 4;
 2636|  5.72M|                cp1 += 4;
 2637|  5.72M|                pp += 10;
 2638|  5.72M|            } while (--x);
  ------------------
  |  Branch (2638:22): [True: 2.51M, False: 3.21M]
  ------------------
 2639|  3.21M|            cp += incr;
 2640|  3.21M|            cp1 += incr;
 2641|  3.21M|            pp += fromskewLocal;
 2642|  3.21M|        }
 2643|   178k|    }
 2644|  7.67k|    else
 2645|  7.67k|    {
 2646|   447k|        while (h > 0)
  ------------------
  |  Branch (2646:16): [True: 447k, False: 0]
  ------------------
 2647|   447k|        {
 2648|  7.71M|            for (x = w; x > 0;)
  ------------------
  |  Branch (2648:25): [True: 7.26M, False: 447k]
  ------------------
 2649|  7.26M|            {
 2650|  7.26M|                int32_t Cb = pp[8];
 2651|  7.26M|                int32_t Cr = pp[9];
 2652|  7.26M|                switch (x)
 2653|  7.26M|                {
 2654|  7.07M|                    default:
  ------------------
  |  Branch (2654:21): [True: 7.07M, False: 193k]
  ------------------
 2655|  7.07M|                        switch (h)
 2656|  7.07M|                        {
 2657|  7.04M|                            default:
  ------------------
  |  Branch (2657:29): [True: 7.04M, False: 35.3k]
  ------------------
 2658|  7.04M|                                YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.04M|    {                                                                          \
  |  | 2457|  7.04M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.04M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.04M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.04M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.04M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.04M|    }
  ------------------
 2659|  7.07M|                            case 1:
  ------------------
  |  Branch (2659:29): [True: 35.3k, False: 7.04M]
  ------------------
 2660|  7.07M|                                YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.07M|    {                                                                          \
  |  | 2457|  7.07M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.07M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.07M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.07M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.07M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.07M|    }
  ------------------
 2661|  7.07M|                        } /* FALLTHROUGH */
 2662|  7.17M|                    case 3:
  ------------------
  |  Branch (2662:21): [True: 99.2k, False: 7.17M]
  ------------------
 2663|  7.17M|                        switch (h)
 2664|  7.17M|                        {
 2665|  7.13M|                            default:
  ------------------
  |  Branch (2665:29): [True: 7.13M, False: 36.0k]
  ------------------
 2666|  7.13M|                                YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.13M|    {                                                                          \
  |  | 2457|  7.13M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.13M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.13M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.13M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.13M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.13M|    }
  ------------------
 2667|  7.17M|                            case 1:
  ------------------
  |  Branch (2667:29): [True: 36.0k, False: 7.13M]
  ------------------
 2668|  7.17M|                                YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.17M|    {                                                                          \
  |  | 2457|  7.17M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.17M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.17M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.17M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.17M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.17M|    }
  ------------------
 2669|  7.17M|                        } /* FALLTHROUGH */
 2670|  7.22M|                    case 2:
  ------------------
  |  Branch (2670:21): [True: 48.4k, False: 7.22M]
  ------------------
 2671|  7.22M|                        switch (h)
 2672|  7.22M|                        {
 2673|  7.18M|                            default:
  ------------------
  |  Branch (2673:29): [True: 7.18M, False: 36.7k]
  ------------------
 2674|  7.18M|                                YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.18M|    {                                                                          \
  |  | 2457|  7.18M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.18M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.18M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.18M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.18M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.18M|    }
  ------------------
 2675|  7.22M|                            case 1:
  ------------------
  |  Branch (2675:29): [True: 36.7k, False: 7.18M]
  ------------------
 2676|  7.22M|                                YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.22M|    {                                                                          \
  |  | 2457|  7.22M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.22M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.22M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.22M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.22M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.22M|    }
  ------------------
 2677|  7.22M|                        } /* FALLTHROUGH */
 2678|  7.26M|                    case 1:
  ------------------
  |  Branch (2678:21): [True: 46.2k, False: 7.22M]
  ------------------
 2679|  7.26M|                        switch (h)
 2680|  7.26M|                        {
 2681|  7.23M|                            default:
  ------------------
  |  Branch (2681:29): [True: 7.23M, False: 37.3k]
  ------------------
 2682|  7.23M|                                YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.23M|    {                                                                          \
  |  | 2457|  7.23M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.23M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.23M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.23M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.23M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.23M|    }
  ------------------
 2683|  7.26M|                            case 1:
  ------------------
  |  Branch (2683:29): [True: 37.3k, False: 7.23M]
  ------------------
 2684|  7.26M|                                YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
  ------------------
  |  | 2456|  7.26M|    {                                                                          \
  |  | 2457|  7.26M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.26M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.26M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.26M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.26M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.26M|    }
  ------------------
 2685|  7.26M|                        } /* FALLTHROUGH */
 2686|  7.26M|                }
 2687|  7.26M|                if (x < 4)
  ------------------
  |  Branch (2687:21): [True: 193k, False: 7.07M]
  ------------------
 2688|   193k|                {
 2689|   193k|                    cp += x;
 2690|   193k|                    cp1 += x;
 2691|   193k|                    x = 0;
 2692|   193k|                }
 2693|  7.07M|                else
 2694|  7.07M|                {
 2695|  7.07M|                    cp += 4;
 2696|  7.07M|                    cp1 += 4;
 2697|  7.07M|                    x -= 4;
 2698|  7.07M|                }
 2699|  7.26M|                pp += 10;
 2700|  7.26M|            }
 2701|   447k|            if (h <= 2)
  ------------------
  |  Branch (2701:17): [True: 7.67k, False: 439k]
  ------------------
 2702|  7.67k|                break;
 2703|   439k|            h -= 2;
 2704|   439k|            cp += incr;
 2705|   439k|            cp1 += incr;
 2706|   439k|            pp += fromskewLocal;
 2707|   439k|        }
 2708|  7.67k|    }
 2709|   186k|}
tif_getimage.c:putcontig8bitYCbCr41tile:
 2715|   109k|{
 2716|   109k|    (void)y;
 2717|   109k|    const tmsize_t fromskewLocal =
 2718|   109k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 1 + 2);
 2719|   109k|    do
 2720|  5.35M|    {
 2721|  5.35M|        x = w >> 2;
 2722|  10.7M|        while (x > 0)
  ------------------
  |  Branch (2722:16): [True: 5.41M, False: 5.35M]
  ------------------
 2723|  5.41M|        {
 2724|  5.41M|            int32_t Cb = pp[4];
 2725|  5.41M|            int32_t Cr = pp[5];
 2726|       |
 2727|  5.41M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  5.41M|    {                                                                          \
  |  | 2457|  5.41M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.41M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.41M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.41M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.41M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.41M|    }
  ------------------
 2728|  5.41M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2456|  5.41M|    {                                                                          \
  |  | 2457|  5.41M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.41M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.41M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.41M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.41M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.41M|    }
  ------------------
 2729|  5.41M|            YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2456|  5.41M|    {                                                                          \
  |  | 2457|  5.41M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.41M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.41M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.41M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.41M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.41M|    }
  ------------------
 2730|  5.41M|            YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2456|  5.41M|    {                                                                          \
  |  | 2457|  5.41M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.41M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.41M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.41M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.41M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.41M|    }
  ------------------
 2731|       |
 2732|  5.41M|            cp += 4;
 2733|  5.41M|            pp += 6;
 2734|  5.41M|            x--;
 2735|  5.41M|        }
 2736|       |
 2737|  5.35M|        if ((w & 3) != 0)
  ------------------
  |  Branch (2737:13): [True: 5.24M, False: 107k]
  ------------------
 2738|  5.24M|        {
 2739|  5.24M|            int32_t Cb = pp[4];
 2740|  5.24M|            int32_t Cr = pp[5];
 2741|       |
 2742|  5.24M|            switch ((w & 3))
 2743|  5.24M|            {
 2744|  17.8k|                case 3:
  ------------------
  |  Branch (2744:17): [True: 17.8k, False: 5.22M]
  ------------------
 2745|  17.8k|                    YCbCrtoRGB(cp[2], pp[2]); /*-fallthrough*/
  ------------------
  |  | 2456|  17.8k|    {                                                                          \
  |  | 2457|  17.8k|        uint32_t r, g, b;                                                      \
  |  | 2458|  17.8k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  17.8k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  17.8k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  17.8k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  17.8k|    }
  ------------------
 2746|  5.12M|                case 2:
  ------------------
  |  Branch (2746:17): [True: 5.10M, False: 138k]
  ------------------
 2747|  5.12M|                    YCbCrtoRGB(cp[1], pp[1]); /*-fallthrough*/
  ------------------
  |  | 2456|  5.12M|    {                                                                          \
  |  | 2457|  5.12M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.12M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.12M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.12M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.12M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.12M|    }
  ------------------
 2748|  5.24M|                case 1:
  ------------------
  |  Branch (2748:17): [True: 120k, False: 5.12M]
  ------------------
 2749|  5.24M|                    YCbCrtoRGB(cp[0], pp[0]); /*-fallthrough*/
  ------------------
  |  | 2456|  5.24M|    {                                                                          \
  |  | 2457|  5.24M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.24M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.24M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.24M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.24M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.24M|    }
  ------------------
 2750|  5.24M|                case 0:
  ------------------
  |  Branch (2750:17): [True: 0, False: 5.24M]
  ------------------
 2751|  5.24M|                    break;
 2752|      0|                default:
  ------------------
  |  Branch (2752:17): [True: 0, False: 5.24M]
  ------------------
 2753|      0|                    break;
 2754|  5.24M|            }
 2755|       |
 2756|  5.24M|            cp += (w & 3);
 2757|  5.24M|            pp += 6;
 2758|  5.24M|        }
 2759|       |
 2760|  5.35M|        cp += toskew;
 2761|  5.35M|        pp += fromskewLocal;
 2762|  5.35M|    } while (--h);
  ------------------
  |  Branch (2762:14): [True: 5.24M, False: 109k]
  ------------------
 2763|   109k|}
tif_getimage.c:putcontig8bitYCbCr22tile:
 2769|   103k|{
 2770|   103k|    uint32_t *cp2;
 2771|   103k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2772|   103k|    (void)y;
 2773|   103k|    const tmsize_t fromskewLocal =
 2774|   103k|        (tmsize_t)(fromskew / 2) * (tmsize_t)(2 * 2 + 2);
 2775|   103k|    cp2 = cp + w + toskew;
 2776|   285k|    while (h >= 2)
  ------------------
  |  Branch (2776:12): [True: 182k, False: 103k]
  ------------------
 2777|   182k|    {
 2778|   182k|        x = w;
 2779|  9.95M|        while (x >= 2)
  ------------------
  |  Branch (2779:16): [True: 9.76M, False: 182k]
  ------------------
 2780|  9.76M|        {
 2781|  9.76M|            uint32_t Cb = pp[4];
 2782|  9.76M|            uint32_t Cr = pp[5];
 2783|  9.76M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  9.76M|    {                                                                          \
  |  | 2457|  9.76M|        uint32_t r, g, b;                                                      \
  |  | 2458|  9.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  9.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  9.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  9.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  9.76M|    }
  ------------------
 2784|  9.76M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2456|  9.76M|    {                                                                          \
  |  | 2457|  9.76M|        uint32_t r, g, b;                                                      \
  |  | 2458|  9.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  9.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  9.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  9.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  9.76M|    }
  ------------------
 2785|  9.76M|            YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 2456|  9.76M|    {                                                                          \
  |  | 2457|  9.76M|        uint32_t r, g, b;                                                      \
  |  | 2458|  9.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  9.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  9.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  9.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  9.76M|    }
  ------------------
 2786|  9.76M|            YCbCrtoRGB(cp2[1], pp[3]);
  ------------------
  |  | 2456|  9.76M|    {                                                                          \
  |  | 2457|  9.76M|        uint32_t r, g, b;                                                      \
  |  | 2458|  9.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  9.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  9.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  9.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  9.76M|    }
  ------------------
 2787|  9.76M|            cp += 2;
 2788|  9.76M|            cp2 += 2;
 2789|  9.76M|            pp += 6;
 2790|  9.76M|            x -= 2;
 2791|  9.76M|        }
 2792|   182k|        if (x == 1)
  ------------------
  |  Branch (2792:13): [True: 122k, False: 59.9k]
  ------------------
 2793|   122k|        {
 2794|   122k|            uint32_t Cb = pp[4];
 2795|   122k|            uint32_t Cr = pp[5];
 2796|   122k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|   122k|    {                                                                          \
  |  | 2457|   122k|        uint32_t r, g, b;                                                      \
  |  | 2458|   122k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   122k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   122k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   122k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   122k|    }
  ------------------
 2797|   122k|            YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 2456|   122k|    {                                                                          \
  |  | 2457|   122k|        uint32_t r, g, b;                                                      \
  |  | 2458|   122k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   122k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   122k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   122k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   122k|    }
  ------------------
 2798|   122k|            cp++;
 2799|   122k|            cp2++;
 2800|   122k|            pp += 6;
 2801|   122k|        }
 2802|   182k|        cp += incr;
 2803|   182k|        cp2 += incr;
 2804|   182k|        pp += fromskewLocal;
 2805|   182k|        h -= 2;
 2806|   182k|    }
 2807|   103k|    if (h == 1)
  ------------------
  |  Branch (2807:9): [True: 101k, False: 1.97k]
  ------------------
 2808|   101k|    {
 2809|   101k|        x = w;
 2810|  7.71M|        while (x >= 2)
  ------------------
  |  Branch (2810:16): [True: 7.61M, False: 101k]
  ------------------
 2811|  7.61M|        {
 2812|  7.61M|            uint32_t Cb = pp[4];
 2813|  7.61M|            uint32_t Cr = pp[5];
 2814|  7.61M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  7.61M|    {                                                                          \
  |  | 2457|  7.61M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.61M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.61M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.61M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.61M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.61M|    }
  ------------------
 2815|  7.61M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2456|  7.61M|    {                                                                          \
  |  | 2457|  7.61M|        uint32_t r, g, b;                                                      \
  |  | 2458|  7.61M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  7.61M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  7.61M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  7.61M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  7.61M|    }
  ------------------
 2816|  7.61M|            cp += 2;
 2817|  7.61M|            cp2 += 2;
 2818|  7.61M|            pp += 6;
 2819|  7.61M|            x -= 2;
 2820|  7.61M|        }
 2821|   101k|        if (x == 1)
  ------------------
  |  Branch (2821:13): [True: 29.1k, False: 72.0k]
  ------------------
 2822|  29.1k|        {
 2823|  29.1k|            uint32_t Cb = pp[4];
 2824|  29.1k|            uint32_t Cr = pp[5];
 2825|  29.1k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  29.1k|    {                                                                          \
  |  | 2457|  29.1k|        uint32_t r, g, b;                                                      \
  |  | 2458|  29.1k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  29.1k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  29.1k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  29.1k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  29.1k|    }
  ------------------
 2826|  29.1k|        }
 2827|   101k|    }
 2828|   103k|}
tif_getimage.c:putcontig8bitYCbCr21tile:
 2834|  19.4k|{
 2835|  19.4k|    (void)y;
 2836|  19.4k|    const tmsize_t fromskewLocal =
 2837|  19.4k|        (tmsize_t)(fromskew / 2) * (tmsize_t)(2 * 1 + 2);
 2838|  19.4k|    do
 2839|   734k|    {
 2840|   734k|        x = w >> 1;
 2841|  6.69M|        while (x > 0)
  ------------------
  |  Branch (2841:16): [True: 5.95M, False: 734k]
  ------------------
 2842|  5.95M|        {
 2843|  5.95M|            int32_t Cb = pp[2];
 2844|  5.95M|            int32_t Cr = pp[3];
 2845|       |
 2846|  5.95M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  5.95M|    {                                                                          \
  |  | 2457|  5.95M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.95M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.95M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.95M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.95M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.95M|    }
  ------------------
 2847|  5.95M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2456|  5.95M|    {                                                                          \
  |  | 2457|  5.95M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.95M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.95M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.95M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.95M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.95M|    }
  ------------------
 2848|       |
 2849|  5.95M|            cp += 2;
 2850|  5.95M|            pp += 4;
 2851|  5.95M|            x--;
 2852|  5.95M|        }
 2853|       |
 2854|   734k|        if ((w & 1) != 0)
  ------------------
  |  Branch (2854:13): [True: 79.2k, False: 655k]
  ------------------
 2855|  79.2k|        {
 2856|  79.2k|            int32_t Cb = pp[2];
 2857|  79.2k|            int32_t Cr = pp[3];
 2858|       |
 2859|  79.2k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  79.2k|    {                                                                          \
  |  | 2457|  79.2k|        uint32_t r, g, b;                                                      \
  |  | 2458|  79.2k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  79.2k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  79.2k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  79.2k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  79.2k|    }
  ------------------
 2860|       |
 2861|  79.2k|            cp += 1;
 2862|  79.2k|            pp += 4;
 2863|  79.2k|        }
 2864|       |
 2865|   734k|        cp += toskew;
 2866|   734k|        pp += fromskewLocal;
 2867|   734k|    } while (--h);
  ------------------
  |  Branch (2867:14): [True: 715k, False: 19.4k]
  ------------------
 2868|  19.4k|}
tif_getimage.c:putcontig8bitYCbCr12tile:
 2874|  8.88k|{
 2875|  8.88k|    uint32_t *cp2;
 2876|  8.88k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2877|  8.88k|    (void)y;
 2878|  8.88k|    const tmsize_t fromskewLocal =
 2879|  8.88k|        (tmsize_t)(fromskew / 1) * (tmsize_t)(1 * 2 + 2);
 2880|  8.88k|    cp2 = cp + w + toskew;
 2881|  1.03M|    while (h >= 2)
  ------------------
  |  Branch (2881:12): [True: 1.02M, False: 8.88k]
  ------------------
 2882|  1.02M|    {
 2883|  1.02M|        x = w;
 2884|  1.02M|        do
 2885|  14.0M|        {
 2886|  14.0M|            uint32_t Cb = pp[2];
 2887|  14.0M|            uint32_t Cr = pp[3];
 2888|  14.0M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|  14.0M|    {                                                                          \
  |  | 2457|  14.0M|        uint32_t r, g, b;                                                      \
  |  | 2458|  14.0M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  14.0M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  14.0M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  14.0M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  14.0M|    }
  ------------------
 2889|  14.0M|            YCbCrtoRGB(cp2[0], pp[1]);
  ------------------
  |  | 2456|  14.0M|    {                                                                          \
  |  | 2457|  14.0M|        uint32_t r, g, b;                                                      \
  |  | 2458|  14.0M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  14.0M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  14.0M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  14.0M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  14.0M|    }
  ------------------
 2890|  14.0M|            cp++;
 2891|  14.0M|            cp2++;
 2892|  14.0M|            pp += 4;
 2893|  14.0M|        } while (--x);
  ------------------
  |  Branch (2893:18): [True: 12.9M, False: 1.02M]
  ------------------
 2894|  1.02M|        cp += incr;
 2895|  1.02M|        cp2 += incr;
 2896|  1.02M|        pp += fromskewLocal;
 2897|  1.02M|        h -= 2;
 2898|  1.02M|    }
 2899|  8.88k|    if (h == 1)
  ------------------
  |  Branch (2899:9): [True: 6.25k, False: 2.63k]
  ------------------
 2900|  6.25k|    {
 2901|  6.25k|        x = w;
 2902|  6.25k|        do
 2903|   180k|        {
 2904|   180k|            uint32_t Cb = pp[2];
 2905|   180k|            uint32_t Cr = pp[3];
 2906|   180k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2456|   180k|    {                                                                          \
  |  | 2457|   180k|        uint32_t r, g, b;                                                      \
  |  | 2458|   180k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|   180k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|   180k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|   180k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|   180k|    }
  ------------------
 2907|   180k|            cp++;
 2908|   180k|            pp += 4;
 2909|   180k|        } while (--x);
  ------------------
  |  Branch (2909:18): [True: 174k, False: 6.25k]
  ------------------
 2910|  6.25k|    }
 2911|  8.88k|}
tif_getimage.c:putcontig8bitYCbCr11tile:
 2917|  58.3k|{
 2918|  58.3k|    (void)y;
 2919|  58.3k|    const tmsize_t fromskewLocal =
 2920|  58.3k|        (tmsize_t)(fromskew / 1) * (tmsize_t)(1 * 1 + 2);
 2921|  58.3k|    do
 2922|  1.86M|    {
 2923|  1.86M|        x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */
 2924|  1.86M|        do
 2925|  5.97M|        {
 2926|  5.97M|            int32_t Cb = pp[1];
 2927|  5.97M|            int32_t Cr = pp[2];
 2928|       |
 2929|  5.97M|            YCbCrtoRGB(*cp++, pp[0]);
  ------------------
  |  | 2456|  5.97M|    {                                                                          \
  |  | 2457|  5.97M|        uint32_t r, g, b;                                                      \
  |  | 2458|  5.97M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2459|  5.97M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1816|  5.97M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1814|  5.97M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2460|  5.97M|    }
  ------------------
 2930|       |
 2931|  5.97M|            pp += 3;
 2932|  5.97M|        } while (--x);
  ------------------
  |  Branch (2932:18): [True: 4.11M, False: 1.86M]
  ------------------
 2933|  1.86M|        cp += toskew;
 2934|  1.86M|        pp += fromskewLocal;
 2935|  1.86M|    } while (--h);
  ------------------
  |  Branch (2935:14): [True: 1.80M, False: 58.3k]
  ------------------
 2936|  58.3k|}
tif_getimage.c:initCIELabConversion:
 3019|     82|{
 3020|     82|    static const char module[] = "initCIELabConversion";
 3021|       |
 3022|     82|    float *whitePoint;
 3023|     82|    float refWhite[3];
 3024|       |
 3025|     82|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
  ------------------
  |  |  307|     82|#define TIFFTAG_WHITEPOINT 318             /* image white point */
  ------------------
 3026|     82|    if (TIFF_FLOAT_EQ(whitePoint[1], 0.0f))
  ------------------
  |  |  357|     82|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (357:29): [True: 1, False: 81]
  |  |  ------------------
  ------------------
 3027|      1|    {
 3028|      1|        TIFFErrorExtR(img->tif, module, "Invalid value for WhitePoint tag.");
 3029|      1|        return NULL;
 3030|      1|    }
 3031|       |
 3032|     81|    if (!img->cielab)
  ------------------
  |  Branch (3032:9): [True: 81, False: 0]
  ------------------
 3033|     81|    {
 3034|     81|        img->cielab = (TIFFCIELabToRGB *)_TIFFmallocExt(
 3035|     81|            img->tif, sizeof(TIFFCIELabToRGB));
 3036|     81|        if (!img->cielab)
  ------------------
  |  Branch (3036:13): [True: 0, False: 81]
  ------------------
 3037|      0|        {
 3038|      0|            TIFFErrorExtR(img->tif, module,
 3039|      0|                          "No space for CIE L*a*b*->RGB conversion state.");
 3040|      0|            return NULL;
 3041|      0|        }
 3042|     81|    }
 3043|       |
 3044|     81|    refWhite[1] = 100.0f;
 3045|     81|    refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
 3046|     81|    refWhite[2] =
 3047|     81|        (1.0f - whitePoint[0] - whitePoint[1]) / whitePoint[1] * refWhite[1];
 3048|     81|    if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0)
  ------------------
  |  Branch (3048:9): [True: 0, False: 81]
  ------------------
 3049|      0|    {
 3050|      0|        TIFFErrorExtR(img->tif, module,
 3051|      0|                      "Failed to initialize CIE L*a*b*->RGB conversion state.");
 3052|      0|        _TIFFfreeExt(img->tif, img->cielab);
 3053|      0|        return NULL;
 3054|      0|    }
 3055|       |
 3056|     81|    if (img->bitspersample == 8)
  ------------------
  |  Branch (3056:9): [True: 53, False: 28]
  ------------------
 3057|     53|        return putcontig8bitCIELab8;
 3058|     28|    else if (img->bitspersample == 16)
  ------------------
  |  Branch (3058:14): [True: 28, False: 0]
  ------------------
 3059|     28|        return putcontig8bitCIELab16;
 3060|      0|    return NULL;
 3061|     81|}
tif_getimage.c:putcontig8bitCIELab8:
 2406|    642|{
 2407|    642|    float X, Y, Z;
 2408|    642|    uint32_t r, g, b;
 2409|    642|    (void)y;
 2410|    642|    const tmsize_t fromskewLocal = (tmsize_t)fromskew * (tmsize_t)3;
 2411|   151k|    for (; h > 0; --h)
  ------------------
  |  Branch (2411:12): [True: 151k, False: 642]
  ------------------
 2412|   151k|    {
 2413|  7.81M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2413:21): [True: 7.66M, False: 151k]
  ------------------
 2414|  7.66M|        {
 2415|  7.66M|            TIFFCIELabToXYZ(img->cielab, (unsigned char)pp[0],
 2416|  7.66M|                            (signed char)pp[1], (signed char)pp[2], &X, &Y, &Z);
 2417|  7.66M|            TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
 2418|  7.66M|            *cp++ = PACK(r, g, b);
  ------------------
  |  | 1816|  7.66M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1814|  7.66M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2419|  7.66M|            pp += 3;
 2420|  7.66M|        }
 2421|   151k|        cp += toskew;
 2422|   151k|        pp += fromskewLocal;
 2423|   151k|    }
 2424|    642|}
tif_getimage.c:putcontig8bitCIELab16:
 2430|    359|{
 2431|    359|    float X, Y, Z;
 2432|    359|    uint32_t r, g, b;
 2433|    359|    uint16_t *wp = (uint16_t *)pp;
 2434|    359|    (void)y;
 2435|    359|    const tmsize_t fromskewLocal = (tmsize_t)fromskew * (tmsize_t)3;
 2436|  50.3k|    for (; h > 0; --h)
  ------------------
  |  Branch (2436:12): [True: 49.9k, False: 359]
  ------------------
 2437|  49.9k|    {
 2438|  7.62M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2438:21): [True: 7.57M, False: 49.9k]
  ------------------
 2439|  7.57M|        {
 2440|  7.57M|            TIFFCIELab16ToXYZ(img->cielab, (uint16_t)wp[0], (int16_t)wp[1],
 2441|  7.57M|                              (int16_t)wp[2], &X, &Y, &Z);
 2442|  7.57M|            TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
 2443|  7.57M|            *cp++ = PACK(r, g, b);
  ------------------
  |  | 1816|  7.57M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1814|  7.57M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2444|  7.57M|            wp += 3;
 2445|  7.57M|        }
 2446|  49.9k|        cp += toskew;
 2447|  49.9k|        wp += fromskewLocal;
 2448|  49.9k|    }
 2449|    359|}
tif_getimage.c:PickSeparateCase:
 3517|  1.24k|{
 3518|  1.24k|    img->get = TIFFIsTiled(img->tif) ? gtTileSeparate : gtStripSeparate;
  ------------------
  |  Branch (3518:16): [True: 1.04k, False: 199]
  ------------------
 3519|  1.24k|    img->put.separate = NULL;
 3520|  1.24k|    switch (img->photometric)
 3521|  1.24k|    {
 3522|      7|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      7|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3522:9): [True: 7, False: 1.23k]
  ------------------
 3523|    361|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|    361|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3523:9): [True: 354, False: 892]
  ------------------
 3524|       |            /* greyscale images processed pretty much as RGB by gtTileSeparate
 3525|       |             */
 3526|    365|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|    365|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3526:9): [True: 4, False: 1.24k]
  ------------------
 3527|    365|            switch (img->bitspersample)
 3528|    365|            {
 3529|    285|                case 8:
  ------------------
  |  Branch (3529:17): [True: 285, False: 80]
  ------------------
 3530|    285|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  331|    285|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3530:25): [True: 145, False: 140]
  ------------------
 3531|    145|                        img->put.separate = putRGBAAseparate8bittile;
 3532|    140|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|    140|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3532:30): [True: 24, False: 116]
  ------------------
 3533|     24|                    {
 3534|     24|                        if (BuildMapUaToAa(img))
  ------------------
  |  Branch (3534:29): [True: 24, False: 0]
  ------------------
 3535|     24|                            img->put.separate = putRGBUAseparate8bittile;
 3536|     24|                    }
 3537|    116|                    else
 3538|    116|                        img->put.separate = putRGBseparate8bittile;
 3539|    285|                    break;
 3540|     76|                case 16:
  ------------------
  |  Branch (3540:17): [True: 76, False: 289]
  ------------------
 3541|     76|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  331|     76|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3541:25): [True: 29, False: 47]
  ------------------
 3542|     29|                    {
 3543|     29|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3543:29): [True: 29, False: 0]
  ------------------
 3544|     29|                            img->put.separate = putRGBAAseparate16bittile;
 3545|     29|                    }
 3546|     47|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|     47|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3546:30): [True: 22, False: 25]
  ------------------
 3547|     22|                    {
 3548|     22|                        if (BuildMapBitdepth16To8(img) && BuildMapUaToAa(img))
  ------------------
  |  Branch (3548:29): [True: 22, False: 0]
  |  Branch (3548:59): [True: 22, False: 0]
  ------------------
 3549|     22|                            img->put.separate = putRGBUAseparate16bittile;
 3550|     22|                    }
 3551|     25|                    else
 3552|     25|                    {
 3553|     25|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3553:29): [True: 25, False: 0]
  ------------------
 3554|     25|                            img->put.separate = putRGBseparate16bittile;
 3555|     25|                    }
 3556|     76|                    break;
 3557|      4|                default:
  ------------------
  |  Branch (3557:17): [True: 4, False: 361]
  ------------------
 3558|      4|                    break;
 3559|    365|            }
 3560|    365|            break;
 3561|    365|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     59|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3561:9): [True: 59, False: 1.18k]
  ------------------
 3562|     59|            if (img->bitspersample == 8 && img->samplesperpixel == 4)
  ------------------
  |  Branch (3562:17): [True: 58, False: 1]
  |  Branch (3562:44): [True: 57, False: 1]
  ------------------
 3563|     57|            {
 3564|       |                /* Not alpha, but seems like the only way to get 4th band */
 3565|     57|                img->alpha = 1;
 3566|     57|                img->put.separate = putCMYKseparate8bittile;
 3567|     57|            }
 3568|     59|            break;
 3569|    821|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|    821|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3569:9): [True: 821, False: 425]
  ------------------
 3570|    821|            if ((img->bitspersample == 8) && (img->samplesperpixel == 3))
  ------------------
  |  Branch (3570:17): [True: 818, False: 3]
  |  Branch (3570:46): [True: 817, False: 1]
  ------------------
 3571|    817|            {
 3572|    817|                if (initYCbCrConversion(img) != 0)
  ------------------
  |  Branch (3572:21): [True: 816, False: 1]
  ------------------
 3573|    816|                {
 3574|    816|                    uint16_t hs, vs;
 3575|    816|                    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|    816|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 3576|    816|                                          &hs, &vs);
 3577|    816|                    switch ((hs << 4) | vs)
 3578|    816|                    {
 3579|    802|                        case 0x11:
  ------------------
  |  Branch (3579:25): [True: 802, False: 14]
  ------------------
 3580|    802|                            img->put.separate = putseparate8bitYCbCr11tile;
 3581|    802|                            break;
 3582|       |                            /* TODO: add other cases here */
 3583|     14|                        default:
  ------------------
  |  Branch (3583:25): [True: 14, False: 802]
  ------------------
 3584|     14|                            break;
 3585|    816|                    }
 3586|    816|                }
 3587|    817|            }
 3588|    821|            break;
 3589|    821|        default:
  ------------------
  |  Branch (3589:9): [True: 1, False: 1.24k]
  ------------------
 3590|      1|            break;
 3591|  1.24k|    }
 3592|  1.24k|    return ((img->get != NULL) && (img->put.separate != NULL));
  ------------------
  |  Branch (3592:13): [True: 1.24k, False: 0]
  |  Branch (3592:35): [True: 1.22k, False: 26]
  ------------------
 3593|  1.24k|}
tif_getimage.c:gtTileSeparate:
 1110|  1.03k|{
 1111|  1.03k|    TIFF *tif = img->tif;
 1112|  1.03k|    tileSeparateRoutine put = img->put.separate;
 1113|  1.03k|    uint32_t col, row, y, rowstoread;
 1114|  1.03k|    tmsize_t pos;
 1115|  1.03k|    uint32_t tw, th;
 1116|  1.03k|    unsigned char *buf = NULL;
 1117|  1.03k|    unsigned char *p0 = NULL;
 1118|  1.03k|    unsigned char *p1 = NULL;
 1119|  1.03k|    unsigned char *p2 = NULL;
 1120|  1.03k|    unsigned char *pa = NULL;
 1121|  1.03k|    tmsize_t tilesize;
 1122|  1.03k|    tmsize_t bufsize;
 1123|  1.03k|    int32_t fromskew, toskew;
 1124|  1.03k|    int alpha = img->alpha;
 1125|  1.03k|    uint32_t nrow;
 1126|  1.03k|    int ret = 1, flip;
 1127|  1.03k|    uint16_t colorchannels;
 1128|  1.03k|    uint32_t this_tw, tocol;
 1129|  1.03k|    int32_t this_toskew, leftmost_toskew;
 1130|  1.03k|    int32_t leftmost_fromskew;
 1131|  1.03k|    uint32_t leftmost_tw;
 1132|       |
 1133|  1.03k|    uint32_t wcpy;            /* samples to copy in raster width direction */
 1134|  1.03k|    uint32_t hcpy;            /* lines to copy in raster height direction */
 1135|  1.03k|    uint32_t *p_raster_start; /* pointer into raster where imagedata shall start
 1136|       |                                 to be written */
 1137|       |
 1138|       |    /* For explanation of some local parameters refer to gtStripContig() */
 1139|       |
 1140|  1.03k|    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  311|  1.03k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
 1141|  1.03k|    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  312|  1.03k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
 1142|       |
 1143|  1.03k|    if (tw == 0 || th == 0)
  ------------------
  |  Branch (1143:9): [True: 0, False: 1.03k]
  |  Branch (1143:20): [True: 0, False: 1.03k]
  ------------------
 1144|      0|    {
 1145|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "tile width or height is zero");
 1146|      0|        return 0;
 1147|      0|    }
 1148|       |
 1149|  1.03k|    if (!calcCopyToRasterParameter(img, raster, rwidth, rheight, &wcpy, &hcpy,
  ------------------
  |  Branch (1149:9): [True: 0, False: 1.03k]
  ------------------
 1150|  1.03k|                                   &flip, &p_raster_start, &toskew, &y, true,
 1151|  1.03k|                                   tw, "gtTileSeparate"))
 1152|      0|    {
 1153|      0|        return 0;
 1154|      0|    }
 1155|       |
 1156|  1.03k|    tilesize = TIFFTileSize(tif);
 1157|  1.03k|    bufsize =
 1158|  1.03k|        _TIFFMultiplySSize(tif, alpha ? 4 : 3, tilesize, "gtTileSeparate");
  ------------------
  |  Branch (1158:33): [True: 197, False: 840]
  ------------------
 1159|  1.03k|    if (bufsize == 0)
  ------------------
  |  Branch (1159:9): [True: 0, False: 1.03k]
  ------------------
 1160|      0|        return 0;
 1161|       |
 1162|  1.03k|    switch (img->photometric)
 1163|  1.03k|    {
 1164|      2|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      2|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (1164:9): [True: 2, False: 1.03k]
  ------------------
 1165|    267|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|    267|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (1165:9): [True: 265, False: 772]
  ------------------
 1166|    267|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|    267|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (1166:9): [True: 0, False: 1.03k]
  ------------------
 1167|    267|            colorchannels = 1;
 1168|    267|            break;
 1169|       |
 1170|    770|        default:
  ------------------
  |  Branch (1170:9): [True: 770, False: 267]
  ------------------
 1171|    770|            colorchannels = 3;
 1172|    770|            break;
 1173|  1.03k|    }
 1174|       |
 1175|       |    /*
 1176|       |     *	Leftmost tile is clipped on left side if col_offset > 0.
 1177|       |     */
 1178|  1.03k|    leftmost_fromskew = (int32_t)((uint32_t)img->col_offset % tw);
 1179|  1.03k|    leftmost_tw = (uint32_t)((int32_t)tw - leftmost_fromskew);
 1180|  1.03k|    int64_t skew_i64 = (int64_t)toskew + (int64_t)(int32_t)leftmost_fromskew;
 1181|  1.03k|    if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
  ------------------
  |  Branch (1181:9): [True: 0, False: 1.03k]
  |  Branch (1181:31): [True: 0, False: 1.03k]
  ------------------
 1182|      0|    {
 1183|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
 1184|      0|                      skew_i64);
 1185|      0|        return 0;
 1186|      0|    }
 1187|  1.03k|    leftmost_toskew = (int32_t)skew_i64;
 1188|  1.03k|    if (!checkColOffsetByteAligned(img, "gtTileSeparate",
  ------------------
  |  Branch (1188:9): [True: 0, False: 1.03k]
  ------------------
 1189|  1.03k|                                   (tmsize_t)leftmost_fromskew *
 1190|  1.03k|                                       img->bitspersample))
 1191|      0|        return 0;
 1192|  24.8k|    for (row = 0; ret != 0 && row < hcpy; row += nrow)
  ------------------
  |  Branch (1192:19): [True: 24.5k, False: 279]
  |  Branch (1192:31): [True: 23.8k, False: 758]
  ------------------
 1193|  23.8k|    {
 1194|  23.8k|        rowstoread = th - ((uint32_t)row + (uint32_t)img->row_offset) % th;
 1195|  23.8k|        nrow = row + rowstoread > hcpy ? hcpy - row : rowstoread;
  ------------------
  |  Branch (1195:16): [True: 968, False: 22.8k]
  ------------------
 1196|  23.8k|        fromskew = leftmost_fromskew;
 1197|  23.8k|        this_tw = leftmost_tw;
 1198|  23.8k|        this_toskew = leftmost_toskew;
 1199|  23.8k|        tocol = 0;
 1200|  23.8k|        col = (uint32_t)img->col_offset;
 1201|       |        /* wcpy: only write imagewidth if raster is bigger. */
 1202|   187k|        while (tocol < wcpy)
  ------------------
  |  Branch (1202:16): [True: 164k, False: 23.5k]
  ------------------
 1203|   164k|        {
 1204|   164k|            if (buf == NULL)
  ------------------
  |  Branch (1204:17): [True: 1.03k, False: 163k]
  ------------------
 1205|  1.03k|            {
 1206|  1.03k|                if (_TIFFReadTileAndAllocBuffer(
  ------------------
  |  Branch (1206:21): [True: 485, False: 552]
  ------------------
 1207|  1.03k|                        tif, (void **)&buf, bufsize, col,
 1208|  1.03k|                        (uint32_t)((int32_t)row + img->row_offset), 0,
 1209|  1.03k|                        0) == (tmsize_t)(-1) &&
 1210|    485|                    (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1210:22): [True: 279, False: 206]
  |  Branch (1210:37): [True: 0, False: 206]
  ------------------
 1211|    279|                {
 1212|    279|                    ret = 0;
 1213|    279|                    break;
 1214|    279|                }
 1215|    758|                p0 = buf;
 1216|    758|                if (colorchannels == 1)
  ------------------
  |  Branch (1216:21): [True: 215, False: 543]
  ------------------
 1217|    215|                {
 1218|    215|                    p2 = p1 = p0;
 1219|    215|                    pa = (alpha ? (p0 + 3 * tilesize) : NULL);
  ------------------
  |  Branch (1219:27): [True: 125, False: 90]
  ------------------
 1220|    215|                }
 1221|    543|                else
 1222|    543|                {
 1223|    543|                    p1 = p0 + tilesize;
 1224|    543|                    p2 = p1 + tilesize;
 1225|    543|                    pa = (alpha ? (p2 + tilesize) : NULL);
  ------------------
  |  Branch (1225:27): [True: 30, False: 513]
  ------------------
 1226|    543|                }
 1227|    758|            }
 1228|   163k|            else if (TIFFReadTile(tif, p0, col,
  ------------------
  |  Branch (1228:22): [True: 82.8k, False: 80.3k]
  ------------------
 1229|   163k|                                  (uint32_t)((int32_t)row + img->row_offset), 0,
 1230|   163k|                                  0) == (tmsize_t)(-1) &&
 1231|  82.8k|                     img->stoponerr)
  ------------------
  |  Branch (1231:22): [True: 0, False: 82.8k]
  ------------------
 1232|      0|            {
 1233|      0|                ret = 0;
 1234|      0|                break;
 1235|      0|            }
 1236|   163k|            if (colorchannels > 1 &&
  ------------------
  |  Branch (1236:17): [True: 99.6k, False: 64.3k]
  ------------------
 1237|  99.6k|                TIFFReadTile(tif, p1, col,
  ------------------
  |  Branch (1237:17): [True: 84.7k, False: 14.8k]
  ------------------
 1238|  99.6k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1239|  99.6k|                             (uint16_t)1) == (tmsize_t)(-1) &&
 1240|  84.7k|                img->stoponerr)
  ------------------
  |  Branch (1240:17): [True: 0, False: 84.7k]
  ------------------
 1241|      0|            {
 1242|      0|                ret = 0;
 1243|      0|                break;
 1244|      0|            }
 1245|   163k|            if (colorchannels > 1 &&
  ------------------
  |  Branch (1245:17): [True: 99.6k, False: 64.3k]
  ------------------
 1246|  99.6k|                TIFFReadTile(tif, p2, col,
  ------------------
  |  Branch (1246:17): [True: 99.2k, False: 352]
  ------------------
 1247|  99.6k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1248|  99.6k|                             (uint16_t)2) == (tmsize_t)(-1) &&
 1249|  99.2k|                img->stoponerr)
  ------------------
  |  Branch (1249:17): [True: 0, False: 99.2k]
  ------------------
 1250|      0|            {
 1251|      0|                ret = 0;
 1252|      0|                break;
 1253|      0|            }
 1254|   163k|            if (alpha &&
  ------------------
  |  Branch (1254:17): [True: 36.1k, False: 127k]
  ------------------
 1255|  36.1k|                TIFFReadTile(tif, pa, col,
  ------------------
  |  Branch (1255:17): [True: 35.7k, False: 319]
  ------------------
 1256|  36.1k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1257|  36.1k|                             (uint16_t)colorchannels) == (tmsize_t)(-1) &&
 1258|  35.7k|                img->stoponerr)
  ------------------
  |  Branch (1258:17): [True: 0, False: 35.7k]
  ------------------
 1259|      0|            {
 1260|      0|                ret = 0;
 1261|      0|                break;
 1262|      0|            }
 1263|       |
 1264|       |            /* For SEPARATE the pos-offset is per sample and should not be
 1265|       |             * multiplied by img->samplesperpixel. */
 1266|   163k|            pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) % th) *
 1267|   163k|                      TIFFTileRowSize(tif) +
 1268|   163k|                  ((tmsize_t)fromskew * img->bitspersample / 8);
 1269|   163k|            if (tocol + this_tw > wcpy)
  ------------------
  |  Branch (1269:17): [True: 21.9k, False: 141k]
  ------------------
 1270|  21.9k|            {
 1271|       |                /*
 1272|       |                 * Rightmost tile is clipped on right side.
 1273|       |                 */
 1274|  21.9k|                fromskew = (int32_t)(tw - (wcpy - tocol));
 1275|  21.9k|                this_tw = (uint32_t)((int32_t)tw - fromskew);
 1276|  21.9k|                this_toskew = (int32_t)(toskew + (int32_t)(uint32_t)fromskew);
 1277|  21.9k|            }
 1278|   163k|            tmsize_t roffset = (tmsize_t)y * rwidth + tocol;
 1279|   163k|            (*put)(img, p_raster_start + roffset, tocol, y, this_tw, nrow,
 1280|   163k|                   fromskew, this_toskew, p0 + pos, p1 + pos, p2 + pos,
 1281|   163k|                   alpha ? pa + pos : NULL);
  ------------------
  |  Branch (1281:20): [True: 36.1k, False: 127k]
  ------------------
 1282|   163k|            tocol += this_tw;
 1283|   163k|            col += this_tw;
 1284|       |            /*
 1285|       |             * After the leftmost tile, tiles are no longer clipped on left
 1286|       |             * side.
 1287|       |             */
 1288|   163k|            fromskew = 0;
 1289|   163k|            this_tw = tw;
 1290|   163k|            this_toskew = toskew;
 1291|   163k|        }
 1292|       |
 1293|  23.8k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|  23.8k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1293:25): [True: 23.7k, False: 29]
  ------------------
 1294|  23.8k|                                                 : (int32_t)nrow);
 1295|  23.8k|    }
 1296|       |
 1297|  1.03k|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|  1.03k|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1297:9): [True: 33, False: 1.00k]
  ------------------
 1298|     33|    {
 1299|     33|        uint32_t line;
 1300|       |
 1301|  87.4k|        for (line = 0; line < hcpy; line++)
  ------------------
  |  Branch (1301:24): [True: 87.3k, False: 33]
  ------------------
 1302|  87.3k|        {
 1303|  87.3k|            uint32_t *left = p_raster_start + (size_t)line * rwidth;
 1304|       |            /* Use wcpy to only flip horizontally data in place and not complete
 1305|       |             * raster-row. */
 1306|  87.3k|            uint32_t *right = left + wcpy - 1;
 1307|       |
 1308|  10.6M|            while (left < right)
  ------------------
  |  Branch (1308:20): [True: 10.5M, False: 87.3k]
  ------------------
 1309|  10.5M|            {
 1310|  10.5M|                uint32_t temp = *left;
 1311|  10.5M|                *left = *right;
 1312|  10.5M|                *right = temp;
 1313|  10.5M|                left++;
 1314|  10.5M|                right--;
 1315|  10.5M|            }
 1316|  87.3k|        }
 1317|     33|    }
 1318|       |
 1319|  1.03k|    _TIFFfreeExt(img->tif, buf);
 1320|  1.03k|    return ret;
 1321|  1.03k|}
tif_getimage.c:gtStripSeparate:
 1521|    183|{
 1522|    183|    TIFF *tif = img->tif;
 1523|    183|    tileSeparateRoutine put = img->put.separate;
 1524|    183|    unsigned char *buf = NULL;
 1525|    183|    unsigned char *p0 = NULL, *p1 = NULL, *p2 = NULL, *pa = NULL;
 1526|    183|    uint32_t row, y, nrow, rowstoread;
 1527|    183|    tmsize_t pos;
 1528|    183|    tmsize_t scanline;
 1529|    183|    uint32_t rowsperstrip, offset_row;
 1530|    183|    tmsize_t stripsize;
 1531|    183|    tmsize_t bufsize;
 1532|    183|    int32_t fromskew, toskew;
 1533|    183|    int alpha = img->alpha; /* local variable is faster */
 1534|    183|    int ret = 1, flip;
 1535|    183|    uint16_t colorchannels;
 1536|    183|    uint32_t wcpy;            /* samples to copy in raster width direction */
 1537|    183|    uint32_t hcpy;            /* lines to copy in raster height direction */
 1538|    183|    uint32_t *p_raster_start; /* pointer into raster where imagedata shall start
 1539|       |                                 to be written */
 1540|       |
 1541|       |    /* For explanation of local parameters refer to gtStripContig() */
 1542|    183|    if (!calcCopyToRasterParameter(img, raster, rwidth, rheight, &wcpy, &hcpy,
  ------------------
  |  Branch (1542:9): [True: 0, False: 183]
  ------------------
 1543|    183|                                   &flip, &p_raster_start, &toskew, &y, false,
 1544|    183|                                   0, "gtStripSeparate"))
 1545|      0|    {
 1546|      0|        return 0;
 1547|      0|    }
 1548|       |
 1549|    183|    if (!checkColOffsetByteAligned(img, "gtStripSeparate",
  ------------------
  |  Branch (1549:9): [True: 0, False: 183]
  ------------------
 1550|    183|                                   (tmsize_t)img->col_offset *
 1551|    183|                                       img->bitspersample))
 1552|      0|        return 0;
 1553|       |
 1554|    183|    stripsize = TIFFStripSize(tif);
 1555|    183|    bufsize =
 1556|    183|        _TIFFMultiplySSize(tif, alpha ? 4 : 3, stripsize, "gtStripSeparate");
  ------------------
  |  Branch (1556:33): [True: 98, False: 85]
  ------------------
 1557|    183|    if (bufsize == 0)
  ------------------
  |  Branch (1557:9): [True: 0, False: 183]
  ------------------
 1558|      0|        return 0;
 1559|       |
 1560|    183|    switch (img->photometric)
 1561|    183|    {
 1562|      4|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      4|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (1562:9): [True: 4, False: 179]
  ------------------
 1563|     91|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|     91|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (1563:9): [True: 87, False: 96]
  ------------------
 1564|     91|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     91|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (1564:9): [True: 0, False: 183]
  ------------------
 1565|     91|            colorchannels = 1;
 1566|     91|            break;
 1567|       |
 1568|     92|        default:
  ------------------
  |  Branch (1568:9): [True: 92, False: 91]
  ------------------
 1569|     92|            colorchannels = 3;
 1570|     92|            break;
 1571|    183|    }
 1572|       |
 1573|    183|    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
  ------------------
  |  |  258|    183|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 1574|    183|    if (rowsperstrip == 0)
  ------------------
  |  Branch (1574:9): [True: 0, False: 183]
  ------------------
 1575|      0|    {
 1576|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
 1577|      0|        return 0;
 1578|      0|    }
 1579|       |
 1580|    183|    scanline = TIFFScanlineSize(tif);
 1581|    183|    if (wcpy < img->width && (img->width - wcpy) > (uint32_t)INT32_MAX)
  ------------------
  |  Branch (1581:9): [True: 0, False: 183]
  |  Branch (1581:30): [True: 0, False: 0]
  ------------------
 1582|      0|    {
 1583|      0|        TIFFErrorExtR(tif, TIFFFileName(tif),
 1584|      0|                      "Too large fromskew value (width=%" PRIu32 ")",
 1585|      0|                      img->width);
 1586|      0|        return 0;
 1587|      0|    }
 1588|    183|    fromskew = (int32_t)(wcpy < img->width ? img->width - wcpy : 0);
  ------------------
  |  Branch (1588:26): [True: 0, False: 183]
  ------------------
 1589|  56.1k|    for (row = 0; row < hcpy; row += nrow)
  ------------------
  |  Branch (1589:19): [True: 55.9k, False: 151]
  ------------------
 1590|  55.9k|    {
 1591|  55.9k|        uint32_t temp;
 1592|  55.9k|        rowstoread =
 1593|  55.9k|            rowsperstrip -
 1594|  55.9k|            ((uint32_t)((int32_t)row + img->row_offset) % rowsperstrip);
 1595|  55.9k|        nrow = row + rowstoread > hcpy ? hcpy - row : rowstoread;
  ------------------
  |  Branch (1595:16): [True: 161, False: 55.8k]
  ------------------
 1596|  55.9k|        offset_row = (uint32_t)((int32_t)row + img->row_offset);
 1597|  55.9k|        temp = (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip + nrow;
 1598|  55.9k|        if (scanline > 0 && temp > (size_t)(TIFF_TMSIZE_T_MAX / scanline))
  ------------------
  |  |   68|  55.9k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (1598:13): [True: 55.9k, False: 0]
  |  Branch (1598:29): [True: 0, False: 55.9k]
  ------------------
 1599|      0|        {
 1600|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1601|      0|                          "Integer overflow in gtStripSeparate");
 1602|      0|            return 0;
 1603|      0|        }
 1604|  55.9k|        if (buf == NULL)
  ------------------
  |  Branch (1604:13): [True: 183, False: 55.7k]
  ------------------
 1605|    183|        {
 1606|    183|            if (_TIFFReadEncodedStripAndAllocBuffer(
  ------------------
  |  Branch (1606:17): [True: 95, False: 88]
  ------------------
 1607|    183|                    tif, TIFFComputeStrip(tif, offset_row, 0), (void **)&buf,
 1608|    183|                    bufsize, temp * scanline) == (tmsize_t)(-1) &&
 1609|     95|                (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1609:18): [True: 32, False: 63]
  |  Branch (1609:33): [True: 0, False: 63]
  ------------------
 1610|     32|            {
 1611|     32|                ret = 0;
 1612|     32|                break;
 1613|     32|            }
 1614|    151|            p0 = buf;
 1615|    151|            if (colorchannels == 1)
  ------------------
  |  Branch (1615:17): [True: 82, False: 69]
  ------------------
 1616|     82|            {
 1617|     82|                p2 = p1 = p0;
 1618|     82|                pa = (alpha ? (p0 + 3 * stripsize) : NULL);
  ------------------
  |  Branch (1618:23): [True: 52, False: 30]
  ------------------
 1619|     82|            }
 1620|     69|            else
 1621|     69|            {
 1622|     69|                p1 = p0 + stripsize;
 1623|     69|                p2 = p1 + stripsize;
 1624|     69|                pa = (alpha ? (p2 + stripsize) : NULL);
  ------------------
  |  Branch (1624:23): [True: 36, False: 33]
  ------------------
 1625|     69|            }
 1626|    151|        }
 1627|  55.7k|        else if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
  ------------------
  |  Branch (1627:18): [True: 47.4k, False: 8.30k]
  ------------------
 1628|  55.7k|                                      p0, temp * scanline) == (tmsize_t)(-1) &&
 1629|  47.4k|                 img->stoponerr)
  ------------------
  |  Branch (1629:18): [True: 0, False: 47.4k]
  ------------------
 1630|      0|        {
 1631|      0|            ret = 0;
 1632|      0|            break;
 1633|      0|        }
 1634|  55.9k|        if (colorchannels > 1 &&
  ------------------
  |  Branch (1634:13): [True: 19.9k, False: 35.9k]
  ------------------
 1635|  19.9k|            TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1), p1,
  ------------------
  |  Branch (1635:13): [True: 12.5k, False: 7.39k]
  ------------------
 1636|  19.9k|                                 temp * scanline) == (tmsize_t)(-1) &&
 1637|  12.5k|            img->stoponerr)
  ------------------
  |  Branch (1637:13): [True: 0, False: 12.5k]
  ------------------
 1638|      0|        {
 1639|      0|            ret = 0;
 1640|      0|            break;
 1641|      0|        }
 1642|  55.9k|        if (colorchannels > 1 &&
  ------------------
  |  Branch (1642:13): [True: 19.9k, False: 35.9k]
  ------------------
 1643|  19.9k|            TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2), p2,
  ------------------
  |  Branch (1643:13): [True: 12.5k, False: 7.38k]
  ------------------
 1644|  19.9k|                                 temp * scanline) == (tmsize_t)(-1) &&
 1645|  12.5k|            img->stoponerr)
  ------------------
  |  Branch (1645:13): [True: 0, False: 12.5k]
  ------------------
 1646|      0|        {
 1647|      0|            ret = 0;
 1648|      0|            break;
 1649|      0|        }
 1650|  55.9k|        if (alpha)
  ------------------
  |  Branch (1650:13): [True: 21.3k, False: 34.5k]
  ------------------
 1651|  21.3k|        {
 1652|  21.3k|            if (TIFFReadEncodedStrip(
  ------------------
  |  Branch (1652:17): [True: 13.3k, False: 8.00k]
  ------------------
 1653|  21.3k|                    tif, TIFFComputeStrip(tif, offset_row, colorchannels), pa,
 1654|  21.3k|                    temp * scanline) == (tmsize_t)(-1) &&
 1655|  13.3k|                img->stoponerr)
  ------------------
  |  Branch (1655:17): [True: 0, False: 13.3k]
  ------------------
 1656|      0|            {
 1657|      0|                ret = 0;
 1658|      0|                break;
 1659|      0|            }
 1660|  21.3k|        }
 1661|       |
 1662|       |        /* For SEPARATE the pos-offset is per sample and should not be
 1663|       |         * multiplied by img->samplesperpixel. */
 1664|  55.9k|        pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) %
 1665|  55.9k|                         rowsperstrip) *
 1666|  55.9k|                  scanline +
 1667|  55.9k|              ((tmsize_t)img->col_offset * img->bitspersample / 8);
 1668|  55.9k|        tmsize_t roffset = (tmsize_t)y * rwidth;
 1669|  55.9k|        (*put)(img, p_raster_start + roffset, 0, y, wcpy, nrow, fromskew,
 1670|  55.9k|               toskew, p0 + pos, p1 + pos, p2 + pos,
 1671|  55.9k|               (alpha ? (pa + pos) : NULL));
  ------------------
  |  Branch (1671:17): [True: 21.3k, False: 34.5k]
  ------------------
 1672|  55.9k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|  55.9k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1672:25): [True: 54.8k, False: 1.05k]
  ------------------
 1673|  55.9k|                                                 : (int32_t)nrow);
 1674|  55.9k|    }
 1675|       |
 1676|    183|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|    183|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1676:9): [True: 48, False: 135]
  ------------------
 1677|     48|    {
 1678|     48|        uint32_t line;
 1679|       |
 1680|   220k|        for (line = 0; line < hcpy; line++)
  ------------------
  |  Branch (1680:24): [True: 220k, False: 48]
  ------------------
 1681|   220k|        {
 1682|   220k|            uint32_t *left = p_raster_start + (size_t)line * rwidth;
 1683|       |            /* Use wcpy to only flip horizontally data in place and not complete
 1684|       |             * raster-row. */
 1685|   220k|            uint32_t *right = left + wcpy - 1;
 1686|       |
 1687|  8.52M|            while (left < right)
  ------------------
  |  Branch (1687:20): [True: 8.30M, False: 220k]
  ------------------
 1688|  8.30M|            {
 1689|  8.30M|                uint32_t temp = *left;
 1690|  8.30M|                *left = *right;
 1691|  8.30M|                *right = temp;
 1692|  8.30M|                left++;
 1693|  8.30M|                right--;
 1694|  8.30M|            }
 1695|   220k|        }
 1696|     48|    }
 1697|       |
 1698|    183|    _TIFFfreeExt(img->tif, buf);
 1699|    183|    return ret;
 1700|    183|}
tif_getimage.c:putRGBAAseparate8bittile:
 2271|  2.54k|{
 2272|  2.54k|    (void)img;
 2273|  2.54k|    (void)x;
 2274|  2.54k|    (void)y;
 2275|  1.42M|    for (; h > 0; --h)
  ------------------
  |  Branch (2275:12): [True: 1.42M, False: 2.54k]
  ------------------
 2276|  1.42M|    {
 2277|  1.42M|        UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++));
  ------------------
  |  | 1758|  1.42M|    {                                                                          \
  |  | 1759|  1.42M|        uint32_t _x;                                                           \
  |  | 1760|  20.9M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1760:22): [True: 19.5M, False: 1.42M]
  |  |  ------------------
  |  | 1761|  19.5M|        {                                                                      \
  |  | 1762|  19.5M|            op1;                                                               \
  |  | 1763|  19.5M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1713|  19.5M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|  19.5M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  19.5M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  19.5M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|  19.5M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  19.5M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  19.5M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1714|  19.5M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|  19.5M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  19.5M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  19.5M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|  19.5M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  19.5M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  19.5M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1764|  19.5M|        }                                                                      \
  |  | 1765|  1.42M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1765:13): [True: 1.09M, False: 327k]
  |  |  ------------------
  |  | 1766|  1.42M|        {                                                                      \
  |  | 1767|  1.09M|            op1;                                                               \
  |  | 1768|  1.09M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1722|  1.09M|    switch (x)                                                                 \
  |  |  |  | 1723|  1.09M|    {                                                                          \
  |  |  |  | 1724|   458k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1724:9): [True: 458k, False: 636k]
  |  |  |  |  ------------------
  |  |  |  | 1725|   458k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1726|   458k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1726:9): [True: 616, False: 1.09M]
  |  |  |  |  ------------------
  |  |  |  | 1727|   458k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1728|   533k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1728:9): [True: 74.9k, False: 1.01M]
  |  |  |  |  ------------------
  |  |  |  | 1729|   533k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1730|  1.05M|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1730:9): [True: 522k, False: 572k]
  |  |  |  |  ------------------
  |  |  |  | 1731|  1.05M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1732|  1.05M|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1732:9): [True: 603, False: 1.09M]
  |  |  |  |  ------------------
  |  |  |  | 1733|  1.05M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1734|  1.08M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1734:9): [True: 24.5k, False: 1.07M]
  |  |  |  |  ------------------
  |  |  |  | 1735|  1.08M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1736|  1.09M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1736:9): [True: 13.4k, False: 1.08M]
  |  |  |  |  ------------------
  |  |  |  | 1737|  1.09M|            op;                                                                \
  |  |  |  | 1738|  1.09M|            break;                                                             \
  |  |  |  | 1739|  1.08M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1739:9): [True: 0, False: 1.09M]
  |  |  |  |  ------------------
  |  |  |  | 1740|      0|            break;                                                             \
  |  |  |  | 1741|  1.09M|    }
  |  |  ------------------
  |  | 1769|  1.09M|        }                                                                      \
  |  | 1770|  1.42M|    }
  ------------------
 2278|  1.42M|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1807|  1.42M|    {                                                                          \
  |  | 1808|  1.42M|        r += skew;                                                             \
  |  | 1809|  1.42M|        g += skew;                                                             \
  |  | 1810|  1.42M|        b += skew;                                                             \
  |  | 1811|  1.42M|        a += skew;                                                             \
  |  | 1812|  1.42M|    }
  ------------------
 2279|  1.42M|        cp += toskew;
 2280|  1.42M|    }
 2281|  2.54k|}
tif_getimage.c:putRGBUAseparate8bittile:
 2310|  2.76k|{
 2311|  2.76k|    (void)img;
 2312|  2.76k|    (void)y;
 2313|   186k|    for (; h > 0; --h)
  ------------------
  |  Branch (2313:12): [True: 184k, False: 2.76k]
  ------------------
 2314|   184k|    {
 2315|   184k|        uint32_t rv, gv, bv, av;
 2316|   184k|        uint8_t *m;
 2317|  28.6M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2317:21): [True: 28.4M, False: 184k]
  ------------------
 2318|  28.4M|        {
 2319|  28.4M|            av = *a++;
 2320|  28.4M|            m = img->UaToAa + ((size_t)av << 8);
 2321|  28.4M|            rv = m[*r++];
 2322|  28.4M|            gv = m[*g++];
 2323|  28.4M|            bv = m[*b++];
 2324|  28.4M|            *cp++ = PACK4(rv, gv, bv, av);
  ------------------
  |  | 1818|  28.4M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1819|  28.4M|     ((uint32_t)(a) << 24))
  ------------------
 2325|  28.4M|        }
 2326|   184k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1807|   184k|    {                                                                          \
  |  | 1808|   184k|        r += skew;                                                             \
  |  | 1809|   184k|        g += skew;                                                             \
  |  | 1810|   184k|        b += skew;                                                             \
  |  | 1811|   184k|        a += skew;                                                             \
  |  | 1812|   184k|    }
  ------------------
 2327|   184k|        cp += toskew;
 2328|   184k|    }
 2329|  2.76k|}
tif_getimage.c:putRGBseparate8bittile:
 2254|  35.5k|{
 2255|  35.5k|    (void)img;
 2256|  35.5k|    (void)x;
 2257|  35.5k|    (void)y;
 2258|  35.5k|    (void)a;
 2259|  1.41M|    for (; h > 0; --h)
  ------------------
  |  Branch (2259:12): [True: 1.37M, False: 35.5k]
  ------------------
 2260|  1.37M|    {
 2261|  1.37M|        UNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++));
  ------------------
  |  | 1758|  1.37M|    {                                                                          \
  |  | 1759|  1.37M|        uint32_t _x;                                                           \
  |  | 1760|  12.3M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1760:22): [True: 11.0M, False: 1.37M]
  |  |  ------------------
  |  | 1761|  11.0M|        {                                                                      \
  |  | 1762|  11.0M|            op1;                                                               \
  |  | 1763|  11.0M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1713|  11.0M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|  11.0M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  11.0M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  11.0M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|  11.0M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  11.0M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  11.0M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1714|  11.0M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1716|  11.0M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  11.0M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  11.0M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1717|  11.0M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1719|  11.0M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1720|  11.0M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1764|  11.0M|        }                                                                      \
  |  | 1765|  1.37M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1765:13): [True: 1.33M, False: 46.7k]
  |  |  ------------------
  |  | 1766|  1.37M|        {                                                                      \
  |  | 1767|  1.33M|            op1;                                                               \
  |  | 1768|  1.33M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1722|  1.33M|    switch (x)                                                                 \
  |  |  |  | 1723|  1.33M|    {                                                                          \
  |  |  |  | 1724|  12.7k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1724:9): [True: 12.7k, False: 1.31M]
  |  |  |  |  ------------------
  |  |  |  | 1725|  12.7k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1726|  19.5k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1726:9): [True: 6.82k, False: 1.32M]
  |  |  |  |  ------------------
  |  |  |  | 1727|  19.5k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1728|  43.6k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1728:9): [True: 24.0k, False: 1.30M]
  |  |  |  |  ------------------
  |  |  |  | 1729|  43.6k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1730|   104k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1730:9): [True: 60.7k, False: 1.26M]
  |  |  |  |  ------------------
  |  |  |  | 1731|   104k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1732|   350k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1732:9): [True: 246k, False: 1.08M]
  |  |  |  |  ------------------
  |  |  |  | 1733|   350k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1734|  1.06M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1734:9): [True: 719k, False: 611k]
  |  |  |  |  ------------------
  |  |  |  | 1735|  1.06M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1736|  1.33M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1736:9): [True: 260k, False: 1.06M]
  |  |  |  |  ------------------
  |  |  |  | 1737|  1.33M|            op;                                                                \
  |  |  |  | 1738|  1.33M|            break;                                                             \
  |  |  |  | 1739|  1.06M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1739:9): [True: 0, False: 1.33M]
  |  |  |  |  ------------------
  |  |  |  | 1740|      0|            break;                                                             \
  |  |  |  | 1741|  1.33M|    }
  |  |  ------------------
  |  | 1769|  1.33M|        }                                                                      \
  |  | 1770|  1.37M|    }
  ------------------
 2262|  1.37M|        SKEW(r, g, b, fromskew);
  ------------------
  |  | 1801|  1.37M|    {                                                                          \
  |  | 1802|  1.37M|        r += skew;                                                             \
  |  | 1803|  1.37M|        g += skew;                                                             \
  |  | 1804|  1.37M|        b += skew;                                                             \
  |  | 1805|  1.37M|    }
  ------------------
 2263|  1.37M|        cp += toskew;
 2264|  1.37M|    }
 2265|  35.5k|}
tif_getimage.c:putRGBAAseparate16bittile:
 2356|  1.04k|{
 2357|  1.04k|    uint16_t *wr = (uint16_t *)r;
 2358|  1.04k|    uint16_t *wg = (uint16_t *)g;
 2359|  1.04k|    uint16_t *wb = (uint16_t *)b;
 2360|  1.04k|    uint16_t *wa = (uint16_t *)a;
 2361|  1.04k|    (void)img;
 2362|  1.04k|    (void)y;
 2363|  85.1k|    for (; h > 0; --h)
  ------------------
  |  Branch (2363:12): [True: 84.0k, False: 1.04k]
  ------------------
 2364|  84.0k|    {
 2365|  6.16M|        for (x = 0; x < w; x++)
  ------------------
  |  Branch (2365:21): [True: 6.07M, False: 84.0k]
  ------------------
 2366|  6.07M|            *cp++ = PACK4(img->Bitdepth16To8[*wr++], img->Bitdepth16To8[*wg++],
  ------------------
  |  | 1818|  6.07M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1819|  6.07M|     ((uint32_t)(a) << 24))
  ------------------
 2367|  84.0k|                          img->Bitdepth16To8[*wb++], img->Bitdepth16To8[*wa++]);
 2368|  84.0k|        SKEW4(wr, wg, wb, wa, fromskew);
  ------------------
  |  | 1807|  84.0k|    {                                                                          \
  |  | 1808|  84.0k|        r += skew;                                                             \
  |  | 1809|  84.0k|        g += skew;                                                             \
  |  | 1810|  84.0k|        b += skew;                                                             \
  |  | 1811|  84.0k|        a += skew;                                                             \
  |  | 1812|  84.0k|    }
  ------------------
 2369|  84.0k|        cp += toskew;
 2370|  84.0k|    }
 2371|  1.04k|}
tif_getimage.c:putRGBUAseparate16bittile:
 2377|  30.2k|{
 2378|  30.2k|    uint16_t *wr = (uint16_t *)r;
 2379|  30.2k|    uint16_t *wg = (uint16_t *)g;
 2380|  30.2k|    uint16_t *wb = (uint16_t *)b;
 2381|  30.2k|    uint16_t *wa = (uint16_t *)a;
 2382|  30.2k|    (void)img;
 2383|  30.2k|    (void)y;
 2384|   378k|    for (; h > 0; --h)
  ------------------
  |  Branch (2384:12): [True: 348k, False: 30.2k]
  ------------------
 2385|   348k|    {
 2386|   348k|        uint32_t r2, g2, b2, a2;
 2387|   348k|        uint8_t *m;
 2388|  41.7M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2388:21): [True: 41.3M, False: 348k]
  ------------------
 2389|  41.3M|        {
 2390|  41.3M|            a2 = img->Bitdepth16To8[*wa++];
 2391|  41.3M|            m = img->UaToAa + ((size_t)a2 << 8);
 2392|  41.3M|            r2 = m[img->Bitdepth16To8[*wr++]];
 2393|  41.3M|            g2 = m[img->Bitdepth16To8[*wg++]];
 2394|  41.3M|            b2 = m[img->Bitdepth16To8[*wb++]];
 2395|  41.3M|            *cp++ = PACK4(r2, g2, b2, a2);
  ------------------
  |  | 1818|  41.3M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1819|  41.3M|     ((uint32_t)(a) << 24))
  ------------------
 2396|  41.3M|        }
 2397|   348k|        SKEW4(wr, wg, wb, wa, fromskew);
  ------------------
  |  | 1807|   348k|    {                                                                          \
  |  | 1808|   348k|        r += skew;                                                             \
  |  | 1809|   348k|        g += skew;                                                             \
  |  | 1810|   348k|        b += skew;                                                             \
  |  | 1811|   348k|        a += skew;                                                             \
  |  | 1812|   348k|    }
  ------------------
 2398|   348k|        cp += toskew;
 2399|   348k|    }
 2400|  30.2k|}
tif_getimage.c:putRGBseparate16bittile:
 2335|  28.1k|{
 2336|  28.1k|    uint16_t *wr = (uint16_t *)r;
 2337|  28.1k|    uint16_t *wg = (uint16_t *)g;
 2338|  28.1k|    uint16_t *wb = (uint16_t *)b;
 2339|  28.1k|    (void)img;
 2340|  28.1k|    (void)y;
 2341|  28.1k|    (void)a;
 2342|  1.30M|    for (; h > 0; --h)
  ------------------
  |  Branch (2342:12): [True: 1.27M, False: 28.1k]
  ------------------
 2343|  1.27M|    {
 2344|  23.8M|        for (x = 0; x < w; x++)
  ------------------
  |  Branch (2344:21): [True: 22.6M, False: 1.27M]
  ------------------
 2345|  22.6M|            *cp++ = PACK(img->Bitdepth16To8[*wr++], img->Bitdepth16To8[*wg++],
  ------------------
  |  | 1816|  22.6M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1814|  22.6M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2346|  1.27M|                         img->Bitdepth16To8[*wb++]);
 2347|  1.27M|        SKEW(wr, wg, wb, fromskew);
  ------------------
  |  | 1801|  1.27M|    {                                                                          \
  |  | 1802|  1.27M|        r += skew;                                                             \
  |  | 1803|  1.27M|        g += skew;                                                             \
  |  | 1804|  1.27M|        b += skew;                                                             \
  |  | 1805|  1.27M|    }
  ------------------
 2348|  1.27M|        cp += toskew;
 2349|  1.27M|    }
 2350|  28.1k|}
tif_getimage.c:putCMYKseparate8bittile:
 2287|  1.56k|{
 2288|  1.56k|    (void)img;
 2289|  1.56k|    (void)y;
 2290|   163k|    for (; h > 0; --h)
  ------------------
  |  Branch (2290:12): [True: 162k, False: 1.56k]
  ------------------
 2291|   162k|    {
 2292|   162k|        unsigned int rv, gv, bv, kv;
 2293|  51.7M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2293:21): [True: 51.6M, False: 162k]
  ------------------
 2294|  51.6M|        {
 2295|  51.6M|            kv = 255U - *a++;
 2296|  51.6M|            rv = (kv * (255U - *r++)) / 255U;
 2297|  51.6M|            gv = (kv * (255U - *g++)) / 255U;
 2298|  51.6M|            bv = (kv * (255U - *b++)) / 255U;
 2299|  51.6M|            *cp++ = PACK4(rv, gv, bv, 255);
  ------------------
  |  | 1818|  51.6M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1819|  51.6M|     ((uint32_t)(a) << 24))
  ------------------
 2300|  51.6M|        }
 2301|   162k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1807|   162k|    {                                                                          \
  |  | 1808|   162k|        r += skew;                                                             \
  |  | 1809|   162k|        g += skew;                                                             \
  |  | 1810|   162k|        b += skew;                                                             \
  |  | 1811|   162k|        a += skew;                                                             \
  |  | 1812|   162k|    }
  ------------------
 2302|   162k|        cp += toskew;
 2303|   162k|    }
 2304|  1.56k|}
tif_getimage.c:putseparate8bitYCbCr11tile:
 2942|   117k|{
 2943|   117k|    (void)y;
 2944|   117k|    (void)a;
 2945|       |    /* TODO: naming of input vars is still off, change obfuscating declaration
 2946|       |     * inside define, or resolve obfuscation */
 2947|  1.00M|    for (; h > 0; --h)
  ------------------
  |  Branch (2947:12): [True: 886k, False: 117k]
  ------------------
 2948|   886k|    {
 2949|   886k|        x = w;
 2950|   886k|        do
 2951|  60.2M|        {
 2952|  60.2M|            uint32_t dr, dg, db;
 2953|  60.2M|            TIFFYCbCrtoRGB(img->ycbcr, *r++, *g++, *b++, &dr, &dg, &db);
 2954|  60.2M|            *cp++ = PACK(dr, dg, db);
  ------------------
  |  | 1816|  60.2M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1814|  60.2M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2955|  60.2M|        } while (--x);
  ------------------
  |  Branch (2955:18): [True: 59.3M, False: 886k]
  ------------------
 2956|   886k|        SKEW(r, g, b, fromskew);
  ------------------
  |  | 1801|   886k|    {                                                                          \
  |  | 1802|   886k|        r += skew;                                                             \
  |  | 1803|   886k|        g += skew;                                                             \
  |  | 1804|   886k|        b += skew;                                                             \
  |  | 1805|   886k|    }
  ------------------
 2957|   886k|        cp += toskew;
 2958|   886k|    }
 2959|   117k|}

TIFFHashSetNew:
  152|  55.1k|{
  153|  55.1k|    TIFFHashSet *set = (TIFFHashSet *)_TIFFmallocExt(tif, sizeof(TIFFHashSet));
  154|  55.1k|    if (set == NULL)
  ------------------
  |  Branch (154:9): [True: 0, False: 55.1k]
  ------------------
  155|      0|        return NULL;
  156|  55.1k|    set->tif = tif;
  157|  55.1k|    set->fnHashFunc = fnHashFunc ? fnHashFunc : TIFFHashSetHashPointer;
  ------------------
  |  Branch (157:23): [True: 55.1k, False: 0]
  ------------------
  158|  55.1k|    set->fnEqualFunc = fnEqualFunc ? fnEqualFunc : TIFFHashSetEqualPointer;
  ------------------
  |  Branch (158:24): [True: 55.1k, False: 0]
  ------------------
  159|  55.1k|    set->fnFreeEltFunc = fnFreeEltFunc;
  160|  55.1k|    set->nSize = 0;
  161|  55.1k|    set->tabList = (TIFFList **)_TIFFcallocExt(tif, 53, sizeof(TIFFList *));
  162|  55.1k|    if (set->tabList == NULL)
  ------------------
  |  Branch (162:9): [True: 0, False: 55.1k]
  ------------------
  163|      0|    {
  164|      0|        _TIFFfreeExt(tif, set);
  165|      0|        return NULL;
  166|      0|    }
  167|  55.1k|    set->nIndiceAllocatedSize = 0;
  168|  55.1k|    set->nAllocatedSize = 53;
  169|  55.1k|    set->psRecyclingList = NULL;
  170|  55.1k|    set->nRecyclingListSize = 0;
  171|  55.1k|    set->bRehash = false;
  172|       |#ifdef HASH_DEBUG
  173|       |    set->nCollisions = 0;
  174|       |#endif
  175|  55.1k|    return set;
  176|  55.1k|}
TIFFHashSetSize:
  193|  27.5k|{
  194|  27.5k|    assert(set != NULL);
  ------------------
  |  Branch (194:5): [True: 0, False: 27.5k]
  |  Branch (194:5): [True: 27.5k, False: 0]
  ------------------
  195|  27.5k|    return set->nSize;
  196|  27.5k|}
TIFFHashSetDestroy:
  299|  55.1k|{
  300|  55.1k|    if (set)
  ------------------
  |  Branch (300:9): [True: 55.1k, False: 0]
  ------------------
  301|  55.1k|    {
  302|       |        TIFFHashSetClearInternal(set, true);
  303|  55.1k|        _TIFFfreeExt(set->tif, set->tabList);
  304|  55.1k|        TIFFListDestroy(set->tif, set->psRecyclingList);
  305|  55.1k|        _TIFFfreeExt(set->tif, set);
  306|  55.1k|    }
  307|  55.1k|}
TIFFHashSetInsert:
  455|  55.1k|{
  456|  55.1k|    assert(set != NULL);
  ------------------
  |  Branch (456:5): [True: 0, False: 55.1k]
  |  Branch (456:5): [True: 55.1k, False: 0]
  ------------------
  457|  55.1k|    void **pElt = TIFFHashSetFindPtr(set, elt);
  458|  55.1k|    if (pElt)
  ------------------
  |  Branch (458:9): [True: 0, False: 55.1k]
  ------------------
  459|      0|    {
  460|      0|        if (set->fnFreeEltFunc)
  ------------------
  |  Branch (460:13): [True: 0, False: 0]
  ------------------
  461|      0|            set->fnFreeEltFunc(set->tif, *pElt);
  462|       |
  463|      0|        *pElt = elt;
  464|      0|        return true;
  465|      0|    }
  466|       |
  467|  55.1k|    if (set->nSize >= 2 * set->nAllocatedSize / 3 ||
  ------------------
  |  Branch (467:9): [True: 0, False: 55.1k]
  ------------------
  468|  55.1k|        (set->bRehash && set->nIndiceAllocatedSize > 0 &&
  ------------------
  |  Branch (468:10): [True: 0, False: 55.1k]
  |  Branch (468:26): [True: 0, False: 0]
  ------------------
  469|      0|         set->nSize <= set->nAllocatedSize / 2))
  ------------------
  |  Branch (469:10): [True: 0, False: 0]
  ------------------
  470|      0|    {
  471|      0|        set->nIndiceAllocatedSize++;
  472|      0|        if (!TIFFHashSetRehash(set))
  ------------------
  |  Branch (472:13): [True: 0, False: 0]
  ------------------
  473|      0|        {
  474|      0|            set->nIndiceAllocatedSize--;
  475|      0|            if (set->fnFreeEltFunc)
  ------------------
  |  Branch (475:17): [True: 0, False: 0]
  ------------------
  476|      0|                set->fnFreeEltFunc(set->tif, elt);
  477|      0|            return false;
  478|      0|        }
  479|      0|    }
  480|       |
  481|  55.1k|    const unsigned long nHashVal =
  482|  55.1k|        set->fnHashFunc(elt) % (unsigned long)set->nAllocatedSize;
  483|       |#ifdef HASH_DEBUG
  484|       |    if (set->tabList[nHashVal])
  485|       |        set->nCollisions++;
  486|       |#endif
  487|       |
  488|  55.1k|    TIFFList *new_elt = TIFFHashSetGetNewListElt(set);
  489|  55.1k|    if (new_elt == NULL)
  ------------------
  |  Branch (489:9): [True: 0, False: 55.1k]
  ------------------
  490|      0|    {
  491|      0|        if (set->fnFreeEltFunc)
  ------------------
  |  Branch (491:13): [True: 0, False: 0]
  ------------------
  492|      0|            set->fnFreeEltFunc(set->tif, elt);
  493|      0|        return false;
  494|      0|    }
  495|  55.1k|    new_elt->pData = elt;
  496|  55.1k|    new_elt->psNext = set->tabList[nHashVal];
  497|  55.1k|    set->tabList[nHashVal] = new_elt;
  498|  55.1k|    set->nSize++;
  499|       |
  500|       |    return true;
  501|  55.1k|}
TIFFHashSetLookup:
  518|  55.1k|{
  519|  55.1k|    assert(set != NULL);
  ------------------
  |  Branch (519:5): [True: 0, False: 55.1k]
  |  Branch (519:5): [True: 55.1k, False: 0]
  ------------------
  520|  55.1k|    void **pElt = TIFFHashSetFindPtr(set, elt);
  521|  55.1k|    if (pElt)
  ------------------
  |  Branch (521:9): [True: 0, False: 55.1k]
  ------------------
  522|      0|        return *pElt;
  523|       |
  524|  55.1k|    return NULL;
  525|  55.1k|}
tif_hash_set.c:TIFFHashSetClearInternal:
  239|  55.1k|{
  240|  55.1k|    assert(set != NULL);
  ------------------
  |  Branch (240:5): [True: 0, False: 55.1k]
  |  Branch (240:5): [True: 55.1k, False: 0]
  ------------------
  241|  2.97M|    for (int i = 0; i < set->nAllocatedSize; i++)
  ------------------
  |  Branch (241:21): [True: 2.92M, False: 55.1k]
  ------------------
  242|  2.92M|    {
  243|  2.92M|        TIFFList *cur = set->tabList[i];
  244|  2.97M|        while (cur)
  ------------------
  |  Branch (244:16): [True: 55.1k, False: 2.92M]
  ------------------
  245|  55.1k|        {
  246|  55.1k|            if (set->fnFreeEltFunc)
  ------------------
  |  Branch (246:17): [True: 27.5k, False: 27.5k]
  ------------------
  247|  27.5k|                set->fnFreeEltFunc(set->tif, cur->pData);
  248|  55.1k|            TIFFList *psNext = cur->psNext;
  249|  55.1k|            if (bFinalize)
  ------------------
  |  Branch (249:17): [True: 55.1k, False: 0]
  ------------------
  250|  55.1k|                _TIFFfreeExt(set->tif, cur);
  251|      0|            else
  252|      0|                TIFFHashSetReturnListElt(set, cur);
  253|  55.1k|            cur = psNext;
  254|  55.1k|        }
  255|  2.92M|        set->tabList[i] = NULL;
  256|  2.92M|    }
  257|       |    set->bRehash = false;
  258|  55.1k|}
tif_hash_set.c:TIFFListDestroy:
  274|  55.1k|{
  275|  55.1k|    TIFFList *psCurrent = psList;
  276|       |
  277|  55.1k|    while (psCurrent)
  ------------------
  |  Branch (277:12): [True: 0, False: 55.1k]
  ------------------
  278|      0|    {
  279|      0|        TIFFList *const psNext = psCurrent->psNext;
  280|      0|        _TIFFfreeExt(tif, psCurrent);
  281|      0|        psCurrent = psNext;
  282|      0|    }
  283|  55.1k|}
tif_hash_set.c:TIFFHashSetFindPtr:
  423|   110k|{
  424|   110k|    const unsigned long nHashVal =
  425|   110k|        set->fnHashFunc(elt) % (unsigned long)set->nAllocatedSize;
  426|   110k|    TIFFList *cur = set->tabList[nHashVal];
  427|   110k|    while (cur)
  ------------------
  |  Branch (427:12): [True: 0, False: 110k]
  ------------------
  428|      0|    {
  429|      0|        if (set->fnEqualFunc(cur->pData, elt))
  ------------------
  |  Branch (429:13): [True: 0, False: 0]
  ------------------
  430|      0|            return &cur->pData;
  431|      0|        cur = cur->psNext;
  432|      0|    }
  433|   110k|    return NULL;
  434|   110k|}
tif_hash_set.c:TIFFHashSetGetNewListElt:
  203|  55.1k|{
  204|  55.1k|    if (set->psRecyclingList)
  ------------------
  |  Branch (204:9): [True: 0, False: 55.1k]
  ------------------
  205|      0|    {
  206|      0|        TIFFList *psRet = set->psRecyclingList;
  207|      0|        psRet->pData = NULL;
  208|      0|        set->nRecyclingListSize--;
  209|      0|        set->psRecyclingList = psRet->psNext;
  210|      0|        return psRet;
  211|      0|    }
  212|       |
  213|  55.1k|    return (TIFFList *)_TIFFmallocExt(set->tif, sizeof(TIFFList));
  214|  55.1k|}

TIFFInitJBIG:
  241|     19|{
  242|     19|    (void)scheme;
  243|     19|    assert(scheme == COMPRESSION_JBIG);
  ------------------
  |  Branch (243:5): [True: 0, False: 19]
  |  Branch (243:5): [True: 19, 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|     19|    tif->tif_flags |= TIFF_NOBITREV;
  ------------------
  |  |  130|     19|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  251|     19|    tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  133|     19|#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|     19|    if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  148|     19|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (256:9): [True: 0, False: 19]
  ------------------
  257|      0|    {
  258|      0|        tif->tif_rawdata = NULL;
  259|      0|        tif->tif_rawdatasize = 0;
  260|      0|        tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  148|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  261|      0|        tif->tif_flags |= TIFF_MYBUFFER;
  ------------------
  |  |  131|      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|     19|    tif->tif_setupdecode = JBIGSetupDecode;
  266|     19|    tif->tif_decodestrip = JBIGDecode;
  267|       |
  268|     19|    tif->tif_setupencode = JBIGSetupEncode;
  269|     19|    tif->tif_encodestrip = JBIGEncode;
  270|       |
  271|     19|    return 1;
  272|     19|}
tif_jbig.c:JBIGSetupDecode:
   46|     19|{
   47|     19|    if (TIFFNumberOfStrips(tif) != 1)
  ------------------
  |  Branch (47:9): [True: 5, False: 14]
  ------------------
   48|      5|    {
   49|      5|        TIFFErrorExtR(tif, "JBIG",
   50|      5|                      "Multistrip images not supported in decoder");
   51|      5|        return 0;
   52|      5|    }
   53|       |
   54|     14|    return 1;
   55|     19|}
tif_jbig.c:JBIGDecode:
   58|      3|{
   59|      3|    struct jbg_dec_state decoder;
   60|      3|    int decodeStatus = 0;
   61|      3|    unsigned char *pImage = NULL;
   62|      3|    unsigned long decodedSize;
   63|      3|    (void)s;
   64|       |
   65|      3|    if (isFillOrder(tif, tif->tif_dir.td_fillorder))
  ------------------
  |  |  284|      3|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  |  |  ------------------
  |  |  |  Branch (284:29): [True: 2, False: 1]
  |  |  ------------------
  ------------------
   66|      2|    {
   67|      2|        TIFFReverseBits(tif->tif_rawcp, tif->tif_rawcc);
   68|      2|    }
   69|       |
   70|      3|    jbg_dec_init(&decoder);
   71|       |
   72|      3|#if defined(HAVE_JBG_NEWLEN)
   73|      3|    jbg_newlen(tif->tif_rawcp, (size_t)tif->tif_rawcc);
   74|       |    /*
   75|       |     * I do not check the return status of jbg_newlen because even if this
   76|       |     * function fails it does not necessarily mean that decoding the image
   77|       |     * will fail.  It is generally only needed for received fax images
   78|       |     * that do not contain the actual length of the image in the BIE
   79|       |     * header.  I do not log when an error occurs because that will cause
   80|       |     * problems when converting JBIG encoded TIFF's to
   81|       |     * PostScript.  As long as the actual image length is contained in the
   82|       |     * BIE header jbg_dec_in should succeed.
   83|       |     */
   84|      3|#endif /* HAVE_JBG_NEWLEN */
   85|       |
   86|      3|    decodeStatus = jbg_dec_in(&decoder, (unsigned char *)tif->tif_rawcp,
   87|      3|                              (size_t)tif->tif_rawcc, NULL);
   88|      3|    if (JBG_EOK != decodeStatus)
  ------------------
  |  Branch (88:9): [True: 3, False: 0]
  ------------------
   89|      3|    {
   90|       |        /*
   91|       |         * XXX: JBG_EN constant was defined in pre-2.0 releases of the
   92|       |         * JBIG-KIT. Since the 2.0 the error reporting functions were
   93|       |         * changed. We will handle both cases here.
   94|       |         */
   95|      3|        TIFFErrorExtR(tif, "JBIG", "Error (%d) decoding: %s", decodeStatus,
   96|       |#if defined(JBG_EN)
   97|       |                      jbg_strerror(decodeStatus, JBG_EN)
   98|       |#else
   99|      3|                      jbg_strerror(decodeStatus)
  100|      3|#endif
  101|      3|        );
  102|      3|        memset(buffer, 0, (size_t)size);
  103|      3|        jbg_dec_free(&decoder);
  104|      3|        return 0;
  105|      3|    }
  106|       |
  107|      0|    decodedSize = jbg_dec_getsize(&decoder);
  108|      0|    if ((tmsize_t)decodedSize < size)
  ------------------
  |  Branch (108:9): [True: 0, False: 0]
  ------------------
  109|      0|    {
  110|      0|        memset(buffer + decodedSize, 0, (size_t)(size - (tmsize_t)decodedSize));
  111|      0|        TIFFWarningExtR(tif, "JBIG",
  112|      0|                        "Only decoded %lu bytes, whereas %" TIFF_SSIZE_FORMAT
  113|      0|                        " requested",
  114|      0|                        decodedSize, size);
  115|      0|    }
  116|      0|    else if ((tmsize_t)decodedSize > size)
  ------------------
  |  Branch (116:14): [True: 0, False: 0]
  ------------------
  117|      0|    {
  118|      0|        TIFFErrorExtR(tif, "JBIG",
  119|      0|                      "Decoded %lu bytes, whereas %" TIFF_SSIZE_FORMAT
  120|      0|                      " were requested",
  121|      0|                      decodedSize, size);
  122|      0|        jbg_dec_free(&decoder);
  123|      0|        return 0;
  124|      0|    }
  125|      0|    pImage = jbg_dec_getimage(&decoder, 0);
  126|      0|    _TIFFmemcpy(buffer, pImage, (tmsize_t)decodedSize);
  127|      0|    jbg_dec_free(&decoder);
  128|       |
  129|      0|    tif->tif_rawcp += tif->tif_rawcc;
  130|      0|    tif->tif_rawcc = 0;
  131|       |
  132|      0|    return 1;
  133|      0|}

TIFFInitJPEG:
 3023|  6.92k|{
 3024|  6.92k|    JPEGState *sp;
 3025|       |
 3026|  6.92k|    (void)scheme;
 3027|  6.92k|    assert(scheme == COMPRESSION_JPEG);
  ------------------
  |  Branch (3027:5): [True: 0, False: 6.92k]
  |  Branch (3027:5): [True: 6.92k, False: 0]
  ------------------
 3028|       |
 3029|       |    /*
 3030|       |     * Merge codec-specific tag information.
 3031|       |     */
 3032|  6.92k|    if (!_TIFFMergeFields(tif, jpegFields, TIFFArrayCount(jpegFields)))
  ------------------
  |  |  354|  6.92k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (3032:9): [True: 0, False: 6.92k]
  ------------------
 3033|      0|    {
 3034|      0|        TIFFErrorExtR(tif, "TIFFInitJPEG",
 3035|      0|                      "Merging JPEG codec-specific tags failed");
 3036|      0|        return 0;
 3037|      0|    }
 3038|       |
 3039|       |    /*
 3040|       |     * Allocate state block so tag methods have storage to record values.
 3041|       |     */
 3042|  6.92k|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(JPEGState));
 3043|       |
 3044|  6.92k|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (3044:9): [True: 0, False: 6.92k]
  ------------------
 3045|      0|    {
 3046|      0|        TIFFErrorExtR(tif, "TIFFInitJPEG", "No space for JPEG state block");
 3047|      0|        return 0;
 3048|      0|    }
 3049|  6.92k|    _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
 3050|       |
 3051|  6.92k|    sp = JState(tif);
  ------------------
  |  |  208|  6.92k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 3052|       |    /*
 3053|       |     * Override parent get/set field methods.
 3054|       |     */
 3055|  6.92k|    sp->otherSettings.vgetparent = tif->tif_tagmethods.vgetfield;
 3056|  6.92k|    sp->otherSettings.vsetparent = tif->tif_tagmethods.vsetfield;
 3057|  6.92k|    sp->otherSettings.printdir = tif->tif_tagmethods.printdir;
 3058|       |
 3059|  6.92k|    sp->otherSettings.defsparent = tif->tif_defstripsize;
 3060|  6.92k|    sp->otherSettings.deftparent = tif->tif_deftilesize;
 3061|       |
 3062|  6.92k|    TIFFInitJPEGCommon(tif);
 3063|       |
 3064|       |    /*
 3065|       |    ** Create a JPEGTables field if no directory has yet been created.
 3066|       |    ** We do this just to ensure that sufficient space is reserved for
 3067|       |    ** the JPEGTables field.  It will be properly created the right
 3068|       |    ** size later.
 3069|       |    */
 3070|  6.92k|    if (tif->tif_diroff == 0)
  ------------------
  |  Branch (3070:9): [True: 0, False: 6.92k]
  ------------------
 3071|      0|    {
 3072|      0|#define SIZE_OF_JPEGTABLES 2000
 3073|       |        /*
 3074|       |        The following line assumes incorrectly that all JPEG-in-TIFF files will
 3075|       |        have a JPEGTABLES tag generated and causes null-filled JPEGTABLES tags
 3076|       |        to be written when the JPEG data is placed with TIFFWriteRawStrip.  The
 3077|       |        field bit should be set, anyway, later when actual JPEGTABLES header is
 3078|       |        generated, so removing it here hopefully is harmless.
 3079|       |        TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
 3080|       |        */
 3081|      0|        sp->otherSettings.jpegtables_length = SIZE_OF_JPEGTABLES;
  ------------------
  |  | 3072|      0|#define SIZE_OF_JPEGTABLES 2000
  ------------------
 3082|      0|        sp->otherSettings.jpegtables =
 3083|      0|            (void *)_TIFFmallocExt(tif, sp->otherSettings.jpegtables_length);
 3084|      0|        if (sp->otherSettings.jpegtables)
  ------------------
  |  Branch (3084:13): [True: 0, False: 0]
  ------------------
 3085|      0|        {
 3086|      0|            _TIFFmemset(sp->otherSettings.jpegtables, 0, SIZE_OF_JPEGTABLES);
  ------------------
  |  | 3072|      0|#define SIZE_OF_JPEGTABLES 2000
  ------------------
 3087|      0|        }
 3088|      0|        else
 3089|      0|        {
 3090|      0|            TIFFErrorExtR(tif, "TIFFInitJPEG",
 3091|      0|                          "Failed to allocate memory for JPEG tables");
 3092|      0|            return 0;
 3093|      0|        }
 3094|      0|#undef SIZE_OF_JPEGTABLES
 3095|      0|    }
 3096|  6.92k|    return 1;
 3097|  6.92k|}
tif_jpeg.c:TIFFjpeg_create_decompress:
  318|  4.42k|{
  319|       |    /* initialize JPEG error handling */
  320|  4.42k|    sp->cinfo.d.err = jpeg_std_error(&sp->err);
  321|  4.42k|    sp->err.error_exit = TIFFjpeg_error_exit;
  322|  4.42k|    sp->err.output_message = TIFFjpeg_output_message;
  323|       |
  324|       |    /* set client_data to avoid UMR warning from tools like Purify */
  325|  4.42k|    sp->cinfo.d.client_data = NULL;
  326|       |
  327|       |    return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|  4.42k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  4.42k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  4.42k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (327:12): [True: 0, False: 4.42k]
  ------------------
  328|  4.42k|}
tif_jpeg.c:TIFFjpeg_error_exit:
  244|   150k|{
  245|   150k|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  246|   150k|    char buffer[JMSG_LENGTH_MAX];
  247|       |
  248|   150k|    (*cinfo->err->format_message)(cinfo, buffer);
  249|   150k|    TIFFErrorExtR(sp->tif, "JPEGLib", "%s",
  250|   150k|                  buffer);       /* display the error message */
  251|   150k|    jpeg_abort(cinfo);           /* clean up libjpeg state */
  252|   150k|    LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|   150k|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  253|   150k|}
tif_jpeg.c:TIFFjpeg_output_message:
  261|  84.7k|{
  262|  84.7k|    char buffer[JMSG_LENGTH_MAX];
  263|       |
  264|  84.7k|    (*cinfo->err->format_message)(cinfo, buffer);
  265|  84.7k|    TIFFWarningExtR(((JPEGState *)cinfo)->tif, "JPEGLib", "%s", buffer);
  266|  84.7k|}
tif_jpeg.c:TIFFjpeg_data_src:
  744|  4.51k|{
  745|  4.51k|    sp->cinfo.d.src = &sp->src;
  746|  4.51k|    sp->src.init_source = std_init_source;
  747|  4.51k|    sp->src.fill_input_buffer = std_fill_input_buffer;
  748|  4.51k|    sp->src.skip_input_data = std_skip_input_data;
  749|  4.51k|    sp->src.resync_to_restart = jpeg_resync_to_restart;
  750|  4.51k|    sp->src.term_source = std_term_source;
  751|  4.51k|    sp->src.bytes_in_buffer = 0; /* for safety */
  752|       |    sp->src.next_input_byte = NULL;
  753|  4.51k|}
tif_jpeg.c:std_init_source:
  674|   184k|{
  675|   184k|    JPEGState *sp = (JPEGState *)cinfo;
  676|   184k|    TIFF *tif = sp->tif;
  677|       |
  678|   184k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
  679|   184k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
  680|   184k|}
tif_jpeg.c:std_fill_input_buffer:
  683|   222k|{
  684|   222k|    JPEGState *sp = (JPEGState *)cinfo;
  685|   222k|    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|   222k|    WARNMS(cinfo, JWRN_JPEG_EOF);
  712|       |    /* insert a fake EOI marker */
  713|   222k|    sp->src.next_input_byte = dummy_EOI;
  714|   222k|    sp->src.bytes_in_buffer = 2;
  715|   222k|    return (TRUE);
  ------------------
  |  |   74|   222k|#define TRUE 1
  ------------------
  716|   222k|}
tif_jpeg.c:std_skip_input_data:
  719|  14.6k|{
  720|  14.6k|    JPEGState *sp = (JPEGState *)cinfo;
  721|       |
  722|  14.6k|    if (num_bytes > 0)
  ------------------
  |  Branch (722:9): [True: 14.6k, False: 0]
  ------------------
  723|  14.6k|    {
  724|  14.6k|        if ((size_t)num_bytes > sp->src.bytes_in_buffer)
  ------------------
  |  Branch (724:13): [True: 7.12k, False: 7.47k]
  ------------------
  725|  7.12k|        {
  726|       |            /* oops, buffer overrun */
  727|  7.12k|            (void)std_fill_input_buffer(cinfo);
  728|  7.12k|        }
  729|  7.47k|        else
  730|  7.47k|        {
  731|  7.47k|            sp->src.next_input_byte += (size_t)num_bytes;
  732|  7.47k|            sp->src.bytes_in_buffer -= (size_t)num_bytes;
  733|  7.47k|        }
  734|  14.6k|    }
  735|  14.6k|}
tif_jpeg.c:std_term_source:
  738|  30.2k|{
  739|       |    /* No work necessary here */
  740|  30.2k|    (void)cinfo;
  741|  30.2k|}
tif_jpeg.c:TIFFjpeg_read_header:
  396|   184k|{
  397|       |    return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
  ------------------
  |  |  301|   184k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|   184k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (397:12): [True: 133k, False: 50.8k]
  ------------------
  398|   184k|}
tif_jpeg.c:TIFFjpeg_destroy:
  525|  4.42k|{
  526|       |    return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
  ------------------
  |  |  302|  4.42k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  4.42k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  4.42k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (526:12): [True: 0, False: 4.42k]
  ------------------
  527|  4.42k|}
tif_jpeg.c:TIFFjpeg_has_multiple_scans:
  401|  47.6k|{
  402|       |    return CALLJPEG(sp, 0, jpeg_has_multiple_scans(&sp->cinfo.d));
  ------------------
  |  |  301|  47.6k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  47.6k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (402:12): [True: 0, False: 47.6k]
  ------------------
  403|  47.6k|}
tif_jpeg.c:TIFFInitJPEGCommon:
 2979|  6.92k|{
 2980|  6.92k|    JPEGState *sp;
 2981|       |
 2982|  6.92k|    sp = JState(tif);
  ------------------
  |  |  208|  6.92k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2983|  6.92k|    sp->tif = tif; /* back link */
 2984|       |
 2985|       |    /* Default values for codec-specific fields */
 2986|  6.92k|    sp->otherSettings.jpegtables = NULL;
 2987|  6.92k|    sp->otherSettings.jpegtables_length = 0;
 2988|  6.92k|    sp->otherSettings.jpegquality = 75; /* Default IJG quality */
 2989|  6.92k|    sp->otherSettings.jpegcolormode = JPEGCOLORMODE_RAW;
  ------------------
  |  |  707|  6.92k|#define JPEGCOLORMODE_RAW 0x0000     /* no conversion (default) */
  ------------------
 2990|  6.92k|    sp->otherSettings.jpegtablesmode =
 2991|  6.92k|        JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  710|  6.92k|#define JPEGTABLESMODE_QUANT 0x0001  /* include quantization tbls */
  ------------------
                      JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  711|  6.92k|#define JPEGTABLESMODE_HUFF 0x0002   /* include Huffman tbls */
  ------------------
 2992|  6.92k|    sp->otherSettings.ycbcrsampling_fetched = 0;
 2993|       |
 2994|  6.92k|    tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
 2995|  6.92k|    tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
 2996|  6.92k|    tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
 2997|       |
 2998|       |    /*
 2999|       |     * Install codec methods.
 3000|       |     */
 3001|  6.92k|    tif->tif_fixuptags = JPEGFixupTags;
 3002|  6.92k|    tif->tif_setupdecode = JPEGSetupDecode;
 3003|  6.92k|    tif->tif_predecode = JPEGPreDecode;
 3004|  6.92k|    tif->tif_decoderow = JPEGDecode;
 3005|  6.92k|    tif->tif_decodestrip = JPEGDecode;
 3006|  6.92k|    tif->tif_decodetile = JPEGDecode;
 3007|  6.92k|    tif->tif_setupencode = JPEGSetupEncode;
 3008|  6.92k|    tif->tif_preencode = JPEGPreEncode;
 3009|  6.92k|    tif->tif_postencode = JPEGPostEncode;
 3010|  6.92k|    tif->tif_encoderow = JPEGEncode;
 3011|  6.92k|    tif->tif_encodestrip = JPEGEncode;
 3012|  6.92k|    tif->tif_encodetile = JPEGEncode;
 3013|  6.92k|    tif->tif_getmaxcompressionratio = JPEGGetMaxCompressionRatio;
 3014|  6.92k|    tif->tif_cleanup = JPEGCleanup;
 3015|       |
 3016|  6.92k|    tif->tif_defstripsize = JPEGDefaultStripSize;
 3017|  6.92k|    tif->tif_deftilesize = JPEGDefaultTileSize;
 3018|  6.92k|    tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
  ------------------
  |  |  130|  6.92k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 3019|  6.92k|    sp->cinfo_initialized = FALSE;
  ------------------
  |  |   75|  6.92k|#define FALSE 0
  ------------------
 3020|  6.92k|}
tif_jpeg.c:JPEGVGetField:
 2806|  61.8k|{
 2807|  61.8k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  61.8k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2808|       |
 2809|  61.8k|    assert(sp != NULL);
  ------------------
  |  Branch (2809:5): [True: 0, False: 61.8k]
  |  Branch (2809:5): [True: 61.8k, False: 0]
  ------------------
 2810|       |
 2811|  61.8k|    switch (tag)
 2812|  61.8k|    {
 2813|      0|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|      0|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (2813:9): [True: 0, False: 61.8k]
  ------------------
 2814|      0|            *va_arg(ap, uint32_t *) = sp->otherSettings.jpegtables_length;
 2815|      0|            *va_arg(ap, const void **) = sp->otherSettings.jpegtables;
 2816|      0|            break;
 2817|      0|        case TIFFTAG_JPEGQUALITY:
  ------------------
  |  |  704|      0|#define TIFFTAG_JPEGQUALITY 65537    /* Compression quality level */
  ------------------
  |  Branch (2817:9): [True: 0, False: 61.8k]
  ------------------
 2818|      0|            *va_arg(ap, int *) = sp->otherSettings.jpegquality;
 2819|      0|            break;
 2820|      0|        case TIFFTAG_JPEGCOLORMODE:
  ------------------
  |  |  706|      0|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  |  Branch (2820:9): [True: 0, False: 61.8k]
  ------------------
 2821|      0|            *va_arg(ap, int *) = sp->otherSettings.jpegcolormode;
 2822|      0|            break;
 2823|      0|        case TIFFTAG_JPEGTABLESMODE:
  ------------------
  |  |  709|      0|#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
  ------------------
  |  Branch (2823:9): [True: 0, False: 61.8k]
  ------------------
 2824|      0|            *va_arg(ap, int *) = sp->otherSettings.jpegtablesmode;
 2825|      0|            break;
 2826|  61.8k|        default:
  ------------------
  |  Branch (2826:9): [True: 61.8k, False: 0]
  ------------------
 2827|  61.8k|            return (*sp->otherSettings.vgetparent)(tif, tag, ap);
 2828|  61.8k|    }
 2829|      0|    return (1);
 2830|  61.8k|}
tif_jpeg.c:JPEGVSetField:
 2746|  38.2k|{
 2747|  38.2k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  38.2k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2748|  38.2k|    const TIFFField *fip;
 2749|  38.2k|    uint32_t v32;
 2750|       |
 2751|  38.2k|    assert(sp != NULL);
  ------------------
  |  Branch (2751:5): [True: 0, False: 38.2k]
  |  Branch (2751:5): [True: 38.2k, False: 0]
  ------------------
 2752|       |
 2753|  38.2k|    switch (tag)
 2754|  38.2k|    {
 2755|    520|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|    520|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (2755:9): [True: 520, False: 37.7k]
  ------------------
 2756|    520|            v32 = (uint32_t)va_arg(ap, uint32_t);
 2757|    520|            if (v32 == 0)
  ------------------
  |  Branch (2757:17): [True: 6, False: 514]
  ------------------
 2758|      6|            {
 2759|       |                /* XXX */
 2760|      6|                return (0);
 2761|      6|            }
 2762|    514|            _TIFFsetByteArrayExt(tif, &sp->otherSettings.jpegtables,
 2763|    514|                                 va_arg(ap, void *), v32);
 2764|    514|            sp->otherSettings.jpegtables_length = v32;
 2765|    514|            TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
  ------------------
  |  |  268|    514|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|    514|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|    514|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 2766|    514|            break;
 2767|      0|        case TIFFTAG_JPEGQUALITY:
  ------------------
  |  |  704|      0|#define TIFFTAG_JPEGQUALITY 65537    /* Compression quality level */
  ------------------
  |  Branch (2767:9): [True: 0, False: 38.2k]
  ------------------
 2768|      0|            sp->otherSettings.jpegquality = (int)va_arg(ap, int);
 2769|      0|            return (1); /* pseudo tag */
 2770|  1.65k|        case TIFFTAG_JPEGCOLORMODE:
  ------------------
  |  |  706|  1.65k|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  |  Branch (2770:9): [True: 1.65k, False: 36.5k]
  ------------------
 2771|  1.65k|            sp->otherSettings.jpegcolormode = (int)va_arg(ap, int);
 2772|  1.65k|            JPEGResetUpsampled(tif);
 2773|  1.65k|            return (1); /* pseudo tag */
 2774|  3.12k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  3.12k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (2774:9): [True: 3.12k, False: 35.1k]
  ------------------
 2775|  3.12k|        {
 2776|  3.12k|            int ret_value = (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2777|  3.12k|            JPEGResetUpsampled(tif);
 2778|  3.12k|            return ret_value;
 2779|    520|        }
 2780|      0|        case TIFFTAG_JPEGTABLESMODE:
  ------------------
  |  |  709|      0|#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
  ------------------
  |  Branch (2780:9): [True: 0, False: 38.2k]
  ------------------
 2781|      0|            sp->otherSettings.jpegtablesmode = (int)va_arg(ap, int);
 2782|      0|            return (1); /* pseudo tag */
 2783|      2|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|      2|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (2783:9): [True: 2, False: 38.2k]
  ------------------
 2784|       |            /* mark the fact that we have a real ycbcrsubsampling! */
 2785|      2|            sp->otherSettings.ycbcrsampling_fetched = 1;
 2786|       |            /* should we be recomputing upsampling info here? */
 2787|      2|            return (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2788|  32.9k|        default:
  ------------------
  |  Branch (2788:9): [True: 32.9k, False: 5.29k]
  ------------------
 2789|  32.9k|            return (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2790|  38.2k|    }
 2791|       |
 2792|    514|    if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
  ------------------
  |  Branch (2792:9): [True: 514, False: 0]
  ------------------
 2793|    514|    {
 2794|    514|        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  268|    514|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|    514|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|    514|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 2795|    514|    }
 2796|      0|    else
 2797|      0|    {
 2798|      0|        return (0);
 2799|      0|    }
 2800|       |
 2801|    514|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  125|    514|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 2802|    514|    return (1);
 2803|    514|}
tif_jpeg.c:JPEGResetUpsampled:
 2707|  4.77k|{
 2708|  4.77k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  4.77k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2709|  4.77k|    TIFFDirectory *td = &tif->tif_dir;
 2710|       |
 2711|       |    /*
 2712|       |     * Mark whether returned data is up-sampled or not so TIFFStripSize
 2713|       |     * and TIFFTileSize return values that reflect the true amount of
 2714|       |     * data.
 2715|       |     */
 2716|  4.77k|    tif->tif_flags &= ~TIFF_UPSAMPLED;
  ------------------
  |  |  136|  4.77k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  ------------------
 2717|  4.77k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  4.77k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (2717:9): [True: 4.70k, False: 74]
  ------------------
 2718|  4.70k|    {
 2719|  4.70k|        if (td->td_photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  9.40k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (2719:13): [True: 4.63k, False: 70]
  ------------------
 2720|  4.63k|            sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|  4.63k|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (2720:13): [True: 1.65k, False: 2.97k]
  ------------------
 2721|  1.65k|        {
 2722|  1.65k|            tif->tif_flags |= TIFF_UPSAMPLED;
  ------------------
  |  |  136|  1.65k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  ------------------
 2723|  1.65k|        }
 2724|  3.04k|        else
 2725|  3.04k|        {
 2726|       |#ifdef notdef
 2727|       |            if (td->td_ycbcrsubsampling[0] != 1 ||
 2728|       |                td->td_ycbcrsubsampling[1] != 1)
 2729|       |                ; /* XXX what about up-sampling? */
 2730|       |#endif
 2731|  3.04k|        }
 2732|  4.70k|    }
 2733|       |
 2734|       |    /*
 2735|       |     * Must recalculate cached tile size in case sampling state changed.
 2736|       |     * Should we really be doing this now if image size isn't set?
 2737|       |     */
 2738|  4.77k|    if (tif->tif_dir.td_tilesize > 0)
  ------------------
  |  Branch (2738:9): [True: 1.64k, False: 3.13k]
  ------------------
 2739|  1.64k|        tif->tif_dir.td_tilesize =
 2740|  1.64k|            isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
  ------------------
  |  |  282|  1.64k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  1.64k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 1.64k, False: 0]
  |  |  ------------------
  ------------------
 2741|  4.77k|    if (tif->tif_dir.td_scanlinesize > 0)
  ------------------
  |  Branch (2741:9): [True: 1.65k, False: 3.12k]
  ------------------
 2742|  1.65k|        tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 2743|  4.77k|}
tif_jpeg.c:JPEGFixupTags:
  849|  6.83k|{
  850|  6.83k|#ifdef CHECK_JPEG_YCBCR_SUBSAMPLING
  851|  6.83k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  6.83k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
  852|  6.83k|    if ((tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|  6.83k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (852:9): [True: 2.97k, False: 3.86k]
  ------------------
  853|  2.97k|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|  2.97k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (853:9): [True: 2.97k, False: 2]
  ------------------
  854|  2.97k|        (tif->tif_dir.td_samplesperpixel == 3) &&
  ------------------
  |  Branch (854:9): [True: 2.95k, False: 19]
  ------------------
  855|  2.95k|        !sp->otherSettings.ycbcrsampling_fetched)
  ------------------
  |  Branch (855:9): [True: 2.95k, False: 1]
  ------------------
  856|  2.95k|        JPEGFixupTagsSubsampling(tif);
  857|  6.83k|#endif
  858|       |
  859|  6.83k|    return (1);
  860|  6.83k|}
tif_jpeg.c:JPEGFixupTagsSubsampling:
  865|  2.95k|{
  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|  2.95k|    static const char module[] = "JPEGFixupTagsSubsampling";
  887|  2.95k|    struct JPEGFixupTagsSubsamplingData m;
  888|  2.95k|    uint64_t fileoffset = TIFFGetStrileOffset(tif, 0);
  889|       |
  890|  2.95k|    if (fileoffset == 0)
  ------------------
  |  Branch (890:9): [True: 9, False: 2.94k]
  ------------------
  891|      9|    {
  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|      9|        return;
  896|      9|    }
  897|       |
  898|  2.94k|    m.tif = tif;
  899|  2.94k|    m.buffersize = 2048;
  900|  2.94k|    m.buffer = _TIFFmallocExt(tif, m.buffersize);
  901|  2.94k|    if (m.buffer == NULL)
  ------------------
  |  Branch (901:9): [True: 0, False: 2.94k]
  ------------------
  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|  2.94k|    m.buffercurrentbyte = NULL;
  909|  2.94k|    m.bufferbytesleft = 0;
  910|  2.94k|    m.fileoffset = fileoffset;
  911|  2.94k|    m.filepositioned = 0;
  912|  2.94k|    m.filebytesleft = TIFFGetStrileByteCount(tif, 0);
  913|  2.94k|    if (!JPEGFixupTagsSubsamplingSec(&m))
  ------------------
  |  Branch (913:9): [True: 1.61k, False: 1.33k]
  ------------------
  914|  1.61k|        TIFFWarningExtR(
  915|  1.61k|            tif, module,
  916|  1.61k|            "Unable to auto-correct subsampling values, likely corrupt JPEG "
  917|  1.61k|            "compressed data in first strip/tile; auto-correcting skipped");
  918|  2.94k|    _TIFFfreeExt(tif, m.buffer);
  919|  2.94k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSec:
  923|  2.94k|{
  924|  2.94k|    static const char module[] = "JPEGFixupTagsSubsamplingSec";
  925|  2.94k|    uint8_t m;
  926|   169k|    while (1)
  ------------------
  |  Branch (926:12): [True: 169k, Folded]
  ------------------
  927|   169k|    {
  928|  3.25M|        while (1)
  ------------------
  |  Branch (928:16): [True: 3.25M, Folded]
  ------------------
  929|  3.25M|        {
  930|  3.25M|            if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (930:17): [True: 406, False: 3.25M]
  ------------------
  931|    406|                return (0);
  932|  3.25M|            if (m == 255)
  ------------------
  |  Branch (932:17): [True: 168k, False: 3.08M]
  ------------------
  933|   168k|                break;
  934|  3.25M|        }
  935|   916k|        while (1)
  ------------------
  |  Branch (935:16): [True: 916k, Folded]
  ------------------
  936|   916k|        {
  937|   916k|            if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (937:17): [True: 104, False: 916k]
  ------------------
  938|    104|                return (0);
  939|   916k|            if (m != 255)
  ------------------
  |  Branch (939:17): [True: 168k, False: 747k]
  ------------------
  940|   168k|                break;
  941|   916k|        }
  942|   168k|        switch (m)
  943|   168k|        {
  944|  4.70k|            case JPEG_MARKER_SOI:
  ------------------
  |  |  816|  4.70k|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (944:13): [True: 4.70k, False: 164k]
  ------------------
  945|       |                /* this type of marker has no data and should be skipped */
  946|  4.70k|                break;
  947|  1.51k|            case JPEG_MARKER_COM:
  ------------------
  |  |  821|  1.51k|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (947:13): [True: 1.51k, False: 167k]
  ------------------
  948|  5.96k|            case JPEG_MARKER_APP0:
  ------------------
  |  |  820|  5.96k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (948:13): [True: 4.45k, False: 164k]
  ------------------
  949|  11.0k|            case JPEG_MARKER_APP0 + 1:
  ------------------
  |  |  820|  11.0k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (949:13): [True: 5.12k, False: 163k]
  ------------------
  950|  11.5k|            case JPEG_MARKER_APP0 + 2:
  ------------------
  |  |  820|  11.5k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (950:13): [True: 469, False: 168k]
  ------------------
  951|  11.8k|            case JPEG_MARKER_APP0 + 3:
  ------------------
  |  |  820|  11.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (951:13): [True: 321, False: 168k]
  ------------------
  952|  30.8k|            case JPEG_MARKER_APP0 + 4:
  ------------------
  |  |  820|  30.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (952:13): [True: 19.0k, False: 149k]
  ------------------
  953|  31.0k|            case JPEG_MARKER_APP0 + 5:
  ------------------
  |  |  820|  31.0k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (953:13): [True: 201, False: 168k]
  ------------------
  954|  33.6k|            case JPEG_MARKER_APP0 + 6:
  ------------------
  |  |  820|  33.6k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (954:13): [True: 2.52k, False: 166k]
  ------------------
  955|  33.9k|            case JPEG_MARKER_APP0 + 7:
  ------------------
  |  |  820|  33.9k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (955:13): [True: 356, False: 168k]
  ------------------
  956|  36.9k|            case JPEG_MARKER_APP0 + 8:
  ------------------
  |  |  820|  36.9k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (956:13): [True: 2.95k, False: 165k]
  ------------------
  957|  37.1k|            case JPEG_MARKER_APP0 + 9:
  ------------------
  |  |  820|  37.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (957:13): [True: 226, False: 168k]
  ------------------
  958|  40.2k|            case JPEG_MARKER_APP0 + 10:
  ------------------
  |  |  820|  40.2k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (958:13): [True: 3.09k, False: 165k]
  ------------------
  959|  45.7k|            case JPEG_MARKER_APP0 + 11:
  ------------------
  |  |  820|  45.7k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (959:13): [True: 5.53k, False: 163k]
  ------------------
  960|  46.7k|            case JPEG_MARKER_APP0 + 12:
  ------------------
  |  |  820|  46.7k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (960:13): [True: 981, False: 167k]
  ------------------
  961|  64.9k|            case JPEG_MARKER_APP0 + 13:
  ------------------
  |  |  820|  64.9k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (961:13): [True: 18.1k, False: 150k]
  ------------------
  962|  69.0k|            case JPEG_MARKER_APP0 + 14:
  ------------------
  |  |  820|  69.0k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (962:13): [True: 4.13k, False: 164k]
  ------------------
  963|  73.8k|            case JPEG_MARKER_APP0 + 15:
  ------------------
  |  |  820|  73.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (963:13): [True: 4.78k, False: 163k]
  ------------------
  964|  75.6k|            case JPEG_MARKER_DQT:
  ------------------
  |  |  818|  75.6k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (964:13): [True: 1.84k, False: 166k]
  ------------------
  965|  75.8k|            case JPEG_MARKER_SOS:
  ------------------
  |  |  817|  75.8k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (965:13): [True: 201, False: 168k]
  ------------------
  966|   161k|            case JPEG_MARKER_DHT:
  ------------------
  |  |  815|   161k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (966:13): [True: 85.8k, False: 82.9k]
  ------------------
  967|   161k|            case JPEG_MARKER_DRI:
  ------------------
  |  |  819|   161k|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (967:13): [True: 244, False: 168k]
  ------------------
  968|       |                /* this type of marker has data, but it has no use to us and
  969|       |                 * should be skipped */
  970|   161k|                {
  971|   161k|                    uint16_t n;
  972|   161k|                    if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (972:25): [True: 337, False: 161k]
  ------------------
  973|    337|                        return (0);
  974|   161k|                    if (n < 2)
  ------------------
  |  Branch (974:25): [True: 24, False: 161k]
  ------------------
  975|     24|                        return (0);
  976|   161k|                    n = (uint16_t)(n - 2);
  977|   161k|                    if (n > 0)
  ------------------
  |  Branch (977:25): [True: 144k, False: 17.4k]
  ------------------
  978|   144k|                        JPEGFixupTagsSubsamplingSkip(data, n);
  979|   161k|                }
  980|      0|                break;
  981|    524|            case JPEG_MARKER_SOF0:  /* Baseline sequential Huffman */
  ------------------
  |  |  810|    524|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (981:13): [True: 524, False: 168k]
  ------------------
  982|    561|            case JPEG_MARKER_SOF1:  /* Extended sequential Huffman */
  ------------------
  |  |  811|    561|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (982:13): [True: 37, False: 168k]
  ------------------
  983|    870|            case JPEG_MARKER_SOF2:  /* Progressive Huffman: normally not allowed
  ------------------
  |  |  812|    870|#define JPEG_MARKER_SOF2 0xC2
  ------------------
  |  Branch (983:13): [True: 309, False: 168k]
  ------------------
  984|       |                                       by  TechNote, but that doesn't hurt
  985|       |                                       supporting it */
  986|  1.37k|            case JPEG_MARKER_SOF9:  /* Extended sequential arithmetic */
  ------------------
  |  |  813|  1.37k|#define JPEG_MARKER_SOF9 0xC9
  ------------------
  |  Branch (986:13): [True: 503, False: 168k]
  ------------------
  987|  1.80k|            case JPEG_MARKER_SOF10: /* Progressive arithmetic: normally not
  ------------------
  |  |  814|  1.80k|#define JPEG_MARKER_SOF10 0xCA
  ------------------
  |  Branch (987:13): [True: 432, False: 168k]
  ------------------
  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|  1.80k|                {
  993|  1.80k|                    uint16_t n;
  994|  1.80k|                    uint16_t o;
  995|  1.80k|                    uint8_t p;
  996|  1.80k|                    uint8_t ph, pv;
  997|  1.80k|                    if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (997:25): [True: 177, False: 1.62k]
  ------------------
  998|    177|                        return (0);
  999|  1.62k|                    if (n != 8 + data->tif->tif_dir.td_samplesperpixel * 3)
  ------------------
  |  Branch (999:25): [True: 28, False: 1.60k]
  ------------------
 1000|     28|                        return (0);
 1001|  1.60k|                    JPEGFixupTagsSubsamplingSkip(data, 7);
 1002|  1.60k|                    if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (1002:25): [True: 130, False: 1.47k]
  ------------------
 1003|    130|                        return (0);
 1004|  1.47k|                    ph = (p >> 4);
 1005|  1.47k|                    pv = (p & 15);
 1006|  1.47k|                    JPEGFixupTagsSubsamplingSkip(data, 1);
 1007|  4.08k|                    for (o = 1; o < data->tif->tif_dir.td_samplesperpixel; o++)
  ------------------
  |  Branch (1007:33): [True: 2.78k, False: 1.29k]
  ------------------
 1008|  2.78k|                    {
 1009|  2.78k|                        JPEGFixupTagsSubsamplingSkip(data, 1);
 1010|  2.78k|                        if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (1010:29): [True: 140, False: 2.64k]
  ------------------
 1011|    140|                            return (0);
 1012|  2.64k|                        if (p != 0x11)
  ------------------
  |  Branch (1012:29): [True: 31, False: 2.61k]
  ------------------
 1013|     31|                        {
 1014|     31|                            TIFFWarningExtR(data->tif, module,
 1015|     31|                                            "Subsampling values inside JPEG "
 1016|     31|                                            "compressed data "
 1017|     31|                                            "have no TIFF equivalent, "
 1018|     31|                                            "auto-correction of TIFF "
 1019|     31|                                            "subsampling values failed");
 1020|     31|                            return (1);
 1021|     31|                        }
 1022|  2.61k|                        JPEGFixupTagsSubsamplingSkip(data, 1);
 1023|  2.61k|                    }
 1024|  1.29k|                    if (((ph != 1) && (ph != 2) && (ph != 4)) ||
  ------------------
  |  Branch (1024:26): [True: 1.21k, False: 86]
  |  Branch (1024:39): [True: 141, False: 1.07k]
  |  Branch (1024:52): [True: 2, False: 139]
  ------------------
 1025|  1.29k|                        ((pv != 1) && (pv != 2) && (pv != 4)))
  ------------------
  |  Branch (1025:26): [True: 1.08k, False: 210]
  |  Branch (1025:39): [True: 82, False: 1.00k]
  |  Branch (1025:52): [True: 1, False: 81]
  ------------------
 1026|      3|                    {
 1027|      3|                        TIFFWarningExtR(data->tif, module,
 1028|      3|                                        "Subsampling values inside JPEG "
 1029|      3|                                        "compressed data have no TIFF "
 1030|      3|                                        "equivalent, auto-correction of TIFF "
 1031|      3|                                        "subsampling values failed");
 1032|      3|                        return (1);
 1033|      3|                    }
 1034|  1.29k|                    if ((ph != data->tif->tif_dir.td_ycbcrsubsampling[0]) ||
  ------------------
  |  Branch (1034:25): [True: 224, False: 1.07k]
  ------------------
 1035|  1.07k|                        (pv != data->tif->tif_dir.td_ycbcrsubsampling[1]))
  ------------------
  |  Branch (1035:25): [True: 150, False: 922]
  ------------------
 1036|    374|                    {
 1037|    374|                        TIFFWarningExtR(
 1038|    374|                            data->tif, module,
 1039|    374|                            "Auto-corrected former TIFF subsampling values "
 1040|    374|                            "[%" PRIu16 ",%" PRIu16
 1041|    374|                            "] to match subsampling values inside JPEG "
 1042|    374|                            "compressed data [%" PRIu8 ",%" PRIu8 "]",
 1043|    374|                            data->tif->tif_dir.td_ycbcrsubsampling[0],
 1044|    374|                            data->tif->tif_dir.td_ycbcrsubsampling[1], ph, pv);
 1045|    374|                        data->tif->tif_dir.td_ycbcrsubsampling[0] = ph;
 1046|    374|                        data->tif->tif_dir.td_ycbcrsubsampling[1] = pv;
 1047|    374|                    }
 1048|  1.29k|                }
 1049|      0|                return (1);
 1050|    265|            default:
  ------------------
  |  Branch (1050:13): [True: 265, False: 168k]
  ------------------
 1051|    265|                return (0);
 1052|   168k|        }
 1053|   168k|    }
 1054|  2.94k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadByte:
 1059|  4.49M|{
 1060|  4.49M|    if (data->bufferbytesleft == 0)
  ------------------
  |  Branch (1060:9): [True: 6.43k, False: 4.49M]
  ------------------
 1061|  6.43k|    {
 1062|  6.43k|        uint32_t m;
 1063|  6.43k|        if (data->filebytesleft == 0)
  ------------------
  |  Branch (1063:13): [True: 349, False: 6.08k]
  ------------------
 1064|    349|            return (0);
 1065|  6.08k|        if (!data->filepositioned)
  ------------------
  |  Branch (1065:13): [True: 3.58k, False: 2.49k]
  ------------------
 1066|  3.58k|        {
 1067|  3.58k|            if (TIFFSeekFile(data->tif, data->fileoffset, SEEK_SET) ==
  ------------------
  |  |  291|  3.58k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
  |  Branch (1067:17): [True: 1, False: 3.58k]
  ------------------
 1068|  3.58k|                (toff_t)-1)
 1069|      1|            {
 1070|      1|                return 0;
 1071|      1|            }
 1072|  3.58k|            data->filepositioned = 1;
 1073|  3.58k|        }
 1074|  6.08k|        m = data->buffersize;
 1075|  6.08k|        if ((uint64_t)m > data->filebytesleft)
  ------------------
  |  Branch (1075:13): [True: 1.94k, False: 4.13k]
  ------------------
 1076|  1.94k|            m = (uint32_t)data->filebytesleft;
 1077|  6.08k|        assert(m < 0x80000000UL);
  ------------------
  |  Branch (1077:9): [True: 0, False: 6.08k]
  |  Branch (1077:9): [True: 6.08k, False: 0]
  ------------------
 1078|  6.08k|        if (TIFFReadFile(data->tif, data->buffer, (tmsize_t)m) != (tmsize_t)m)
  ------------------
  |  |  287|  6.08k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  |  Branch (1078:13): [True: 944, False: 5.13k]
  ------------------
 1079|    944|            return (0);
 1080|  5.13k|        data->buffercurrentbyte = (uint8_t *)data->buffer;
 1081|  5.13k|        data->bufferbytesleft = m;
 1082|  5.13k|        data->fileoffset += m;
 1083|  5.13k|        data->filebytesleft -= m;
 1084|  5.13k|    }
 1085|  4.49M|    *result = *data->buffercurrentbyte;
 1086|  4.49M|    data->buffercurrentbyte++;
 1087|  4.49M|    data->bufferbytesleft--;
 1088|  4.49M|    return (1);
 1089|  4.49M|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadWord:
 1094|   163k|{
 1095|   163k|    uint8_t ma;
 1096|   163k|    uint8_t mb;
 1097|   163k|    if (!JPEGFixupTagsSubsamplingReadByte(data, &ma))
  ------------------
  |  Branch (1097:9): [True: 306, False: 163k]
  ------------------
 1098|    306|        return (0);
 1099|   163k|    if (!JPEGFixupTagsSubsamplingReadByte(data, &mb))
  ------------------
  |  Branch (1099:9): [True: 208, False: 163k]
  ------------------
 1100|    208|        return (0);
 1101|   163k|    *result = (uint16_t)((ma << 8) | mb);
 1102|   163k|    return (1);
 1103|   163k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSkip:
 1108|   152k|{
 1109|   152k|    if ((uint32_t)skiplength <= data->bufferbytesleft)
  ------------------
  |  Branch (1109:9): [True: 151k, False: 917]
  ------------------
 1110|   151k|    {
 1111|   151k|        data->buffercurrentbyte += skiplength;
 1112|   151k|        data->bufferbytesleft -= skiplength;
 1113|   151k|    }
 1114|    917|    else
 1115|    917|    {
 1116|    917|        uint16_t m;
 1117|    917|        m = (uint16_t)(skiplength - data->bufferbytesleft);
 1118|    917|        if (m <= data->filebytesleft)
  ------------------
  |  Branch (1118:13): [True: 835, False: 82]
  ------------------
 1119|    835|        {
 1120|    835|            data->bufferbytesleft = 0;
 1121|    835|            data->fileoffset += m;
 1122|    835|            data->filebytesleft -= m;
 1123|    835|            data->filepositioned = 0;
 1124|    835|        }
 1125|     82|        else
 1126|     82|        {
 1127|     82|            data->bufferbytesleft = 0;
 1128|     82|            data->filebytesleft = 0;
 1129|     82|        }
 1130|    917|    }
 1131|   152k|}
tif_jpeg.c:JPEGSetupDecode:
 1136|  5.48k|{
 1137|  5.48k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  5.48k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1138|  5.48k|    TIFFDirectory *td = &tif->tif_dir;
 1139|       |
 1140|  5.48k|#if defined(JPEG_DUAL_MODE_8_12) && !defined(FROM_TIF_JPEG_12)
 1141|  5.48k|    if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (1141:9): [True: 1.05k, False: 4.42k]
  ------------------
 1142|  1.05k|    {
 1143|       |        /* We pass a pointer to a copy of otherSettings, since */
 1144|       |        /* TIFFReInitJPEG_12() will clear sp */
 1145|  1.05k|        JPEGOtherSettings savedOtherSettings = sp->otherSettings;
 1146|  1.05k|        return TIFFReInitJPEG_12(tif, &savedOtherSettings, COMPRESSION_JPEG, 0);
  ------------------
  |  |  190|  1.05k|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
 1147|  1.05k|    }
 1148|  4.42k|#endif
 1149|       |
 1150|  4.42k|    if (!JPEGInitializeLibJPEG(tif, TRUE))
  ------------------
  |  |   74|  4.42k|#define TRUE 1
  ------------------
  |  Branch (1150:9): [True: 0, False: 4.42k]
  ------------------
 1151|      0|    {
 1152|      0|        TIFFErrorExtR(tif, "JPEGSetupDecode",
 1153|      0|                      "Failed to initialize libjpeg decompressor");
 1154|      0|        return (0);
 1155|      0|    }
 1156|       |
 1157|  4.42k|    assert(sp != NULL);
  ------------------
  |  Branch (1157:5): [True: 0, False: 4.42k]
  |  Branch (1157:5): [True: 4.42k, False: 0]
  ------------------
 1158|  4.42k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1158:5): [True: 0, False: 4.42k]
  |  Branch (1158:5): [True: 4.42k, False: 0]
  ------------------
 1159|       |
 1160|       |    /* Read JPEGTables if it is present */
 1161|  4.42k|    if (TIFFFieldSet(tif, FIELD_JPEGTABLES))
  ------------------
  |  |  267|  4.42k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  4.42k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  4.42k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 89, False: 4.33k]
  |  |  ------------------
  ------------------
 1162|     89|    {
 1163|     89|        TIFFjpeg_tables_src(sp);
 1164|     89|        if (TIFFjpeg_read_header(sp, FALSE) != JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  |   75|     89|#define FALSE 0
  ------------------
  |  Branch (1164:13): [True: 5, False: 84]
  ------------------
 1165|      5|        {
 1166|      5|            TIFFErrorExtR(tif, "JPEGSetupDecode", "Bogus JPEGTables field");
 1167|      5|            return (0);
 1168|      5|        }
 1169|     89|    }
 1170|       |
 1171|       |    /* Grab parameters that are same for all strips/tiles */
 1172|  4.42k|    sp->photometric = td->td_photometric;
 1173|  4.42k|    switch (sp->photometric)
 1174|  4.42k|    {
 1175|  1.63k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  1.63k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1175:9): [True: 1.63k, False: 2.79k]
  ------------------
 1176|  1.63k|            sp->h_sampling = td->td_ycbcrsubsampling[0];
 1177|  1.63k|            sp->v_sampling = td->td_ycbcrsubsampling[1];
 1178|  1.63k|            break;
 1179|  2.79k|        default:
  ------------------
  |  Branch (1179:9): [True: 2.79k, False: 1.63k]
  ------------------
 1180|       |            /* TIFF 6.0 forbids subsampling of all other color spaces */
 1181|  2.79k|            sp->h_sampling = 1;
 1182|  2.79k|            sp->v_sampling = 1;
 1183|  2.79k|            break;
 1184|  4.42k|    }
 1185|       |
 1186|       |    /* Set up for reading normal data */
 1187|  4.42k|    TIFFjpeg_data_src(sp);
 1188|  4.42k|    tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
 1189|  4.42k|    return (1);
 1190|  4.42k|}
tif_jpeg.c:JPEGInitializeLibJPEG:
 2893|  4.42k|{
 2894|  4.42k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  4.42k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2895|       |
 2896|  4.42k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2896:9): [True: 2, False: 4.42k]
  ------------------
 2897|      2|    {
 2898|      2|        if (!decompress && sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2898:13): [True: 0, False: 2]
  |  Branch (2898:28): [True: 0, False: 0]
  ------------------
 2899|      0|            TIFFjpeg_destroy(sp);
 2900|      2|        else if (decompress && !sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2900:18): [True: 2, False: 0]
  |  Branch (2900:32): [True: 0, False: 2]
  ------------------
 2901|      0|            TIFFjpeg_destroy(sp);
 2902|      2|        else
 2903|      2|            return 1;
 2904|       |
 2905|      0|        sp->cinfo_initialized = 0;
 2906|      0|    }
 2907|       |
 2908|       |    /*
 2909|       |     * Initialize libjpeg.
 2910|       |     */
 2911|  4.42k|    if (decompress)
  ------------------
  |  Branch (2911:9): [True: 4.42k, False: 0]
  ------------------
 2912|  4.42k|    {
 2913|  4.42k|        if (!TIFFjpeg_create_decompress(sp))
  ------------------
  |  Branch (2913:13): [True: 0, False: 4.42k]
  ------------------
 2914|      0|            return (0);
 2915|  4.42k|    }
 2916|      0|    else
 2917|      0|    {
 2918|      0|        if (!TIFFjpeg_create_compress(sp))
  ------------------
  |  Branch (2918:13): [True: 0, False: 0]
  ------------------
 2919|      0|            return (0);
 2920|      0|#ifndef TIFF_JPEG_MAX_MEMORY_TO_USE
 2921|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
 2922|      0|#endif
 2923|       |        /* libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing */
 2924|       |        /* store implementation, so better not set max_memory_to_use ourselves.
 2925|       |         */
 2926|       |        /* See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162 */
 2927|      0|        if (sp->cinfo.c.mem->max_memory_to_use > 0)
  ------------------
  |  Branch (2927:13): [True: 0, False: 0]
  ------------------
 2928|      0|        {
 2929|       |            /* This is to address bug related in ticket GDAL #1795. */
 2930|      0|            if (getenv("JPEGMEM") == NULL)
  ------------------
  |  Branch (2930:17): [True: 0, False: 0]
  ------------------
 2931|      0|            {
 2932|       |                /* Increase the max memory usable. This helps when creating
 2933|       |                 * files */
 2934|       |                /* with "big" tile, without using libjpeg temporary files. */
 2935|       |                /* For example a 512x512 tile with 3 bands */
 2936|       |                /* requires 1.5 MB which is above libjpeg 1MB default */
 2937|      0|                if (sp->cinfo.c.mem->max_memory_to_use <
  ------------------
  |  Branch (2937:21): [True: 0, False: 0]
  ------------------
 2938|      0|                    TIFF_JPEG_MAX_MEMORY_TO_USE)
  ------------------
  |  | 2921|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2939|      0|                    sp->cinfo.c.mem->max_memory_to_use =
 2940|      0|                        TIFF_JPEG_MAX_MEMORY_TO_USE;
  ------------------
  |  | 2921|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2941|      0|            }
 2942|      0|        }
 2943|      0|    }
 2944|       |
 2945|  4.42k|    sp->cinfo_initialized = TRUE;
  ------------------
  |  |   74|  4.42k|#define TRUE 1
  ------------------
 2946|       |
 2947|  4.42k|    return 1;
 2948|  4.42k|}
tif_jpeg.c:TIFFjpeg_tables_src:
  769|     89|{
  770|     89|    TIFFjpeg_data_src(sp);
  771|     89|    sp->src.init_source = tables_init_source;
  772|     89|}
tif_jpeg.c:tables_init_source:
  761|     88|{
  762|     88|    JPEGState *sp = (JPEGState *)cinfo;
  763|       |
  764|     88|    sp->src.next_input_byte = (const JOCTET *)sp->otherSettings.jpegtables;
  765|     88|    sp->src.bytes_in_buffer = (size_t)sp->otherSettings.jpegtables_length;
  766|     88|}
tif_jpeg.c:JPEGPreDecode:
 1273|   184k|{
 1274|   184k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|   184k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1275|   184k|    TIFFDirectory *td = &tif->tif_dir;
 1276|   184k|    static const char module[] = "JPEGPreDecode";
 1277|   184k|    int downsampled_output;
 1278|   184k|    int ci;
 1279|       |
 1280|   184k|    assert(sp != NULL);
  ------------------
  |  Branch (1280:5): [True: 0, False: 184k]
  |  Branch (1280:5): [True: 184k, False: 0]
  ------------------
 1281|       |
 1282|   184k|    if (sp->cinfo.comm.is_decompressor == 0)
  ------------------
  |  Branch (1282:9): [True: 0, False: 184k]
  ------------------
 1283|      0|    {
 1284|      0|        tif->tif_setupdecode(tif);
 1285|      0|    }
 1286|       |
 1287|   184k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1287:5): [True: 0, False: 184k]
  |  Branch (1287:5): [True: 184k, False: 0]
  ------------------
 1288|       |    /*
 1289|       |     * Reset decoder state from any previous strip/tile,
 1290|       |     * in case application didn't read the whole strip.
 1291|       |     */
 1292|   184k|    if (!TIFFjpeg_abort(sp))
  ------------------
  |  Branch (1292:9): [True: 0, False: 184k]
  ------------------
 1293|      0|        return (0);
 1294|       |    /*
 1295|       |     * Read the header for this strip/tile.
 1296|       |     */
 1297|       |
 1298|   184k|    if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
  ------------------
  |  |   74|   184k|#define TRUE 1
  ------------------
  |  Branch (1298:9): [True: 133k, False: 50.8k]
  ------------------
 1299|   133k|        return (0);
 1300|       |
 1301|  50.8k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1302|  50.8k|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1303|       |
 1304|  50.8k|    if (!JPEGComputeStrileWidthHeightBytesPerLine(tif, s))
  ------------------
  |  Branch (1304:9): [True: 0, False: 50.8k]
  ------------------
 1305|      0|        return 0;
 1306|       |
 1307|  50.8k|    if (sp->cinfo.d.image_width < sp->strile_width ||
  ------------------
  |  Branch (1307:9): [True: 47.7k, False: 3.09k]
  ------------------
 1308|  3.09k|        sp->cinfo.d.image_height < sp->strile_height)
  ------------------
  |  Branch (1308:9): [True: 2.27k, False: 825]
  ------------------
 1309|  49.9k|    {
 1310|  49.9k|        TIFFWarningExtR(tif, module,
 1311|  49.9k|                        "Improper JPEG strip/tile size, "
 1312|  49.9k|                        "expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1313|  49.9k|                        sp->strile_width, sp->strile_height,
 1314|  49.9k|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1315|  49.9k|    }
 1316|  50.8k|    if (sp->cinfo.d.image_width == sp->strile_width &&
  ------------------
  |  Branch (1316:9): [True: 1.58k, False: 49.2k]
  ------------------
 1317|  1.58k|        sp->cinfo.d.image_height > sp->strile_height &&
  ------------------
  |  Branch (1317:9): [True: 428, False: 1.16k]
  ------------------
 1318|    428|        tif->tif_dir.td_row + sp->strile_height == td->td_imagelength &&
  ------------------
  |  Branch (1318:9): [True: 39, False: 389]
  ------------------
 1319|     39|        !isTiled(tif))
  ------------------
  |  |  282|     39|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|     39|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1319:9): [True: 38, False: 1]
  ------------------
 1320|     38|    {
 1321|       |        /* Some files have a last strip, that should be truncated, */
 1322|       |        /* but their JPEG codestream has still the maximum strip */
 1323|       |        /* height. Warn about this as this is non compliant, but */
 1324|       |        /* we can safely recover from that. */
 1325|     38|        TIFFWarningExtR(tif, module,
 1326|     38|                        "JPEG strip size exceeds expected dimensions,"
 1327|     38|                        " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1328|     38|                        sp->strile_width, sp->strile_height,
 1329|     38|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1330|     38|    }
 1331|  50.7k|    else if (sp->cinfo.d.image_width > sp->strile_width ||
  ------------------
  |  Branch (1331:14): [True: 1.50k, False: 49.2k]
  ------------------
 1332|  49.2k|             sp->cinfo.d.image_height > sp->strile_height)
  ------------------
  |  Branch (1332:14): [True: 474, False: 48.7k]
  ------------------
 1333|  1.98k|    {
 1334|       |        /*
 1335|       |         * This case could be dangerous, if the strip or tile size has
 1336|       |         * been reported as less than the amount of data jpeg will
 1337|       |         * return, some potential security issues arise. Catch this
 1338|       |         * case and error out.
 1339|       |         */
 1340|  1.98k|        TIFFErrorExtR(tif, module,
 1341|  1.98k|                      "JPEG strip/tile size exceeds expected dimensions,"
 1342|  1.98k|                      " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1343|  1.98k|                      sp->strile_width, sp->strile_height,
 1344|  1.98k|                      sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1345|  1.98k|        return (0);
 1346|  1.98k|    }
 1347|  48.8k|    if (sp->cinfo.d.num_components !=
  ------------------
  |  Branch (1347:9): [True: 840, False: 47.9k]
  ------------------
 1348|  48.8k|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|  48.8k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1348:10): [True: 47.9k, False: 863]
  ------------------
 1349|  48.8k|                                                    : 1))
 1350|    840|    {
 1351|    840|        TIFFErrorExtR(tif, module, "Improper JPEG component count");
 1352|    840|        return (0);
 1353|    840|    }
 1354|       |#ifdef JPEG_LIB_MK1
 1355|       |    if (12 != td->td_bitspersample && 8 != td->td_bitspersample)
 1356|       |    {
 1357|       |        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1358|       |        return (0);
 1359|       |    }
 1360|       |    sp->cinfo.d.data_precision = td->td_bitspersample;
 1361|       |    sp->cinfo.d.bits_in_jsample = td->td_bitspersample;
 1362|       |#else
 1363|  47.9k|    if (td->td_bitspersample != BITS_IN_JSAMPLE ||
  ------------------
  |  |  108|  95.9k|#define BITS_IN_JSAMPLE 8
  ------------------
  |  Branch (1363:9): [True: 4, False: 47.9k]
  ------------------
 1364|  47.9k|        sp->cinfo.d.data_precision != td->td_bitspersample)
  ------------------
  |  Branch (1364:9): [True: 347, False: 47.6k]
  ------------------
 1365|    351|    {
 1366|    351|        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1367|    351|        return (0);
 1368|    351|    }
 1369|  47.6k|#endif
 1370|       |
 1371|  47.6k|    if (sp->cinfo.d.progressive_mode &&
  ------------------
  |  Branch (1371:9): [True: 18.6k, False: 28.9k]
  ------------------
 1372|  18.6k|        !sp->otherSettings.has_warned_about_progressive_mode)
  ------------------
  |  Branch (1372:9): [True: 1.71k, False: 16.9k]
  ------------------
 1373|  1.71k|    {
 1374|  1.71k|        TIFFWarningExtR(tif, module,
 1375|  1.71k|                        "The JPEG strip/tile is encoded with progressive mode, "
 1376|  1.71k|                        "which is normally not legal for JPEG-in-TIFF.\n"
 1377|  1.71k|                        "libtiff should be able to decode it, but it might "
 1378|  1.71k|                        "cause compatibility issues with other readers");
 1379|  1.71k|        sp->otherSettings.has_warned_about_progressive_mode = TRUE;
  ------------------
  |  |   74|  1.71k|#define TRUE 1
  ------------------
 1380|  1.71k|    }
 1381|       |
 1382|       |    /* In some cases, libjpeg needs to allocate a lot of memory */
 1383|       |    /* http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
 1384|       |     */
 1385|  47.6k|    if (TIFFjpeg_has_multiple_scans(sp))
  ------------------
  |  Branch (1385:9): [True: 27.3k, False: 20.3k]
  ------------------
 1386|  27.3k|    {
 1387|       |        /* In this case libjpeg will need to allocate memory or backing */
 1388|       |        /* store for all coefficients */
 1389|       |        /* See call to jinit_d_coef_controller() from master_selection() */
 1390|       |        /* in libjpeg */
 1391|       |
 1392|       |        /* 1 MB for regular libjpeg usage */
 1393|  27.3k|        toff_t nRequiredMemory = 1024 * 1024;
 1394|       |
 1395|  92.2k|        for (ci = 0; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1395:22): [True: 64.8k, False: 27.3k]
  ------------------
 1396|  64.8k|        {
 1397|  64.8k|            const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
 1398|  64.8k|            if (compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0)
  ------------------
  |  Branch (1398:17): [True: 64.8k, False: 0]
  |  Branch (1398:47): [True: 64.8k, False: 0]
  ------------------
 1399|  64.8k|            {
 1400|  64.8k|                nRequiredMemory +=
 1401|  64.8k|                    (toff_t)((JDIMENSION)(((int)compptr->width_in_blocks +
 1402|  64.8k|                                           compptr->h_samp_factor - 1) /
 1403|  64.8k|                                          compptr->h_samp_factor)) *
 1404|  64.8k|                    (JDIMENSION)(((int)compptr->height_in_blocks +
 1405|  64.8k|                                  compptr->v_samp_factor - 1) /
 1406|  64.8k|                                 compptr->v_samp_factor) *
 1407|  64.8k|                    sizeof(JBLOCK);
 1408|  64.8k|            }
 1409|  64.8k|        }
 1410|       |
 1411|  27.3k|        if (sp->cinfo.d.mem->max_memory_to_use > 0 &&
  ------------------
  |  Branch (1411:13): [True: 0, False: 27.3k]
  ------------------
 1412|      0|            nRequiredMemory > (toff_t)(sp->cinfo.d.mem->max_memory_to_use) &&
  ------------------
  |  Branch (1412:13): [True: 0, False: 0]
  ------------------
 1413|      0|            getenv("LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC") == NULL)
  ------------------
  |  Branch (1413:13): [True: 0, False: 0]
  ------------------
 1414|      0|        {
 1415|      0|            TIFFErrorExtR(
 1416|      0|                tif, module,
 1417|      0|                "Reading this image would require libjpeg to allocate "
 1418|      0|                "at least %" PRIu64 " bytes. "
 1419|      0|                "This is disabled since above the %ld threshold. "
 1420|      0|                "You may override this restriction by defining the "
 1421|      0|                "LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC environment variable, "
 1422|      0|                "or setting the JPEGMEM environment variable to a value "
 1423|      0|                "greater "
 1424|      0|                "or equal to '%" PRIu64 "M'",
 1425|      0|                nRequiredMemory, sp->cinfo.d.mem->max_memory_to_use,
 1426|      0|                (nRequiredMemory + 1000000u - 1u) / 1000000u);
 1427|      0|            return 0;
 1428|      0|        }
 1429|  27.3k|    }
 1430|       |
 1431|  47.6k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  47.6k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1431:9): [True: 46.7k, False: 861]
  ------------------
 1432|  46.7k|    {
 1433|       |        /* Component 0 should have expected sampling factors */
 1434|  46.7k|        if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
  ------------------
  |  Branch (1434:13): [True: 215, False: 46.5k]
  ------------------
 1435|  46.5k|            sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling)
  ------------------
  |  Branch (1435:13): [True: 221, False: 46.3k]
  ------------------
 1436|    436|        {
 1437|    436|            TIFFErrorExtR(tif, module,
 1438|    436|                          "Improper JPEG sampling factors %d,%d\n"
 1439|    436|                          "Apparently should be %" PRIu16 ",%" PRIu16 ".",
 1440|    436|                          sp->cinfo.d.comp_info[0].h_samp_factor,
 1441|    436|                          sp->cinfo.d.comp_info[0].v_samp_factor,
 1442|    436|                          sp->h_sampling, sp->v_sampling);
 1443|    436|            return (0);
 1444|    436|        }
 1445|       |        /* Rest should have sampling factors 1,1 */
 1446|  84.7k|        for (ci = 1; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1446:22): [True: 38.4k, False: 46.3k]
  ------------------
 1447|  38.4k|        {
 1448|  38.4k|            if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
  ------------------
  |  Branch (1448:17): [True: 10, False: 38.4k]
  ------------------
 1449|  38.4k|                sp->cinfo.d.comp_info[ci].v_samp_factor != 1)
  ------------------
  |  Branch (1449:17): [True: 10, False: 38.4k]
  ------------------
 1450|     20|            {
 1451|     20|                TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1452|     20|                return (0);
 1453|     20|            }
 1454|  38.4k|        }
 1455|  46.3k|    }
 1456|    861|    else
 1457|    861|    {
 1458|       |        /* PC 2's single component should have sampling factors 1,1 */
 1459|    861|        if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
  ------------------
  |  Branch (1459:13): [True: 81, False: 780]
  ------------------
 1460|    780|            sp->cinfo.d.comp_info[0].v_samp_factor != 1)
  ------------------
  |  Branch (1460:13): [True: 21, False: 759]
  ------------------
 1461|    102|        {
 1462|    102|            TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1463|    102|            return (0);
 1464|    102|        }
 1465|    861|    }
 1466|  47.0k|    downsampled_output = FALSE;
  ------------------
  |  |   75|  47.0k|#define FALSE 0
  ------------------
 1467|  47.0k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  94.1k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1467:9): [True: 46.3k, False: 759]
  ------------------
 1468|  46.3k|        sp->photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  93.4k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1468:9): [True: 18.6k, False: 27.6k]
  ------------------
 1469|  18.6k|        sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|  18.6k|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (1469:9): [True: 18.6k, False: 2]
  ------------------
 1470|  18.6k|    {
 1471|       |        /* Convert YCbCr to RGB */
 1472|  18.6k|        sp->cinfo.d.jpeg_color_space = JCS_YCbCr;
 1473|  18.6k|        sp->cinfo.d.out_color_space = JCS_RGB;
 1474|  18.6k|    }
 1475|  28.4k|    else
 1476|  28.4k|    {
 1477|       |        /* Suppress colorspace handling */
 1478|  28.4k|        sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;
 1479|  28.4k|        sp->cinfo.d.out_color_space = JCS_UNKNOWN;
 1480|  28.4k|        if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  56.8k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1480:13): [True: 27.6k, False: 759]
  ------------------
 1481|  27.6k|            (sp->h_sampling != 1 || sp->v_sampling != 1))
  ------------------
  |  Branch (1481:14): [True: 1, False: 27.6k]
  |  Branch (1481:37): [True: 1, False: 27.6k]
  ------------------
 1482|      2|            downsampled_output = TRUE;
  ------------------
  |  |   74|      2|#define TRUE 1
  ------------------
 1483|       |        /* XXX what about up-sampling? */
 1484|  28.4k|    }
 1485|  47.0k|    if (downsampled_output)
  ------------------
  |  Branch (1485:9): [True: 2, False: 47.0k]
  ------------------
 1486|      2|    {
 1487|       |        /* Need to use raw-data interface to libjpeg */
 1488|      2|        sp->cinfo.d.raw_data_out = TRUE;
  ------------------
  |  |   74|      2|#define TRUE 1
  ------------------
 1489|       |#if JPEG_LIB_VERSION >= 70
 1490|       |        sp->cinfo.d.do_fancy_upsampling = FALSE;
 1491|       |#endif /* JPEG_LIB_VERSION >= 70 */
 1492|      2|        tif->tif_decoderow = DecodeRowError;
 1493|      2|        tif->tif_decodestrip = JPEGDecodeRaw;
 1494|      2|        tif->tif_decodetile = JPEGDecodeRaw;
 1495|      2|    }
 1496|  47.0k|    else
 1497|  47.0k|    {
 1498|       |        /* Use normal interface to libjpeg */
 1499|  47.0k|        sp->cinfo.d.raw_data_out = FALSE;
  ------------------
  |  |   75|  47.0k|#define FALSE 0
  ------------------
 1500|  47.0k|        tif->tif_decoderow = JPEGDecode;
 1501|  47.0k|        tif->tif_decodestrip = JPEGDecode;
 1502|  47.0k|        tif->tif_decodetile = JPEGDecode;
 1503|  47.0k|    }
 1504|       |    /* Start JPEG decompressor */
 1505|  47.0k|    if (!TIFFjpeg_start_decompress(sp))
  ------------------
  |  Branch (1505:9): [True: 8.70k, False: 38.3k]
  ------------------
 1506|  8.70k|        return (0);
 1507|       |    /* Allocate downsampled-data buffers if needed */
 1508|  38.3k|    if (downsampled_output)
  ------------------
  |  Branch (1508:9): [True: 2, False: 38.3k]
  ------------------
 1509|      2|    {
 1510|      2|        if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
  ------------------
  |  Branch (1510:13): [True: 0, False: 2]
  ------------------
 1511|      2|                                       sp->cinfo.d.num_components))
 1512|      0|            return (0);
 1513|      2|        sp->scancount = DCTSIZE; /* mark buffer empty */
 1514|      2|    }
 1515|  38.3k|    return (1);
 1516|  38.3k|}
tif_jpeg.c:TIFFjpeg_abort:
  520|   184k|{
  521|       |    return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
  ------------------
  |  |  302|   184k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|   184k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|   184k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (521:12): [True: 0, False: 184k]
  ------------------
  522|   184k|}
tif_jpeg.c:JPEGComputeStrileWidthHeightBytesPerLine:
 1229|  50.8k|{
 1230|  50.8k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  50.8k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1231|  50.8k|    TIFFDirectory *td = &tif->tif_dir;
 1232|       |
 1233|       |    /*
 1234|       |     * Check image parameters and set decompression parameters.
 1235|       |     */
 1236|  50.8k|    if (isTiled(tif))
  ------------------
  |  |  282|  50.8k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  50.8k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 50.3k, False: 462]
  |  |  ------------------
  ------------------
 1237|  50.3k|    {
 1238|  50.3k|        sp->strile_width = td->td_tilewidth;
 1239|  50.3k|        sp->strile_height = td->td_tilelength;
 1240|  50.3k|        sp->bytesperline = TIFFTileRowSize(tif);
 1241|  50.3k|    }
 1242|    462|    else
 1243|    462|    {
 1244|    462|        sp->strile_width = td->td_imagewidth;
 1245|    462|        sp->strile_height = td->td_imagelength - tif->tif_dir.td_row;
 1246|    462|        if (sp->strile_height > td->td_rowsperstrip)
  ------------------
  |  Branch (1246:13): [True: 406, False: 56]
  ------------------
 1247|    406|            sp->strile_height = td->td_rowsperstrip;
 1248|    462|        sp->bytesperline = TIFFScanlineSize(tif);
 1249|    462|    }
 1250|  50.8k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0)
  ------------------
  |  |  266|   101k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (1250:9): [True: 863, False: 49.9k]
  |  Branch (1250:57): [True: 337, False: 526]
  ------------------
 1251|    337|    {
 1252|       |        /*
 1253|       |         * For PC 2, scale down the expected strip/tile size
 1254|       |         * to match a downsampled component
 1255|       |         */
 1256|    337|        if (sp->h_sampling == 0 || sp->v_sampling == 0)
  ------------------
  |  Branch (1256:13): [True: 0, False: 337]
  |  Branch (1256:36): [True: 0, False: 337]
  ------------------
 1257|      0|        {
 1258|      0|            TIFFErrorExtR(tif, "JPEGComputeStrileWidthHeightBytesPerLine",
 1259|      0|                          "JPEG horizontal or vertical sampling is zero");
 1260|      0|            return (0);
 1261|      0|        }
 1262|    337|        sp->strile_width = TIFFhowmany_32(sp->strile_width, sp->h_sampling);
  ------------------
  |  |  316|    337|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 337, False: 0]
  |  |  ------------------
  |  |  317|    337|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|    337|         : 0U)
  ------------------
 1263|    337|        sp->strile_height = TIFFhowmany_32(sp->strile_height, sp->v_sampling);
  ------------------
  |  |  316|    337|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 337, False: 0]
  |  |  ------------------
  |  |  317|    337|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|    337|         : 0U)
  ------------------
 1264|    337|    }
 1265|       |
 1266|  50.8k|    return 1;
 1267|  50.8k|}
tif_jpeg.c:DecodeRowError:
 1726|      2|{
 1727|      2|    (void)buf;
 1728|      2|    (void)cc;
 1729|      2|    (void)s;
 1730|       |
 1731|      2|    TIFFErrorExtR(
 1732|      2|        tif, "TIFFReadScanline",
 1733|      2|        "scanline oriented access is not supported for downsampled JPEG "
 1734|      2|        "compressed images, consider enabling TIFFTAG_JPEGCOLORMODE as "
 1735|      2|        "JPEGCOLORMODE_RGB.");
 1736|      2|    return 0;
 1737|      2|}
tif_jpeg.c:TIFFjpeg_finish_decompress:
  515|  38.3k|{
  516|       |    return CALLJPEG(sp, -1, (int)jpeg_finish_decompress(&sp->cinfo.d));
  ------------------
  |  |  301|  38.3k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  38.3k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (516:12): [True: 8.05k, False: 30.2k]
  ------------------
  517|  38.3k|}
tif_jpeg.c:TIFFjpeg_start_decompress:
  406|  47.0k|{
  407|  47.0k|    const char *sz_max_allowed_scan_number;
  408|       |    /* progress monitor */
  409|  47.0k|    sp->cinfo.d.progress = &sp->progress;
  410|  47.0k|    sp->progress.progress_monitor = TIFFjpeg_progress_monitor;
  411|  47.0k|    sp->otherSettings.max_allowed_scan_number = 100;
  412|  47.0k|    sz_max_allowed_scan_number = getenv("LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER");
  413|  47.0k|    if (sz_max_allowed_scan_number)
  ------------------
  |  Branch (413:9): [True: 0, False: 47.0k]
  ------------------
  414|      0|        sp->otherSettings.max_allowed_scan_number =
  415|      0|            (int)_TIFFParseUInt32(sz_max_allowed_scan_number, 100, INT_MAX);
  416|       |
  417|       |    return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|  47.0k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  47.0k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  47.0k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (417:12): [True: 8.70k, False: 38.3k]
  ------------------
  418|  47.0k|}
tif_jpeg.c:TIFFjpeg_progress_monitor:
  274|  19.3M|{
  275|  19.3M|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  276|  19.3M|    if (cinfo->is_decompressor)
  ------------------
  |  Branch (276:9): [True: 19.3M, False: 0]
  ------------------
  277|  19.3M|    {
  278|  19.3M|        const int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
  279|  19.3M|        if (scan_no >= sp->otherSettings.max_allowed_scan_number)
  ------------------
  |  Branch (279:13): [True: 3, False: 19.3M]
  ------------------
  280|      3|        {
  281|      3|            TIFFErrorExtR(
  282|      3|                ((JPEGState *)cinfo)->tif, "TIFFjpeg_progress_monitor",
  283|      3|                "Scan number %d exceeds maximum scans (%d). This limit "
  284|      3|                "can be raised through the "
  285|      3|                "LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER "
  286|      3|                "environment variable.",
  287|      3|                scan_no, sp->otherSettings.max_allowed_scan_number);
  288|       |
  289|      3|            jpeg_abort(cinfo);           /* clean up libjpeg state */
  290|      3|            LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|      3|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  291|      3|        }
  292|  19.3M|    }
  293|  19.3M|}
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:
 1524|  43.2k|{
 1525|  43.2k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  43.2k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1526|  43.2k|    tmsize_t nrows;
 1527|  43.2k|    (void)s;
 1528|       |
 1529|       |    /*
 1530|       |    ** Update available information, buffer may have been refilled
 1531|       |    ** between decode requests
 1532|       |    */
 1533|  43.2k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawcp;
 1534|  43.2k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
 1535|       |
 1536|  43.2k|    if (sp->bytesperline == 0)
  ------------------
  |  Branch (1536:9): [True: 0, False: 43.2k]
  ------------------
 1537|      0|    {
 1538|      0|        memset(buf, 0, (size_t)cc);
 1539|      0|        return 0;
 1540|      0|    }
 1541|       |
 1542|  43.2k|    nrows = cc / sp->bytesperline;
 1543|  43.2k|    if (cc % sp->bytesperline)
  ------------------
  |  Branch (1543:9): [True: 0, False: 43.2k]
  ------------------
 1544|      0|        TIFFWarningExtR(tif, tif->tif_name, "fractional scanline not read");
 1545|       |
 1546|  43.2k|    if (nrows > (tmsize_t)sp->cinfo.d.image_height)
  ------------------
  |  Branch (1546:9): [True: 38.0k, False: 5.23k]
  ------------------
 1547|  38.0k|    {
 1548|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1549|       |         * strile height. */
 1550|  38.0k|        memset(buf, 0, (size_t)cc);
 1551|  38.0k|        nrows = sp->cinfo.d.image_height;
 1552|  38.0k|    }
 1553|  5.23k|    else if (sp->strile_width > sp->cinfo.d.image_width)
  ------------------
  |  Branch (1553:14): [True: 1.72k, False: 3.51k]
  ------------------
 1554|  1.72k|    {
 1555|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1556|       |         * strile width. */
 1557|  1.72k|        memset(buf, 0, (size_t)cc);
 1558|  1.72k|    }
 1559|       |
 1560|       |    /* data is expected to be read in multiples of a scanline */
 1561|  43.2k|    if (nrows)
  ------------------
  |  Branch (1561:9): [True: 43.2k, False: 0]
  ------------------
 1562|  43.2k|    {
 1563|  43.2k|        do
 1564|  16.3M|        {
 1565|       |            /*
 1566|       |             * In the libjpeg6b-9a 8bit case.  We read directly into
 1567|       |             * the TIFF buffer.
 1568|       |             */
 1569|  16.3M|            JSAMPROW bufptr = (JSAMPROW)buf;
 1570|       |
 1571|  16.3M|            if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)
  ------------------
  |  Branch (1571:17): [True: 46, False: 16.3M]
  ------------------
 1572|     46|            {
 1573|     46|                memset(buf, 0, (size_t)cc);
 1574|     46|                return (0);
 1575|     46|            }
 1576|       |
 1577|  16.3M|            ++tif->tif_dir.td_row;
 1578|  16.3M|            buf += sp->bytesperline;
 1579|  16.3M|            cc -= sp->bytesperline;
 1580|  16.3M|        } while (--nrows > 0);
  ------------------
  |  Branch (1580:18): [True: 16.3M, False: 43.1k]
  ------------------
 1581|  43.2k|    }
 1582|       |
 1583|       |    /* Update information on consumed data */
 1584|  43.1k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1585|  43.1k|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1586|       |
 1587|       |    /* Close down the decompressor if we've finished the strip or tile. */
 1588|  43.1k|    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height ||
  ------------------
  |  Branch (1588:12): [True: 4.88k, False: 38.3k]
  ------------------
 1589|  38.3k|           TIFFjpeg_finish_decompress(sp);
  ------------------
  |  Branch (1589:12): [True: 38.3k, False: 0]
  ------------------
 1590|  43.2k|}
tif_jpeg.c:TIFFjpeg_read_scanlines:
  422|  16.3M|{
  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|  16.3M|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  16.3M|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (428:12): [True: 46, False: 16.3M]
  ------------------
  429|  16.3M|                    (int)jpeg_read_scanlines(&sp->cinfo.d, scanlines,
  430|  16.3M|                                             (JDIMENSION)max_lines));
  431|  16.3M|#endif
  432|  16.3M|}
tif_jpeg.c:JPEGGetMaxCompressionRatio:
 2951|     10|{
 2952|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
 2953|       |     * the maximum compression rate. */
 2954|       |
 2955|     10|    const JPEGState *sp = JState(tif);
  ------------------
  |  |  208|     10|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2956|     10|    if ((tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|     10|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (2956:9): [True: 9, False: 1]
  ------------------
 2957|      9|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|      9|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (2957:9): [True: 9, False: 0]
  ------------------
 2958|      9|        (tif->tif_dir.td_samplesperpixel == 3))
  ------------------
  |  Branch (2958:9): [True: 9, False: 0]
  ------------------
 2959|      9|    {
 2960|      9|        if (sp->h_sampling == 2 && sp->v_sampling == 2)
  ------------------
  |  Branch (2960:13): [True: 2, False: 7]
  |  Branch (2960:36): [True: 1, False: 1]
  ------------------
 2961|      1|        {
 2962|      1|            if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (2962:17): [True: 0, False: 1]
  ------------------
 2963|      0|                return 768;
 2964|      1|            else
 2965|      1|                return 512;
 2966|      1|        }
 2967|       |
 2968|      8|        return 0; /* unknown */
 2969|      9|    }
 2970|       |
 2971|      1|    if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (2971:9): [True: 0, False: 1]
  ------------------
 2972|      0|        return 384;
 2973|      1|    else
 2974|      1|        return 256;
 2975|      1|}
tif_jpeg.c:JPEGCleanup:
 2688|  5.86k|{
 2689|  5.86k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  5.86k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2690|       |
 2691|  5.86k|    assert(sp != 0);
  ------------------
  |  Branch (2691:5): [True: 0, False: 5.86k]
  |  Branch (2691:5): [True: 5.86k, False: 0]
  ------------------
 2692|       |
 2693|  5.86k|    tif->tif_tagmethods.vgetfield = sp->otherSettings.vgetparent;
 2694|  5.86k|    tif->tif_tagmethods.vsetfield = sp->otherSettings.vsetparent;
 2695|  5.86k|    tif->tif_tagmethods.printdir = sp->otherSettings.printdir;
 2696|  5.86k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2696:9): [True: 4.42k, False: 1.44k]
  ------------------
 2697|  4.42k|        TIFFjpeg_destroy(sp);         /* release libjpeg resources */
 2698|  5.86k|    if (sp->otherSettings.jpegtables) /* tag value */
  ------------------
  |  Branch (2698:9): [True: 90, False: 5.77k]
  ------------------
 2699|     90|        _TIFFfreeExt(tif, sp->otherSettings.jpegtables);
 2700|  5.86k|    _TIFFfreeExt(tif, tif->tif_data); /* release local state */
 2701|  5.86k|    tif->tif_data = NULL;
 2702|       |
 2703|  5.86k|    _TIFFSetDefaultCompressionState(tif);
 2704|  5.86k|}
tif_jpeg_12.c:TIFFjpeg_create_decompress:
  318|  1.05k|{
  319|       |    /* initialize JPEG error handling */
  320|  1.05k|    sp->cinfo.d.err = jpeg_std_error(&sp->err);
  321|  1.05k|    sp->err.error_exit = TIFFjpeg_error_exit;
  322|  1.05k|    sp->err.output_message = TIFFjpeg_output_message;
  323|       |
  324|       |    /* set client_data to avoid UMR warning from tools like Purify */
  325|  1.05k|    sp->cinfo.d.client_data = NULL;
  326|       |
  327|       |    return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|  1.05k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.05k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.05k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (327:12): [True: 0, False: 1.05k]
  ------------------
  328|  1.05k|}
tif_jpeg_12.c:TIFFjpeg_error_exit:
  244|    343|{
  245|    343|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  246|    343|    char buffer[JMSG_LENGTH_MAX];
  247|       |
  248|    343|    (*cinfo->err->format_message)(cinfo, buffer);
  249|    343|    TIFFErrorExtR(sp->tif, "JPEGLib", "%s",
  250|    343|                  buffer);       /* display the error message */
  251|    343|    jpeg_abort(cinfo);           /* clean up libjpeg state */
  252|    343|    LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|    343|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  253|    343|}
tif_jpeg_12.c:TIFFjpeg_output_message:
  261|  1.47k|{
  262|  1.47k|    char buffer[JMSG_LENGTH_MAX];
  263|       |
  264|  1.47k|    (*cinfo->err->format_message)(cinfo, buffer);
  265|  1.47k|    TIFFWarningExtR(((JPEGState *)cinfo)->tif, "JPEGLib", "%s", buffer);
  266|  1.47k|}
tif_jpeg_12.c:TIFFjpeg_data_src:
  744|  1.47k|{
  745|  1.47k|    sp->cinfo.d.src = &sp->src;
  746|  1.47k|    sp->src.init_source = std_init_source;
  747|  1.47k|    sp->src.fill_input_buffer = std_fill_input_buffer;
  748|  1.47k|    sp->src.skip_input_data = std_skip_input_data;
  749|  1.47k|    sp->src.resync_to_restart = jpeg_resync_to_restart;
  750|  1.47k|    sp->src.term_source = std_term_source;
  751|  1.47k|    sp->src.bytes_in_buffer = 0; /* for safety */
  752|       |    sp->src.next_input_byte = NULL;
  753|  1.47k|}
tif_jpeg_12.c:std_init_source:
  674|  1.10k|{
  675|  1.10k|    JPEGState *sp = (JPEGState *)cinfo;
  676|  1.10k|    TIFF *tif = sp->tif;
  677|       |
  678|  1.10k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
  679|  1.10k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
  680|  1.10k|}
tif_jpeg_12.c:std_fill_input_buffer:
  683|  2.03k|{
  684|  2.03k|    JPEGState *sp = (JPEGState *)cinfo;
  685|  2.03k|    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|  2.03k|    WARNMS(cinfo, JWRN_JPEG_EOF);
  712|       |    /* insert a fake EOI marker */
  713|  2.03k|    sp->src.next_input_byte = dummy_EOI;
  714|  2.03k|    sp->src.bytes_in_buffer = 2;
  715|  2.03k|    return (TRUE);
  ------------------
  |  |   74|  2.03k|#define TRUE 1
  ------------------
  716|  2.03k|}
tif_jpeg_12.c:std_skip_input_data:
  719|  30.4k|{
  720|  30.4k|    JPEGState *sp = (JPEGState *)cinfo;
  721|       |
  722|  30.4k|    if (num_bytes > 0)
  ------------------
  |  Branch (722:9): [True: 30.4k, False: 0]
  ------------------
  723|  30.4k|    {
  724|  30.4k|        if ((size_t)num_bytes > sp->src.bytes_in_buffer)
  ------------------
  |  Branch (724:13): [True: 236, False: 30.1k]
  ------------------
  725|    236|        {
  726|       |            /* oops, buffer overrun */
  727|    236|            (void)std_fill_input_buffer(cinfo);
  728|    236|        }
  729|  30.1k|        else
  730|  30.1k|        {
  731|  30.1k|            sp->src.next_input_byte += (size_t)num_bytes;
  732|  30.1k|            sp->src.bytes_in_buffer -= (size_t)num_bytes;
  733|  30.1k|        }
  734|  30.4k|    }
  735|  30.4k|}
tif_jpeg_12.c:std_term_source:
  738|    320|{
  739|       |    /* No work necessary here */
  740|    320|    (void)cinfo;
  741|    320|}
tif_jpeg_12.c:TIFFjpeg_read_header:
  396|  1.52k|{
  397|       |    return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
  ------------------
  |  |  301|  1.52k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  1.52k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (397:12): [True: 27, False: 1.50k]
  ------------------
  398|  1.52k|}
tif_jpeg_12.c:TIFFjpeg_destroy:
  525|  1.05k|{
  526|       |    return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
  ------------------
  |  |  302|  1.05k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.05k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.05k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (526:12): [True: 0, False: 1.05k]
  ------------------
  527|  1.05k|}
tif_jpeg_12.c:TIFFjpeg_has_multiple_scans:
  401|  1.06k|{
  402|       |    return CALLJPEG(sp, 0, jpeg_has_multiple_scans(&sp->cinfo.d));
  ------------------
  |  |  301|  1.06k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  1.06k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (402:12): [True: 0, False: 1.06k]
  ------------------
  403|  1.06k|}
tif_jpeg_12.c:TIFFInitJPEGCommon:
 2979|  1.05k|{
 2980|  1.05k|    JPEGState *sp;
 2981|       |
 2982|  1.05k|    sp = JState(tif);
  ------------------
  |  |  208|  1.05k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2983|  1.05k|    sp->tif = tif; /* back link */
 2984|       |
 2985|       |    /* Default values for codec-specific fields */
 2986|  1.05k|    sp->otherSettings.jpegtables = NULL;
 2987|  1.05k|    sp->otherSettings.jpegtables_length = 0;
 2988|  1.05k|    sp->otherSettings.jpegquality = 75; /* Default IJG quality */
 2989|  1.05k|    sp->otherSettings.jpegcolormode = JPEGCOLORMODE_RAW;
  ------------------
  |  |  707|  1.05k|#define JPEGCOLORMODE_RAW 0x0000     /* no conversion (default) */
  ------------------
 2990|  1.05k|    sp->otherSettings.jpegtablesmode =
 2991|  1.05k|        JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  710|  1.05k|#define JPEGTABLESMODE_QUANT 0x0001  /* include quantization tbls */
  ------------------
                      JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  711|  1.05k|#define JPEGTABLESMODE_HUFF 0x0002   /* include Huffman tbls */
  ------------------
 2992|  1.05k|    sp->otherSettings.ycbcrsampling_fetched = 0;
 2993|       |
 2994|  1.05k|    tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
 2995|  1.05k|    tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
 2996|  1.05k|    tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
 2997|       |
 2998|       |    /*
 2999|       |     * Install codec methods.
 3000|       |     */
 3001|  1.05k|    tif->tif_fixuptags = JPEGFixupTags;
 3002|  1.05k|    tif->tif_setupdecode = JPEGSetupDecode;
 3003|  1.05k|    tif->tif_predecode = JPEGPreDecode;
 3004|  1.05k|    tif->tif_decoderow = JPEGDecode;
 3005|  1.05k|    tif->tif_decodestrip = JPEGDecode;
 3006|  1.05k|    tif->tif_decodetile = JPEGDecode;
 3007|  1.05k|    tif->tif_setupencode = JPEGSetupEncode;
 3008|  1.05k|    tif->tif_preencode = JPEGPreEncode;
 3009|  1.05k|    tif->tif_postencode = JPEGPostEncode;
 3010|  1.05k|    tif->tif_encoderow = JPEGEncode;
 3011|  1.05k|    tif->tif_encodestrip = JPEGEncode;
 3012|  1.05k|    tif->tif_encodetile = JPEGEncode;
 3013|  1.05k|    tif->tif_getmaxcompressionratio = JPEGGetMaxCompressionRatio;
 3014|  1.05k|    tif->tif_cleanup = JPEGCleanup;
 3015|       |
 3016|  1.05k|    tif->tif_defstripsize = JPEGDefaultStripSize;
 3017|  1.05k|    tif->tif_deftilesize = JPEGDefaultTileSize;
 3018|  1.05k|    tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
  ------------------
  |  |  130|  1.05k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 3019|  1.05k|    sp->cinfo_initialized = FALSE;
  ------------------
  |  |   75|  1.05k|#define FALSE 0
  ------------------
 3020|  1.05k|}
tif_jpeg_12.c:JPEGPreDecode:
 1273|  1.10k|{
 1274|  1.10k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.10k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1275|  1.10k|    TIFFDirectory *td = &tif->tif_dir;
 1276|  1.10k|    static const char module[] = "JPEGPreDecode";
 1277|  1.10k|    int downsampled_output;
 1278|  1.10k|    int ci;
 1279|       |
 1280|  1.10k|    assert(sp != NULL);
  ------------------
  |  Branch (1280:5): [True: 0, False: 1.10k]
  |  Branch (1280:5): [True: 1.10k, False: 0]
  ------------------
 1281|       |
 1282|  1.10k|    if (sp->cinfo.comm.is_decompressor == 0)
  ------------------
  |  Branch (1282:9): [True: 0, False: 1.10k]
  ------------------
 1283|      0|    {
 1284|      0|        tif->tif_setupdecode(tif);
 1285|      0|    }
 1286|       |
 1287|  1.10k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1287:5): [True: 0, False: 1.10k]
  |  Branch (1287:5): [True: 1.10k, False: 0]
  ------------------
 1288|       |    /*
 1289|       |     * Reset decoder state from any previous strip/tile,
 1290|       |     * in case application didn't read the whole strip.
 1291|       |     */
 1292|  1.10k|    if (!TIFFjpeg_abort(sp))
  ------------------
  |  Branch (1292:9): [True: 0, False: 1.10k]
  ------------------
 1293|      0|        return (0);
 1294|       |    /*
 1295|       |     * Read the header for this strip/tile.
 1296|       |     */
 1297|       |
 1298|  1.10k|    if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
  ------------------
  |  |   74|  1.10k|#define TRUE 1
  ------------------
  |  Branch (1298:9): [True: 26, False: 1.07k]
  ------------------
 1299|     26|        return (0);
 1300|       |
 1301|  1.07k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1302|  1.07k|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1303|       |
 1304|  1.07k|    if (!JPEGComputeStrileWidthHeightBytesPerLine(tif, s))
  ------------------
  |  Branch (1304:9): [True: 0, False: 1.07k]
  ------------------
 1305|      0|        return 0;
 1306|       |
 1307|  1.07k|    if (sp->cinfo.d.image_width < sp->strile_width ||
  ------------------
  |  Branch (1307:9): [True: 410, False: 668]
  ------------------
 1308|    668|        sp->cinfo.d.image_height < sp->strile_height)
  ------------------
  |  Branch (1308:9): [True: 22, False: 646]
  ------------------
 1309|    432|    {
 1310|    432|        TIFFWarningExtR(tif, module,
 1311|    432|                        "Improper JPEG strip/tile size, "
 1312|    432|                        "expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1313|    432|                        sp->strile_width, sp->strile_height,
 1314|    432|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1315|    432|    }
 1316|  1.07k|    if (sp->cinfo.d.image_width == sp->strile_width &&
  ------------------
  |  Branch (1316:9): [True: 662, False: 416]
  ------------------
 1317|    662|        sp->cinfo.d.image_height > sp->strile_height &&
  ------------------
  |  Branch (1317:9): [True: 582, False: 80]
  ------------------
 1318|    582|        tif->tif_dir.td_row + sp->strile_height == td->td_imagelength &&
  ------------------
  |  Branch (1318:9): [True: 581, False: 1]
  ------------------
 1319|    581|        !isTiled(tif))
  ------------------
  |  |  282|    581|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    581|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1319:9): [True: 581, False: 0]
  ------------------
 1320|    581|    {
 1321|       |        /* Some files have a last strip, that should be truncated, */
 1322|       |        /* but their JPEG codestream has still the maximum strip */
 1323|       |        /* height. Warn about this as this is non compliant, but */
 1324|       |        /* we can safely recover from that. */
 1325|    581|        TIFFWarningExtR(tif, module,
 1326|    581|                        "JPEG strip size exceeds expected dimensions,"
 1327|    581|                        " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1328|    581|                        sp->strile_width, sp->strile_height,
 1329|    581|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1330|    581|    }
 1331|    497|    else if (sp->cinfo.d.image_width > sp->strile_width ||
  ------------------
  |  Branch (1331:14): [True: 6, False: 491]
  ------------------
 1332|    491|             sp->cinfo.d.image_height > sp->strile_height)
  ------------------
  |  Branch (1332:14): [True: 4, False: 487]
  ------------------
 1333|     10|    {
 1334|       |        /*
 1335|       |         * This case could be dangerous, if the strip or tile size has
 1336|       |         * been reported as less than the amount of data jpeg will
 1337|       |         * return, some potential security issues arise. Catch this
 1338|       |         * case and error out.
 1339|       |         */
 1340|     10|        TIFFErrorExtR(tif, module,
 1341|     10|                      "JPEG strip/tile size exceeds expected dimensions,"
 1342|     10|                      " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1343|     10|                      sp->strile_width, sp->strile_height,
 1344|     10|                      sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1345|     10|        return (0);
 1346|     10|    }
 1347|  1.06k|    if (sp->cinfo.d.num_components !=
  ------------------
  |  Branch (1347:9): [True: 2, False: 1.06k]
  ------------------
 1348|  1.06k|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|  1.06k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1348:10): [True: 866, False: 202]
  ------------------
 1349|  1.06k|                                                    : 1))
 1350|      2|    {
 1351|      2|        TIFFErrorExtR(tif, module, "Improper JPEG component count");
 1352|      2|        return (0);
 1353|      2|    }
 1354|       |#ifdef JPEG_LIB_MK1
 1355|       |    if (12 != td->td_bitspersample && 8 != td->td_bitspersample)
 1356|       |    {
 1357|       |        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1358|       |        return (0);
 1359|       |    }
 1360|       |    sp->cinfo.d.data_precision = td->td_bitspersample;
 1361|       |    sp->cinfo.d.bits_in_jsample = td->td_bitspersample;
 1362|       |#else
 1363|  1.06k|    if (td->td_bitspersample != BITS_IN_JSAMPLE ||
  ------------------
  |  |  102|  2.13k|#define BITS_IN_JSAMPLE 12
  ------------------
  |  Branch (1363:9): [True: 0, False: 1.06k]
  ------------------
 1364|  1.06k|        sp->cinfo.d.data_precision != td->td_bitspersample)
  ------------------
  |  Branch (1364:9): [True: 1, False: 1.06k]
  ------------------
 1365|      1|    {
 1366|      1|        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1367|      1|        return (0);
 1368|      1|    }
 1369|  1.06k|#endif
 1370|       |
 1371|  1.06k|    if (sp->cinfo.d.progressive_mode &&
  ------------------
  |  Branch (1371:9): [True: 344, False: 721]
  ------------------
 1372|    344|        !sp->otherSettings.has_warned_about_progressive_mode)
  ------------------
  |  Branch (1372:9): [True: 305, False: 39]
  ------------------
 1373|    305|    {
 1374|    305|        TIFFWarningExtR(tif, module,
 1375|    305|                        "The JPEG strip/tile is encoded with progressive mode, "
 1376|    305|                        "which is normally not legal for JPEG-in-TIFF.\n"
 1377|    305|                        "libtiff should be able to decode it, but it might "
 1378|    305|                        "cause compatibility issues with other readers");
 1379|    305|        sp->otherSettings.has_warned_about_progressive_mode = TRUE;
  ------------------
  |  |   74|    305|#define TRUE 1
  ------------------
 1380|    305|    }
 1381|       |
 1382|       |    /* In some cases, libjpeg needs to allocate a lot of memory */
 1383|       |    /* http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
 1384|       |     */
 1385|  1.06k|    if (TIFFjpeg_has_multiple_scans(sp))
  ------------------
  |  Branch (1385:9): [True: 690, False: 375]
  ------------------
 1386|    690|    {
 1387|       |        /* In this case libjpeg will need to allocate memory or backing */
 1388|       |        /* store for all coefficients */
 1389|       |        /* See call to jinit_d_coef_controller() from master_selection() */
 1390|       |        /* in libjpeg */
 1391|       |
 1392|       |        /* 1 MB for regular libjpeg usage */
 1393|    690|        toff_t nRequiredMemory = 1024 * 1024;
 1394|       |
 1395|  2.08k|        for (ci = 0; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1395:22): [True: 1.39k, False: 690]
  ------------------
 1396|  1.39k|        {
 1397|  1.39k|            const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
 1398|  1.39k|            if (compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0)
  ------------------
  |  Branch (1398:17): [True: 1.39k, False: 0]
  |  Branch (1398:47): [True: 1.39k, False: 0]
  ------------------
 1399|  1.39k|            {
 1400|  1.39k|                nRequiredMemory +=
 1401|  1.39k|                    (toff_t)((JDIMENSION)(((int)compptr->width_in_blocks +
 1402|  1.39k|                                           compptr->h_samp_factor - 1) /
 1403|  1.39k|                                          compptr->h_samp_factor)) *
 1404|  1.39k|                    (JDIMENSION)(((int)compptr->height_in_blocks +
 1405|  1.39k|                                  compptr->v_samp_factor - 1) /
 1406|  1.39k|                                 compptr->v_samp_factor) *
 1407|  1.39k|                    sizeof(JBLOCK);
 1408|  1.39k|            }
 1409|  1.39k|        }
 1410|       |
 1411|    690|        if (sp->cinfo.d.mem->max_memory_to_use > 0 &&
  ------------------
  |  Branch (1411:13): [True: 0, False: 690]
  ------------------
 1412|      0|            nRequiredMemory > (toff_t)(sp->cinfo.d.mem->max_memory_to_use) &&
  ------------------
  |  Branch (1412:13): [True: 0, False: 0]
  ------------------
 1413|      0|            getenv("LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC") == NULL)
  ------------------
  |  Branch (1413:13): [True: 0, False: 0]
  ------------------
 1414|      0|        {
 1415|      0|            TIFFErrorExtR(
 1416|      0|                tif, module,
 1417|      0|                "Reading this image would require libjpeg to allocate "
 1418|      0|                "at least %" PRIu64 " bytes. "
 1419|      0|                "This is disabled since above the %ld threshold. "
 1420|      0|                "You may override this restriction by defining the "
 1421|      0|                "LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC environment variable, "
 1422|      0|                "or setting the JPEGMEM environment variable to a value "
 1423|      0|                "greater "
 1424|      0|                "or equal to '%" PRIu64 "M'",
 1425|      0|                nRequiredMemory, sp->cinfo.d.mem->max_memory_to_use,
 1426|      0|                (nRequiredMemory + 1000000u - 1u) / 1000000u);
 1427|      0|            return 0;
 1428|      0|        }
 1429|    690|    }
 1430|       |
 1431|  1.06k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.06k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1431:9): [True: 863, False: 202]
  ------------------
 1432|    863|    {
 1433|       |        /* Component 0 should have expected sampling factors */
 1434|    863|        if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
  ------------------
  |  Branch (1434:13): [True: 1, False: 862]
  ------------------
 1435|    862|            sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling)
  ------------------
  |  Branch (1435:13): [True: 1, False: 861]
  ------------------
 1436|      2|        {
 1437|      2|            TIFFErrorExtR(tif, module,
 1438|      2|                          "Improper JPEG sampling factors %d,%d\n"
 1439|      2|                          "Apparently should be %" PRIu16 ",%" PRIu16 ".",
 1440|      2|                          sp->cinfo.d.comp_info[0].h_samp_factor,
 1441|      2|                          sp->cinfo.d.comp_info[0].v_samp_factor,
 1442|      2|                          sp->h_sampling, sp->v_sampling);
 1443|      2|            return (0);
 1444|      2|        }
 1445|       |        /* Rest should have sampling factors 1,1 */
 1446|  1.55k|        for (ci = 1; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1446:22): [True: 697, False: 859]
  ------------------
 1447|    697|        {
 1448|    697|            if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
  ------------------
  |  Branch (1448:17): [True: 1, False: 696]
  ------------------
 1449|    696|                sp->cinfo.d.comp_info[ci].v_samp_factor != 1)
  ------------------
  |  Branch (1449:17): [True: 1, False: 695]
  ------------------
 1450|      2|            {
 1451|      2|                TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1452|      2|                return (0);
 1453|      2|            }
 1454|    697|        }
 1455|    861|    }
 1456|    202|    else
 1457|    202|    {
 1458|       |        /* PC 2's single component should have sampling factors 1,1 */
 1459|    202|        if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
  ------------------
  |  Branch (1459:13): [True: 1, False: 201]
  ------------------
 1460|    201|            sp->cinfo.d.comp_info[0].v_samp_factor != 1)
  ------------------
  |  Branch (1460:13): [True: 1, False: 200]
  ------------------
 1461|      2|        {
 1462|      2|            TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1463|      2|            return (0);
 1464|      2|        }
 1465|    202|    }
 1466|  1.05k|    downsampled_output = FALSE;
  ------------------
  |  |   75|  1.05k|#define FALSE 0
  ------------------
 1467|  1.05k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  2.11k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1467:9): [True: 859, False: 200]
  ------------------
 1468|    859|        sp->photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  1.91k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1468:9): [True: 13, False: 846]
  ------------------
 1469|     13|        sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|     13|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (1469:9): [True: 0, False: 13]
  ------------------
 1470|      0|    {
 1471|       |        /* Convert YCbCr to RGB */
 1472|      0|        sp->cinfo.d.jpeg_color_space = JCS_YCbCr;
 1473|      0|        sp->cinfo.d.out_color_space = JCS_RGB;
 1474|      0|    }
 1475|  1.05k|    else
 1476|  1.05k|    {
 1477|       |        /* Suppress colorspace handling */
 1478|  1.05k|        sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;
 1479|  1.05k|        sp->cinfo.d.out_color_space = JCS_UNKNOWN;
 1480|  1.05k|        if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  2.11k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1480:13): [True: 859, False: 200]
  ------------------
 1481|    859|            (sp->h_sampling != 1 || sp->v_sampling != 1))
  ------------------
  |  Branch (1481:14): [True: 4, False: 855]
  |  Branch (1481:37): [True: 9, False: 846]
  ------------------
 1482|     13|            downsampled_output = TRUE;
  ------------------
  |  |   74|     13|#define TRUE 1
  ------------------
 1483|       |        /* XXX what about up-sampling? */
 1484|  1.05k|    }
 1485|  1.05k|    if (downsampled_output)
  ------------------
  |  Branch (1485:9): [True: 13, False: 1.04k]
  ------------------
 1486|     13|    {
 1487|       |        /* Need to use raw-data interface to libjpeg */
 1488|     13|        sp->cinfo.d.raw_data_out = TRUE;
  ------------------
  |  |   74|     13|#define TRUE 1
  ------------------
 1489|       |#if JPEG_LIB_VERSION >= 70
 1490|       |        sp->cinfo.d.do_fancy_upsampling = FALSE;
 1491|       |#endif /* JPEG_LIB_VERSION >= 70 */
 1492|     13|        tif->tif_decoderow = DecodeRowError;
 1493|     13|        tif->tif_decodestrip = JPEGDecodeRaw;
 1494|     13|        tif->tif_decodetile = JPEGDecodeRaw;
 1495|     13|    }
 1496|  1.04k|    else
 1497|  1.04k|    {
 1498|       |        /* Use normal interface to libjpeg */
 1499|  1.04k|        sp->cinfo.d.raw_data_out = FALSE;
  ------------------
  |  |   75|  1.04k|#define FALSE 0
  ------------------
 1500|  1.04k|        tif->tif_decoderow = JPEGDecode;
 1501|  1.04k|        tif->tif_decodestrip = JPEGDecode;
 1502|  1.04k|        tif->tif_decodetile = JPEGDecode;
 1503|  1.04k|    }
 1504|       |    /* Start JPEG decompressor */
 1505|  1.05k|    if (!TIFFjpeg_start_decompress(sp))
  ------------------
  |  Branch (1505:9): [True: 31, False: 1.02k]
  ------------------
 1506|     31|        return (0);
 1507|       |    /* Allocate downsampled-data buffers if needed */
 1508|  1.02k|    if (downsampled_output)
  ------------------
  |  Branch (1508:9): [True: 10, False: 1.01k]
  ------------------
 1509|     10|    {
 1510|     10|        if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
  ------------------
  |  Branch (1510:13): [True: 0, False: 10]
  ------------------
 1511|     10|                                       sp->cinfo.d.num_components))
 1512|      0|            return (0);
 1513|     10|        sp->scancount = DCTSIZE; /* mark buffer empty */
 1514|     10|    }
 1515|  1.02k|    return (1);
 1516|  1.02k|}
tif_jpeg_12.c:TIFFjpeg_abort:
  520|  1.10k|{
  521|       |    return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
  ------------------
  |  |  302|  1.10k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.10k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.10k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (521:12): [True: 0, False: 1.10k]
  ------------------
  522|  1.10k|}
tif_jpeg_12.c:JPEGComputeStrileWidthHeightBytesPerLine:
 1229|  1.07k|{
 1230|  1.07k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.07k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1231|  1.07k|    TIFFDirectory *td = &tif->tif_dir;
 1232|       |
 1233|       |    /*
 1234|       |     * Check image parameters and set decompression parameters.
 1235|       |     */
 1236|  1.07k|    if (isTiled(tif))
  ------------------
  |  |  282|  1.07k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  1.07k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 0, False: 1.07k]
  |  |  ------------------
  ------------------
 1237|      0|    {
 1238|      0|        sp->strile_width = td->td_tilewidth;
 1239|      0|        sp->strile_height = td->td_tilelength;
 1240|      0|        sp->bytesperline = TIFFTileRowSize(tif);
 1241|      0|    }
 1242|  1.07k|    else
 1243|  1.07k|    {
 1244|  1.07k|        sp->strile_width = td->td_imagewidth;
 1245|  1.07k|        sp->strile_height = td->td_imagelength - tif->tif_dir.td_row;
 1246|  1.07k|        if (sp->strile_height > td->td_rowsperstrip)
  ------------------
  |  Branch (1246:13): [True: 113, False: 965]
  ------------------
 1247|    113|            sp->strile_height = td->td_rowsperstrip;
 1248|  1.07k|        sp->bytesperline = TIFFScanlineSize(tif);
 1249|  1.07k|    }
 1250|  1.07k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0)
  ------------------
  |  |  266|  2.15k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (1250:9): [True: 204, False: 874]
  |  Branch (1250:57): [True: 0, False: 204]
  ------------------
 1251|      0|    {
 1252|       |        /*
 1253|       |         * For PC 2, scale down the expected strip/tile size
 1254|       |         * to match a downsampled component
 1255|       |         */
 1256|      0|        if (sp->h_sampling == 0 || sp->v_sampling == 0)
  ------------------
  |  Branch (1256:13): [True: 0, False: 0]
  |  Branch (1256:36): [True: 0, False: 0]
  ------------------
 1257|      0|        {
 1258|      0|            TIFFErrorExtR(tif, "JPEGComputeStrileWidthHeightBytesPerLine",
 1259|      0|                          "JPEG horizontal or vertical sampling is zero");
 1260|      0|            return (0);
 1261|      0|        }
 1262|      0|        sp->strile_width = TIFFhowmany_32(sp->strile_width, sp->h_sampling);
  ------------------
  |  |  316|      0|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  317|      0|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|      0|         : 0U)
  ------------------
 1263|      0|        sp->strile_height = TIFFhowmany_32(sp->strile_height, sp->v_sampling);
  ------------------
  |  |  316|      0|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  317|      0|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|      0|         : 0U)
  ------------------
 1264|      0|    }
 1265|       |
 1266|  1.07k|    return 1;
 1267|  1.07k|}
tif_jpeg_12.c:DecodeRowError:
 1726|     10|{
 1727|     10|    (void)buf;
 1728|     10|    (void)cc;
 1729|     10|    (void)s;
 1730|       |
 1731|     10|    TIFFErrorExtR(
 1732|     10|        tif, "TIFFReadScanline",
 1733|     10|        "scanline oriented access is not supported for downsampled JPEG "
 1734|     10|        "compressed images, consider enabling TIFFTAG_JPEGCOLORMODE as "
 1735|     10|        "JPEGCOLORMODE_RGB.");
 1736|     10|    return 0;
 1737|     10|}
tif_jpeg_12.c:JPEGWritePacked12Sample:
  499|  37.1k|{
  500|  37.1k|    uint16_t v = (uint16_t)sample & 0x0fff;
  501|  37.1k|    uint8_t *p = buf + (sample_index / 2) * 3;
  502|  37.1k|    if ((sample_index & 1) != 0)
  ------------------
  |  Branch (502:9): [True: 0, False: 37.1k]
  ------------------
  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|  37.1k|    else
  508|  37.1k|    {
  509|  37.1k|        p[0] = (uint8_t)(v >> 4);
  510|  37.1k|        p[1] = (uint8_t)((v & 0x0f) << 4);
  511|  37.1k|    }
  512|  37.1k|}
tif_jpeg_12.c:TIFFjpeg_finish_decompress:
  515|    449|{
  516|       |    return CALLJPEG(sp, -1, (int)jpeg_finish_decompress(&sp->cinfo.d));
  ------------------
  |  |  301|    449|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|    449|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (516:12): [True: 129, False: 320]
  ------------------
  517|    449|}
tif_jpeg_12.c:TIFFjpeg_start_decompress:
  406|  1.05k|{
  407|  1.05k|    const char *sz_max_allowed_scan_number;
  408|       |    /* progress monitor */
  409|  1.05k|    sp->cinfo.d.progress = &sp->progress;
  410|  1.05k|    sp->progress.progress_monitor = TIFFjpeg_progress_monitor;
  411|  1.05k|    sp->otherSettings.max_allowed_scan_number = 100;
  412|  1.05k|    sz_max_allowed_scan_number = getenv("LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER");
  413|  1.05k|    if (sz_max_allowed_scan_number)
  ------------------
  |  Branch (413:9): [True: 0, False: 1.05k]
  ------------------
  414|      0|        sp->otherSettings.max_allowed_scan_number =
  415|      0|            (int)_TIFFParseUInt32(sz_max_allowed_scan_number, 100, INT_MAX);
  416|       |
  417|       |    return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|  1.05k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.05k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.05k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (417:12): [True: 31, False: 1.02k]
  ------------------
  418|  1.05k|}
tif_jpeg_12.c:TIFFjpeg_progress_monitor:
  274|  1.93M|{
  275|  1.93M|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  276|  1.93M|    if (cinfo->is_decompressor)
  ------------------
  |  Branch (276:9): [True: 1.93M, False: 0]
  ------------------
  277|  1.93M|    {
  278|  1.93M|        const int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
  279|  1.93M|        if (scan_no >= sp->otherSettings.max_allowed_scan_number)
  ------------------
  |  Branch (279:13): [True: 0, False: 1.93M]
  ------------------
  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|  1.93M|    }
  293|  1.93M|}
tif_jpeg_12.c:alloc_downsampled_buffers:
  783|     10|{
  784|     10|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|     10|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
  785|     10|    int ci;
  786|     10|    jpeg_component_info *compptr;
  787|     10|    TIFF_JSAMPARRAY buf;
  ------------------
  |  |  104|     10|#define TIFF_JSAMPARRAY J12SAMPARRAY
  ------------------
  788|     10|    int samples_per_clump = 0;
  789|       |
  790|     40|    for (ci = 0, compptr = comp_info; ci < num_components; ci++, compptr++)
  ------------------
  |  Branch (790:39): [True: 30, False: 10]
  ------------------
  791|     30|    {
  792|     30|        samples_per_clump += compptr->h_samp_factor * compptr->v_samp_factor;
  793|     30|        buf = (TIFF_JSAMPARRAY)TIFFjpeg_alloc_sarray(
  794|     30|            sp, JPOOL_IMAGE, compptr->width_in_blocks * DCTSIZE,
  795|     30|            (JDIMENSION)(compptr->v_samp_factor * DCTSIZE));
  796|     30|        if (buf == NULL)
  ------------------
  |  Branch (796:13): [True: 0, False: 30]
  ------------------
  797|      0|            return (0);
  798|     30|        sp->ds_buffer[ci] = buf;
  799|     30|    }
  800|     10|    sp->samplesperclump = samples_per_clump;
  801|     10|    return (1);
  802|     10|}
tif_jpeg_12.c:TIFFjpeg_alloc_sarray:
  532|     30|{
  533|       |    return CALLJPEG(sp, (JSAMPARRAY)NULL,
  ------------------
  |  |  301|     30|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|     30|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (533:12): [True: 0, False: 30]
  ------------------
  534|     30|                    (*sp->cinfo.comm.mem->alloc_sarray)(
  535|     30|                        &sp->cinfo.comm, pool_id, samplesperrow, numrows));
  536|     30|}
tif_jpeg_12.c:JPEGDecode:
 1596|   822k|{
 1597|   822k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|   822k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1598|   822k|    tmsize_t nrows;
 1599|   822k|    (void)s;
 1600|       |
 1601|       |    /*
 1602|       |    ** Update available information, buffer may have been refilled
 1603|       |    ** between decode requests
 1604|       |    */
 1605|   822k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawcp;
 1606|   822k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
 1607|       |
 1608|   822k|    if (sp->bytesperline == 0)
  ------------------
  |  Branch (1608:9): [True: 0, False: 822k]
  ------------------
 1609|      0|    {
 1610|      0|        memset(buf, 0, (size_t)cc);
 1611|      0|        return 0;
 1612|      0|    }
 1613|       |
 1614|   822k|    nrows = cc / sp->bytesperline;
 1615|   822k|    if (cc % sp->bytesperline)
  ------------------
  |  Branch (1615:9): [True: 0, False: 822k]
  ------------------
 1616|      0|        TIFFWarningExtR(tif, tif->tif_name, "fractional scanline not read");
 1617|       |
 1618|   822k|    if (nrows > (tmsize_t)sp->cinfo.d.image_height)
  ------------------
  |  Branch (1618:9): [True: 0, False: 822k]
  ------------------
 1619|      0|    {
 1620|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1621|       |         * strile height. */
 1622|      0|        memset(buf, 0, (size_t)cc);
 1623|      0|        nrows = sp->cinfo.d.image_height;
 1624|      0|    }
 1625|   822k|    else if (sp->strile_width > sp->cinfo.d.image_width)
  ------------------
  |  Branch (1625:14): [True: 43.3k, False: 779k]
  ------------------
 1626|  43.3k|    {
 1627|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1628|       |         * strile width. */
 1629|  43.3k|        memset(buf, 0, (size_t)cc);
 1630|  43.3k|    }
 1631|       |
 1632|       |    /* data is expected to be read in multiples of a scanline */
 1633|   822k|    if (nrows)
  ------------------
  |  Branch (1633:9): [True: 822k, False: 0]
  ------------------
 1634|   822k|    {
 1635|   822k|        TIFF_JSAMPROW line_work_buf = NULL;
  ------------------
  |  |  106|   822k|#define TIFF_JSAMPROW J12SAMPROW
  ------------------
 1636|       |
 1637|       |        /*
 1638|       |         * For 6B, only use temporary buffer for 12 bit imagery.
 1639|       |         * For Mk1 always use it.
 1640|       |         */
 1641|   822k|        if (sp->cinfo.d.data_precision == 12)
  ------------------
  |  Branch (1641:13): [True: 822k, False: 0]
  ------------------
 1642|   822k|        {
 1643|   822k|            line_work_buf = (TIFF_JSAMPROW)_TIFFmallocExt(
 1644|   822k|                tif, (tmsize_t)((size_t)sizeof(short) *
 1645|   822k|                                (size_t)sp->cinfo.d.output_width *
 1646|   822k|                                (size_t)sp->cinfo.d.num_components));
 1647|   822k|        }
 1648|       |
 1649|   822k|        do
 1650|   822k|        {
 1651|   822k|            if (line_work_buf != NULL)
  ------------------
  |  Branch (1651:17): [True: 822k, False: 0]
  ------------------
 1652|   822k|            {
 1653|       |                /*
 1654|       |                 * In the MK1 case, we always read into a 16bit
 1655|       |                 * buffer, and then pack down to 12bit or 8bit.
 1656|       |                 * In 6B case we only read into 16 bit buffer
 1657|       |                 * for 12bit data, which we need to repack.
 1658|       |                 */
 1659|   822k|                if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1)
  ------------------
  |  Branch (1659:21): [True: 156, False: 822k]
  ------------------
 1660|    156|                {
 1661|    156|                    memset(buf, 0, (size_t)cc);
 1662|    156|                    _TIFFfreeExt(tif, line_work_buf);
 1663|    156|                    return (0);
 1664|    156|                }
 1665|       |
 1666|   822k|                if (sp->cinfo.d.data_precision == 12)
  ------------------
  |  Branch (1666:21): [True: 822k, False: 0]
  ------------------
 1667|   822k|                {
 1668|   822k|                    tmsize_t value_count =
 1669|   822k|                        (tmsize_t)sp->cinfo.d.output_width *
 1670|   822k|                        sp->cinfo.d.num_components;
 1671|   822k|                    tmsize_t iPair;
 1672|       |
 1673|   242M|                    for (iPair = 0; iPair < value_count / 2; iPair++)
  ------------------
  |  Branch (1673:37): [True: 241M, False: 822k]
  ------------------
 1674|   241M|                    {
 1675|   241M|                        unsigned char *out_ptr =
 1676|   241M|                            ((unsigned char *)buf) + iPair * 3;
 1677|   241M|                        TIFF_JSAMPLE *in_ptr = line_work_buf + iPair * 2;
  ------------------
  |  |  103|   241M|#define TIFF_JSAMPLE J12SAMPLE
  ------------------
 1678|       |
 1679|   241M|                        out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
 1680|   241M|                        out_ptr[1] =
 1681|   241M|                            (unsigned char)(((in_ptr[0] & 0xf) << 4) |
 1682|   241M|                                            ((in_ptr[1] & 0xf00) >> 8));
 1683|   241M|                        out_ptr[2] = (unsigned char)(((in_ptr[1] & 0xff) >> 0));
 1684|   241M|                    }
 1685|   822k|                    if ((value_count & 1) != 0)
  ------------------
  |  Branch (1685:25): [True: 37.1k, False: 785k]
  ------------------
 1686|  37.1k|                        JPEGWritePacked12Sample((uint8_t *)buf, value_count - 1,
 1687|  37.1k|                                                line_work_buf[value_count - 1]);
 1688|   822k|                }
 1689|      0|                else if (sp->cinfo.d.data_precision == 8)
  ------------------
  |  Branch (1689:26): [True: 0, False: 0]
  ------------------
 1690|      0|                {
 1691|      0|                    tmsize_t value_count =
 1692|      0|                        (tmsize_t)sp->cinfo.d.output_width *
 1693|      0|                        sp->cinfo.d.num_components;
 1694|      0|                    tmsize_t iValue;
 1695|       |
 1696|      0|                    for (iValue = 0; iValue < value_count; iValue++)
  ------------------
  |  Branch (1696:38): [True: 0, False: 0]
  ------------------
 1697|      0|                    {
 1698|      0|                        ((unsigned char *)buf)[iValue] =
 1699|      0|                            (unsigned char)(line_work_buf[iValue] & 0xff);
 1700|      0|                    }
 1701|      0|                }
 1702|   822k|            }
 1703|       |
 1704|   822k|            ++tif->tif_dir.td_row;
 1705|   822k|            buf += sp->bytesperline;
 1706|   822k|            cc -= sp->bytesperline;
 1707|   822k|        } while (--nrows > 0);
  ------------------
  |  Branch (1707:18): [True: 0, False: 822k]
  ------------------
 1708|       |
 1709|   822k|        if (line_work_buf != NULL)
  ------------------
  |  Branch (1709:13): [True: 822k, False: 0]
  ------------------
 1710|   822k|            _TIFFfreeExt(tif, line_work_buf);
 1711|   822k|    }
 1712|       |
 1713|       |    /* Update information on consumed data */
 1714|   822k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1715|   822k|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1716|       |
 1717|       |    /* Close down the decompressor if we've finished the strip or tile. */
 1718|   822k|    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height ||
  ------------------
  |  Branch (1718:12): [True: 821k, False: 449]
  ------------------
 1719|    449|           TIFFjpeg_finish_decompress(sp);
  ------------------
  |  Branch (1719:12): [True: 449, False: 0]
  ------------------
 1720|   822k|}
tif_jpeg_12.c:TIFFjpeg_read_scanlines:
  422|   822k|{
  423|   822k|#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12) && BITS_IN_JSAMPLE == 12
  424|   822k|    return CALLJPEG(sp, -1,
  ------------------
  |  |  301|   822k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|   822k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (424:12): [True: 156, False: 822k]
  ------------------
  425|   822k|                    (int)jpeg12_read_scanlines(&sp->cinfo.d, scanlines,
  426|   822k|                                               (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|   822k|}
tif_jpeg_12.c:JPEGCleanup:
 2688|  1.05k|{
 2689|  1.05k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.05k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2690|       |
 2691|  1.05k|    assert(sp != 0);
  ------------------
  |  Branch (2691:5): [True: 0, False: 1.05k]
  |  Branch (2691:5): [True: 1.05k, False: 0]
  ------------------
 2692|       |
 2693|  1.05k|    tif->tif_tagmethods.vgetfield = sp->otherSettings.vgetparent;
 2694|  1.05k|    tif->tif_tagmethods.vsetfield = sp->otherSettings.vsetparent;
 2695|  1.05k|    tif->tif_tagmethods.printdir = sp->otherSettings.printdir;
 2696|  1.05k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2696:9): [True: 1.05k, False: 0]
  ------------------
 2697|  1.05k|        TIFFjpeg_destroy(sp);         /* release libjpeg resources */
 2698|  1.05k|    if (sp->otherSettings.jpegtables) /* tag value */
  ------------------
  |  Branch (2698:9): [True: 424, False: 632]
  ------------------
 2699|    424|        _TIFFfreeExt(tif, sp->otherSettings.jpegtables);
 2700|  1.05k|    _TIFFfreeExt(tif, tif->tif_data); /* release local state */
 2701|  1.05k|    tif->tif_data = NULL;
 2702|       |
 2703|  1.05k|    _TIFFSetDefaultCompressionState(tif);
 2704|  1.05k|}
tif_jpeg_12.c:JPEGInitializeLibJPEG:
 2893|  1.05k|{
 2894|  1.05k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.05k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2895|       |
 2896|  1.05k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2896:9): [True: 0, False: 1.05k]
  ------------------
 2897|      0|    {
 2898|      0|        if (!decompress && sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2898:13): [True: 0, False: 0]
  |  Branch (2898:28): [True: 0, False: 0]
  ------------------
 2899|      0|            TIFFjpeg_destroy(sp);
 2900|      0|        else if (decompress && !sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2900:18): [True: 0, False: 0]
  |  Branch (2900:32): [True: 0, False: 0]
  ------------------
 2901|      0|            TIFFjpeg_destroy(sp);
 2902|      0|        else
 2903|      0|            return 1;
 2904|       |
 2905|      0|        sp->cinfo_initialized = 0;
 2906|      0|    }
 2907|       |
 2908|       |    /*
 2909|       |     * Initialize libjpeg.
 2910|       |     */
 2911|  1.05k|    if (decompress)
  ------------------
  |  Branch (2911:9): [True: 1.05k, False: 0]
  ------------------
 2912|  1.05k|    {
 2913|  1.05k|        if (!TIFFjpeg_create_decompress(sp))
  ------------------
  |  Branch (2913:13): [True: 0, False: 1.05k]
  ------------------
 2914|      0|            return (0);
 2915|  1.05k|    }
 2916|      0|    else
 2917|      0|    {
 2918|      0|        if (!TIFFjpeg_create_compress(sp))
  ------------------
  |  Branch (2918:13): [True: 0, False: 0]
  ------------------
 2919|      0|            return (0);
 2920|      0|#ifndef TIFF_JPEG_MAX_MEMORY_TO_USE
 2921|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
 2922|      0|#endif
 2923|       |        /* libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing */
 2924|       |        /* store implementation, so better not set max_memory_to_use ourselves.
 2925|       |         */
 2926|       |        /* See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162 */
 2927|      0|        if (sp->cinfo.c.mem->max_memory_to_use > 0)
  ------------------
  |  Branch (2927:13): [True: 0, False: 0]
  ------------------
 2928|      0|        {
 2929|       |            /* This is to address bug related in ticket GDAL #1795. */
 2930|      0|            if (getenv("JPEGMEM") == NULL)
  ------------------
  |  Branch (2930:17): [True: 0, False: 0]
  ------------------
 2931|      0|            {
 2932|       |                /* Increase the max memory usable. This helps when creating
 2933|       |                 * files */
 2934|       |                /* with "big" tile, without using libjpeg temporary files. */
 2935|       |                /* For example a 512x512 tile with 3 bands */
 2936|       |                /* requires 1.5 MB which is above libjpeg 1MB default */
 2937|      0|                if (sp->cinfo.c.mem->max_memory_to_use <
  ------------------
  |  Branch (2937:21): [True: 0, False: 0]
  ------------------
 2938|      0|                    TIFF_JPEG_MAX_MEMORY_TO_USE)
  ------------------
  |  | 2921|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2939|      0|                    sp->cinfo.c.mem->max_memory_to_use =
 2940|      0|                        TIFF_JPEG_MAX_MEMORY_TO_USE;
  ------------------
  |  | 2921|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2941|      0|            }
 2942|      0|        }
 2943|      0|    }
 2944|       |
 2945|  1.05k|    sp->cinfo_initialized = TRUE;
  ------------------
  |  |   74|  1.05k|#define TRUE 1
  ------------------
 2946|       |
 2947|  1.05k|    return 1;
 2948|  1.05k|}
tif_jpeg_12.c:JPEGSetupDecode:
 1136|  1.05k|{
 1137|  1.05k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.05k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1138|  1.05k|    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|  1.05k|    if (!JPEGInitializeLibJPEG(tif, TRUE))
  ------------------
  |  |   74|  1.05k|#define TRUE 1
  ------------------
  |  Branch (1150:9): [True: 0, False: 1.05k]
  ------------------
 1151|      0|    {
 1152|      0|        TIFFErrorExtR(tif, "JPEGSetupDecode",
 1153|      0|                      "Failed to initialize libjpeg decompressor");
 1154|      0|        return (0);
 1155|      0|    }
 1156|       |
 1157|  1.05k|    assert(sp != NULL);
  ------------------
  |  Branch (1157:5): [True: 0, False: 1.05k]
  |  Branch (1157:5): [True: 1.05k, False: 0]
  ------------------
 1158|  1.05k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1158:5): [True: 0, False: 1.05k]
  |  Branch (1158:5): [True: 1.05k, False: 0]
  ------------------
 1159|       |
 1160|       |    /* Read JPEGTables if it is present */
 1161|  1.05k|    if (TIFFFieldSet(tif, FIELD_JPEGTABLES))
  ------------------
  |  |  267|  1.05k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  266|  1.05k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  265|  1.05k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (267:34): [True: 424, False: 632]
  |  |  ------------------
  ------------------
 1162|    424|    {
 1163|    424|        TIFFjpeg_tables_src(sp);
 1164|    424|        if (TIFFjpeg_read_header(sp, FALSE) != JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  |   75|    424|#define FALSE 0
  ------------------
  |  Branch (1164:13): [True: 1, False: 423]
  ------------------
 1165|      1|        {
 1166|      1|            TIFFErrorExtR(tif, "JPEGSetupDecode", "Bogus JPEGTables field");
 1167|      1|            return (0);
 1168|      1|        }
 1169|    424|    }
 1170|       |
 1171|       |    /* Grab parameters that are same for all strips/tiles */
 1172|  1.05k|    sp->photometric = td->td_photometric;
 1173|  1.05k|    switch (sp->photometric)
 1174|  1.05k|    {
 1175|     15|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|     15|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1175:9): [True: 15, False: 1.04k]
  ------------------
 1176|     15|            sp->h_sampling = td->td_ycbcrsubsampling[0];
 1177|     15|            sp->v_sampling = td->td_ycbcrsubsampling[1];
 1178|     15|            break;
 1179|  1.04k|        default:
  ------------------
  |  Branch (1179:9): [True: 1.04k, False: 15]
  ------------------
 1180|       |            /* TIFF 6.0 forbids subsampling of all other color spaces */
 1181|  1.04k|            sp->h_sampling = 1;
 1182|  1.04k|            sp->v_sampling = 1;
 1183|  1.04k|            break;
 1184|  1.05k|    }
 1185|       |
 1186|       |    /* Set up for reading normal data */
 1187|  1.05k|    TIFFjpeg_data_src(sp);
 1188|  1.05k|    tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
 1189|  1.05k|    return (1);
 1190|  1.05k|}
tif_jpeg_12.c:TIFFjpeg_tables_src:
  769|    424|{
  770|    424|    TIFFjpeg_data_src(sp);
  771|    424|    sp->src.init_source = tables_init_source;
  772|    424|}
tif_jpeg_12.c:tables_init_source:
  761|    424|{
  762|    424|    JPEGState *sp = (JPEGState *)cinfo;
  763|       |
  764|    424|    sp->src.next_input_byte = (const JOCTET *)sp->otherSettings.jpegtables;
  765|    424|    sp->src.bytes_in_buffer = (size_t)sp->otherSettings.jpegtables_length;
  766|    424|}

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

LogL16toY:
  893|  13.1M|{
  894|  13.1M|    int Le = p16 & 0x7fff;
  895|  13.1M|    double Y;
  896|       |
  897|  13.1M|    if (!Le)
  ------------------
  |  Branch (897:9): [True: 531k, False: 12.6M]
  ------------------
  898|   531k|        return (0.);
  899|  12.6M|    Y = exp(M_LN2 / 256. * (Le + .5) - M_LN2 * 64.);
  900|  12.6M|    return (!(p16 & 0x8000) ? Y : -Y);
  ------------------
  |  Branch (900:13): [True: 2.03M, False: 10.5M]
  ------------------
  901|  13.1M|}
XYZtoRGB24:
 1048|   143k|{
 1049|   143k|    double r, g, b;
 1050|       |    /* assume CCIR-709 primaries */
 1051|   143k|    r = 2.690 * (double)xyz[0] + -1.276 * (double)xyz[1] +
 1052|   143k|        -0.414 * (double)xyz[2];
 1053|   143k|    g = -1.022 * (double)xyz[0] + 1.978 * (double)xyz[1] +
 1054|   143k|        0.044 * (double)xyz[2];
 1055|   143k|    b = 0.061 * (double)xyz[0] + -0.224 * (double)xyz[1] +
 1056|   143k|        1.163 * (double)xyz[2];
 1057|       |    /* assume 2.0 gamma for speed */
 1058|       |    /* could use integer sqrt approx., but this is probably faster */
 1059|   143k|    rgb[0] = (uint8_t)((r <= 0.) ? 0 : (r >= 1.) ? 255 : (int)(256. * sqrt(r)));
  ------------------
  |  Branch (1059:24): [True: 85.3k, False: 58.4k]
  |  Branch (1059:40): [True: 16.1k, False: 42.3k]
  ------------------
 1060|   143k|    rgb[1] = (uint8_t)((g <= 0.) ? 0 : (g >= 1.) ? 255 : (int)(256. * sqrt(g)));
  ------------------
  |  Branch (1060:24): [True: 115k, False: 28.1k]
  |  Branch (1060:40): [True: 10.7k, False: 17.3k]
  ------------------
 1061|   143k|    rgb[2] = (uint8_t)((b <= 0.) ? 0 : (b >= 1.) ? 255 : (int)(256. * sqrt(b)));
  ------------------
  |  Branch (1061:24): [True: 78.4k, False: 65.3k]
  |  Branch (1061:40): [True: 18.1k, False: 47.2k]
  ------------------
 1062|   143k|}
LogL10toY:
 1068|   132k|{
 1069|   132k|    if (p10 == 0)
  ------------------
  |  Branch (1069:9): [True: 66.6k, False: 65.4k]
  ------------------
 1070|  66.6k|        return (0.);
 1071|  65.4k|    return (exp(M_LN2 / 64. * (p10 + .5) - M_LN2 * 12.));
 1072|   132k|}
uv_decode:
 1183|  68.4k|{
 1184|  68.4k|    unsigned int upper, lower;
 1185|  68.4k|    int ui;
 1186|  68.4k|    unsigned int vi;
 1187|       |
 1188|  68.4k|    if (c < 0 || c >= UV_NDIVS)
  ------------------
  |  |    3|  68.4k|#define UV_NDIVS 16289
  ------------------
  |  Branch (1188:9): [True: 0, False: 68.4k]
  |  Branch (1188:18): [True: 7.71k, False: 60.7k]
  ------------------
 1189|  7.71k|        return (-1);
 1190|  60.7k|    lower = 0; /* binary search */
 1191|  60.7k|    upper = UV_NVS;
  ------------------
  |  |    5|  60.7k|#define UV_NVS 163
  ------------------
 1192|   501k|    while (upper - lower > 1)
  ------------------
  |  Branch (1192:12): [True: 441k, False: 59.9k]
  ------------------
 1193|   441k|    {
 1194|   441k|        vi = (lower + upper) >> 1;
 1195|   441k|        ui = c - uv_row[vi].ncum;
 1196|   441k|        if (ui > 0)
  ------------------
  |  Branch (1196:13): [True: 191k, False: 250k]
  ------------------
 1197|   191k|            lower = vi;
 1198|   250k|        else if (ui < 0)
  ------------------
  |  Branch (1198:18): [True: 249k, False: 806]
  ------------------
 1199|   249k|            upper = vi;
 1200|    806|        else
 1201|    806|        {
 1202|    806|            lower = vi;
 1203|    806|            break;
 1204|    806|        }
 1205|   441k|    }
 1206|  60.7k|    vi = lower;
 1207|  60.7k|    ui = c - uv_row[vi].ncum;
 1208|  60.7k|    *up = (double)uv_row[vi].ustart + ((double)ui + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    2|  60.7k|#define UV_SQSIZ (float)0.003500
  ------------------
 1209|  60.7k|    *vp = (double)UV_VSTART + ((double)vi + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    4|  60.7k|#define UV_VSTART (float)0.016940
  ------------------
                  *vp = (double)UV_VSTART + ((double)vi + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    2|  60.7k|#define UV_SQSIZ (float)0.003500
  ------------------
 1210|  60.7k|    return (0);
 1211|  68.4k|}
LogLuv24toXYZ:
 1217|   132k|{
 1218|   132k|    int Ce;
 1219|   132k|    double L, u, v, s, x, y;
 1220|       |    /* decode luminance */
 1221|   132k|    L = LogL10toY(p >> 14 & 0x3ff);
 1222|   132k|    if (L <= 0.)
  ------------------
  |  Branch (1222:9): [True: 66.6k, False: 65.4k]
  ------------------
 1223|  66.6k|    {
 1224|  66.6k|        XYZ[0] = XYZ[1] = XYZ[2] = 0.;
 1225|  66.6k|        return;
 1226|  66.6k|    }
 1227|       |    /* decode color */
 1228|  65.4k|    Ce = p & 0x3fff;
 1229|  65.4k|    if (uv_decode(&u, &v, Ce) < 0)
  ------------------
  |  Branch (1229:9): [True: 7.36k, False: 58.0k]
  ------------------
 1230|  7.36k|    {
 1231|  7.36k|        u = U_NEU;
  ------------------
  |  |  661|  7.36k|#define U_NEU 0.210526316
  ------------------
 1232|  7.36k|        v = V_NEU;
  ------------------
  |  |  662|  7.36k|#define V_NEU 0.473684211
  ------------------
 1233|  7.36k|    }
 1234|  65.4k|    s = 1. / (6. * u - 16. * v + 12.);
 1235|  65.4k|    x = 9. * u * s;
 1236|  65.4k|    y = 4. * v * s;
 1237|       |    /* convert to XYZ */
 1238|  65.4k|    XYZ[0] = (float)(x / y * L);
 1239|  65.4k|    XYZ[1] = (float)L;
 1240|  65.4k|    XYZ[2] = (float)((1. - x - y) / y * L);
 1241|  65.4k|}
LogLuv32toXYZ:
 1377|   112k|{
 1378|   112k|    double L, u, v, s, x, y;
 1379|       |    /* decode luminance */
 1380|   112k|    L = LogL16toY((int)p >> 16);
 1381|   112k|    if (L <= 0.)
  ------------------
  |  Branch (1381:9): [True: 95.7k, False: 17.0k]
  ------------------
 1382|  95.7k|    {
 1383|  95.7k|        XYZ[0] = XYZ[1] = XYZ[2] = 0.;
 1384|  95.7k|        return;
 1385|  95.7k|    }
 1386|       |    /* decode color */
 1387|  17.0k|    u = 1. / UVSCALE * ((p >> 8 & 0xff) + .5);
  ------------------
  |  |  663|  17.0k|#define UVSCALE 410.
  ------------------
 1388|  17.0k|    v = 1. / UVSCALE * ((p & 0xff) + .5);
  ------------------
  |  |  663|  17.0k|#define UVSCALE 410.
  ------------------
 1389|  17.0k|    s = 1. / (6. * u - 16. * v + 12.);
 1390|  17.0k|    x = 9. * u * s;
 1391|  17.0k|    y = 4. * v * s;
 1392|       |    /* convert to XYZ */
 1393|  17.0k|    XYZ[0] = (float)(x / y * L);
 1394|  17.0k|    XYZ[1] = (float)L;
 1395|  17.0k|    XYZ[2] = (float)((1. - x - y) / y * L);
 1396|  17.0k|}
TIFFInitSGILog:
 2077|    556|{
 2078|    556|    static const char module[] = "TIFFInitSGILog";
 2079|    556|    LogLuvState *sp;
 2080|       |
 2081|    556|    assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG);
  ------------------
  |  Branch (2081:5): [True: 556, False: 0]
  |  Branch (2081:5): [True: 0, False: 0]
  |  Branch (2081:5): [True: 176, False: 380]
  |  Branch (2081:5): [True: 380, False: 0]
  ------------------
 2082|       |
 2083|       |    /*
 2084|       |     * Merge codec-specific tag information.
 2085|       |     */
 2086|    556|    if (!_TIFFMergeFields(tif, LogLuvFields, TIFFArrayCount(LogLuvFields)))
  ------------------
  |  |  354|    556|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (2086:9): [True: 0, False: 556]
  ------------------
 2087|      0|    {
 2088|      0|        TIFFErrorExtR(tif, module, "Merging SGILog codec-specific tags failed");
 2089|      0|        return 0;
 2090|      0|    }
 2091|       |
 2092|       |    /*
 2093|       |     * Allocate state block so tag methods have storage to record values.
 2094|       |     */
 2095|    556|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LogLuvState));
 2096|    556|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (2096:9): [True: 0, False: 556]
  ------------------
 2097|      0|        goto bad;
 2098|    556|    sp = (LogLuvState *)tif->tif_data;
 2099|    556|    _TIFFmemset((void *)sp, 0, sizeof(*sp));
 2100|    556|    sp->user_datafmt = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|    556|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 2101|    556|    sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ? SGILOGENCODE_RANDITHER
  ------------------
  |  |  211|    556|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
                  sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ? SGILOGENCODE_RANDITHER
  ------------------
  |  |  750|    176|#define SGILOGENCODE_RANDITHER 1       /* randomly dither encd values */
  ------------------
  |  Branch (2101:23): [True: 176, False: 380]
  ------------------
 2102|    556|                                                       : SGILOGENCODE_NODITHER;
  ------------------
  |  |  749|    936|#define SGILOGENCODE_NODITHER 0        /* do not dither encoded values*/
  ------------------
 2103|    556|    sp->tfunc = _logLuvNop;
 2104|       |
 2105|       |    /*
 2106|       |     * Install codec methods.
 2107|       |     * NB: tif_decoderow & tif_encoderow are filled
 2108|       |     *     in at setup time.
 2109|       |     */
 2110|    556|    tif->tif_fixuptags = LogLuvFixupTags;
 2111|    556|    tif->tif_setupdecode = LogLuvSetupDecode;
 2112|    556|    tif->tif_decodestrip = LogLuvDecodeStrip;
 2113|    556|    tif->tif_decodetile = LogLuvDecodeTile;
 2114|    556|    tif->tif_setupencode = LogLuvSetupEncode;
 2115|    556|    tif->tif_encodestrip = LogLuvEncodeStrip;
 2116|    556|    tif->tif_encodetile = LogLuvEncodeTile;
 2117|    556|    tif->tif_close = LogLuvClose;
 2118|    556|    tif->tif_cleanup = LogLuvCleanup;
 2119|       |
 2120|       |    /*
 2121|       |     * Override parent get/set field methods.
 2122|       |     */
 2123|    556|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 2124|    556|    tif->tif_tagmethods.vgetfield = LogLuvVGetField; /* hook for codec tags */
 2125|    556|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 2126|    556|    tif->tif_tagmethods.vsetfield = LogLuvVSetField; /* hook for codec tags */
 2127|       |
 2128|    556|    return (1);
 2129|      0|bad:
 2130|      0|    TIFFErrorExtR(tif, module, "%s: No space for LogLuv state block",
 2131|      0|                  tif->tif_name);
 2132|      0|    return (0);
 2133|    556|}
tif_luv.c:LogLuvFixupTags:
 1759|    534|{
 1760|    534|    (void)tif;
 1761|    534|    return (1);
 1762|    534|}
tif_luv.c:LogLuvSetupDecode:
 1765|    517|{
 1766|    517|    static const char module[] = "LogLuvSetupDecode";
 1767|    517|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|    517|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1768|    517|    TIFFDirectory *td = &tif->tif_dir;
 1769|       |
 1770|    517|    tif->tif_postdecode = _TIFFNoPostDecode;
 1771|    517|    switch (td->td_photometric)
 1772|    517|    {
 1773|    324|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|    324|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (1773:9): [True: 324, False: 193]
  ------------------
 1774|    324|            if (!LogLuvInitState(tif))
  ------------------
  |  Branch (1774:17): [True: 24, False: 300]
  ------------------
 1775|     24|                break;
 1776|    300|            if (td->td_compression == COMPRESSION_SGILOG24)
  ------------------
  |  |  211|    300|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (1776:17): [True: 135, False: 165]
  ------------------
 1777|    135|            {
 1778|    135|                tif->tif_decoderow = LogLuvDecode24;
 1779|    135|                switch (sp->user_datafmt)
 1780|    135|                {
 1781|     13|                    case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|     13|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1781:21): [True: 13, False: 122]
  ------------------
 1782|     13|                        sp->tfunc = Luv24toXYZ;
 1783|     13|                        break;
 1784|     43|                    case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|     43|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1784:21): [True: 43, False: 92]
  ------------------
 1785|     43|                        sp->tfunc = Luv24toLuv48;
 1786|     43|                        break;
 1787|     69|                    case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|     69|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1787:21): [True: 69, False: 66]
  ------------------
 1788|     69|                        sp->tfunc = Luv24toRGB;
 1789|     69|                        break;
 1790|     10|                    default:
  ------------------
  |  Branch (1790:21): [True: 10, False: 125]
  ------------------
 1791|     10|                        break;
 1792|    135|                }
 1793|    135|            }
 1794|    165|            else
 1795|    165|            {
 1796|    165|                tif->tif_decoderow = LogLuvDecode32;
 1797|    165|                switch (sp->user_datafmt)
 1798|    165|                {
 1799|     34|                    case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|     34|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1799:21): [True: 34, False: 131]
  ------------------
 1800|     34|                        sp->tfunc = Luv32toXYZ;
 1801|     34|                        break;
 1802|     12|                    case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|     12|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1802:21): [True: 12, False: 153]
  ------------------
 1803|     12|                        sp->tfunc = Luv32toLuv48;
 1804|     12|                        break;
 1805|    104|                    case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|    104|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1805:21): [True: 104, False: 61]
  ------------------
 1806|    104|                        sp->tfunc = Luv32toRGB;
 1807|    104|                        break;
 1808|     15|                    default:
  ------------------
  |  Branch (1808:21): [True: 15, False: 150]
  ------------------
 1809|     15|                        break;
 1810|    165|                }
 1811|    165|            }
 1812|    300|            return (1);
 1813|    189|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|    189|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (1813:9): [True: 189, False: 328]
  ------------------
 1814|    189|            if (!LogL16InitState(tif))
  ------------------
  |  Branch (1814:17): [True: 11, False: 178]
  ------------------
 1815|     11|                break;
 1816|    178|            tif->tif_decoderow = LogL16Decode;
 1817|    178|            switch (sp->user_datafmt)
 1818|    178|            {
 1819|     28|                case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|     28|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1819:17): [True: 28, False: 150]
  ------------------
 1820|     28|                    sp->tfunc = L16toY;
 1821|     28|                    break;
 1822|    137|                case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|    137|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1822:17): [True: 137, False: 41]
  ------------------
 1823|    137|                    sp->tfunc = L16toGry;
 1824|    137|                    break;
 1825|     13|                default:
  ------------------
  |  Branch (1825:17): [True: 13, False: 165]
  ------------------
 1826|     13|                    break;
 1827|    178|            }
 1828|    178|            return (1);
 1829|      4|        default:
  ------------------
  |  Branch (1829:9): [True: 4, False: 513]
  ------------------
 1830|      4|            TIFFErrorExtR(tif, module,
 1831|      4|                          "Inappropriate photometric interpretation %" PRIu16
 1832|      4|                          " for SGILog compression; %s",
 1833|      4|                          td->td_photometric, "must be either LogLUV or LogL");
 1834|      4|            break;
 1835|    517|    }
 1836|     39|    return (0);
 1837|    517|}
tif_luv.c:LogLuvInitState:
 1699|    324|{
 1700|    324|    static const char module[] = "LogLuvInitState";
 1701|    324|    TIFFDirectory *td = &tif->tif_dir;
 1702|    324|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|    324|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1703|       |
 1704|    324|    assert(sp != NULL);
  ------------------
  |  Branch (1704:5): [True: 0, False: 324]
  |  Branch (1704:5): [True: 324, False: 0]
  ------------------
 1705|    324|    assert(td->td_photometric == PHOTOMETRIC_LOGLUV);
  ------------------
  |  Branch (1705:5): [True: 0, False: 324]
  |  Branch (1705:5): [True: 324, False: 0]
  ------------------
 1706|       |
 1707|       |    /* for some reason, we can't do this in TIFFInitLogLuv */
 1708|    324|    if (td->td_planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|    324|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1708:9): [True: 2, False: 322]
  ------------------
 1709|      2|    {
 1710|      2|        TIFFErrorExtR(tif, module,
 1711|      2|                      "SGILog compression cannot handle non-contiguous data");
 1712|      2|        return (0);
 1713|      2|    }
 1714|    322|    if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  178|    322|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1714:9): [True: 140, False: 182]
  ------------------
 1715|    140|        sp->user_datafmt = LogLuvGuessDataFmt(td);
 1716|    322|    switch (sp->user_datafmt)
 1717|    322|    {
 1718|     47|        case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|     47|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1718:9): [True: 47, False: 275]
  ------------------
 1719|     47|            sp->pixel_size = 3 * sizeof(float);
 1720|     47|            break;
 1721|     55|        case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|     55|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1721:9): [True: 55, False: 267]
  ------------------
 1722|     55|            sp->pixel_size = 3 * sizeof(int16_t);
 1723|     55|            break;
 1724|     25|        case SGILOGDATAFMT_RAW:
  ------------------
  |  |  746|     25|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1724:9): [True: 25, False: 297]
  ------------------
 1725|     25|            sp->pixel_size = sizeof(uint32_t);
 1726|     25|            break;
 1727|    183|        case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|    183|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1727:9): [True: 183, False: 139]
  ------------------
 1728|    183|            sp->pixel_size = 3 * sizeof(uint8_t);
 1729|    183|            break;
 1730|     12|        default:
  ------------------
  |  Branch (1730:9): [True: 12, False: 310]
  ------------------
 1731|     12|            TIFFErrorExtR(
 1732|     12|                tif, module,
 1733|     12|                "No support for converting user data format to LogLuv");
 1734|     12|            return (0);
 1735|    322|    }
 1736|    310|    if (isTiled(tif))
  ------------------
  |  |  282|    310|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    310|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 143, False: 167]
  |  |  ------------------
  ------------------
 1737|    143|        sp->tbuflen =
 1738|    143|            multiply_ms(tif, module, td->td_tilewidth, td->td_tilelength);
 1739|    167|    else if (td->td_rowsperstrip < td->td_imagelength)
  ------------------
  |  Branch (1739:14): [True: 5, False: 162]
  ------------------
 1740|      5|        sp->tbuflen =
 1741|      5|            multiply_ms(tif, module, td->td_imagewidth, td->td_rowsperstrip);
 1742|    162|    else
 1743|    162|        sp->tbuflen =
 1744|    162|            multiply_ms(tif, module, td->td_imagewidth, td->td_imagelength);
 1745|    310|    if (sp->tbuflen == 0)
  ------------------
  |  Branch (1745:9): [True: 0, False: 310]
  ------------------
 1746|      0|        return (0); /* already reported by multiply_ms() */
 1747|    310|    if (multiply_ms(tif, module, sp->tbuflen, (tmsize_t)sizeof(uint32_t)) ==
  ------------------
  |  Branch (1747:9): [True: 0, False: 310]
  ------------------
 1748|    310|            0 ||
 1749|    310|        (sp->tbuf = (uint8_t *)_TIFFmallocExt(
  ------------------
  |  Branch (1749:9): [True: 10, False: 300]
  ------------------
 1750|    310|             tif, (tmsize_t)((size_t)sp->tbuflen * sizeof(uint32_t)))) == NULL)
 1751|     10|    {
 1752|     10|        TIFFErrorExtR(tif, module, "No space for SGILog translation buffer");
 1753|     10|        return (0);
 1754|     10|    }
 1755|    300|    return (1);
 1756|    310|}
tif_luv.c:LogLuvGuessDataFmt:
 1646|    140|{
 1647|    140|    int guess;
 1648|       |
 1649|       |    /*
 1650|       |     * If the user didn't tell us their datafmt,
 1651|       |     * take our best guess from the bitspersample.
 1652|       |     */
 1653|    140|#define PACK(a, b) (((a) << 3) | (b))
 1654|    140|    switch (PACK(td->td_bitspersample, td->td_sampleformat))
  ------------------
  |  | 1653|    140|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
 1655|    140|    {
 1656|     47|        case PACK(32, SAMPLEFORMAT_IEEEFP):
  ------------------
  |  | 1653|     47|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1656:9): [True: 47, False: 93]
  ------------------
 1657|     47|            guess = SGILOGDATAFMT_FLOAT;
  ------------------
  |  |  744|     47|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
 1658|     47|            break;
 1659|      6|        case PACK(32, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1653|      6|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1659:9): [True: 6, False: 134]
  ------------------
 1660|     25|        case PACK(32, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1653|     25|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1660:9): [True: 19, False: 121]
  ------------------
 1661|     26|        case PACK(32, SAMPLEFORMAT_INT):
  ------------------
  |  | 1653|     26|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1661:9): [True: 1, False: 139]
  ------------------
 1662|     26|            guess = SGILOGDATAFMT_RAW;
  ------------------
  |  |  746|     26|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
 1663|     26|            break;
 1664|      1|        case PACK(16, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1653|      1|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1664:9): [True: 1, False: 139]
  ------------------
 1665|      2|        case PACK(16, SAMPLEFORMAT_INT):
  ------------------
  |  | 1653|      2|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1665:9): [True: 1, False: 139]
  ------------------
 1666|     58|        case PACK(16, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1653|     58|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1666:9): [True: 56, False: 84]
  ------------------
 1667|     58|            guess = SGILOGDATAFMT_16BIT;
  ------------------
  |  |  745|     58|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
 1668|     58|            break;
 1669|      1|        case PACK(8, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1653|      1|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1669:9): [True: 1, False: 139]
  ------------------
 1670|      2|        case PACK(8, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1653|      2|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1670:9): [True: 1, False: 139]
  ------------------
 1671|      2|            guess = SGILOGDATAFMT_8BIT;
  ------------------
  |  |  747|      2|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
 1672|      2|            break;
 1673|      7|        default:
  ------------------
  |  Branch (1673:9): [True: 7, False: 133]
  ------------------
 1674|      7|            guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      7|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1675|      7|            break;
 1676|    140|#undef PACK
 1677|    140|    }
 1678|       |    /*
 1679|       |     * Double-check samples per pixel.
 1680|       |     */
 1681|    140|    switch (td->td_samplesperpixel)
 1682|    140|    {
 1683|     32|        case 1:
  ------------------
  |  Branch (1683:9): [True: 32, False: 108]
  ------------------
 1684|     32|            if (guess != SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|     32|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1684:17): [True: 7, False: 25]
  ------------------
 1685|      7|                guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      7|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1686|     32|            break;
 1687|    107|        case 3:
  ------------------
  |  Branch (1687:9): [True: 107, False: 33]
  ------------------
 1688|    107|            if (guess == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|    107|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1688:17): [True: 1, False: 106]
  ------------------
 1689|      1|                guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      1|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1690|    107|            break;
 1691|      1|        default:
  ------------------
  |  Branch (1691:9): [True: 1, False: 139]
  ------------------
 1692|      1|            guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      1|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1693|      1|            break;
 1694|    140|    }
 1695|    140|    return (guess);
 1696|    140|}
tif_luv.c:multiply_ms:
 1584|    980|{
 1585|    980|    return _TIFFMultiplySSize(tif, m1, m2, module);
 1586|    980|}
tif_luv.c:LogLuvDecode24:
  337|  13.8k|{
  338|  13.8k|    static const char module[] = "LogLuvDecode24";
  339|  13.8k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|  13.8k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  340|  13.8k|    tmsize_t cc;
  341|  13.8k|    tmsize_t i;
  342|  13.8k|    tmsize_t npixels;
  343|  13.8k|    unsigned char *bp;
  344|  13.8k|    uint32_t *tp;
  345|       |
  346|  13.8k|    (void)s;
  347|  13.8k|    assert(s == 0);
  ------------------
  |  Branch (347:5): [True: 0, False: 13.8k]
  |  Branch (347:5): [True: 13.8k, False: 0]
  ------------------
  348|  13.8k|    assert(sp != NULL);
  ------------------
  |  Branch (348:5): [True: 0, False: 13.8k]
  |  Branch (348:5): [True: 13.8k, False: 0]
  ------------------
  349|       |
  350|  13.8k|    npixels = occ / sp->pixel_size;
  351|       |
  352|  13.8k|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (352:9): [True: 0, False: 13.8k]
  ------------------
  353|      0|    {
  354|       |        /* Clear the part of the buffer that is not written. */
  355|      0|        _TIFFmemset(op, 0, occ);
  356|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  357|      0|        return (0);
  358|      0|    }
  359|  13.8k|    tp = (uint32_t *)sp->tbuf;
  360|       |    /* copy to array of uint32_t */
  361|  13.8k|    bp = (unsigned char *)tif->tif_rawcp;
  362|  13.8k|    cc = tif->tif_rawcc;
  363|   151k|    for (i = 0; i < npixels && cc >= 3; i++)
  ------------------
  |  Branch (363:17): [True: 138k, False: 12.3k]
  |  Branch (363:32): [True: 137k, False: 1.48k]
  ------------------
  364|   137k|    {
  365|   137k|        tp[i] = (uint32_t)bp[0] << 16 | (uint32_t)bp[1] << 8 | bp[2];
  366|   137k|        bp += 3;
  367|   137k|        cc -= 3;
  368|   137k|    }
  369|  13.8k|    tif->tif_rawcp = (uint8_t *)bp;
  370|  13.8k|    tif->tif_rawcc = cc;
  371|  13.8k|    if (i != npixels)
  ------------------
  |  Branch (371:9): [True: 1.48k, False: 12.3k]
  ------------------
  372|  1.48k|    {
  373|       |        /* Clear the part of the buffer that is not written. */
  374|  1.48k|        _TIFFmemset(op, 0, occ);
  375|  1.48k|        TIFFErrorExtR(tif, module,
  376|  1.48k|                      "Not enough data at row %" PRIu32
  377|  1.48k|                      " (short %" TIFF_SSIZE_FORMAT " pixels)",
  378|  1.48k|                      tif->tif_dir.td_row, npixels - i);
  379|  1.48k|        return (0);
  380|  1.48k|    }
  381|  12.3k|    if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|  12.3k|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (381:9): [True: 250, False: 12.0k]
  ------------------
  382|    250|        LuvRawToRaw(sp, op, npixels);
  383|  12.0k|    else
  384|  12.0k|        (*sp->tfunc)(sp, op, npixels);
  385|  12.3k|    return (1);
  386|  13.8k|}
tif_luv.c:LuvRawToRaw:
  986|    621|{
  987|    621|    uint32_t *luv = (uint32_t *)sp->tbuf;
  988|       |
  989|  1.96k|    while (n-- > 0)
  ------------------
  |  Branch (989:12): [True: 1.34k, False: 621]
  ------------------
  990|  1.34k|    {
  991|  1.34k|        LogLuvStore32NativeUnaligned(op, *luv++);
  992|  1.34k|        op += sizeof(uint32_t);
  993|  1.34k|    }
  994|    621|}
tif_luv.c:LogLuvStore32NativeUnaligned:
  959|  1.34k|{
  960|  1.34k|    memcpy(cp, &v, sizeof(v));
  961|  1.34k|}
tif_luv.c:Luv24toXYZ:
 1272|    373|{
 1273|    373|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1274|       |
 1275|    968|    while (n-- > 0)
  ------------------
  |  Branch (1275:12): [True: 595, False: 373]
  ------------------
 1276|    595|    {
 1277|    595|        float xyz[3];
 1278|    595|        LogLuv24toXYZ(*luv, xyz);
 1279|    595|        LogLuvStoreFloatNativeUnaligned(op, xyz[0]);
 1280|    595|        LogLuvStoreFloatNativeUnaligned(op + sizeof(float), xyz[1]);
 1281|    595|        LogLuvStoreFloatNativeUnaligned(op + 2 * sizeof(float), xyz[2]);
 1282|    595|        op += 3 * sizeof(float);
 1283|    595|        luv++;
 1284|    595|    }
 1285|    373|}
tif_luv.c:LogLuvStoreFloatNativeUnaligned:
  935|   305k|{
  936|   305k|    memcpy(cp, &v, sizeof(v));
  937|   305k|}
tif_luv.c:Luv24toLuv48:
 1288|  1.23k|{
 1289|  1.23k|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1290|       |
 1291|  4.24k|    while (n-- > 0)
  ------------------
  |  Branch (1291:12): [True: 3.01k, False: 1.23k]
  ------------------
 1292|  3.01k|    {
 1293|  3.01k|        double u, v;
 1294|  3.01k|        int16_t luv0;
 1295|  3.01k|        int16_t luv1;
 1296|  3.01k|        int16_t luv2;
 1297|       |
 1298|  3.01k|        luv0 = (int16_t)((*luv >> 12 & 0xffd) + 13314);
 1299|  3.01k|        if (uv_decode(&u, &v, *luv & 0x3fff) < 0)
  ------------------
  |  Branch (1299:13): [True: 341, False: 2.67k]
  ------------------
 1300|    341|        {
 1301|    341|            u = U_NEU;
  ------------------
  |  |  661|    341|#define U_NEU 0.210526316
  ------------------
 1302|    341|            v = V_NEU;
  ------------------
  |  |  662|    341|#define V_NEU 0.473684211
  ------------------
 1303|    341|        }
 1304|  3.01k|        luv1 = (int16_t)(u * (1 << 15));
 1305|  3.01k|        luv2 = (int16_t)(v * (1 << 15));
 1306|  3.01k|        LogLuvStore16NativeUnaligned(op, luv0);
 1307|  3.01k|        LogLuvStore16NativeUnaligned(op + sizeof(int16_t), luv1);
 1308|  3.01k|        LogLuvStore16NativeUnaligned(op + 2 * sizeof(int16_t), luv2);
 1309|  3.01k|        op += 3 * sizeof(int16_t);
 1310|  3.01k|        luv++;
 1311|  3.01k|    }
 1312|  1.23k|}
tif_luv.c:LogLuvStore16NativeUnaligned:
  947|  12.8k|{
  948|  12.8k|    memcpy(cp, &v, sizeof(v));
  949|  12.8k|}
tif_luv.c:Luv24toRGB:
 1315|  10.4k|{
 1316|  10.4k|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1317|  10.4k|    uint8_t *rgb = (uint8_t *)op;
 1318|       |
 1319|   141k|    while (n-- > 0)
  ------------------
  |  Branch (1319:12): [True: 131k, False: 10.4k]
  ------------------
 1320|   131k|    {
 1321|   131k|        float xyz[3];
 1322|       |
 1323|   131k|        LogLuv24toXYZ(*luv++, xyz);
 1324|   131k|        XYZtoRGB24(xyz, rgb);
 1325|   131k|        rgb += 3;
 1326|   131k|    }
 1327|  10.4k|}
tif_luv.c:LogLuvDecode32:
  392|  7.42k|{
  393|  7.42k|    static const char module[] = "LogLuvDecode32";
  394|  7.42k|    LogLuvState *sp;
  395|  7.42k|    int shft;
  396|  7.42k|    tmsize_t i;
  397|  7.42k|    tmsize_t npixels;
  398|  7.42k|    unsigned char *bp;
  399|  7.42k|    uint32_t *tp;
  400|  7.42k|    uint32_t b;
  401|  7.42k|    tmsize_t cc;
  402|  7.42k|    int rc;
  403|       |
  404|  7.42k|    (void)s;
  405|  7.42k|    assert(s == 0);
  ------------------
  |  Branch (405:5): [True: 0, False: 7.42k]
  |  Branch (405:5): [True: 7.42k, False: 0]
  ------------------
  406|  7.42k|    sp = DecoderState(tif);
  ------------------
  |  |  175|  7.42k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  407|  7.42k|    assert(sp != NULL);
  ------------------
  |  Branch (407:5): [True: 0, False: 7.42k]
  |  Branch (407:5): [True: 7.42k, False: 0]
  ------------------
  408|       |
  409|  7.42k|    npixels = occ / sp->pixel_size;
  410|       |
  411|  7.42k|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (411:9): [True: 0, False: 7.42k]
  ------------------
  412|      0|    {
  413|       |        /* Clear the part of the buffer that is not written. */
  414|      0|        _TIFFmemset(op, 0, occ);
  415|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  416|      0|        return (0);
  417|      0|    }
  418|  7.42k|    tp = (uint32_t *)sp->tbuf;
  419|  7.42k|    _TIFFmemset((void *)tp, 0, (tmsize_t)((size_t)npixels * sizeof(tp[0])));
  420|       |
  421|  7.42k|    bp = (unsigned char *)tif->tif_rawcp;
  422|  7.42k|    cc = tif->tif_rawcc;
  423|       |    /* get each byte string */
  424|  30.7k|    for (shft = 24; shft >= 0; shft -= 8)
  ------------------
  |  Branch (424:21): [True: 25.2k, False: 5.51k]
  ------------------
  425|  25.2k|    {
  426|  76.2k|        for (i = 0; i < npixels && cc > 0;)
  ------------------
  |  Branch (426:21): [True: 52.8k, False: 23.3k]
  |  Branch (426:36): [True: 51.1k, False: 1.66k]
  ------------------
  427|  51.1k|        {
  428|  51.1k|            if (*bp >= 128)
  ------------------
  |  Branch (428:17): [True: 14.7k, False: 36.4k]
  ------------------
  429|  14.7k|            { /* run */
  430|  14.7k|                if (cc < 2)
  ------------------
  |  Branch (430:21): [True: 242, False: 14.5k]
  ------------------
  431|    242|                    break;
  432|  14.5k|                rc = *bp++ + (2 - 128);
  433|  14.5k|                b = (uint32_t)*bp++ << shft;
  434|  14.5k|                cc -= 2;
  435|   452k|                while (rc-- && i < npixels)
  ------------------
  |  Branch (435:24): [True: 449k, False: 3.87k]
  |  Branch (435:32): [True: 438k, False: 10.6k]
  ------------------
  436|   438k|                    tp[i++] |= b;
  437|  14.5k|            }
  438|  36.4k|            else
  439|  36.4k|            {               /* non-run */
  440|  36.4k|                rc = *bp++; /* nul is noop */
  441|   101k|                while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (441:24): [True: 99.7k, False: 1.62k]
  |  Branch (441:32): [True: 74.4k, False: 25.3k]
  |  Branch (441:40): [True: 64.9k, False: 9.46k]
  ------------------
  442|  64.9k|                    tp[i++] |= (uint32_t)*bp++ << shft;
  443|  36.4k|            }
  444|  51.1k|        }
  445|  25.2k|        if (i != npixels)
  ------------------
  |  Branch (445:13): [True: 1.90k, False: 23.3k]
  ------------------
  446|  1.90k|        {
  447|       |            /* Clear the part of the buffer that is not written. */
  448|  1.90k|            _TIFFmemset(op, 0, occ);
  449|  1.90k|            TIFFErrorExtR(tif, module,
  450|  1.90k|                          "Not enough data at row %" PRIu32
  451|  1.90k|                          " (short %" TIFF_SSIZE_FORMAT " pixels)",
  452|  1.90k|                          tif->tif_dir.td_row, npixels - i);
  453|  1.90k|            tif->tif_rawcp = (uint8_t *)bp;
  454|  1.90k|            tif->tif_rawcc = cc;
  455|  1.90k|            return (0);
  456|  1.90k|        }
  457|  25.2k|    }
  458|  5.51k|    if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|  5.51k|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (458:9): [True: 371, False: 5.14k]
  ------------------
  459|    371|        LuvRawToRaw(sp, op, npixels);
  460|  5.14k|    else
  461|  5.14k|        (*sp->tfunc)(sp, op, npixels);
  462|  5.51k|    tif->tif_rawcp = (uint8_t *)bp;
  463|  5.51k|    tif->tif_rawcc = cc;
  464|  5.51k|    return (1);
  465|  7.42k|}
tif_luv.c:Luv32toXYZ:
 1436|    564|{
 1437|    564|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1438|       |
 1439|   101k|    while (n-- > 0)
  ------------------
  |  Branch (1439:12): [True: 100k, False: 564]
  ------------------
 1440|   100k|    {
 1441|   100k|        float xyz[3];
 1442|   100k|        LogLuv32toXYZ(*luv++, xyz);
 1443|   100k|        LogLuvStoreFloatNativeUnaligned(op, xyz[0]);
 1444|   100k|        LogLuvStoreFloatNativeUnaligned(op + sizeof(float), xyz[1]);
 1445|   100k|        LogLuvStoreFloatNativeUnaligned(op + 2 * sizeof(float), xyz[2]);
 1446|   100k|        op += 3 * sizeof(float);
 1447|   100k|    }
 1448|    564|}
tif_luv.c:Luv32toLuv48:
 1451|    215|{
 1452|    215|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1453|       |
 1454|  1.21k|    while (n-- > 0)
  ------------------
  |  Branch (1454:12): [True: 1.00k, False: 215]
  ------------------
 1455|  1.00k|    {
 1456|  1.00k|        double u, v;
 1457|  1.00k|        int16_t luv0 = (int16_t)(*luv >> 16);
 1458|  1.00k|        int16_t luv1;
 1459|  1.00k|        int16_t luv2;
 1460|       |
 1461|  1.00k|        u = 1. / UVSCALE * ((*luv >> 8 & 0xff) + .5);
  ------------------
  |  |  663|  1.00k|#define UVSCALE 410.
  ------------------
 1462|  1.00k|        v = 1. / UVSCALE * ((*luv & 0xff) + .5);
  ------------------
  |  |  663|  1.00k|#define UVSCALE 410.
  ------------------
 1463|  1.00k|        luv1 = (int16_t)(u * (1 << 15));
 1464|  1.00k|        luv2 = (int16_t)(v * (1 << 15));
 1465|  1.00k|        LogLuvStore16NativeUnaligned(op, luv0);
 1466|  1.00k|        LogLuvStore16NativeUnaligned(op + sizeof(int16_t), luv1);
 1467|  1.00k|        LogLuvStore16NativeUnaligned(op + 2 * sizeof(int16_t), luv2);
 1468|  1.00k|        op += 3 * sizeof(int16_t);
 1469|  1.00k|        luv++;
 1470|  1.00k|    }
 1471|    215|}
tif_luv.c:Luv32toRGB:
 1474|  4.36k|{
 1475|  4.36k|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1476|  4.36k|    uint8_t *rgb = (uint8_t *)op;
 1477|       |
 1478|  16.7k|    while (n-- > 0)
  ------------------
  |  Branch (1478:12): [True: 12.3k, False: 4.36k]
  ------------------
 1479|  12.3k|    {
 1480|  12.3k|        float xyz[3];
 1481|       |
 1482|  12.3k|        LogLuv32toXYZ(*luv++, xyz);
 1483|  12.3k|        XYZtoRGB24(xyz, rgb);
 1484|  12.3k|        rgb += 3;
 1485|  12.3k|    }
 1486|  4.36k|}
tif_luv.c:LogL16InitState:
 1589|    189|{
 1590|    189|    static const char module[] = "LogL16InitState";
 1591|    189|    TIFFDirectory *td = &tif->tif_dir;
 1592|    189|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|    189|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1593|       |
 1594|    189|    assert(sp != NULL);
  ------------------
  |  Branch (1594:5): [True: 0, False: 189]
  |  Branch (1594:5): [True: 189, False: 0]
  ------------------
 1595|    189|    assert(td->td_photometric == PHOTOMETRIC_LOGL);
  ------------------
  |  Branch (1595:5): [True: 0, False: 189]
  |  Branch (1595:5): [True: 189, False: 0]
  ------------------
 1596|       |
 1597|    189|    if (td->td_samplesperpixel != 1)
  ------------------
  |  Branch (1597:9): [True: 3, False: 186]
  ------------------
 1598|      3|    {
 1599|      3|        TIFFErrorExtR(tif, module,
 1600|      3|                      "Sorry, can not handle LogL image with %s=%" PRIu16,
 1601|      3|                      "Samples/pixel", td->td_samplesperpixel);
 1602|      3|        return 0;
 1603|      3|    }
 1604|       |
 1605|       |    /* for some reason, we can't do this in TIFFInitLogL16 */
 1606|    186|    if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  178|    186|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1606:9): [True: 50, False: 136]
  ------------------
 1607|     50|        sp->user_datafmt = LogL16GuessDataFmt(td);
 1608|    186|    switch (sp->user_datafmt)
 1609|    186|    {
 1610|     28|        case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|     28|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1610:9): [True: 28, False: 158]
  ------------------
 1611|     28|            sp->pixel_size = sizeof(float);
 1612|     28|            break;
 1613|     13|        case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|     13|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1613:9): [True: 13, False: 173]
  ------------------
 1614|     13|            sp->pixel_size = sizeof(int16_t);
 1615|     13|            break;
 1616|    139|        case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|    139|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1616:9): [True: 139, False: 47]
  ------------------
 1617|    139|            sp->pixel_size = sizeof(uint8_t);
 1618|    139|            break;
 1619|      6|        default:
  ------------------
  |  Branch (1619:9): [True: 6, False: 180]
  ------------------
 1620|      6|            TIFFErrorExtR(tif, module,
 1621|      6|                          "No support for converting user data format to LogL");
 1622|      6|            return (0);
 1623|    186|    }
 1624|    180|    if (isTiled(tif))
  ------------------
  |  |  282|    180|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    180|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 98, False: 82]
  |  |  ------------------
  ------------------
 1625|     98|        sp->tbuflen =
 1626|     98|            multiply_ms(tif, module, td->td_tilewidth, td->td_tilelength);
 1627|     82|    else if (td->td_rowsperstrip < td->td_imagelength)
  ------------------
  |  Branch (1627:14): [True: 16, False: 66]
  ------------------
 1628|     16|        sp->tbuflen =
 1629|     16|            multiply_ms(tif, module, td->td_imagewidth, td->td_rowsperstrip);
 1630|     66|    else
 1631|     66|        sp->tbuflen =
 1632|     66|            multiply_ms(tif, module, td->td_imagewidth, td->td_imagelength);
 1633|    180|    if (sp->tbuflen == 0)
  ------------------
  |  Branch (1633:9): [True: 0, False: 180]
  ------------------
 1634|      0|        return (0); /* already reported by multiply_ms() */
 1635|    180|    if (multiply_ms(tif, module, sp->tbuflen, (tmsize_t)sizeof(int16_t)) == 0 ||
  ------------------
  |  Branch (1635:9): [True: 0, False: 180]
  ------------------
 1636|    180|        (sp->tbuf = (uint8_t *)_TIFFmallocExt(
  ------------------
  |  Branch (1636:9): [True: 2, False: 178]
  ------------------
 1637|    180|             tif, (tmsize_t)((size_t)sp->tbuflen * sizeof(int16_t)))) == NULL)
 1638|      2|    {
 1639|      2|        TIFFErrorExtR(tif, module, "No space for SGILog translation buffer");
 1640|      2|        return (0);
 1641|      2|    }
 1642|    178|    return (1);
 1643|    180|}
tif_luv.c:LogL16GuessDataFmt:
 1547|     50|{
 1548|     50|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
 1549|     50|    switch (
 1550|     50|        PACK(td->td_samplesperpixel, td->td_bitspersample, td->td_sampleformat))
  ------------------
  |  | 1548|     50|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
 1551|     50|    {
 1552|     28|        case PACK(1, 32, SAMPLEFORMAT_IEEEFP):
  ------------------
  |  | 1548|     28|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1552:9): [True: 28, False: 22]
  ------------------
 1553|     28|            return (SGILOGDATAFMT_FLOAT);
  ------------------
  |  |  744|     28|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
 1554|      1|        case PACK(1, 16, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1548|      1|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1554:9): [True: 1, False: 49]
  ------------------
 1555|      2|        case PACK(1, 16, SAMPLEFORMAT_INT):
  ------------------
  |  | 1548|      2|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1555:9): [True: 1, False: 49]
  ------------------
 1556|     13|        case PACK(1, 16, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1548|     13|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1556:9): [True: 11, False: 39]
  ------------------
 1557|     13|            return (SGILOGDATAFMT_16BIT);
  ------------------
  |  |  745|     13|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
 1558|      2|        case PACK(1, 8, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1548|      2|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1558:9): [True: 2, False: 48]
  ------------------
 1559|      3|        case PACK(1, 8, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1548|      3|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1559:9): [True: 1, False: 49]
  ------------------
 1560|      3|            return (SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|      3|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
 1561|      6|        default:
  ------------------
  |  Branch (1561:9): [True: 6, False: 44]
  ------------------
 1562|      6|            break;
 1563|     50|    }
 1564|      6|#undef PACK
 1565|      6|    return (SGILOGDATAFMT_UNKNOWN);
  ------------------
  |  |  178|      6|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1566|     50|}
tif_luv.c:LogL16Decode:
  259|   105k|{
  260|   105k|    static const char module[] = "LogL16Decode";
  261|   105k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|   105k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  262|   105k|    int shft;
  263|   105k|    tmsize_t i;
  264|   105k|    tmsize_t npixels;
  265|   105k|    unsigned char *bp;
  266|   105k|    int16_t *tp;
  267|   105k|    int16_t b;
  268|   105k|    tmsize_t cc;
  269|   105k|    int rc;
  270|       |
  271|   105k|    (void)s;
  272|   105k|    assert(s == 0);
  ------------------
  |  Branch (272:5): [True: 0, False: 105k]
  |  Branch (272:5): [True: 105k, False: 0]
  ------------------
  273|   105k|    assert(sp != NULL);
  ------------------
  |  Branch (273:5): [True: 0, False: 105k]
  |  Branch (273:5): [True: 105k, False: 0]
  ------------------
  274|       |
  275|   105k|    npixels = occ / sp->pixel_size;
  276|       |
  277|   105k|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (277:9): [True: 0, False: 105k]
  ------------------
  278|      0|    {
  279|       |        /* Clear the part of the buffer that is not written. */
  280|      0|        _TIFFmemset(op, 0, occ);
  281|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  282|      0|        return (0);
  283|      0|    }
  284|   105k|    tp = (int16_t *)sp->tbuf;
  285|   105k|    _TIFFmemset((void *)tp, 0, (tmsize_t)((size_t)npixels * sizeof(tp[0])));
  286|       |
  287|   105k|    bp = (unsigned char *)tif->tif_rawcp;
  288|   105k|    cc = tif->tif_rawcc;
  289|       |    /* get each byte string */
  290|   313k|    for (shft = 8; shft >= 0; shft -= 8)
  ------------------
  |  Branch (290:20): [True: 210k, False: 103k]
  ------------------
  291|   210k|    {
  292|   770k|        for (i = 0; i < npixels && cc > 0;)
  ------------------
  |  Branch (292:21): [True: 562k, False: 207k]
  |  Branch (292:36): [True: 560k, False: 2.02k]
  ------------------
  293|   560k|        {
  294|   560k|            if (*bp >= 128)
  ------------------
  |  Branch (294:17): [True: 223k, False: 336k]
  ------------------
  295|   223k|            { /* run */
  296|   223k|                if (cc < 2)
  ------------------
  |  Branch (296:21): [True: 397, False: 223k]
  ------------------
  297|    397|                    break;
  298|   223k|                rc = *bp++ + (2 - 128);
  299|   223k|                b = (int16_t)(*bp++ << shft);
  300|   223k|                cc -= 2;
  301|  24.9M|                while (rc-- && i < npixels)
  ------------------
  |  Branch (301:24): [True: 24.7M, False: 194k]
  |  Branch (301:32): [True: 24.7M, False: 29.1k]
  ------------------
  302|  24.7M|                    tp[i++] |= b;
  303|   223k|            }
  304|   336k|            else
  305|   336k|            {               /* non-run */
  306|   336k|                rc = *bp++; /* nul is noop */
  307|  1.83M|                while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (307:24): [True: 1.83M, False: 1.92k]
  |  Branch (307:32): [True: 1.50M, False: 323k]
  |  Branch (307:40): [True: 1.49M, False: 10.9k]
  ------------------
  308|  1.49M|                    tp[i++] |= (int16_t)(*bp++ << shft);
  309|   336k|            }
  310|   560k|        }
  311|   210k|        if (i != npixels)
  ------------------
  |  Branch (311:13): [True: 2.41k, False: 207k]
  ------------------
  312|  2.41k|        {
  313|       |            /* Clear the part of the buffer that is not written. */
  314|  2.41k|            _TIFFmemset(op, 0, occ);
  315|  2.41k|            TIFFErrorExtR(tif, module,
  316|  2.41k|                          "Not enough data at row %" PRIu32
  317|  2.41k|                          " (short %" TIFF_SSIZE_FORMAT " pixels)",
  318|  2.41k|                          tif->tif_dir.td_row, npixels - i);
  319|  2.41k|            tif->tif_rawcp = (uint8_t *)bp;
  320|  2.41k|            tif->tif_rawcc = cc;
  321|  2.41k|            return (0);
  322|  2.41k|        }
  323|   210k|    }
  324|   103k|    if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
  ------------------
  |  |  745|   103k|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (324:9): [True: 224, False: 103k]
  ------------------
  325|    224|        L16toL16(sp, op, npixels);
  326|   103k|    else
  327|   103k|        (*sp->tfunc)(sp, op, npixels);
  328|   103k|    tif->tif_rawcp = (uint8_t *)bp;
  329|   103k|    tif->tif_rawcc = cc;
  330|   103k|    return (1);
  331|   105k|}
tif_luv.c:L16toL16:
  964|    224|{
  965|    224|    int16_t *l16 = (int16_t *)sp->tbuf;
  966|       |
  967|  1.03k|    while (n-- > 0)
  ------------------
  |  Branch (967:12): [True: 807, False: 224]
  ------------------
  968|    807|    {
  969|    807|        LogLuvStore16NativeUnaligned(op, *l16++);
  970|    807|        op += sizeof(int16_t);
  971|    807|    }
  972|    224|}
tif_luv.c:L16toY:
 1008|    279|{
 1009|    279|    int16_t *l16 = (int16_t *)sp->tbuf;
 1010|       |
 1011|  2.24k|    while (n-- > 0)
  ------------------
  |  Branch (1011:12): [True: 1.96k, False: 279]
  ------------------
 1012|  1.96k|    {
 1013|  1.96k|        LogLuvStoreFloatNativeUnaligned(op, (float)LogL16toY(*l16++));
 1014|  1.96k|        op += sizeof(float);
 1015|  1.96k|    }
 1016|    279|}
tif_luv.c:L16toGry:
 1019|   102k|{
 1020|   102k|    int16_t *l16 = (int16_t *)sp->tbuf;
 1021|   102k|    uint8_t *gp = (uint8_t *)op;
 1022|       |
 1023|  13.1M|    while (n-- > 0)
  ------------------
  |  Branch (1023:12): [True: 13.0M, False: 102k]
  ------------------
 1024|  13.0M|    {
 1025|  13.0M|        double Y = LogL16toY(*l16++);
 1026|  13.0M|        *gp++ = (uint8_t)((Y <= 0.)   ? 0
  ------------------
  |  Branch (1026:27): [True: 11.0M, False: 2.02M]
  ------------------
 1027|  13.0M|                          : (Y >= 1.) ? 255
  ------------------
  |  Branch (1027:29): [True: 389k, False: 1.63M]
  ------------------
 1028|  2.02M|                                      : (int)(256. * sqrt(Y)));
 1029|  13.0M|    }
 1030|   102k|}
tif_luv.c:LogLuvDecodeStrip:
  473|  1.36k|{
  474|  1.36k|    tmsize_t rowlen = TIFFScanlineSize(tif);
  475|       |
  476|  1.36k|    if (rowlen == 0)
  ------------------
  |  Branch (476:9): [True: 0, False: 1.36k]
  ------------------
  477|      0|    {
  478|       |        /* Clear the part of the buffer that is not written. */
  479|      0|        _TIFFmemset(bp, 0, cc);
  480|      0|        return 0;
  481|      0|    }
  482|       |
  483|  1.36k|    if (cc % rowlen != 0)
  ------------------
  |  Branch (483:9): [True: 0, False: 1.36k]
  ------------------
  484|      0|    {
  485|       |        /* Clear the part of the buffer that is not written. */
  486|      0|        _TIFFmemset(bp, 0, cc);
  487|      0|        TIFFErrorExtR(tif, "LogLuvDecodeStrip",
  488|      0|                      "Fractional scanline cannot be read");
  489|      0|        return 0;
  490|      0|    }
  491|  6.32k|    while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
  ------------------
  |  Branch (491:12): [True: 6.05k, False: 277]
  |  Branch (491:18): [True: 4.96k, False: 1.08k]
  ------------------
  492|  4.96k|    {
  493|  4.96k|        bp += rowlen;
  494|  4.96k|        cc -= rowlen;
  495|  4.96k|    }
  496|  1.36k|    if (cc)
  ------------------
  |  Branch (496:9): [True: 1.08k, False: 277]
  ------------------
  497|  1.08k|    {
  498|       |        /* Clear the part of the buffer that is not written. */
  499|  1.08k|        _TIFFmemset(bp, 0, cc);
  500|  1.08k|        return (0);
  501|  1.08k|    }
  502|    277|    return (1);
  503|  1.36k|}
tif_luv.c:LogLuvDecodeTile:
  511|  4.85k|{
  512|  4.85k|    tmsize_t rowlen = TIFFTileRowSize(tif);
  513|       |
  514|  4.85k|    if (rowlen == 0)
  ------------------
  |  Branch (514:9): [True: 0, False: 4.85k]
  ------------------
  515|      0|    {
  516|       |        /* Clear the part of the buffer that is not written. */
  517|      0|        _TIFFmemset(bp, 0, cc);
  518|      0|        return 0;
  519|      0|    }
  520|       |
  521|  4.85k|    if (cc % rowlen != 0)
  ------------------
  |  Branch (521:9): [True: 0, False: 4.85k]
  ------------------
  522|      0|    {
  523|       |        /* Clear the part of the buffer that is not written. */
  524|      0|        _TIFFmemset(bp, 0, cc);
  525|      0|        TIFFErrorExtR(tif, "LogLuvDecodeTile",
  526|      0|                      "Fractional scanline cannot be read");
  527|      0|        return 0;
  528|      0|    }
  529|   117k|    while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
  ------------------
  |  Branch (529:12): [True: 117k, False: 205]
  |  Branch (529:18): [True: 112k, False: 4.65k]
  ------------------
  530|   112k|    {
  531|   112k|        bp += rowlen;
  532|   112k|        cc -= rowlen;
  533|   112k|    }
  534|  4.85k|    if (cc)
  ------------------
  |  Branch (534:9): [True: 4.65k, False: 205]
  ------------------
  535|  4.65k|    {
  536|       |        /* Clear the part of the buffer that is not written. */
  537|  4.65k|        _TIFFmemset(bp, 0, cc);
  538|  4.65k|        return (0);
  539|  4.65k|    }
  540|    205|    return (1);
  541|  4.85k|}
tif_luv.c:LogLuvCleanup:
 1970|    556|{
 1971|    556|    LogLuvState *sp = (LogLuvState *)tif->tif_data;
 1972|       |
 1973|    556|    assert(sp != 0);
  ------------------
  |  Branch (1973:5): [True: 0, False: 556]
  |  Branch (1973:5): [True: 556, False: 0]
  ------------------
 1974|       |
 1975|    556|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1976|    556|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1977|       |
 1978|    556|    if (sp->tbuf)
  ------------------
  |  Branch (1978:9): [True: 478, False: 78]
  ------------------
 1979|    478|        _TIFFfreeExt(tif, sp->tbuf);
 1980|    556|    _TIFFfreeExt(tif, sp);
 1981|    556|    tif->tif_data = NULL;
 1982|       |
 1983|    556|    _TIFFSetDefaultCompressionState(tif);
 1984|    556|}
tif_luv.c:LogLuvVGetField:
 2057|  4.99k|{
 2058|  4.99k|    LogLuvState *sp = (LogLuvState *)tif->tif_data;
 2059|       |
 2060|  4.99k|    switch (tag)
 2061|  4.99k|    {
 2062|      0|        case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  743|      0|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
  |  Branch (2062:9): [True: 0, False: 4.99k]
  ------------------
 2063|      0|            *va_arg(ap, int *) = sp->user_datafmt;
 2064|      0|            return (1);
 2065|  4.99k|        default:
  ------------------
  |  Branch (2065:9): [True: 4.99k, False: 0]
  ------------------
 2066|  4.99k|            return (*sp->vgetparent)(tif, tag, ap);
 2067|  4.99k|    }
 2068|  4.99k|}
tif_luv.c:LogLuvVSetField:
 1987|  4.07k|{
 1988|  4.07k|    static const char module[] = "LogLuvVSetField";
 1989|  4.07k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|  4.07k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1990|  4.07k|    int bps, fmt;
 1991|       |
 1992|  4.07k|    switch (tag)
 1993|  4.07k|    {
 1994|    321|        case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  743|    321|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
  |  Branch (1994:9): [True: 321, False: 3.75k]
  ------------------
 1995|    321|            sp->user_datafmt = (int)va_arg(ap, int);
 1996|       |            /*
 1997|       |             * Tweak the TIFF header so that the rest of libtiff knows what
 1998|       |             * size of data will be passed between app and library, and
 1999|       |             * assume that the app knows what it is doing and is not
 2000|       |             * confused by these header manipulations...
 2001|       |             */
 2002|    321|            switch (sp->user_datafmt)
 2003|    321|            {
 2004|      0|                case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      0|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (2004:17): [True: 0, False: 321]
  ------------------
 2005|      0|                    bps = 32;
 2006|      0|                    fmt = SAMPLEFORMAT_IEEEFP;
  ------------------
  |  |  336|      0|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
 2007|      0|                    break;
 2008|      0|                case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|      0|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (2008:17): [True: 0, False: 321]
  ------------------
 2009|      0|                    bps = 16;
 2010|      0|                    fmt = SAMPLEFORMAT_INT;
  ------------------
  |  |  335|      0|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
 2011|      0|                    break;
 2012|      0|                case SGILOGDATAFMT_RAW:
  ------------------
  |  |  746|      0|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (2012:17): [True: 0, False: 321]
  ------------------
 2013|      0|                    bps = 32;
 2014|      0|                    fmt = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 2015|      0|                    if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1))
  ------------------
  |  |  257|      0|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (2015:25): [True: 0, False: 0]
  ------------------
 2016|      0|                        return (0);
 2017|      0|                    break;
 2018|    321|                case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|    321|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (2018:17): [True: 321, False: 0]
  ------------------
 2019|    321|                    bps = 8;
 2020|    321|                    fmt = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|    321|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 2021|    321|                    break;
 2022|      0|                default:
  ------------------
  |  Branch (2022:17): [True: 0, False: 321]
  ------------------
 2023|      0|                    TIFFErrorExtR(
 2024|      0|                        tif, tif->tif_name,
 2025|      0|                        "Unknown data format %d for LogLuv compression",
 2026|      0|                        sp->user_datafmt);
 2027|      0|                    return (0);
 2028|    321|            }
 2029|    321|            if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps))
  ------------------
  |  |  180|    321|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (2029:17): [True: 0, False: 321]
  ------------------
 2030|      0|                return (0);
 2031|    321|            if (!TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt))
  ------------------
  |  |  333|    321|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (2031:17): [True: 0, False: 321]
  ------------------
 2032|      0|                return (0);
 2033|       |            /*
 2034|       |             * Must recalculate sizes should bits/sample change.
 2035|       |             */
 2036|    321|            tif->tif_dir.td_tilesize =
 2037|    321|                isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)-1;
  ------------------
  |  |  282|    321|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    321|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 243, False: 78]
  |  |  ------------------
  ------------------
 2038|    321|            tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 2039|    321|            return (1);
 2040|      0|        case TIFFTAG_SGILOGENCODE:
  ------------------
  |  |  748|      0|#define TIFFTAG_SGILOGENCODE 65561     /* SGILog data encoding control*/
  ------------------
  |  Branch (2040:9): [True: 0, False: 4.07k]
  ------------------
 2041|      0|            sp->encode_meth = (int)va_arg(ap, int);
 2042|      0|            if (sp->encode_meth != SGILOGENCODE_NODITHER &&
  ------------------
  |  |  749|      0|#define SGILOGENCODE_NODITHER 0        /* do not dither encoded values*/
  ------------------
  |  Branch (2042:17): [True: 0, False: 0]
  ------------------
 2043|      0|                sp->encode_meth != SGILOGENCODE_RANDITHER)
  ------------------
  |  |  750|      0|#define SGILOGENCODE_RANDITHER 1       /* randomly dither encd values */
  ------------------
  |  Branch (2043:17): [True: 0, False: 0]
  ------------------
 2044|      0|            {
 2045|      0|                TIFFErrorExtR(tif, module,
 2046|      0|                              "Unknown encoding %d for LogLuv compression",
 2047|      0|                              sp->encode_meth);
 2048|      0|                return (0);
 2049|      0|            }
 2050|      0|            return (1);
 2051|  3.75k|        default:
  ------------------
  |  Branch (2051:9): [True: 3.75k, False: 321]
  ------------------
 2052|  3.75k|            return (*sp->vsetparent)(tif, tag, ap);
 2053|  4.07k|    }
 2054|  4.07k|}

TIFFInitLZMA:
  505|     55|{
  506|     55|    static const char module[] = "TIFFInitLZMA";
  507|     55|    LZMAState *sp;
  508|     55|    lzma_stream tmp_stream = LZMA_STREAM_INIT;
  509|       |
  510|     55|    (void)scheme;
  511|     55|    assert(scheme == COMPRESSION_LZMA);
  ------------------
  |  Branch (511:5): [True: 0, False: 55]
  |  Branch (511:5): [True: 55, False: 0]
  ------------------
  512|       |
  513|       |    /*
  514|       |     * Merge codec-specific tag information.
  515|       |     */
  516|     55|    if (!_TIFFMergeFields(tif, lzmaFields, TIFFArrayCount(lzmaFields)))
  ------------------
  |  |  354|     55|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (516:9): [True: 0, False: 55]
  ------------------
  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|     55|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZMAState));
  526|     55|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (526:9): [True: 0, False: 55]
  ------------------
  527|      0|        goto bad;
  528|     55|    sp = GetLZMAState(tif);
  ------------------
  |  |   63|     55|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  529|     55|    memcpy(&sp->stream, &tmp_stream, sizeof(lzma_stream));
  530|       |
  531|       |    /*
  532|       |     * Override parent get/set field methods.
  533|       |     */
  534|     55|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  535|     55|    tif->tif_tagmethods.vgetfield = LZMAVGetField; /* hook for codec tags */
  536|     55|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  537|     55|    tif->tif_tagmethods.vsetfield = LZMAVSetField; /* hook for codec tags */
  538|       |
  539|       |    /* Default values for codec-specific fields */
  540|     55|    sp->preset = LZMA_PRESET_DEFAULT; /* default comp. level */
  541|     55|    sp->check = LZMA_CHECK_NONE;
  542|     55|    sp->state = 0;
  543|       |
  544|       |    /* Data filters. So far we are using delta and LZMA2 filters only. */
  545|     55|    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|     55|    sp->opt_delta.dist = (tif->tif_dir.td_bitspersample % 8)
  ------------------
  |  Branch (550:26): [True: 55, False: 0]
  ------------------
  551|     55|                             ? 1
  552|     55|                             : tif->tif_dir.td_bitspersample / 8;
  553|     55|    sp->filters[0].id = LZMA_FILTER_DELTA;
  554|     55|    sp->filters[0].options = &sp->opt_delta;
  555|       |
  556|     55|    lzma_lzma_preset(&sp->opt_lzma, (uint32_t)sp->preset);
  557|     55|    sp->filters[1].id = LZMA_FILTER_LZMA2;
  558|     55|    sp->filters[1].options = &sp->opt_lzma;
  559|       |
  560|     55|    sp->filters[2].id = LZMA_VLI_UNKNOWN;
  561|     55|    sp->filters[2].options = NULL;
  562|       |
  563|       |    /*
  564|       |     * Install codec methods.
  565|       |     */
  566|     55|    tif->tif_fixuptags = LZMAFixupTags;
  567|     55|    tif->tif_setupdecode = LZMASetupDecode;
  568|     55|    tif->tif_predecode = LZMAPreDecode;
  569|     55|    tif->tif_decoderow = LZMADecode;
  570|     55|    tif->tif_decodestrip = LZMADecode;
  571|     55|    tif->tif_decodetile = LZMADecode;
  572|     55|    tif->tif_setupencode = LZMASetupEncode;
  573|     55|    tif->tif_preencode = LZMAPreEncode;
  574|     55|    tif->tif_postencode = LZMAPostEncode;
  575|     55|    tif->tif_encoderow = LZMAEncode;
  576|     55|    tif->tif_encodestrip = LZMAEncode;
  577|     55|    tif->tif_encodetile = LZMAEncode;
  578|     55|    tif->tif_cleanup = LZMACleanup;
  579|     55|    tif->tif_getmaxcompressionratio = LZMAGetMaxCompressionRatio;
  580|       |
  581|       |    /*
  582|       |     * Setup predictor setup.
  583|       |     */
  584|     55|    (void)TIFFPredictorInit(tif);
  585|     55|    return 1;
  586|      0|bad:
  587|      0|    TIFFErrorExtR(tif, module, "No space for LZMA2 state block");
  588|      0|    return 0;
  589|     55|}
tif_lzma.c:LZMAVGetField:
  470|    819|{
  471|    819|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|    819|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  472|       |
  473|    819|    switch (tag)
  474|    819|    {
  475|      0|        case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  751|      0|#define TIFFTAG_LZMAPRESET 65562       /* LZMA2 preset (compression level) */
  ------------------
  |  Branch (475:9): [True: 0, False: 819]
  ------------------
  476|      0|            *va_arg(ap, int *) = sp->preset;
  477|      0|            break;
  478|    819|        default:
  ------------------
  |  Branch (478:9): [True: 819, False: 0]
  ------------------
  479|    819|            return (*sp->vgetparent)(tif, tag, ap);
  480|    819|    }
  481|      0|    return 1;
  482|    819|}
tif_lzma.c:LZMAVSetField:
  443|  1.01k|{
  444|  1.01k|    static const char module[] = "LZMAVSetField";
  445|  1.01k|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|  1.01k|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  446|       |
  447|  1.01k|    switch (tag)
  448|  1.01k|    {
  449|      0|        case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  751|      0|#define TIFFTAG_LZMAPRESET 65562       /* LZMA2 preset (compression level) */
  ------------------
  |  Branch (449:9): [True: 0, False: 1.01k]
  ------------------
  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|  1.01k|        default:
  ------------------
  |  Branch (463:9): [True: 1.01k, False: 0]
  ------------------
  464|  1.01k|            return (*sp->vsetparent)(tif, tag, ap);
  465|  1.01k|    }
  466|       |    /*NOTREACHED*/
  467|  1.01k|}
tif_lzma.c:LZMAStrerror:
   71|    482|{
   72|    482|    switch (ret)
   73|    482|    {
   74|      0|        case LZMA_OK:
  ------------------
  |  Branch (74:9): [True: 0, False: 482]
  ------------------
   75|      0|            return "operation completed successfully";
   76|      0|        case LZMA_STREAM_END:
  ------------------
  |  Branch (76:9): [True: 0, False: 482]
  ------------------
   77|      0|            return "end of stream was reached";
   78|      0|        case LZMA_NO_CHECK:
  ------------------
  |  Branch (78:9): [True: 0, False: 482]
  ------------------
   79|      0|            return "input stream has no integrity check";
   80|      0|        case LZMA_UNSUPPORTED_CHECK:
  ------------------
  |  Branch (80:9): [True: 0, False: 482]
  ------------------
   81|      0|            return "cannot calculate the integrity check";
   82|      0|        case LZMA_GET_CHECK:
  ------------------
  |  Branch (82:9): [True: 0, False: 482]
  ------------------
   83|      0|            return "integrity check type is now available";
   84|      0|        case LZMA_MEM_ERROR:
  ------------------
  |  Branch (84:9): [True: 0, False: 482]
  ------------------
   85|      0|            return "cannot allocate memory";
   86|      0|        case LZMA_MEMLIMIT_ERROR:
  ------------------
  |  Branch (86:9): [True: 0, False: 482]
  ------------------
   87|      0|            return "memory usage limit was reached";
   88|    270|        case LZMA_FORMAT_ERROR:
  ------------------
  |  Branch (88:9): [True: 270, False: 212]
  ------------------
   89|    270|            return "file format not recognized";
   90|      0|        case LZMA_OPTIONS_ERROR:
  ------------------
  |  Branch (90:9): [True: 0, False: 482]
  ------------------
   91|      0|            return "invalid or unsupported options";
   92|      0|        case LZMA_DATA_ERROR:
  ------------------
  |  Branch (92:9): [True: 0, False: 482]
  ------------------
   93|      0|            return "data is corrupt";
   94|    212|        case LZMA_BUF_ERROR:
  ------------------
  |  Branch (94:9): [True: 212, False: 270]
  ------------------
   95|    212|            return "no progress is possible (stream is truncated or corrupt)";
   96|      0|        case LZMA_PROG_ERROR:
  ------------------
  |  Branch (96:9): [True: 0, False: 482]
  ------------------
   97|      0|            return "programming error";
   98|      0|#if LZMA_VERSION >= 50040000 /* 5.4.0 */
   99|      0|        case LZMA_SEEK_NEEDED:
  ------------------
  |  Branch (99:9): [True: 0, False: 482]
  ------------------
  100|      0|        case LZMA_RET_INTERNAL1:
  ------------------
  |  Branch (100:9): [True: 0, False: 482]
  ------------------
  101|      0|        case LZMA_RET_INTERNAL2:
  ------------------
  |  Branch (101:9): [True: 0, False: 482]
  ------------------
  102|      0|        case LZMA_RET_INTERNAL3:
  ------------------
  |  Branch (102:9): [True: 0, False: 482]
  ------------------
  103|      0|        case LZMA_RET_INTERNAL4:
  ------------------
  |  Branch (103:9): [True: 0, False: 482]
  ------------------
  104|      0|        case LZMA_RET_INTERNAL5:
  ------------------
  |  Branch (104:9): [True: 0, False: 482]
  ------------------
  105|      0|        case LZMA_RET_INTERNAL6:
  ------------------
  |  Branch (105:9): [True: 0, False: 482]
  ------------------
  106|      0|        case LZMA_RET_INTERNAL7:
  ------------------
  |  Branch (106:9): [True: 0, False: 482]
  ------------------
  107|      0|        case LZMA_RET_INTERNAL8:
  ------------------
  |  Branch (107:9): [True: 0, False: 482]
  ------------------
  108|      0|#endif
  109|      0|        default:
  ------------------
  |  Branch (109:9): [True: 0, False: 482]
  ------------------
  110|      0|            return "unidentified liblzma error";
  111|    482|    }
  112|    482|}
tif_lzma.c:LZMAFixupTags:
  115|     33|{
  116|     33|    (void)tif;
  117|     33|    return 1;
  118|     33|}
tif_lzma.c:LZMASetupDecode:
  121|     27|{
  122|     27|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|     27|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|     27|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  123|       |
  124|     27|    assert(sp != NULL);
  ------------------
  |  Branch (124:5): [True: 0, False: 27]
  |  Branch (124:5): [True: 27, False: 0]
  ------------------
  125|       |
  126|       |    /* if we were last encoding, terminate this mode */
  127|     27|    if (sp->state & LSTATE_INIT_ENCODE)
  ------------------
  |  |   57|     27|#define LSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (127:9): [True: 0, False: 27]
  ------------------
  128|      0|    {
  129|      0|        lzma_end(&sp->stream);
  130|      0|        sp->state = 0;
  131|      0|    }
  132|       |
  133|     27|    sp->state |= LSTATE_INIT_DECODE;
  ------------------
  |  |   56|     27|#define LSTATE_INIT_DECODE 0x01
  ------------------
  134|     27|    return 1;
  135|     27|}
tif_lzma.c:LZMAPreDecode:
  141|    482|{
  142|    482|    static const char module[] = "LZMAPreDecode";
  143|    482|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|    482|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|    482|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  144|    482|    lzma_ret ret;
  145|       |
  146|    482|    (void)s;
  147|    482|    assert(sp != NULL);
  ------------------
  |  Branch (147:5): [True: 0, False: 482]
  |  Branch (147:5): [True: 482, False: 0]
  ------------------
  148|       |
  149|    482|    if ((sp->state & LSTATE_INIT_DECODE) == 0)
  ------------------
  |  |   56|    482|#define LSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (149:9): [True: 0, False: 482]
  ------------------
  150|      0|        tif->tif_setupdecode(tif);
  151|       |
  152|    482|    sp->stream.next_in = tif->tif_rawdata;
  153|    482|    sp->stream.avail_in = (size_t)tif->tif_rawcc;
  154|    482|    if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
  ------------------
  |  Branch (154:9): [True: 0, False: 482]
  ------------------
  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|    482|    ret = lzma_stream_decoder(&sp->stream, (uint64_t)-1, 0);
  166|    482|    if (ret != LZMA_OK)
  ------------------
  |  Branch (166:9): [True: 0, False: 482]
  ------------------
  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|    482|    sp->read_error = 0;
  174|       |
  175|    482|    return 1;
  176|    482|}
tif_lzma.c:LZMADecode:
  179|    484|{
  180|    484|    static const char module[] = "LZMADecode";
  181|    484|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|    484|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|    484|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  182|       |
  183|    484|    (void)s;
  184|    484|    assert(sp != NULL);
  ------------------
  |  Branch (184:5): [True: 0, False: 484]
  |  Branch (184:5): [True: 484, False: 0]
  ------------------
  185|    484|    assert(sp->state == LSTATE_INIT_DECODE);
  ------------------
  |  Branch (185:5): [True: 0, False: 484]
  |  Branch (185:5): [True: 484, False: 0]
  ------------------
  186|       |
  187|    484|    if (sp->read_error)
  ------------------
  |  Branch (187:9): [True: 2, False: 482]
  ------------------
  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|    482|    sp->stream.next_in = tif->tif_rawcp;
  198|    482|    sp->stream.avail_in = (size_t)tif->tif_rawcc;
  199|       |
  200|    482|    sp->stream.next_out = op;
  201|    482|    sp->stream.avail_out = (size_t)occ;
  202|    482|    if ((tmsize_t)sp->stream.avail_out != occ)
  ------------------
  |  Branch (202:9): [True: 0, False: 482]
  ------------------
  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|    482|    do
  213|    906|    {
  214|       |        /*
  215|       |         * Save the current stream state to properly recover from the
  216|       |         * decoding errors later.
  217|       |         */
  218|    906|        const uint8_t *next_in = sp->stream.next_in;
  219|    906|        size_t avail_in = sp->stream.avail_in;
  220|       |
  221|    906|        lzma_ret ret = lzma_code(&sp->stream, LZMA_RUN);
  222|    906|        if (ret == LZMA_STREAM_END)
  ------------------
  |  Branch (222:13): [True: 0, False: 906]
  ------------------
  223|      0|            break;
  224|    906|        if (ret == LZMA_MEMLIMIT_ERROR)
  ------------------
  |  Branch (224:13): [True: 0, False: 906]
  ------------------
  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|    906|        if (ret != LZMA_OK)
  ------------------
  |  Branch (241:13): [True: 482, False: 424]
  ------------------
  242|    482|        {
  243|    482|            TIFFErrorExtR(tif, module,
  244|    482|                          "Decoding error at scanline %" PRIu32 ", %s",
  245|    482|                          tif->tif_dir.td_row, LZMAStrerror(ret));
  246|    482|            break;
  247|    482|        }
  248|    906|    } while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (248:14): [True: 424, False: 0]
  ------------------
  249|    482|    if (sp->stream.avail_out != 0)
  ------------------
  |  Branch (249:9): [True: 482, False: 0]
  ------------------
  250|    482|    {
  251|    482|        sp->read_error = 1;
  252|    482|        memset(sp->stream.next_out, 0, sp->stream.avail_out);
  253|    482|        TIFFErrorExtR(tif, module,
  254|    482|                      "Not enough data at scanline %" PRIu32
  255|    482|                      " (short %" TIFF_SIZE_FORMAT " bytes)",
  256|    482|                      tif->tif_dir.td_row, sp->stream.avail_out);
  257|    482|        return 0;
  258|    482|    }
  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|    482|}
tif_lzma.c:LZMACleanup:
  421|     55|{
  422|     55|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|     55|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  423|       |
  424|     55|    assert(sp != 0);
  ------------------
  |  Branch (424:5): [True: 0, False: 55]
  |  Branch (424:5): [True: 55, False: 0]
  ------------------
  425|       |
  426|     55|    (void)TIFFPredictorCleanup(tif);
  427|       |
  428|     55|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
  429|     55|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
  430|       |
  431|     55|    if (sp->state)
  ------------------
  |  Branch (431:9): [True: 26, False: 29]
  ------------------
  432|     26|    {
  433|     26|        lzma_end(&sp->stream);
  434|     26|        sp->state = 0;
  435|     26|    }
  436|     55|    _TIFFfreeExt(tif, sp);
  437|     55|    tif->tif_data = NULL;
  438|       |
  439|     55|    _TIFFSetDefaultCompressionState(tif);
  440|     55|}

TIFFInitLZW:
 1447|    802|{
 1448|    802|    static const char module[] = "TIFFInitLZW";
 1449|    802|    (void)scheme;
 1450|    802|    assert(scheme == COMPRESSION_LZW);
  ------------------
  |  Branch (1450:5): [True: 0, False: 802]
  |  Branch (1450:5): [True: 802, False: 0]
  ------------------
 1451|       |    /*
 1452|       |     * Allocate state block so tag methods have storage to record values.
 1453|       |     */
 1454|    802|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZWCodecState));
 1455|    802|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1455:9): [True: 0, False: 802]
  ------------------
 1456|      0|        goto bad;
 1457|    802|    LZWDecoderState(tif)->dec_codetab = NULL;
  ------------------
  |  |  164|    802|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    802|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1458|    802|    LZWDecoderState(tif)->dec_decode = NULL;
  ------------------
  |  |  164|    802|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    802|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1459|    802|    LZWEncoderState(tif)->enc_hashtab = NULL;
  ------------------
  |  |  165|    802|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    802|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1460|    802|    LZWState(tif)->rw_mode = tif->tif_mode;
  ------------------
  |  |  163|    802|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  ------------------
 1461|       |
 1462|       |    /*
 1463|       |     * Install codec methods.
 1464|       |     */
 1465|    802|    tif->tif_fixuptags = LZWFixupTags;
 1466|    802|    tif->tif_setupdecode = LZWSetupDecode;
 1467|    802|    tif->tif_predecode = LZWPreDecode;
 1468|    802|    tif->tif_decoderow = LZWDecode;
 1469|    802|    tif->tif_decodestrip = LZWDecode;
 1470|    802|    tif->tif_decodetile = LZWDecode;
 1471|    802|#ifndef LZW_READ_ONLY
 1472|    802|    tif->tif_setupencode = LZWSetupEncode;
 1473|    802|    tif->tif_preencode = LZWPreEncode;
 1474|    802|    tif->tif_postencode = LZWPostEncode;
 1475|    802|    tif->tif_encoderow = LZWEncode;
 1476|    802|    tif->tif_encodestrip = LZWEncode;
 1477|    802|    tif->tif_encodetile = LZWEncode;
 1478|    802|#endif
 1479|    802|    tif->tif_getmaxcompressionratio = LZWGetMaxCompressionRatio;
 1480|    802|    tif->tif_cleanup = LZWCleanup;
 1481|       |    /*
 1482|       |     * Setup predictor setup.
 1483|       |     */
 1484|    802|    (void)TIFFPredictorInit(tif);
 1485|    802|    return (1);
 1486|      0|bad:
 1487|      0|    TIFFErrorExtR(tif, module, "No space for LZW state block");
 1488|      0|    return (0);
 1489|    802|}
tif_lzw.c:LZWFixupTags:
  177|    768|{
  178|    768|    (void)tif;
  179|    768|    return (1);
  180|    768|}
tif_lzw.c:LZWSetupDecode:
  183|    946|{
  184|    946|    static const char module[] = "LZWSetupDecode";
  185|    946|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|    946|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    946|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  186|    946|    int code;
  187|       |
  188|    946|    if (sp == NULL)
  ------------------
  |  Branch (188:9): [True: 0, False: 946]
  ------------------
  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|    946|    if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (211:9): [True: 755, False: 191]
  ------------------
  212|    755|    {
  213|    755|        sp->dec_codetab = (code_t *)_TIFFmallocExt(tif, CSIZE * sizeof(code_t));
  ------------------
  |  |   79|    755|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|    755|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  214|    755|        if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (214:13): [True: 0, False: 755]
  ------------------
  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|    755|        code = 255;
  223|    755|        do
  224|   193k|        {
  225|   193k|            sp->dec_codetab[code].firstchar = (unsigned char)code;
  226|   193k|            sp->dec_codetab[code].value = (unsigned char)code;
  227|   193k|            sp->dec_codetab[code].repeated = true;
  228|   193k|            sp->dec_codetab[code].length = 1;
  229|   193k|            sp->dec_codetab[code].next = NULL;
  230|   193k|        } while (code--);
  ------------------
  |  Branch (230:18): [True: 192k, False: 755]
  ------------------
  231|       |        /*
  232|       |         * Zero-out the unused entries  */
  233|       |        /* Silence false positive */
  234|       |        /* coverity[overrun-buffer-arg] */
  235|    755|        memset(&sp->dec_codetab[CODE_CLEAR], 0,
  ------------------
  |  |   71|    755|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  236|    755|               (CODE_FIRST - CODE_CLEAR) * sizeof(code_t));
  ------------------
  |  |   73|    755|#define CODE_FIRST 258 /* first free code entry */
  ------------------
                             (CODE_FIRST - CODE_CLEAR) * sizeof(code_t));
  ------------------
  |  |   71|    755|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  237|    755|    }
  238|    946|    return (1);
  239|    946|}
tif_lzw.c:LZWPreDecode:
  245|  24.3k|{
  246|  24.3k|    static const char module[] = "LZWPreDecode";
  247|  24.3k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  24.3k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  24.3k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  248|       |
  249|  24.3k|    (void)s;
  250|  24.3k|    assert(sp != NULL);
  ------------------
  |  Branch (250:5): [True: 0, False: 24.3k]
  |  Branch (250:5): [True: 24.3k, False: 0]
  ------------------
  251|  24.3k|    if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (251:9): [True: 0, False: 24.3k]
  ------------------
  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|  24.3k|    if (tif->tif_rawcc >= 2 && tif->tif_rawdata[0] == 0 &&
  ------------------
  |  Branch (261:9): [True: 20.0k, False: 4.27k]
  |  Branch (261:32): [True: 5.57k, False: 14.5k]
  ------------------
  262|  5.57k|        (tif->tif_rawdata[1] & 0x1))
  ------------------
  |  Branch (262:9): [True: 3.51k, False: 2.05k]
  ------------------
  263|  3.51k|    {
  264|  3.51k|#ifdef LZW_COMPAT
  265|  3.51k|        if (!sp->dec_decode)
  ------------------
  |  Branch (265:13): [True: 189, False: 3.33k]
  ------------------
  266|    189|        {
  267|    189|            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|    189|            tif->tif_decoderow = LZWDecodeCompat;
  276|    189|            tif->tif_decodestrip = LZWDecodeCompat;
  277|    189|            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|    189|            (*tif->tif_setupdecode)(tif);
  284|    189|            sp->dec_decode = LZWDecodeCompat;
  285|    189|        }
  286|  3.51k|        sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |  103|  3.51k|#define lzw_maxcode base.maxcode
  ------------------
                      sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  3.51k|#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|  3.51k|    }
  296|  20.8k|    else
  297|  20.8k|    {
  298|  20.8k|        sp->lzw_maxcode = MAXCODE(BITS_MIN) - 1;
  ------------------
  |  |  103|  20.8k|#define lzw_maxcode base.maxcode
  ------------------
                      sp->lzw_maxcode = MAXCODE(BITS_MIN) - 1;
  ------------------
  |  |   63|  20.8k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  299|  20.8k|        sp->dec_decode = LZWDecode;
  300|  20.8k|    }
  301|  24.3k|    sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |  102|  24.3k|#define lzw_nbits base.nbits
  ------------------
                  sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |   68|  24.3k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  302|  24.3k|    sp->lzw_nextbits = 0;
  ------------------
  |  |  106|  24.3k|#define lzw_nextbits base.nextbits
  ------------------
  303|  24.3k|    sp->lzw_nextdata = 0;
  ------------------
  |  |  105|  24.3k|#define lzw_nextdata base.nextdata
  ------------------
  304|       |
  305|  24.3k|    sp->dec_restart = 0;
  306|  24.3k|    sp->dec_nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  24.3k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  307|  24.3k|    sp->dec_bitsleft = 0;
  308|  24.3k|    sp->old_tif_rawcc = 0;
  309|  24.3k|    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|  24.3k|    sp->dec_oldcodep = &sp->dec_codetab[0];
  318|  24.3k|    sp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask - 1];
  319|  24.3k|    sp->read_error = 0;
  320|  24.3k|    return (1);
  321|  24.3k|}
tif_lzw.c:LZWDecodeCompat:
  800|  12.7k|{
  801|  12.7k|    static const char module[] = "LZWDecodeCompat";
  802|  12.7k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  12.7k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  12.7k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  803|  12.7k|    uint8_t *op = (uint8_t *)op0;
  804|  12.7k|    tmsize_t occ = occ0;
  805|  12.7k|    uint8_t *tp;
  806|  12.7k|    uint8_t *bp;
  807|  12.7k|    int code, nbits;
  808|  12.7k|    int len;
  809|  12.7k|    long nextbits, nbitsmask;
  810|  12.7k|    WordType nextdata;
  811|  12.7k|    code_t *codep, *free_entp, *maxcodep, *oldcodep;
  812|       |
  813|  12.7k|    (void)s;
  814|  12.7k|    assert(sp != NULL);
  ------------------
  |  Branch (814:5): [True: 0, False: 12.7k]
  |  Branch (814:5): [True: 12.7k, False: 0]
  ------------------
  815|       |
  816|  12.7k|    if (sp->read_error)
  ------------------
  |  Branch (816:9): [True: 5, False: 12.7k]
  ------------------
  817|      5|    {
  818|      5|        memset(op, 0, (size_t)occ);
  819|      5|        TIFFErrorExtR(tif, module,
  820|      5|                      "LZWDecodeCompat: Scanline %" PRIu32
  821|      5|                      " cannot be read due to previous error",
  822|      5|                      tif->tif_dir.td_row);
  823|      5|        return 0;
  824|      5|    }
  825|       |
  826|       |    /*
  827|       |     * Restart interrupted output operation.
  828|       |     */
  829|  12.7k|    if (sp->dec_restart)
  ------------------
  |  Branch (829:9): [True: 2.21k, False: 10.5k]
  ------------------
  830|  2.21k|    {
  831|  2.21k|        tmsize_t residue;
  832|       |
  833|  2.21k|        codep = sp->dec_codep;
  834|  2.21k|        residue = codep->length - sp->dec_restart;
  835|  2.21k|        if (residue > occ)
  ------------------
  |  Branch (835:13): [True: 622, False: 1.58k]
  ------------------
  836|    622|        {
  837|       |            /*
  838|       |             * Residue from previous decode is sufficient
  839|       |             * to satisfy decode request.  Skip to the
  840|       |             * start of the decoded string, place decoded
  841|       |             * values in the output buffer, and return.
  842|       |             */
  843|    622|            sp->dec_restart += occ;
  844|    622|            do
  845|    883|            {
  846|    883|                codep = codep->next;
  847|    883|            } while (--residue > occ);
  ------------------
  |  Branch (847:22): [True: 261, False: 622]
  ------------------
  848|    622|            tp = op + occ;
  849|    622|            do
  850|  1.24k|            {
  851|  1.24k|                *--tp = codep->value;
  852|  1.24k|                codep = codep->next;
  853|  1.24k|            } while (--occ);
  ------------------
  |  Branch (853:22): [True: 622, False: 622]
  ------------------
  854|    622|            return (1);
  855|    622|        }
  856|       |        /*
  857|       |         * Residue satisfies only part of the decode request.
  858|       |         */
  859|  1.58k|        op += residue;
  860|  1.58k|        occ -= residue;
  861|  1.58k|        tp = op;
  862|  1.58k|        do
  863|  23.3k|        {
  864|  23.3k|            *--tp = codep->value;
  865|  23.3k|            codep = codep->next;
  866|  23.3k|        } while (--residue);
  ------------------
  |  Branch (866:18): [True: 21.7k, False: 1.58k]
  ------------------
  867|  1.58k|        sp->dec_restart = 0;
  868|  1.58k|    }
  869|       |
  870|  12.1k|    bp = (uint8_t *)tif->tif_rawcp;
  871|       |
  872|  12.1k|    sp->dec_bitsleft +=
  873|  12.1k|        (((uint64_t)tif->tif_rawcc - (uint64_t)sp->old_tif_rawcc) << 3);
  874|  12.1k|    uint64_t dec_bitsleft = sp->dec_bitsleft;
  875|       |
  876|  12.1k|    nbits = sp->lzw_nbits;
  ------------------
  |  |  102|  12.1k|#define lzw_nbits base.nbits
  ------------------
  877|  12.1k|    nextdata = sp->lzw_nextdata;
  ------------------
  |  |  105|  12.1k|#define lzw_nextdata base.nextdata
  ------------------
  878|  12.1k|    nextbits = sp->lzw_nextbits;
  ------------------
  |  |  106|  12.1k|#define lzw_nextbits base.nextbits
  ------------------
  879|  12.1k|    nbitsmask = sp->dec_nbitsmask;
  880|  12.1k|    oldcodep = sp->dec_oldcodep;
  881|  12.1k|    free_entp = sp->dec_free_entp;
  882|  12.1k|    maxcodep = sp->dec_maxcodep;
  883|       |
  884|   662k|    while (occ > 0)
  ------------------
  |  Branch (884:12): [True: 659k, False: 2.47k]
  ------------------
  885|   659k|    {
  886|   659k|        NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  766|   659k|    {                                                                          \
  |  |  767|   659k|        if (dec_bitsleft < (uint64_t)nbits)                                    \
  |  |  ------------------
  |  |  |  Branch (767:13): [True: 1.97k, False: 657k]
  |  |  ------------------
  |  |  768|   659k|        {                                                                      \
  |  |  769|  1.97k|            TIFFWarningExtR(_tif, module,                                      \
  |  |  770|  1.97k|                            "LZWDecode: Strip %" PRIu32                        \
  |  |  771|  1.97k|                            " not terminated with EOI code",                   \
  |  |  772|  1.97k|                            _tif->tif_dir.td_curstrip);                        \
  |  |  773|  1.97k|            _code = CODE_EOI;                                                  \
  |  |  ------------------
  |  |  |  |   72|  1.97k|#define CODE_EOI 257   /* end-of-information code */
  |  |  ------------------
  |  |  774|  1.97k|        }                                                                      \
  |  |  775|   659k|        else                                                                   \
  |  |  776|   659k|        {                                                                      \
  |  |  777|   657k|            _get(_sp, _bp, _code);                                             \
  |  |  ------------------
  |  |  |  |  886|   657k|        NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  786|   657k|    {                                                                          \
  |  |  |  |  |  |  787|   657k|        nextdata |= (unsigned long)*(bp)++ << nextbits;                        \
  |  |  |  |  |  |  788|   657k|        nextbits += 8;                                                         \
  |  |  |  |  |  |  789|   657k|        if (nextbits < nbits)                                                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (789:13): [True: 246k, False: 411k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  790|   657k|        {                                                                      \
  |  |  |  |  |  |  791|   246k|            nextdata |= (unsigned long)*(bp)++ << nextbits;                    \
  |  |  |  |  |  |  792|   246k|            nextbits += 8;                                                     \
  |  |  |  |  |  |  793|   246k|        }                                                                      \
  |  |  |  |  |  |  794|   657k|        code = (hcode_t)(nextdata & (unsigned long)nbitsmask);                 \
  |  |  |  |  |  |  795|   657k|        nextdata >>= nbits;                                                    \
  |  |  |  |  |  |  796|   657k|        nextbits -= nbits;                                                     \
  |  |  |  |  |  |  797|   657k|    }
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  778|   657k|            dec_bitsleft -= (uint64_t)nbits;                                   \
  |  |  779|   657k|        }                                                                      \
  |  |  780|   659k|    }
  ------------------
  887|   659k|        if (code == CODE_EOI)
  ------------------
  |  |   72|   659k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (887:13): [True: 2.14k, False: 657k]
  ------------------
  888|  2.14k|            break;
  889|   657k|        if (code == CODE_CLEAR)
  ------------------
  |  |   71|   657k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (889:13): [True: 4.41k, False: 653k]
  ------------------
  890|  4.41k|        {
  891|  4.41k|            do
  892|  5.24k|            {
  893|  5.24k|                free_entp = sp->dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  5.24k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  894|  5.24k|                _TIFFmemset(free_entp, 0,
  895|  5.24k|                            (CSIZE - CODE_FIRST) * sizeof(code_t));
  ------------------
  |  |   79|  5.24k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  5.24k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
                                          (CSIZE - CODE_FIRST) * sizeof(code_t));
  ------------------
  |  |   73|  5.24k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  896|  5.24k|                nbits = BITS_MIN;
  ------------------
  |  |   68|  5.24k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  897|  5.24k|                nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  5.24k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  898|  5.24k|                maxcodep = sp->dec_codetab + nbitsmask;
  899|  5.24k|                NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  766|  5.24k|    {                                                                          \
  |  |  767|  5.24k|        if (dec_bitsleft < (uint64_t)nbits)                                    \
  |  |  ------------------
  |  |  |  Branch (767:13): [True: 233, False: 5.00k]
  |  |  ------------------
  |  |  768|  5.24k|        {                                                                      \
  |  |  769|    233|            TIFFWarningExtR(_tif, module,                                      \
  |  |  770|    233|                            "LZWDecode: Strip %" PRIu32                        \
  |  |  771|    233|                            " not terminated with EOI code",                   \
  |  |  772|    233|                            _tif->tif_dir.td_curstrip);                        \
  |  |  773|    233|            _code = CODE_EOI;                                                  \
  |  |  ------------------
  |  |  |  |   72|    233|#define CODE_EOI 257   /* end-of-information code */
  |  |  ------------------
  |  |  774|    233|        }                                                                      \
  |  |  775|  5.24k|        else                                                                   \
  |  |  776|  5.24k|        {                                                                      \
  |  |  777|  5.00k|            _get(_sp, _bp, _code);                                             \
  |  |  ------------------
  |  |  |  |  899|  5.00k|                NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  786|  5.00k|    {                                                                          \
  |  |  |  |  |  |  787|  5.00k|        nextdata |= (unsigned long)*(bp)++ << nextbits;                        \
  |  |  |  |  |  |  788|  5.00k|        nextbits += 8;                                                         \
  |  |  |  |  |  |  789|  5.00k|        if (nextbits < nbits)                                                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (789:13): [True: 579, False: 4.43k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  5.00k|        {                                                                      \
  |  |  |  |  |  |  791|    579|            nextdata |= (unsigned long)*(bp)++ << nextbits;                    \
  |  |  |  |  |  |  792|    579|            nextbits += 8;                                                     \
  |  |  |  |  |  |  793|    579|        }                                                                      \
  |  |  |  |  |  |  794|  5.00k|        code = (hcode_t)(nextdata & (unsigned long)nbitsmask);                 \
  |  |  |  |  |  |  795|  5.00k|        nextdata >>= nbits;                                                    \
  |  |  |  |  |  |  796|  5.00k|        nextbits -= nbits;                                                     \
  |  |  |  |  |  |  797|  5.00k|    }
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  778|  5.00k|            dec_bitsleft -= (uint64_t)nbits;                                   \
  |  |  779|  5.00k|        }                                                                      \
  |  |  780|  5.24k|    }
  ------------------
  900|  5.24k|            } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  5.24k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (900:22): [True: 829, False: 4.41k]
  ------------------
  901|  4.41k|            if (code == CODE_EOI)
  ------------------
  |  |   72|  4.41k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (901:17): [True: 498, False: 3.91k]
  ------------------
  902|    498|                break;
  903|  3.91k|            if (code > CODE_CLEAR)
  ------------------
  |  |   71|  3.91k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (903:17): [True: 487, False: 3.42k]
  ------------------
  904|    487|            {
  905|    487|                memset(op0, 0, (size_t)occ0);
  906|    487|                sp->read_error = 1;
  907|    487|                TIFFErrorExtR(
  908|    487|                    tif, tif->tif_name,
  909|    487|                    "LZWDecode: Corrupted LZW table at scanline %" PRIu32,
  910|    487|                    tif->tif_dir.td_row);
  911|    487|                return (0);
  912|    487|            }
  913|  3.42k|            *op++ = (uint8_t)code;
  914|  3.42k|            occ--;
  915|  3.42k|            oldcodep = sp->dec_codetab + code;
  916|  3.42k|            continue;
  917|  3.91k|        }
  918|   653k|        codep = sp->dec_codetab + code;
  919|       |
  920|       |        /*
  921|       |         * Add the new entry to the code table.
  922|       |         */
  923|   653k|        if (free_entp < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (923:13): [True: 3.76k, False: 649k]
  ------------------
  924|   649k|            free_entp >= &sp->dec_codetab[CSIZE])
  ------------------
  |  |   79|   649k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|   649k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (924:13): [True: 1, False: 649k]
  ------------------
  925|  3.76k|        {
  926|  3.76k|            memset(op0, 0, (size_t)occ0);
  927|  3.76k|            sp->read_error = 1;
  928|  3.76k|            TIFFErrorExtR(tif, module,
  929|  3.76k|                          "Corrupted LZW table at scanline %" PRIu32,
  930|  3.76k|                          tif->tif_dir.td_row);
  931|  3.76k|            return (0);
  932|  3.76k|        }
  933|       |
  934|   649k|        free_entp->next = oldcodep;
  935|   649k|        if (free_entp->next < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (935:13): [True: 0, False: 649k]
  ------------------
  936|   649k|            free_entp->next >= &sp->dec_codetab[CSIZE])
  ------------------
  |  |   79|   649k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|   649k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (936:13): [True: 0, False: 649k]
  ------------------
  937|      0|        {
  938|      0|            memset(op0, 0, (size_t)occ0);
  939|      0|            sp->read_error = 1;
  940|      0|            TIFFErrorExtR(tif, module,
  941|      0|                          "Corrupted LZW table at scanline %" PRIu32,
  942|      0|                          tif->tif_dir.td_row);
  943|      0|            return (0);
  944|      0|        }
  945|   649k|        free_entp->firstchar = free_entp->next->firstchar;
  946|   649k|        free_entp->length = (uint16_t)(free_entp->next->length + 1);
  947|   649k|        free_entp->value =
  948|   649k|            (codep < free_entp) ? codep->firstchar : free_entp->firstchar;
  ------------------
  |  Branch (948:13): [True: 626k, False: 23.0k]
  ------------------
  949|   649k|        if (++free_entp > maxcodep)
  ------------------
  |  Branch (949:13): [True: 21.5k, False: 627k]
  ------------------
  950|  21.5k|        {
  951|  21.5k|            if (++nbits > BITS_MAX) /* should not happen */
  ------------------
  |  |   69|  21.5k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (951:17): [True: 21.0k, False: 556]
  ------------------
  952|  21.0k|                nbits = BITS_MAX;
  ------------------
  |  |   69|  21.0k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  953|  21.5k|            nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  21.5k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  954|  21.5k|            maxcodep = sp->dec_codetab + nbitsmask;
  955|  21.5k|        }
  956|   649k|        oldcodep = codep;
  957|   649k|        if (code >= 256)
  ------------------
  |  Branch (957:13): [True: 195k, False: 453k]
  ------------------
  958|   195k|        {
  959|       |            /*
  960|       |             * Code maps to a string, copy string
  961|       |             * value to output (written in reverse).
  962|       |             */
  963|   195k|            if (codep->length == 0)
  ------------------
  |  Branch (963:17): [True: 705, False: 194k]
  ------------------
  964|    705|            {
  965|    705|                memset(op0, 0, (size_t)occ0);
  966|    705|                sp->read_error = 1;
  967|    705|                TIFFErrorExtR(
  968|    705|                    tif, module,
  969|    705|                    "Wrong length of decoded "
  970|    705|                    "string: data probably corrupted at scanline %" PRIu32,
  971|    705|                    tif->tif_dir.td_row);
  972|    705|                return (0);
  973|    705|            }
  974|   194k|            if (codep->length > occ)
  ------------------
  |  Branch (974:17): [True: 2.04k, False: 192k]
  ------------------
  975|  2.04k|            {
  976|       |                /*
  977|       |                 * String is too long for decode buffer,
  978|       |                 * locate portion that will fit, copy to
  979|       |                 * the decode buffer, and setup restart
  980|       |                 * logic for the next decoding call.
  981|       |                 */
  982|  2.04k|                sp->dec_codep = codep;
  983|  2.04k|                do
  984|  25.9k|                {
  985|  25.9k|                    codep = codep->next;
  986|  25.9k|                } while (codep->length > occ);
  ------------------
  |  Branch (986:26): [True: 23.9k, False: 2.04k]
  ------------------
  987|  2.04k|                sp->dec_restart = occ;
  988|  2.04k|                tp = op + occ;
  989|  2.04k|                do
  990|  34.7k|                {
  991|  34.7k|                    *--tp = codep->value;
  992|  34.7k|                    codep = codep->next;
  993|  34.7k|                } while (--occ);
  ------------------
  |  Branch (993:26): [True: 32.7k, False: 2.04k]
  ------------------
  994|  2.04k|                break;
  995|  2.04k|            }
  996|   192k|            len = codep->length;
  997|   192k|            tp = op + len;
  998|   192k|            do
  999|  1.75M|            {
 1000|  1.75M|                *--tp = codep->value;
 1001|  1.75M|                codep = codep->next;
 1002|  1.75M|            } while (codep && tp > op);
  ------------------
  |  Branch (1002:22): [True: 1.55M, False: 192k]
  |  Branch (1002:31): [True: 1.55M, False: 0]
  ------------------
 1003|   192k|            assert(occ >= len);
  ------------------
  |  Branch (1003:13): [True: 0, False: 192k]
  |  Branch (1003:13): [True: 192k, False: 0]
  ------------------
 1004|   192k|            op += len;
 1005|   192k|            occ -= len;
 1006|   192k|        }
 1007|   453k|        else
 1008|   453k|        {
 1009|   453k|            *op++ = (uint8_t)code;
 1010|   453k|            occ--;
 1011|   453k|        }
 1012|   649k|    }
 1013|       |
 1014|  7.17k|    tif->tif_rawcc -= (tmsize_t)((uint8_t *)bp - tif->tif_rawcp);
 1015|  7.17k|    tif->tif_rawcp = (uint8_t *)bp;
 1016|       |
 1017|  7.17k|    sp->old_tif_rawcc = tif->tif_rawcc;
 1018|  7.17k|    sp->dec_bitsleft = dec_bitsleft;
 1019|       |
 1020|  7.17k|    sp->lzw_nbits = (unsigned short)nbits;
  ------------------
  |  |  102|  7.17k|#define lzw_nbits base.nbits
  ------------------
 1021|  7.17k|    sp->lzw_nextdata = nextdata;
  ------------------
  |  |  105|  7.17k|#define lzw_nextdata base.nextdata
  ------------------
 1022|  7.17k|    sp->lzw_nextbits = nextbits;
  ------------------
  |  |  106|  7.17k|#define lzw_nextbits base.nextbits
  ------------------
 1023|  7.17k|    sp->dec_nbitsmask = nbitsmask;
 1024|  7.17k|    sp->dec_oldcodep = oldcodep;
 1025|  7.17k|    sp->dec_free_entp = free_entp;
 1026|  7.17k|    sp->dec_maxcodep = maxcodep;
 1027|       |
 1028|  7.17k|    if (occ > 0)
  ------------------
  |  Branch (1028:9): [True: 2.64k, False: 4.52k]
  ------------------
 1029|  2.64k|    {
 1030|  2.64k|        memset(op, 0, (size_t)occ);
 1031|  2.64k|        sp->read_error = 1;
 1032|  2.64k|        TIFFErrorExtR(tif, module,
 1033|  2.64k|                      "Not enough data at scanline %" PRIu32 " (short %" PRIu64
 1034|  2.64k|                      " bytes)",
 1035|  2.64k|                      tif->tif_dir.td_row, (uint64_t)occ);
 1036|  2.64k|        return (0);
 1037|  2.64k|    }
 1038|  4.52k|    return (1);
 1039|  7.17k|}
tif_lzw.c:LZWDecode:
  403|  20.2k|{
  404|  20.2k|    static const char module[] = "LZWDecode";
  405|  20.2k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  20.2k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  20.2k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  406|  20.2k|    uint8_t *op = (uint8_t *)op0;
  407|  20.2k|    tmsize_t occ = occ0;
  408|  20.2k|    uint8_t *bp;
  409|  20.2k|    long nbits, nextbits, nbitsmask;
  410|  20.2k|    WordType nextdata;
  411|  20.2k|    code_t *free_entp, *maxcodep, *oldcodep;
  412|       |
  413|  20.2k|    (void)s;
  414|  20.2k|    assert(sp != NULL);
  ------------------
  |  Branch (414:5): [True: 0, False: 20.2k]
  |  Branch (414:5): [True: 20.2k, False: 0]
  ------------------
  415|  20.2k|    assert(sp->dec_codetab != NULL);
  ------------------
  |  Branch (415:5): [True: 0, False: 20.2k]
  |  Branch (415:5): [True: 20.2k, False: 0]
  ------------------
  416|       |
  417|  20.2k|    if (sp->read_error)
  ------------------
  |  Branch (417:9): [True: 16, False: 20.1k]
  ------------------
  418|     16|    {
  419|     16|        memset(op, 0, (size_t)occ);
  420|     16|        TIFFErrorExtR(tif, module,
  421|     16|                      "LZWDecode: Scanline %" PRIu32 " cannot be read due to "
  422|     16|                      "previous error",
  423|     16|                      tif->tif_dir.td_row);
  424|     16|        return 0;
  425|     16|    }
  426|       |
  427|       |    /*
  428|       |     * Restart interrupted output operation.
  429|       |     */
  430|  20.1k|    if (sp->dec_restart)
  ------------------
  |  Branch (430:9): [True: 1.95k, False: 18.2k]
  ------------------
  431|  1.95k|    {
  432|  1.95k|        tmsize_t residue;
  433|       |
  434|  1.95k|        code_t *codep = sp->dec_codep;
  435|  1.95k|        residue = codep->length - sp->dec_restart;
  436|  1.95k|        if (residue > occ)
  ------------------
  |  Branch (436:13): [True: 486, False: 1.46k]
  ------------------
  437|    486|        {
  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|    486|            sp->dec_restart += occ;
  445|    486|            do
  446|  1.07k|            {
  447|  1.07k|                codep = codep->next;
  448|  1.07k|            } while (--residue > occ && codep);
  ------------------
  |  Branch (448:22): [True: 586, False: 486]
  |  Branch (448:41): [True: 586, False: 0]
  ------------------
  449|    486|            if (codep)
  ------------------
  |  Branch (449:17): [True: 486, False: 0]
  ------------------
  450|    486|            {
  451|    486|                uint8_t *tp = op + occ;
  452|    486|                do
  453|    823|                {
  454|    823|                    *--tp = codep->value;
  455|    823|                    codep = codep->next;
  456|    823|                } while (--occ && codep);
  ------------------
  |  Branch (456:26): [True: 337, False: 486]
  |  Branch (456:35): [True: 337, False: 0]
  ------------------
  457|    486|            }
  458|    486|            return (1);
  459|    486|        }
  460|       |        /*
  461|       |         * Residue satisfies only part of the decode request.
  462|       |         */
  463|  1.46k|        op += residue;
  464|  1.46k|        occ -= residue;
  465|  1.46k|        uint8_t *tp = op;
  466|  1.46k|        do
  467|  2.72k|        {
  468|  2.72k|            *--tp = codep->value;
  469|  2.72k|            codep = codep->next;
  470|  2.72k|        } while (--residue && codep);
  ------------------
  |  Branch (470:18): [True: 1.26k, False: 1.46k]
  |  Branch (470:31): [True: 1.26k, False: 0]
  ------------------
  471|  1.46k|        sp->dec_restart = 0;
  472|  1.46k|    }
  473|       |
  474|  19.7k|    bp = (uint8_t *)tif->tif_rawcp;
  475|  19.7k|    sp->dec_bitsleft +=
  476|  19.7k|        (((uint64_t)tif->tif_rawcc - (uint64_t)sp->old_tif_rawcc) << 3);
  477|  19.7k|    uint64_t dec_bitsleft = sp->dec_bitsleft;
  478|  19.7k|    nbits = sp->lzw_nbits;
  ------------------
  |  |  102|  19.7k|#define lzw_nbits base.nbits
  ------------------
  479|  19.7k|    nextdata = sp->lzw_nextdata;
  ------------------
  |  |  105|  19.7k|#define lzw_nextdata base.nextdata
  ------------------
  480|  19.7k|    nextbits = sp->lzw_nextbits;
  ------------------
  |  |  106|  19.7k|#define lzw_nextbits base.nextbits
  ------------------
  481|  19.7k|    nbitsmask = sp->dec_nbitsmask;
  482|  19.7k|    oldcodep = sp->dec_oldcodep;
  483|  19.7k|    free_entp = sp->dec_free_entp;
  484|  19.7k|    maxcodep = sp->dec_maxcodep;
  485|  19.7k|    code_t *const dec_codetab = sp->dec_codetab;
  486|  19.7k|    code_t *codep;
  487|       |
  488|  19.7k|    if (occ == 0)
  ------------------
  |  Branch (488:9): [True: 418, False: 19.2k]
  ------------------
  489|    418|    {
  490|    418|        goto after_loop;
  491|    418|    }
  492|       |
  493|   308k|begin:
  494|   308k|{
  495|   308k|    WordType code;
  496|   308k|    GetNextCodeLZW();
  ------------------
  |  |  362|   308k|    do                                                                         \
  |  |  363|   308k|    {                                                                          \
  |  |  364|   308k|        nextbits -= nbits;                                                     \
  |  |  365|   308k|        if (nextbits < 0)                                                      \
  |  |  ------------------
  |  |  |  Branch (365:13): [True: 61.9k, False: 246k]
  |  |  ------------------
  |  |  366|   308k|        {                                                                      \
  |  |  367|  61.9k|            if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE)                           \
  |  |  ------------------
  |  |  |  |   45|  61.9k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  61.9k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (367:17): [True: 54.7k, False: 7.18k]
  |  |  ------------------
  |  |  368|  61.9k|            {                                                                  \
  |  |  369|  54.7k|                unsigned codetmp = (unsigned)(nextdata << (-nextbits));        \
  |  |  370|  54.7k|                GetNextData(nextdata, bp);                                     \
  |  |  ------------------
  |  |  |  |  335|  54.7k|    memcpy(&nextdata, bp, sizeof(nextdata));                                   \
  |  |  |  |  336|  54.7k|    nextdata = __builtin_bswap64(nextdata)
  |  |  ------------------
  |  |  371|  54.7k|                bp += SIZEOF_WORDTYPE;                                         \
  |  |  ------------------
  |  |  |  |   45|  54.7k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  54.7k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  54.7k|                nextbits += 8 * SIZEOF_WORDTYPE;                               \
  |  |  ------------------
  |  |  |  |   45|  54.7k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  54.7k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|  54.7k|                dec_bitsleft -= 8 * SIZEOF_WORDTYPE;                           \
  |  |  ------------------
  |  |  |  |   45|  54.7k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  54.7k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|  54.7k|                code = (WordType)((codetmp | (nextdata >> nextbits)) &         \
  |  |  375|  54.7k|                                  (WordType)nbitsmask);                        \
  |  |  376|  54.7k|                break;                                                         \
  |  |  377|  54.7k|            }                                                                  \
  |  |  378|  61.9k|            else                                                               \
  |  |  379|  61.9k|            {                                                                  \
  |  |  380|  7.18k|                if (dec_bitsleft < 8)                                          \
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 1.00k, False: 6.18k]
  |  |  ------------------
  |  |  381|  7.18k|                {                                                              \
  |  |  382|  1.00k|                    goto no_eoi;                                               \
  |  |  383|  1.00k|                }                                                              \
  |  |  384|  7.18k|                nextdata = (nextdata << 8) | *(bp)++;                          \
  |  |  385|  6.18k|                nextbits += 8;                                                 \
  |  |  386|  6.18k|                dec_bitsleft -= 8;                                             \
  |  |  387|  6.18k|                if (nextbits < 0)                                              \
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 3.99k, False: 2.18k]
  |  |  ------------------
  |  |  388|  6.18k|                {                                                              \
  |  |  389|  3.99k|                    if (dec_bitsleft < 8)                                      \
  |  |  ------------------
  |  |  |  Branch (389:25): [True: 2.54k, False: 1.44k]
  |  |  ------------------
  |  |  390|  3.99k|                    {                                                          \
  |  |  391|  2.54k|                        goto no_eoi;                                           \
  |  |  392|  2.54k|                    }                                                          \
  |  |  393|  3.99k|                    nextdata = (nextdata << 8) | *(bp)++;                      \
  |  |  394|  1.44k|                    nextbits += 8;                                             \
  |  |  395|  1.44k|                    dec_bitsleft -= 8;                                         \
  |  |  396|  1.44k|                }                                                              \
  |  |  397|  6.18k|            }                                                                  \
  |  |  398|  61.9k|        }                                                                      \
  |  |  399|   308k|        code = (WordType)((nextdata >> nextbits) & (WordType)nbitsmask);       \
  |  |  400|   249k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (400:14): [Folded, False: 249k]
  |  |  ------------------
  ------------------
  497|   304k|    codep = dec_codetab + (unsigned long)code;
  498|   304k|    if (code >= CODE_FIRST)
  ------------------
  |  |   73|   304k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  |  Branch (498:9): [True: 92.8k, False: 211k]
  ------------------
  499|  92.8k|        goto code_above_or_equal_to_258;
  500|   211k|    if (code < 256)
  ------------------
  |  Branch (500:9): [True: 203k, False: 8.10k]
  ------------------
  501|   203k|        goto code_below_256;
  502|  8.10k|    if (code == CODE_EOI)
  ------------------
  |  |   72|  8.10k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (502:9): [True: 322, False: 7.78k]
  ------------------
  503|    322|        goto after_loop;
  504|  7.78k|    goto code_clear;
  505|       |
  506|   203k|code_below_256:
  507|   203k|{
  508|   203k|    if (codep > free_entp)
  ------------------
  |  Branch (508:9): [True: 6.97k, False: 196k]
  ------------------
  509|  6.97k|        goto error_code;
  510|   196k|    free_entp->next = oldcodep;
  511|   196k|    free_entp->firstchar = oldcodep->firstchar;
  512|   196k|    free_entp->length = (uint16_t)(oldcodep->length + 1);
  513|   196k|    free_entp->value = (uint8_t)code;
  514|   196k|    free_entp->repeated =
  515|   196k|        (bool)(oldcodep->repeated & (oldcodep->value == code));
  516|   196k|    if (++free_entp > maxcodep)
  ------------------
  |  Branch (516:9): [True: 778, False: 195k]
  ------------------
  517|    778|    {
  518|    778|        if (++nbits > BITS_MAX) /* should not happen for a conformant encoder */
  ------------------
  |  |   69|    778|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (518:13): [True: 654, False: 124]
  ------------------
  519|    654|            nbits = BITS_MAX;
  ------------------
  |  |   69|    654|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  520|    778|        nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|    778|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  521|    778|        maxcodep = dec_codetab + nbitsmask - 1;
  522|    778|        if (free_entp >= &dec_codetab[CSIZE])
  ------------------
  |  |   79|    778|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|    778|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (522:13): [True: 1, False: 777]
  ------------------
  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|    778|    }
  531|   196k|    oldcodep = codep;
  532|   196k|    *op++ = (uint8_t)code;
  533|   196k|    occ--;
  534|   196k|    if (occ == 0)
  ------------------
  |  Branch (534:9): [True: 1.87k, False: 194k]
  ------------------
  535|  1.87k|        goto after_loop;
  536|   194k|    goto begin;
  537|   196k|}
  538|       |
  539|   194k|code_above_or_equal_to_258:
  540|  92.8k|{
  541|       |    /*
  542|       |     * Add the new entry to the code table.
  543|       |     */
  544|       |
  545|  92.8k|    if (codep >= free_entp)
  ------------------
  |  Branch (545:9): [True: 9.38k, False: 83.4k]
  ------------------
  546|  9.38k|    {
  547|  9.38k|        if (codep != free_entp)
  ------------------
  |  Branch (547:13): [True: 1.70k, False: 7.68k]
  ------------------
  548|  1.70k|            goto error_code;
  549|  7.68k|        free_entp->value = oldcodep->firstchar;
  550|  7.68k|    }
  551|  83.4k|    else
  552|  83.4k|    {
  553|  83.4k|        free_entp->value = codep->firstchar;
  554|  83.4k|    }
  555|  91.1k|    free_entp->repeated =
  556|  91.1k|        (bool)(oldcodep->repeated & (oldcodep->value == free_entp->value));
  557|  91.1k|    free_entp->next = oldcodep;
  558|       |
  559|  91.1k|    free_entp->firstchar = oldcodep->firstchar;
  560|  91.1k|    free_entp->length = (uint16_t)(oldcodep->length + 1);
  561|  91.1k|    if (++free_entp > maxcodep)
  ------------------
  |  Branch (561:9): [True: 2.29k, False: 88.8k]
  ------------------
  562|  2.29k|    {
  563|  2.29k|        if (++nbits > BITS_MAX) /* should not happen for a conformant encoder */
  ------------------
  |  |   69|  2.29k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (563:13): [True: 2.25k, False: 36]
  ------------------
  564|  2.25k|            nbits = BITS_MAX;
  ------------------
  |  |   69|  2.25k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  565|  2.29k|        nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  2.29k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  566|  2.29k|        maxcodep = dec_codetab + nbitsmask - 1;
  567|  2.29k|        if (free_entp >= &dec_codetab[CSIZE])
  ------------------
  |  |   79|  2.29k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  2.29k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (567:13): [True: 1, False: 2.29k]
  ------------------
  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|  2.29k|    }
  576|  91.1k|    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|  91.1k|    unsigned short len = codep->length;
  584|       |
  585|  91.1k|    if (len < 3) /* equivalent to len == 2 given all other conditions */
  ------------------
  |  Branch (585:9): [True: 30.7k, False: 60.4k]
  ------------------
  586|  30.7k|    {
  587|  30.7k|        if (occ <= 2)
  ------------------
  |  Branch (587:13): [True: 1.05k, False: 29.6k]
  ------------------
  588|  1.05k|        {
  589|  1.05k|            if (occ == 2)
  ------------------
  |  Branch (589:17): [True: 475, False: 579]
  ------------------
  590|    475|            {
  591|    475|                memcpy(op, &(codep->firstchar), 2);
  592|    475|                op += 2;
  593|    475|                occ -= 2;
  594|    475|                goto after_loop;
  595|    475|            }
  596|    579|            goto too_short_buffer;
  597|  1.05k|        }
  598|       |
  599|  29.6k|        memcpy(op, &(codep->firstchar), 2);
  600|  29.6k|        op += 2;
  601|  29.6k|        occ -= 2;
  602|  29.6k|        goto begin; /* we can save the comparison occ > 0 */
  603|  30.7k|    }
  604|       |
  605|  60.4k|    if (len == 3)
  ------------------
  |  Branch (605:9): [True: 46.7k, False: 13.6k]
  ------------------
  606|  46.7k|    {
  607|  46.7k|        if (occ <= 3)
  ------------------
  |  Branch (607:13): [True: 831, False: 45.9k]
  ------------------
  608|    831|        {
  609|    831|            if (occ == 3)
  ------------------
  |  Branch (609:17): [True: 334, False: 497]
  ------------------
  610|    334|            {
  611|    334|                op[0] = codep->firstchar;
  612|    334|                op[1] = codep->next->value;
  613|    334|                op[2] = codep->value;
  614|    334|                op += 3;
  615|    334|                occ -= 3;
  616|    334|                goto after_loop;
  617|    334|            }
  618|    497|            goto too_short_buffer;
  619|    831|        }
  620|       |
  621|  45.9k|        op[0] = codep->firstchar;
  622|  45.9k|        op[1] = codep->next->value;
  623|  45.9k|        op[2] = codep->value;
  624|  45.9k|        op += 3;
  625|  45.9k|        occ -= 3;
  626|  45.9k|        goto begin; /* we can save the comparison occ > 0 */
  627|  46.7k|    }
  628|       |
  629|  13.6k|    if (len > occ)
  ------------------
  |  Branch (629:9): [True: 1.09k, False: 12.5k]
  ------------------
  630|  1.09k|    {
  631|  1.09k|        goto too_short_buffer;
  632|  1.09k|    }
  633|       |
  634|  12.5k|    if (codep->repeated)
  ------------------
  |  Branch (634:9): [True: 6.22k, False: 6.35k]
  ------------------
  635|  6.22k|    {
  636|  6.22k|        memset(op, codep->value, len);
  637|  6.22k|        op += len;
  638|  6.22k|        occ -= len;
  639|  6.22k|        if (occ == 0)
  ------------------
  |  Branch (639:13): [True: 215, False: 6.01k]
  ------------------
  640|    215|            goto after_loop;
  641|  6.01k|        goto begin;
  642|  6.22k|    }
  643|       |
  644|  6.35k|    uint8_t *tp = op + len;
  645|       |
  646|  6.35k|    assert(len >= 4);
  ------------------
  |  Branch (646:5): [True: 0, False: 6.35k]
  |  Branch (646:5): [True: 6.35k, False: 0]
  ------------------
  647|       |
  648|  6.35k|    *--tp = codep->value;
  649|  6.35k|    codep = codep->next;
  650|  6.35k|    *--tp = codep->value;
  651|  6.35k|    codep = codep->next;
  652|  6.35k|    *--tp = codep->value;
  653|  6.35k|    codep = codep->next;
  654|  6.35k|    *--tp = codep->value;
  655|  6.35k|    if (tp > op)
  ------------------
  |  Branch (655:9): [True: 2.48k, False: 3.87k]
  ------------------
  656|  2.48k|    {
  657|  2.48k|        do
  658|  6.99k|        {
  659|  6.99k|            codep = codep->next;
  660|  6.99k|            *--tp = codep->value;
  661|  6.99k|        } while (tp > op);
  ------------------
  |  Branch (661:18): [True: 4.50k, False: 2.48k]
  ------------------
  662|  2.48k|    }
  663|       |
  664|  6.35k|    assert(occ >= len);
  ------------------
  |  Branch (664:5): [True: 0, False: 6.35k]
  |  Branch (664:5): [True: 6.35k, False: 0]
  ------------------
  665|  6.35k|    op += len;
  666|  6.35k|    occ -= len;
  667|  6.35k|    if (occ == 0)
  ------------------
  |  Branch (667:9): [True: 267, False: 6.08k]
  ------------------
  668|    267|        goto after_loop;
  669|  6.08k|    goto begin;
  670|  6.35k|}
  671|       |
  672|  7.78k|code_clear:
  673|  7.78k|{
  674|  7.78k|    free_entp = dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  7.78k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  675|  7.78k|    nbits = BITS_MIN;
  ------------------
  |  |   68|  7.78k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  676|  7.78k|    nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  7.78k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  677|  7.78k|    maxcodep = dec_codetab + (unsigned long)nbitsmask - 1;
  678|  7.78k|    do
  679|  8.72k|    {
  680|  8.72k|        GetNextCodeLZW();
  ------------------
  |  |  362|  8.72k|    do                                                                         \
  |  |  363|  8.72k|    {                                                                          \
  |  |  364|  8.72k|        nextbits -= nbits;                                                     \
  |  |  365|  8.72k|        if (nextbits < 0)                                                      \
  |  |  ------------------
  |  |  |  Branch (365:13): [True: 1.54k, False: 7.18k]
  |  |  ------------------
  |  |  366|  8.72k|        {                                                                      \
  |  |  367|  1.54k|            if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE)                           \
  |  |  ------------------
  |  |  |  |   45|  1.54k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  1.54k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (367:17): [True: 343, False: 1.19k]
  |  |  ------------------
  |  |  368|  1.54k|            {                                                                  \
  |  |  369|    343|                unsigned codetmp = (unsigned)(nextdata << (-nextbits));        \
  |  |  370|    343|                GetNextData(nextdata, bp);                                     \
  |  |  ------------------
  |  |  |  |  335|    343|    memcpy(&nextdata, bp, sizeof(nextdata));                                   \
  |  |  |  |  336|    343|    nextdata = __builtin_bswap64(nextdata)
  |  |  ------------------
  |  |  371|    343|                bp += SIZEOF_WORDTYPE;                                         \
  |  |  ------------------
  |  |  |  |   45|    343|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    343|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|    343|                nextbits += 8 * SIZEOF_WORDTYPE;                               \
  |  |  ------------------
  |  |  |  |   45|    343|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    343|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|    343|                dec_bitsleft -= 8 * SIZEOF_WORDTYPE;                           \
  |  |  ------------------
  |  |  |  |   45|    343|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    343|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|    343|                code = (WordType)((codetmp | (nextdata >> nextbits)) &         \
  |  |  375|    343|                                  (WordType)nbitsmask);                        \
  |  |  376|    343|                break;                                                         \
  |  |  377|    343|            }                                                                  \
  |  |  378|  1.54k|            else                                                               \
  |  |  379|  1.54k|            {                                                                  \
  |  |  380|  1.19k|                if (dec_bitsleft < 8)                                          \
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 248, False: 951]
  |  |  ------------------
  |  |  381|  1.19k|                {                                                              \
  |  |  382|    248|                    goto no_eoi;                                               \
  |  |  383|    248|                }                                                              \
  |  |  384|  1.19k|                nextdata = (nextdata << 8) | *(bp)++;                          \
  |  |  385|    951|                nextbits += 8;                                                 \
  |  |  386|    951|                dec_bitsleft -= 8;                                             \
  |  |  387|    951|                if (nextbits < 0)                                              \
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 423, False: 528]
  |  |  ------------------
  |  |  388|    951|                {                                                              \
  |  |  389|    423|                    if (dec_bitsleft < 8)                                      \
  |  |  ------------------
  |  |  |  Branch (389:25): [True: 215, False: 208]
  |  |  ------------------
  |  |  390|    423|                    {                                                          \
  |  |  391|    215|                        goto no_eoi;                                           \
  |  |  392|    215|                    }                                                          \
  |  |  393|    423|                    nextdata = (nextdata << 8) | *(bp)++;                      \
  |  |  394|    208|                    nextbits += 8;                                             \
  |  |  395|    208|                    dec_bitsleft -= 8;                                         \
  |  |  396|    208|                }                                                              \
  |  |  397|    951|            }                                                                  \
  |  |  398|  1.54k|        }                                                                      \
  |  |  399|  8.72k|        code = (WordType)((nextdata >> nextbits) & (WordType)nbitsmask);       \
  |  |  400|  7.91k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (400:14): [Folded, False: 7.91k]
  |  |  ------------------
  ------------------
  681|  8.72k|    } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  8.25k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (681:14): [True: 938, False: 7.32k]
  ------------------
  682|  7.32k|    if (code == CODE_EOI)
  ------------------
  |  |   72|  7.32k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (682:9): [True: 227, False: 7.09k]
  ------------------
  683|    227|        goto after_loop;
  684|  7.09k|    if (code > CODE_EOI)
  ------------------
  |  |   72|  7.09k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (684:9): [True: 482, False: 6.61k]
  ------------------
  685|    482|    {
  686|    482|        goto error_code;
  687|    482|    }
  688|  6.61k|    *op++ = (uint8_t)code;
  689|  6.61k|    occ--;
  690|  6.61k|    oldcodep = dec_codetab + code;
  691|  6.61k|    if (occ == 0)
  ------------------
  |  Branch (691:9): [True: 222, False: 6.39k]
  ------------------
  692|    222|        goto after_loop;
  693|  6.39k|    goto begin;
  694|  6.61k|}
  695|  6.61k|}
  696|       |
  697|  6.39k|too_short_buffer:
  698|  2.16k|{
  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.16k|    sp->dec_codep = codep;
  706|  2.16k|    do
  707|  4.58k|    {
  708|  4.58k|        codep = codep->next;
  709|  4.58k|    } while (codep->length > occ);
  ------------------
  |  Branch (709:14): [True: 2.42k, False: 2.16k]
  ------------------
  710|       |
  711|  2.16k|    sp->dec_restart = occ;
  712|  2.16k|    uint8_t *tp = op + occ;
  713|  2.16k|    do
  714|  3.79k|    {
  715|  3.79k|        *--tp = codep->value;
  716|  3.79k|        codep = codep->next;
  717|  3.79k|    } while (--occ);
  ------------------
  |  Branch (717:14): [True: 1.62k, False: 2.16k]
  ------------------
  718|  2.16k|}
  719|       |
  720|  6.52k|after_loop:
  721|  6.52k|    tif->tif_rawcc -= (tmsize_t)((uint8_t *)bp - tif->tif_rawcp);
  722|  6.52k|    tif->tif_rawcp = (uint8_t *)bp;
  723|  6.52k|    sp->old_tif_rawcc = tif->tif_rawcc;
  724|  6.52k|    sp->dec_bitsleft = dec_bitsleft;
  725|  6.52k|    sp->lzw_nbits = (unsigned short)nbits;
  ------------------
  |  |  102|  6.52k|#define lzw_nbits base.nbits
  ------------------
  726|  6.52k|    sp->lzw_nextdata = nextdata;
  ------------------
  |  |  105|  6.52k|#define lzw_nextdata base.nextdata
  ------------------
  727|  6.52k|    sp->lzw_nextbits = nextbits;
  ------------------
  |  |  106|  6.52k|#define lzw_nextbits base.nextbits
  ------------------
  728|  6.52k|    sp->dec_nbitsmask = nbitsmask;
  729|  6.52k|    sp->dec_oldcodep = oldcodep;
  730|  6.52k|    sp->dec_free_entp = free_entp;
  731|  6.52k|    sp->dec_maxcodep = maxcodep;
  732|       |
  733|  6.52k|    if (occ > 0)
  ------------------
  |  Branch (733:9): [True: 549, False: 5.97k]
  ------------------
  734|    549|    {
  735|    549|        memset(op, 0, (size_t)occ);
  736|    549|        sp->read_error = 1;
  737|    549|        TIFFErrorExtR(tif, module,
  738|    549|                      "Not enough data at scanline %" PRIu32 " (short %" PRIu64
  739|    549|                      " bytes)",
  740|    549|                      tif->tif_dir.td_row, (uint64_t)occ);
  741|    549|        return (0);
  742|    549|    }
  743|  5.97k|    return (1);
  744|       |
  745|  4.01k|no_eoi:
  746|  4.01k|    memset(op, 0, (size_t)occ);
  747|  4.01k|    sp->read_error = 1;
  748|  4.01k|    TIFFErrorExtR(tif, module,
  749|  4.01k|                  "LZWDecode: Strip %" PRIu32 " not terminated with EOI code",
  750|  4.01k|                  tif->tif_dir.td_curstrip);
  751|  4.01k|    return 0;
  752|  9.16k|error_code:
  753|  9.16k|    memset(op, 0, (size_t)occ);
  754|  9.16k|    sp->read_error = 1;
  755|  9.16k|    TIFFErrorExtR(tif, tif->tif_name, "Using code not yet in table");
  756|  9.16k|    return 0;
  757|  6.52k|}
tif_lzw.c:LZWGetMaxCompressionRatio:
 1432|      2|{
 1433|      2|    (void)tif;
 1434|       |
 1435|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
 1436|       |     * the maximum compression rate. */
 1437|       |
 1438|       |    /* 1024x1024: 562 */
 1439|       |    /* 4096x4096: 1243 */
 1440|       |    /* 16383x16383: 1353 */
 1441|       |    /* 65536x65536: 1362 */
 1442|       |
 1443|      2|    return 1400;
 1444|      2|}
tif_lzw.c:LZWCleanup:
 1414|    802|{
 1415|    802|    (void)TIFFPredictorCleanup(tif);
 1416|       |
 1417|    802|    assert(tif->tif_data != NULL);
  ------------------
  |  Branch (1417:5): [True: 0, False: 802]
  |  Branch (1417:5): [True: 802, False: 0]
  ------------------
 1418|       |
 1419|    802|    if (LZWDecoderState(tif)->dec_codetab)
  ------------------
  |  |  164|    802|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    802|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1419:9): [True: 755, False: 47]
  ------------------
 1420|    755|        _TIFFfreeExt(tif, LZWDecoderState(tif)->dec_codetab);
  ------------------
  |  |  164|    755|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    755|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1421|       |
 1422|    802|    if (LZWEncoderState(tif)->enc_hashtab)
  ------------------
  |  |  165|    802|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    802|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1422:9): [True: 0, False: 802]
  ------------------
 1423|      0|        _TIFFfreeExt(tif, LZWEncoderState(tif)->enc_hashtab);
  ------------------
  |  |  165|      0|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|      0|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1424|       |
 1425|    802|    _TIFFfreeExt(tif, tif->tif_data);
 1426|    802|    tif->tif_data = NULL;
 1427|       |
 1428|    802|    _TIFFSetDefaultCompressionState(tif);
 1429|    802|}

TIFFInitNeXT:
  195|    101|{
  196|    101|    (void)scheme;
  197|    101|    tif->tif_predecode = NeXTPreDecode;
  198|    101|    tif->tif_decoderow = NeXTDecode;
  199|    101|    tif->tif_decodestrip = NeXTDecode;
  200|    101|    tif->tif_decodetile = NeXTDecode;
  201|    101|    return (1);
  202|    101|}
tif_next.c:NeXTPreDecode:
  172|  3.32k|{
  173|  3.32k|    static const char module[] = "NeXTPreDecode";
  174|  3.32k|    TIFFDirectory *td = &tif->tif_dir;
  175|  3.32k|    (void)s;
  176|       |
  177|  3.32k|    if (td->td_bitspersample != 2)
  ------------------
  |  Branch (177:9): [True: 3, False: 3.31k]
  ------------------
  178|      3|    {
  179|      3|        TIFFErrorExtR(tif, module, "Unsupported BitsPerSample = %" PRIu16,
  180|      3|                      td->td_bitspersample);
  181|      3|        return (0);
  182|      3|    }
  183|  3.31k|    if (td->td_samplesperpixel != 1 &&
  ------------------
  |  Branch (183:9): [True: 2, False: 3.31k]
  ------------------
  184|      2|        td->td_planarconfig != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|      2|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (184:9): [True: 1, False: 1]
  ------------------
  185|      1|    {
  186|      1|        TIFFErrorExtR(tif, module,
  187|      1|                      "Samples/pixel shall be 1 for NeXT decoding, "
  188|      1|                      "or PlanarConfiguration must be set to Separate.");
  189|      1|        return (0);
  190|      1|    }
  191|  3.31k|    return (1);
  192|  3.31k|}
tif_next.c:NeXTDecode:
   59|  21.9k|{
   60|  21.9k|    static const char module[] = "NeXTDecode";
   61|  21.9k|    unsigned char *bp, *op;
   62|  21.9k|    tmsize_t cc;
   63|  21.9k|    uint8_t *row;
   64|  21.9k|    tmsize_t scanline, n;
   65|       |
   66|  21.9k|    (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|  53.0M|    for (op = (unsigned char *)buf, cc = occ; cc-- > 0;)
  ------------------
  |  Branch (72:47): [True: 53.0M, False: 21.9k]
  ------------------
   73|  53.0M|        *op++ = 0xff;
   74|       |
   75|  21.9k|    bp = (unsigned char *)tif->tif_rawcp;
   76|  21.9k|    cc = tif->tif_rawcc;
   77|  21.9k|    scanline = tif->tif_dir.td_scanlinesize;
   78|  21.9k|    if (occ % scanline)
  ------------------
  |  Branch (78:9): [True: 264, False: 21.6k]
  ------------------
   79|    264|    {
   80|    264|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
   81|    264|        return (0);
   82|    264|    }
   83|  75.6k|    for (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline)
  ------------------
  |  Branch (83:21): [True: 57.0k, False: 18.6k]
  |  Branch (83:31): [True: 56.2k, False: 733]
  ------------------
   84|  56.2k|    {
   85|  56.2k|        n = *bp++;
   86|  56.2k|        cc--;
   87|  56.2k|        switch (n)
   88|  56.2k|        {
   89|  12.2k|            case LITERALROW:
  ------------------
  |  |   55|  12.2k|#define LITERALROW 0x00
  ------------------
  |  Branch (89:13): [True: 12.2k, False: 43.9k]
  ------------------
   90|       |                /*
   91|       |                 * The entire scanline is given as literal values.
   92|       |                 */
   93|  12.2k|                if (cc < scanline)
  ------------------
  |  Branch (93:21): [True: 582, False: 11.7k]
  ------------------
   94|    582|                    goto bad;
   95|  11.7k|                _TIFFmemcpy(row, bp, scanline);
   96|  11.7k|                bp += scanline;
   97|  11.7k|                cc -= scanline;
   98|  11.7k|                break;
   99|  1.21k|            case LITERALSPAN:
  ------------------
  |  |   56|  1.21k|#define LITERALSPAN 0x40
  ------------------
  |  Branch (99:13): [True: 1.21k, False: 55.0k]
  ------------------
  100|  1.21k|            {
  101|  1.21k|                tmsize_t off;
  102|       |                /*
  103|       |                 * The scanline has a literal span that begins at some
  104|       |                 * offset.
  105|       |                 */
  106|  1.21k|                if (cc < 4)
  ------------------
  |  Branch (106:21): [True: 257, False: 955]
  ------------------
  107|    257|                    goto bad;
  108|    955|                off = (bp[0] * 256) + bp[1];
  109|    955|                n = (bp[2] * 256) + bp[3];
  110|    955|                if (cc < 4 + n || off + n > scanline)
  ------------------
  |  Branch (110:21): [True: 420, False: 535]
  |  Branch (110:35): [True: 309, False: 226]
  ------------------
  111|    729|                    goto bad;
  112|    226|                _TIFFmemcpy(row + off, bp + 4, n);
  113|    226|                bp += 4 + n;
  114|    226|                cc -= 4 + n;
  115|    226|                break;
  116|    955|            }
  117|  42.7k|            default:
  ------------------
  |  Branch (117:13): [True: 42.7k, False: 13.5k]
  ------------------
  118|  42.7k|            {
  119|  42.7k|                uint32_t npixels = 0, grey;
  120|  42.7k|                tmsize_t op_offset = 0;
  121|  42.7k|                uint32_t imagewidth = tif->tif_dir.td_imagewidth;
  122|  42.7k|                if (isTiled(tif))
  ------------------
  |  |  282|  42.7k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  42.7k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 39.4k, False: 3.30k]
  |  |  ------------------
  ------------------
  123|  39.4k|                    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|  42.7k|                op = row;
  132|  42.7k|                for (;;)
  133|  83.5k|                {
  134|  83.5k|                    grey = (uint32_t)((n >> 6) & 0x3);
  135|  83.5k|                    n &= 0x3f;
  136|       |                    /*
  137|       |                     * Ensure the run does not exceed the scanline
  138|       |                     * bounds, potentially resulting in a security
  139|       |                     * issue.
  140|       |                     */
  141|   676k|                    while (n-- > 0 && npixels < imagewidth &&
  ------------------
  |  Branch (141:28): [True: 631k, False: 45.5k]
  |  Branch (141:39): [True: 593k, False: 37.7k]
  ------------------
  142|   593k|                           op_offset < scanline)
  ------------------
  |  Branch (142:28): [True: 593k, False: 262]
  ------------------
  143|   593k|                        SETPIXEL(op, grey);
  ------------------
  |  |   34|   593k|    {                                                                          \
  |  |   35|   593k|        switch (npixels++ & 3)                                                 \
  |  |   36|   593k|        {                                                                      \
  |  |   37|   175k|            case 0:                                                            \
  |  |  ------------------
  |  |  |  Branch (37:13): [True: 175k, False: 417k]
  |  |  ------------------
  |  |   38|   175k|                op[0] = (unsigned char)((v) << 6);                             \
  |  |   39|   175k|                break;                                                         \
  |  |   40|   141k|            case 1:                                                            \
  |  |  ------------------
  |  |  |  Branch (40:13): [True: 141k, False: 451k]
  |  |  ------------------
  |  |   41|   141k|                op[0] |= (unsigned char)((v) << 4);                            \
  |  |   42|   141k|                break;                                                         \
  |  |   43|   139k|            case 2:                                                            \
  |  |  ------------------
  |  |  |  Branch (43:13): [True: 139k, False: 453k]
  |  |  ------------------
  |  |   44|   139k|                op[0] |= (unsigned char)((v) << 2);                            \
  |  |   45|   139k|                break;                                                         \
  |  |   46|   135k|            case 3:                                                            \
  |  |  ------------------
  |  |  |  Branch (46:13): [True: 135k, False: 457k]
  |  |  ------------------
  |  |   47|   135k|                *op++ |= (unsigned char)(v);                                   \
  |  |   48|   135k|                op_offset++;                                                   \
  |  |   49|   135k|                break;                                                         \
  |  |   50|      0|            default:                                                           \
  |  |  ------------------
  |  |  |  Branch (50:13): [True: 0, False: 593k]
  |  |  ------------------
  |  |   51|      0|                break;                                                         \
  |  |   52|   593k|        }                                                                      \
  |  |   53|   593k|    }
  ------------------
  144|  83.5k|                    if (npixels >= imagewidth)
  ------------------
  |  Branch (144:25): [True: 42.0k, False: 41.4k]
  ------------------
  145|  42.0k|                        break;
  146|  41.4k|                    if (op_offset >= scanline)
  ------------------
  |  Branch (146:25): [True: 268, False: 41.2k]
  ------------------
  147|    268|                    {
  148|    268|                        TIFFErrorExtR(tif, module,
  149|    268|                                      "Invalid data for scanline %" PRIu32,
  150|    268|                                      tif->tif_dir.td_row);
  151|    268|                        return (0);
  152|    268|                    }
  153|  41.2k|                    if (cc == 0)
  ------------------
  |  Branch (153:25): [True: 451, False: 40.7k]
  ------------------
  154|    451|                        goto bad;
  155|  40.7k|                    n = *bp++;
  156|  40.7k|                    cc--;
  157|  40.7k|                }
  158|  42.0k|                break;
  159|  42.7k|            }
  160|  56.2k|        }
  161|  56.2k|    }
  162|  19.3k|    tif->tif_rawcp = (uint8_t *)bp;
  163|  19.3k|    tif->tif_rawcc = cc;
  164|  19.3k|    return (1);
  165|  2.01k|bad:
  166|       |    TIFFErrorExtR(tif, module, "Not enough data for scanline %" PRIu32,
  167|  2.01k|                  tif->tif_dir.td_row);
  168|  2.01k|    return (0);
  169|  21.6k|}

TIFFInitOJPEG:
  454|  3.18k|{
  455|  3.18k|    static const char module[] = "TIFFInitOJPEG";
  456|  3.18k|    OJPEGState *sp;
  457|       |
  458|  3.18k|    (void)scheme;
  459|  3.18k|    assert(scheme == COMPRESSION_OJPEG);
  ------------------
  |  Branch (459:5): [True: 0, False: 3.18k]
  |  Branch (459:5): [True: 3.18k, False: 0]
  ------------------
  460|       |
  461|       |    /*
  462|       |     * Merge codec-specific tag information.
  463|       |     */
  464|  3.18k|    if (!_TIFFMergeFields(tif, ojpegFields, TIFFArrayCount(ojpegFields)))
  ------------------
  |  |  354|  3.18k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (464:9): [True: 0, False: 3.18k]
  ------------------
  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|  3.18k|    sp = (OJPEGState *)_TIFFmallocExt(tif, sizeof(OJPEGState));
  473|  3.18k|    if (sp == NULL)
  ------------------
  |  Branch (473:9): [True: 0, False: 3.18k]
  ------------------
  474|      0|    {
  475|      0|        TIFFErrorExtR(tif, module, "No space for OJPEG state block");
  476|      0|        return (0);
  477|      0|    }
  478|  3.18k|    _TIFFmemset(sp, 0, sizeof(OJPEGState));
  479|  3.18k|    sp->tif = tif;
  480|  3.18k|    sp->jpeg_proc = 1;
  481|  3.18k|    sp->subsampling_hor = 2;
  482|  3.18k|    sp->subsampling_ver = 2;
  483|  3.18k|    TIFFSetField(tif, TIFFTAG_YCBCRSUBSAMPLING, 2, 2);
  ------------------
  |  |  388|  3.18k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  484|       |    /* tif codec methods */
  485|  3.18k|    tif->tif_fixuptags = OJPEGFixupTags;
  486|  3.18k|    tif->tif_setupdecode = OJPEGSetupDecode;
  487|  3.18k|    tif->tif_predecode = OJPEGPreDecode;
  488|  3.18k|    tif->tif_postdecode = OJPEGPostDecode;
  489|  3.18k|    tif->tif_decoderow = OJPEGDecode;
  490|  3.18k|    tif->tif_decodestrip = OJPEGDecode;
  491|  3.18k|    tif->tif_decodetile = OJPEGDecode;
  492|  3.18k|    tif->tif_setupencode = OJPEGSetupEncode;
  493|  3.18k|    tif->tif_preencode = OJPEGPreEncode;
  494|  3.18k|    tif->tif_postencode = OJPEGPostEncode;
  495|  3.18k|    tif->tif_encoderow = OJPEGEncode;
  496|  3.18k|    tif->tif_encodestrip = OJPEGEncode;
  497|  3.18k|    tif->tif_encodetile = OJPEGEncode;
  498|  3.18k|    tif->tif_cleanup = OJPEGCleanup;
  499|  3.18k|    tif->tif_data = (uint8_t *)sp;
  500|       |    /* tif tag methods */
  501|  3.18k|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  502|  3.18k|    tif->tif_tagmethods.vgetfield = OJPEGVGetField;
  503|  3.18k|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  504|  3.18k|    tif->tif_tagmethods.vsetfield = OJPEGVSetField;
  505|  3.18k|    sp->printdir = tif->tif_tagmethods.printdir;
  506|  3.18k|    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|  3.18k|    tif->tif_flags |= TIFF_NOREADRAW;
  ------------------
  |  |  141|  3.18k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  514|  3.18k|    return (1);
  515|  3.18k|}
tif_ojpeg.c:OJPEGVGetField:
  518|  38.0k|{
  519|  38.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  520|  38.0k|    switch (tag)
  521|  38.0k|    {
  522|      0|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|      0|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (522:9): [True: 0, False: 38.0k]
  ------------------
  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: 38.0k]
  ------------------
  526|      0|            *va_arg(ap, uint64_t *) =
  527|      0|                (uint64_t)sp->jpeg_interchange_format_length;
  528|      0|            break;
  529|  10.4k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  10.4k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (529:9): [True: 10.4k, False: 27.6k]
  ------------------
  530|  10.4k|            if (sp->subsamplingcorrect_done == 0)
  ------------------
  |  Branch (530:17): [True: 2.93k, False: 7.49k]
  ------------------
  531|  2.93k|                OJPEGSubsamplingCorrect(tif);
  532|  10.4k|            *va_arg(ap, uint16_t *) = (uint16_t)sp->subsampling_hor;
  533|  10.4k|            *va_arg(ap, uint16_t *) = (uint16_t)sp->subsampling_ver;
  534|  10.4k|            break;
  535|      0|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|      0|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (535:9): [True: 0, False: 38.0k]
  ------------------
  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: 38.0k]
  ------------------
  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: 38.0k]
  ------------------
  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: 38.0k]
  ------------------
  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: 38.0k]
  ------------------
  551|      0|            *va_arg(ap, uint16_t *) = sp->restart_interval;
  552|      0|            break;
  553|  27.6k|        default:
  ------------------
  |  Branch (553:9): [True: 27.6k, False: 10.4k]
  ------------------
  554|  27.6k|            return (*sp->vgetparent)(tif, tag, ap);
  555|  38.0k|    }
  556|  10.4k|    return (1);
  557|  38.0k|}
tif_ojpeg.c:OJPEGSubsamplingCorrect:
 1084|  2.99k|{
 1085|  2.99k|    static const char module[] = "OJPEGSubsamplingCorrect";
 1086|  2.99k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1087|  2.99k|    uint8_t mh;
 1088|  2.99k|    uint8_t mv;
 1089|       |
 1090|  2.99k|    assert(sp->subsamplingcorrect_done == 0);
  ------------------
  |  Branch (1090:5): [True: 0, False: 2.99k]
  |  Branch (1090:5): [True: 2.99k, False: 0]
  ------------------
 1091|  2.99k|    if ((tif->tif_dir.td_samplesperpixel != 3) ||
  ------------------
  |  Branch (1091:9): [True: 59, False: 2.93k]
  ------------------
 1092|  2.93k|        ((tif->tif_dir.td_photometric != PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|  2.93k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1092:10): [True: 23, False: 2.90k]
  ------------------
 1093|     23|         (tif->tif_dir.td_photometric != PHOTOMETRIC_ITULAB)))
  ------------------
  |  |  230|     23|#define PHOTOMETRIC_ITULAB 10              /* ITU L*a*b* */
  ------------------
  |  Branch (1093:10): [True: 22, False: 1]
  ------------------
 1094|     81|    {
 1095|     81|        if (sp->subsampling_tag != 0)
  ------------------
  |  Branch (1095:13): [True: 4, False: 77]
  ------------------
 1096|      4|            TIFFWarningExtR(tif, module,
 1097|      4|                            "Subsampling tag not appropriate for this "
 1098|      4|                            "Photometric and/or SamplesPerPixel");
 1099|     81|        sp->subsampling_hor = 1;
 1100|     81|        sp->subsampling_ver = 1;
 1101|     81|        sp->subsampling_force_desubsampling_inside_decompression = 0;
 1102|     81|    }
 1103|  2.91k|    else
 1104|  2.91k|    {
 1105|  2.91k|        sp->subsamplingcorrect_done = 1;
 1106|  2.91k|        mh = sp->subsampling_hor;
 1107|  2.91k|        mv = sp->subsampling_ver;
 1108|  2.91k|        sp->subsamplingcorrect = 1;
 1109|  2.91k|        OJPEGReadHeaderInfoSec(tif);
 1110|  2.91k|        if (sp->subsampling_force_desubsampling_inside_decompression != 0)
  ------------------
  |  Branch (1110:13): [True: 111, False: 2.79k]
  ------------------
 1111|    111|        {
 1112|    111|            sp->subsampling_hor = 1;
 1113|    111|            sp->subsampling_ver = 1;
 1114|    111|        }
 1115|  2.91k|        sp->subsamplingcorrect = 0;
 1116|  2.91k|        if (((sp->subsampling_hor != mh) || (sp->subsampling_ver != mv)) &&
  ------------------
  |  Branch (1116:14): [True: 129, False: 2.78k]
  |  Branch (1116:45): [True: 3, False: 2.77k]
  ------------------
 1117|    132|            (sp->subsampling_force_desubsampling_inside_decompression == 0))
  ------------------
  |  Branch (1117:13): [True: 21, False: 111]
  ------------------
 1118|     21|        {
 1119|     21|            if (sp->subsampling_tag == 0)
  ------------------
  |  Branch (1119:17): [True: 20, False: 1]
  ------------------
 1120|     20|                TIFFWarningExtR(
 1121|     20|                    tif, module,
 1122|     20|                    "Subsampling tag is not set, yet subsampling inside JPEG "
 1123|     20|                    "data [%" PRIu8 ",%" PRIu8
 1124|     20|                    "] does not match default values [2,2]; assuming "
 1125|     20|                    "subsampling inside JPEG data is correct",
 1126|     20|                    sp->subsampling_hor, sp->subsampling_ver);
 1127|      1|            else
 1128|      1|                TIFFWarningExtR(
 1129|      1|                    tif, module,
 1130|      1|                    "Subsampling inside JPEG data [%" PRIu8 ",%" PRIu8
 1131|      1|                    "] does not match subsampling tag values [%" PRIu8
 1132|      1|                    ",%" PRIu8
 1133|      1|                    "]; assuming subsampling inside JPEG data is correct",
 1134|      1|                    sp->subsampling_hor, sp->subsampling_ver, mh, mv);
 1135|     21|        }
 1136|  2.91k|        if (sp->subsampling_force_desubsampling_inside_decompression != 0)
  ------------------
  |  Branch (1136:13): [True: 111, False: 2.79k]
  ------------------
 1137|    111|        {
 1138|    111|            if (sp->subsampling_tag == 0)
  ------------------
  |  Branch (1138:17): [True: 110, False: 1]
  ------------------
 1139|    110|                TIFFWarningExtR(
 1140|    110|                    tif, module,
 1141|    110|                    "Subsampling tag is not set, yet subsampling inside JPEG "
 1142|    110|                    "data does not match default values [2,2] (nor any other "
 1143|    110|                    "values allowed in TIFF); assuming subsampling inside JPEG "
 1144|    110|                    "data is correct and desubsampling inside JPEG "
 1145|    110|                    "decompression");
 1146|      1|            else
 1147|      1|                TIFFWarningExtR(
 1148|      1|                    tif, module,
 1149|      1|                    "Subsampling inside JPEG data does not match subsampling "
 1150|      1|                    "tag values [%" PRIu8 ",%" PRIu8
 1151|      1|                    "] (nor any other values allowed in TIFF); assuming "
 1152|      1|                    "subsampling inside JPEG data is correct and desubsampling "
 1153|      1|                    "inside JPEG decompression",
 1154|      1|                    mh, mv);
 1155|    111|        }
 1156|  2.91k|        if (sp->subsampling_force_desubsampling_inside_decompression == 0)
  ------------------
  |  Branch (1156:13): [True: 2.79k, False: 111]
  ------------------
 1157|  2.79k|        {
 1158|  2.79k|            if (sp->subsampling_hor < sp->subsampling_ver)
  ------------------
  |  Branch (1158:17): [True: 19, False: 2.78k]
  ------------------
 1159|     19|                TIFFWarningExtR(tif, module,
 1160|     19|                                "Subsampling values [%" PRIu8 ",%" PRIu8
 1161|     19|                                "] are not allowed in TIFF",
 1162|     19|                                sp->subsampling_hor, sp->subsampling_ver);
 1163|  2.79k|        }
 1164|  2.91k|    }
 1165|  2.99k|    sp->subsamplingcorrect_done = 1;
 1166|  2.99k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSec:
 1538|  4.77k|{
 1539|  4.77k|    static const char module[] = "OJPEGReadHeaderInfoSec";
 1540|  4.77k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1541|  4.77k|    uint8_t m;
 1542|  4.77k|    uint16_t n;
 1543|  4.77k|    uint8_t o;
 1544|  4.77k|    if (sp->file_size == 0)
  ------------------
  |  Branch (1544:9): [True: 2.98k, False: 1.78k]
  ------------------
 1545|  2.98k|        sp->file_size = TIFFGetFileSize(tif);
  ------------------
  |  |  293|  2.98k|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 1546|  4.77k|    if (sp->jpeg_interchange_format != 0)
  ------------------
  |  Branch (1546:9): [True: 1.43k, False: 3.33k]
  ------------------
 1547|  1.43k|    {
 1548|  1.43k|        if (sp->jpeg_interchange_format >= sp->file_size)
  ------------------
  |  Branch (1548:13): [True: 169, False: 1.26k]
  ------------------
 1549|    169|        {
 1550|    169|            sp->jpeg_interchange_format = 0;
 1551|    169|            sp->jpeg_interchange_format_length = 0;
 1552|    169|        }
 1553|  1.26k|        else
 1554|  1.26k|        {
 1555|  1.26k|            if ((sp->jpeg_interchange_format_length == 0) ||
  ------------------
  |  Branch (1555:17): [True: 682, False: 586]
  ------------------
 1556|    586|                (sp->jpeg_interchange_format >
  ------------------
  |  Branch (1556:17): [True: 1, False: 585]
  ------------------
 1557|    586|                 UINT64_MAX - sp->jpeg_interchange_format_length) ||
 1558|    585|                (sp->jpeg_interchange_format +
  ------------------
  |  Branch (1558:17): [True: 162, False: 423]
  ------------------
 1559|    585|                     sp->jpeg_interchange_format_length >
 1560|    585|                 sp->file_size))
 1561|    845|                sp->jpeg_interchange_format_length =
 1562|    845|                    sp->file_size - sp->jpeg_interchange_format;
 1563|  1.26k|        }
 1564|  1.43k|    }
 1565|  4.77k|    sp->in_buffer_source = osibsNotSetYet;
 1566|  4.77k|    sp->in_buffer_next_strile = 0;
 1567|  4.77k|    sp->in_buffer_strile_count = tif->tif_dir.td_nstrips;
 1568|  4.77k|    sp->in_buffer_file_togo = 0;
 1569|  4.77k|    sp->in_buffer_togo = 0;
 1570|  4.77k|    do
 1571|  23.1k|    {
 1572|  23.1k|        if (OJPEGReadBytePeek(sp, &m) == 0)
  ------------------
  |  Branch (1572:13): [True: 947, False: 22.2k]
  ------------------
 1573|    947|            return (0);
 1574|  22.2k|        if (m != 255)
  ------------------
  |  Branch (1574:13): [True: 3.16k, False: 19.0k]
  ------------------
 1575|  3.16k|            break;
 1576|  19.0k|        OJPEGReadByteAdvance(sp);
 1577|  19.0k|        do
 1578|   377k|        {
 1579|   377k|            if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1579:17): [True: 20, False: 377k]
  ------------------
 1580|     20|                return (0);
 1581|   377k|        } while (m == 255);
  ------------------
  |  Branch (1581:18): [True: 358k, False: 19.0k]
  ------------------
 1582|  19.0k|        switch (m)
 1583|  19.0k|        {
 1584|  4.49k|            case JPEG_MARKER_SOI:
  ------------------
  |  |  163|  4.49k|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (1584:13): [True: 4.49k, False: 14.5k]
  ------------------
 1585|       |                /* this type of marker has no data, and should be skipped */
 1586|  4.49k|                break;
 1587|    679|            case JPEG_MARKER_COM:
  ------------------
  |  |  169|    679|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (1587:13): [True: 679, False: 18.3k]
  ------------------
 1588|    898|            case JPEG_MARKER_APP0:
  ------------------
  |  |  168|    898|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1588:13): [True: 219, False: 18.8k]
  ------------------
 1589|  1.39k|            case JPEG_MARKER_APP0 + 1:
  ------------------
  |  |  168|  1.39k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1589:13): [True: 501, False: 18.5k]
  ------------------
 1590|  1.62k|            case JPEG_MARKER_APP0 + 2:
  ------------------
  |  |  168|  1.62k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1590:13): [True: 222, False: 18.8k]
  ------------------
 1591|  1.92k|            case JPEG_MARKER_APP0 + 3:
  ------------------
  |  |  168|  1.92k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1591:13): [True: 303, False: 18.7k]
  ------------------
 1592|  2.16k|            case JPEG_MARKER_APP0 + 4:
  ------------------
  |  |  168|  2.16k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1592:13): [True: 239, False: 18.7k]
  ------------------
 1593|  2.51k|            case JPEG_MARKER_APP0 + 5:
  ------------------
  |  |  168|  2.51k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1593:13): [True: 354, False: 18.6k]
  ------------------
 1594|  2.73k|            case JPEG_MARKER_APP0 + 6:
  ------------------
  |  |  168|  2.73k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1594:13): [True: 218, False: 18.8k]
  ------------------
 1595|  2.98k|            case JPEG_MARKER_APP0 + 7:
  ------------------
  |  |  168|  2.98k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1595:13): [True: 245, False: 18.7k]
  ------------------
 1596|  4.00k|            case JPEG_MARKER_APP0 + 8:
  ------------------
  |  |  168|  4.00k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1596:13): [True: 1.02k, False: 18.0k]
  ------------------
 1597|  4.31k|            case JPEG_MARKER_APP0 + 9:
  ------------------
  |  |  168|  4.31k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1597:13): [True: 311, False: 18.7k]
  ------------------
 1598|  4.59k|            case JPEG_MARKER_APP0 + 10:
  ------------------
  |  |  168|  4.59k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1598:13): [True: 278, False: 18.7k]
  ------------------
 1599|  5.11k|            case JPEG_MARKER_APP0 + 11:
  ------------------
  |  |  168|  5.11k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1599:13): [True: 527, False: 18.5k]
  ------------------
 1600|  5.47k|            case JPEG_MARKER_APP0 + 12:
  ------------------
  |  |  168|  5.47k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1600:13): [True: 359, False: 18.6k]
  ------------------
 1601|  5.70k|            case JPEG_MARKER_APP0 + 13:
  ------------------
  |  |  168|  5.70k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1601:13): [True: 226, False: 18.8k]
  ------------------
 1602|  6.03k|            case JPEG_MARKER_APP0 + 14:
  ------------------
  |  |  168|  6.03k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1602:13): [True: 333, False: 18.7k]
  ------------------
 1603|  6.29k|            case JPEG_MARKER_APP0 + 15:
  ------------------
  |  |  168|  6.29k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1603:13): [True: 254, False: 18.7k]
  ------------------
 1604|       |                /* this type of marker has data, but it has no use to us (and no
 1605|       |                 * place here) and should be skipped */
 1606|  6.29k|                if (OJPEGReadWord(sp, &n) == 0)
  ------------------
  |  Branch (1606:21): [True: 68, False: 6.22k]
  ------------------
 1607|     68|                    return (0);
 1608|  6.22k|                if (n < 2)
  ------------------
  |  Branch (1608:21): [True: 8, False: 6.21k]
  ------------------
 1609|      8|                {
 1610|      8|                    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1610:25): [True: 4, False: 4]
  ------------------
 1611|      4|                        TIFFErrorExtR(tif, module, "Corrupt JPEG data");
 1612|      8|                    return (0);
 1613|      8|                }
 1614|  6.21k|                if (n > 2)
  ------------------
  |  Branch (1614:21): [True: 5.96k, False: 249]
  ------------------
 1615|  5.96k|                    OJPEGReadSkip(sp, (uint16_t)(n - 2));
 1616|  6.21k|                break;
 1617|    259|            case JPEG_MARKER_DRI:
  ------------------
  |  |  167|    259|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (1617:13): [True: 259, False: 18.7k]
  ------------------
 1618|    259|                if (OJPEGReadHeaderInfoSecStreamDri(tif) == 0)
  ------------------
  |  Branch (1618:21): [True: 26, False: 233]
  ------------------
 1619|     26|                    return (0);
 1620|    233|                break;
 1621|  5.04k|            case JPEG_MARKER_DQT:
  ------------------
  |  |  166|  5.04k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (1621:13): [True: 5.04k, False: 13.9k]
  ------------------
 1622|  5.04k|                if (OJPEGReadHeaderInfoSecStreamDqt(tif) == 0)
  ------------------
  |  Branch (1622:21): [True: 57, False: 4.99k]
  ------------------
 1623|     57|                    return (0);
 1624|  4.99k|                break;
 1625|  4.99k|            case JPEG_MARKER_DHT:
  ------------------
  |  |  161|  2.45k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (1625:13): [True: 2.45k, False: 16.5k]
  ------------------
 1626|  2.45k|                if (OJPEGReadHeaderInfoSecStreamDht(tif) == 0)
  ------------------
  |  Branch (1626:21): [True: 44, False: 2.41k]
  ------------------
 1627|     44|                    return (0);
 1628|  2.41k|                break;
 1629|  2.41k|            case JPEG_MARKER_SOF0:
  ------------------
  |  |  158|     84|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (1629:13): [True: 84, False: 18.9k]
  ------------------
 1630|    187|            case JPEG_MARKER_SOF1:
  ------------------
  |  |  159|    187|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (1630:13): [True: 103, False: 18.9k]
  ------------------
 1631|    413|            case JPEG_MARKER_SOF3:
  ------------------
  |  |  160|    413|#define JPEG_MARKER_SOF3 0xC3
  ------------------
  |  Branch (1631:13): [True: 226, False: 18.8k]
  ------------------
 1632|    413|                if (OJPEGReadHeaderInfoSecStreamSof(tif, m) == 0)
  ------------------
  |  Branch (1632:21): [True: 292, False: 121]
  ------------------
 1633|    292|                    return (0);
 1634|    121|                if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1634:21): [True: 70, False: 51]
  ------------------
 1635|     70|                    return (1);
 1636|     51|                break;
 1637|     51|            case JPEG_MARKER_SOS:
  ------------------
  |  |  165|     20|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1637:13): [True: 20, False: 19.0k]
  ------------------
 1638|     20|                if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1638:21): [True: 2, False: 18]
  ------------------
 1639|      2|                    return (1);
 1640|     20|                assert(sp->plane_sample_offset == 0);
  ------------------
  |  Branch (1640:17): [True: 0, False: 18]
  |  Branch (1640:17): [True: 18, False: 0]
  ------------------
 1641|     18|                if (OJPEGReadHeaderInfoSecStreamSos(tif) == 0)
  ------------------
  |  Branch (1641:21): [True: 5, False: 13]
  ------------------
 1642|      5|                    return (0);
 1643|     13|                break;
 1644|     55|            default:
  ------------------
  |  Branch (1644:13): [True: 55, False: 18.9k]
  ------------------
 1645|     55|                TIFFErrorExtR(tif, module,
 1646|     55|                              "Unknown marker type %" PRIu8 " in JPEG data", m);
 1647|     55|                return (0);
 1648|  19.0k|        }
 1649|  19.0k|    } while (m != JPEG_MARKER_SOS);
  ------------------
  |  |  165|  18.4k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1649:14): [True: 18.3k, False: 13]
  ------------------
 1650|  3.18k|    if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1650:9): [True: 1.73k, False: 1.44k]
  ------------------
 1651|  1.73k|        return (1);
 1652|  1.44k|    if (sp->sof_log == 0)
  ------------------
  |  Branch (1652:9): [True: 1.36k, False: 82]
  ------------------
 1653|  1.36k|    {
 1654|  1.36k|        if (OJPEGReadHeaderInfoSecTablesQTable(tif) == 0)
  ------------------
  |  Branch (1654:13): [True: 259, False: 1.10k]
  ------------------
 1655|    259|            return (0);
 1656|  1.10k|        sp->sof_marker_id = JPEG_MARKER_SOF0;
  ------------------
  |  |  158|  1.10k|#define JPEG_MARKER_SOF0 0xC0
  ------------------
 1657|  4.33k|        for (o = 0; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1657:21): [True: 3.22k, False: 1.10k]
  ------------------
 1658|  3.22k|            sp->sof_c[o] = (uint8_t)o;
 1659|  1.10k|        sp->sof_hv[0] =
 1660|  1.10k|            (uint8_t)((sp->subsampling_hor << 4) | sp->subsampling_ver);
 1661|  3.22k|        for (o = 1; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1661:21): [True: 2.12k, False: 1.10k]
  ------------------
 1662|  2.12k|            sp->sof_hv[o] = 17;
 1663|  1.10k|        sp->sof_x = sp->strile_width;
 1664|  1.10k|        sp->sof_y = sp->strile_length_total;
 1665|  1.10k|        sp->sof_log = 1;
 1666|  1.10k|        if (OJPEGReadHeaderInfoSecTablesDcTable(tif) == 0)
  ------------------
  |  Branch (1666:13): [True: 169, False: 938]
  ------------------
 1667|    169|            return (0);
 1668|    938|        if (OJPEGReadHeaderInfoSecTablesAcTable(tif) == 0)
  ------------------
  |  Branch (1668:13): [True: 225, False: 713]
  ------------------
 1669|    225|            return (0);
 1670|  2.08k|        for (o = 1; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1670:21): [True: 1.37k, False: 713]
  ------------------
 1671|  1.37k|            sp->sos_cs[o] = o;
 1672|    713|    }
 1673|    795|    return (1);
 1674|  1.44k|}
tif_ojpeg.c:OJPEGReadBytePeek:
 2366|  23.1k|{
 2367|  23.1k|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2367:9): [True: 12.7k, False: 10.4k]
  ------------------
 2368|  12.7k|    {
 2369|  12.7k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2369:13): [True: 947, False: 11.7k]
  ------------------
 2370|    947|            return (0);
 2371|  12.7k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2371:9): [True: 0, False: 11.7k]
  |  Branch (2371:9): [True: 11.7k, False: 0]
  ------------------
 2372|  11.7k|    }
 2373|  22.2k|    *byte = *(sp->in_buffer_cur);
 2374|  22.2k|    return (1);
 2375|  23.1k|}
tif_ojpeg.c:OJPEGReadBufferFill:
 2258|   433k|{
 2259|   433k|    uint16_t m;
 2260|   433k|    tmsize_t n;
 2261|       |    /* TODO: double-check: when subsamplingcorrect is set, no call to
 2262|       |     * TIFFErrorExt or TIFFWarningExt should be made in any other case, seek or
 2263|       |     * read errors should be passed through */
 2264|   433k|    do
 2265|  68.0M|    {
 2266|  68.0M|        if (sp->in_buffer_file_togo != 0)
  ------------------
  |  Branch (2266:13): [True: 279k, False: 67.7M]
  ------------------
 2267|   279k|        {
 2268|   279k|            if (sp->in_buffer_file_pos_log == 0)
  ------------------
  |  Branch (2268:17): [True: 250k, False: 29.2k]
  ------------------
 2269|   250k|            {
 2270|   250k|                TIFFSeekFile(sp->tif, sp->in_buffer_file_pos, SEEK_SET);
  ------------------
  |  |  291|   250k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2271|   250k|                sp->in_buffer_file_pos_log = 1;
 2272|   250k|            }
 2273|   279k|            m = OJPEG_BUFFER;
  ------------------
  |  |  155|   279k|#define OJPEG_BUFFER 2048
  ------------------
 2274|   279k|            if ((uint64_t)m > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2274:17): [True: 245k, False: 34.5k]
  ------------------
 2275|   245k|                m = (uint16_t)sp->in_buffer_file_togo;
 2276|   279k|            n = TIFFReadFile(sp->tif, sp->in_buffer, (tmsize_t)m);
  ------------------
  |  |  287|   279k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2277|   279k|            if (n <= 0)
  ------------------
  |  Branch (2277:17): [True: 0, False: 279k]
  ------------------
 2278|      0|                return (0);
 2279|   279k|            assert(n > 0);
  ------------------
  |  Branch (2279:13): [True: 0, False: 279k]
  |  Branch (2279:13): [True: 279k, False: 0]
  ------------------
 2280|   279k|            assert(n <= OJPEG_BUFFER);
  ------------------
  |  Branch (2280:13): [True: 0, False: 279k]
  |  Branch (2280:13): [True: 279k, False: 0]
  ------------------
 2281|   279k|            assert(n < 65536);
  ------------------
  |  Branch (2281:13): [True: 0, False: 279k]
  |  Branch (2281:13): [True: 279k, False: 0]
  ------------------
 2282|   279k|            assert((uint64_t)n <= sp->in_buffer_file_togo);
  ------------------
  |  Branch (2282:13): [True: 0, False: 279k]
  |  Branch (2282:13): [True: 279k, False: 0]
  ------------------
 2283|   279k|            m = (uint16_t)n;
 2284|   279k|            sp->in_buffer_togo = m;
 2285|   279k|            sp->in_buffer_cur = sp->in_buffer;
 2286|   279k|            sp->in_buffer_file_togo -= m;
 2287|   279k|            sp->in_buffer_file_pos += m;
 2288|   279k|            break;
 2289|   279k|        }
 2290|  67.7M|        sp->in_buffer_file_pos_log = 0;
 2291|  67.7M|        switch (sp->in_buffer_source)
 2292|  67.7M|        {
 2293|  4.77k|            case osibsNotSetYet:
  ------------------
  |  Branch (2293:13): [True: 4.77k, False: 67.7M]
  ------------------
 2294|  4.77k|                if (sp->jpeg_interchange_format != 0)
  ------------------
  |  Branch (2294:21): [True: 1.26k, False: 3.50k]
  ------------------
 2295|  1.26k|                {
 2296|  1.26k|                    sp->in_buffer_file_pos = sp->jpeg_interchange_format;
 2297|  1.26k|                    sp->in_buffer_file_togo =
 2298|  1.26k|                        sp->jpeg_interchange_format_length;
 2299|  1.26k|                }
 2300|  4.77k|                sp->in_buffer_source = osibsJpegInterchangeFormat;
 2301|  4.77k|                break;
 2302|   132k|            case osibsJpegInterchangeFormat:
  ------------------
  |  Branch (2302:13): [True: 132k, False: 67.6M]
  ------------------
 2303|   132k|                sp->in_buffer_source = osibsStrile;
 2304|   132k|                break;
 2305|  67.6M|            case osibsStrile:
  ------------------
  |  Branch (2305:13): [True: 67.6M, False: 169k]
  ------------------
 2306|  67.6M|                if (sp->in_buffer_next_strile == sp->in_buffer_strile_count)
  ------------------
  |  Branch (2306:21): [True: 32.0k, False: 67.5M]
  ------------------
 2307|  32.0k|                    sp->in_buffer_source = osibsEof;
 2308|  67.5M|                else
 2309|  67.5M|                {
 2310|  67.5M|                    int err = 0;
 2311|  67.5M|                    sp->in_buffer_file_pos = TIFFGetStrileOffsetWithErr(
 2312|  67.5M|                        sp->tif, sp->in_buffer_next_strile, &err);
 2313|  67.5M|                    if (err)
  ------------------
  |  Branch (2313:25): [True: 121k, False: 67.4M]
  ------------------
 2314|   121k|                        return 0;
 2315|  67.4M|                    if (sp->in_buffer_file_pos != 0)
  ------------------
  |  Branch (2315:25): [True: 857k, False: 66.6M]
  ------------------
 2316|   857k|                    {
 2317|   857k|                        uint64_t bytecount = TIFFGetStrileByteCountWithErr(
 2318|   857k|                            sp->tif, sp->in_buffer_next_strile, &err);
 2319|   857k|                        if (err)
  ------------------
  |  Branch (2319:29): [True: 631, False: 856k]
  ------------------
 2320|    631|                            return 0;
 2321|   856k|                        if (sp->in_buffer_file_pos >= sp->file_size)
  ------------------
  |  Branch (2321:29): [True: 817k, False: 39.0k]
  ------------------
 2322|   817k|                            sp->in_buffer_file_pos = 0;
 2323|  39.0k|                        else if (bytecount == 0)
  ------------------
  |  Branch (2323:34): [True: 11.7k, False: 27.3k]
  ------------------
 2324|  11.7k|                            sp->in_buffer_file_togo =
 2325|  11.7k|                                sp->file_size - sp->in_buffer_file_pos;
 2326|  27.3k|                        else
 2327|  27.3k|                        {
 2328|  27.3k|                            sp->in_buffer_file_togo = bytecount;
 2329|  27.3k|                            if (sp->in_buffer_file_togo == 0)
  ------------------
  |  Branch (2329:33): [True: 0, False: 27.3k]
  ------------------
 2330|      0|                                sp->in_buffer_file_pos = 0;
 2331|  27.3k|                            else if (sp->in_buffer_file_pos >
  ------------------
  |  Branch (2331:38): [True: 607, False: 26.7k]
  ------------------
 2332|  27.3k|                                         UINT64_MAX - sp->in_buffer_file_togo ||
 2333|  26.7k|                                     sp->in_buffer_file_pos +
  ------------------
  |  Branch (2333:38): [True: 16.2k, False: 10.4k]
  ------------------
 2334|  26.7k|                                             sp->in_buffer_file_togo >
 2335|  26.7k|                                         sp->file_size)
 2336|  16.8k|                                sp->in_buffer_file_togo =
 2337|  16.8k|                                    sp->file_size - sp->in_buffer_file_pos;
 2338|  27.3k|                        }
 2339|   856k|                    }
 2340|  67.4M|                    sp->in_buffer_next_strile++;
 2341|  67.4M|                }
 2342|  67.4M|                break;
 2343|  67.4M|            case osibsEof:
  ------------------
  |  Branch (2343:13): [True: 32.4k, False: 67.7M]
  ------------------
 2344|  32.4k|            default:
  ------------------
  |  Branch (2344:13): [True: 0, False: 67.7M]
  ------------------
 2345|  32.4k|                return (0);
 2346|  67.7M|        }
 2347|  67.7M|    } while (1);
  ------------------
  |  Branch (2347:14): [True: 67.6M, Folded]
  ------------------
 2348|   279k|    return (1);
 2349|   433k|}
tif_ojpeg.c:OJPEGReadByteAdvance:
 2378|  19.0k|{
 2379|  19.0k|    assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2379:5): [True: 0, False: 19.0k]
  |  Branch (2379:5): [True: 19.0k, False: 0]
  ------------------
 2380|  19.0k|    sp->in_buffer_cur++;
 2381|  19.0k|    sp->in_buffer_togo--;
 2382|  19.0k|}
tif_ojpeg.c:OJPEGReadByte:
 2352|  64.0M|{
 2353|  64.0M|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2353:9): [True: 336k, False: 63.6M]
  ------------------
 2354|   336k|    {
 2355|   336k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2355:13): [True: 147k, False: 188k]
  ------------------
 2356|   147k|            return (0);
 2357|   336k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2357:9): [True: 0, False: 188k]
  |  Branch (2357:9): [True: 188k, False: 0]
  ------------------
 2358|   188k|    }
 2359|  63.8M|    *byte = *(sp->in_buffer_cur);
 2360|  63.8M|    sp->in_buffer_cur++;
 2361|  63.8M|    sp->in_buffer_togo--;
 2362|  63.8M|    return (1);
 2363|  64.0M|}
tif_ojpeg.c:OJPEGReadWord:
 2385|  36.7k|{
 2386|  36.7k|    uint8_t m;
 2387|  36.7k|    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (2387:9): [True: 987, False: 35.7k]
  ------------------
 2388|    987|        return (0);
 2389|  35.7k|    *word = (uint16_t)(m << 8);
 2390|  35.7k|    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (2390:9): [True: 949, False: 34.7k]
  ------------------
 2391|    949|        return (0);
 2392|  34.7k|    *word |= m;
 2393|  34.7k|    return (1);
 2394|  35.7k|}
tif_ojpeg.c:OJPEGReadSkip:
 2425|  12.8k|{
 2426|  12.8k|    uint16_t m;
 2427|  12.8k|    uint16_t n;
 2428|  12.8k|    m = len;
 2429|  12.8k|    n = m;
 2430|  12.8k|    if (n > sp->in_buffer_togo)
  ------------------
  |  Branch (2430:9): [True: 7.63k, False: 5.22k]
  ------------------
 2431|  7.63k|        n = sp->in_buffer_togo;
 2432|  12.8k|    sp->in_buffer_cur += n;
 2433|  12.8k|    sp->in_buffer_togo = (uint16_t)(sp->in_buffer_togo - n);
 2434|  12.8k|    m = (uint16_t)(m - n);
 2435|  12.8k|    if (m > 0)
  ------------------
  |  Branch (2435:9): [True: 7.63k, False: 5.22k]
  ------------------
 2436|  7.63k|    {
 2437|  7.63k|        assert(sp->in_buffer_togo == 0);
  ------------------
  |  Branch (2437:9): [True: 0, False: 7.63k]
  |  Branch (2437:9): [True: 7.63k, False: 0]
  ------------------
 2438|  7.63k|        n = m;
 2439|  7.63k|        if ((uint64_t)n > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2439:13): [True: 6.68k, False: 953]
  ------------------
 2440|  6.68k|            n = (uint16_t)sp->in_buffer_file_togo;
 2441|  7.63k|        sp->in_buffer_file_pos += n;
 2442|  7.63k|        sp->in_buffer_file_togo -= n;
 2443|  7.63k|        sp->in_buffer_file_pos_log = 0;
 2444|       |        /* we don't skip past jpeginterchangeformat/strile block...
 2445|       |         * if that is asked from us, we're dealing with totally bazurk
 2446|       |         * data anyway, and we've not seen this happening on any
 2447|       |         * testfile, so we might as well likely cause some other
 2448|       |         * meaningless error to be passed at some later time
 2449|       |         */
 2450|  7.63k|    }
 2451|  12.8k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDri:
 1677|    259|{
 1678|       |    /* This could easily cause trouble in some cases... but no such cases have
 1679|       |       occurred so far */
 1680|    259|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDri";
 1681|    259|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1682|    259|    uint16_t m;
 1683|    259|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1683:9): [True: 7, False: 252]
  ------------------
 1684|      7|        return (0);
 1685|    252|    if (m != 4)
  ------------------
  |  Branch (1685:9): [True: 12, False: 240]
  ------------------
 1686|     12|    {
 1687|     12|        TIFFErrorExtR(tif, module, "Corrupt DRI marker in JPEG data");
 1688|     12|        return (0);
 1689|     12|    }
 1690|    240|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1690:9): [True: 7, False: 233]
  ------------------
 1691|      7|        return (0);
 1692|    233|    sp->restart_interval = m;
 1693|    233|    return (1);
 1694|    240|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDqt:
 1697|  5.04k|{
 1698|       |    /* this is a table marker, and it is to be saved as a whole for exact
 1699|       |     * pushing on the jpeg stream later on */
 1700|  5.04k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDqt";
 1701|  5.04k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1702|  5.04k|    uint16_t m;
 1703|  5.04k|    uint32_t na;
 1704|  5.04k|    uint8_t *nb;
 1705|  5.04k|    uint8_t o;
 1706|  5.04k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1706:9): [True: 9, False: 5.03k]
  ------------------
 1707|      9|        return (0);
 1708|  5.03k|    if (m <= 2)
  ------------------
  |  Branch (1708:9): [True: 6, False: 5.03k]
  ------------------
 1709|      6|    {
 1710|      6|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1710:13): [True: 3, False: 3]
  ------------------
 1711|      3|            TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1712|      6|        return (0);
 1713|      6|    }
 1714|  5.03k|    if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1714:9): [True: 4.72k, False: 309]
  ------------------
 1715|  4.72k|        OJPEGReadSkip(sp, (uint16_t)(m - 2));
 1716|    309|    else
 1717|    309|    {
 1718|    309|        m = (uint16_t)(m - 2);
 1719|    309|        do
 1720|    634|        {
 1721|    634|            if (m < 65)
  ------------------
  |  Branch (1721:17): [True: 9, False: 625]
  ------------------
 1722|      9|            {
 1723|      9|                TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1724|      9|                return (0);
 1725|      9|            }
 1726|    625|            na = sizeof(uint32_t) + 69;
 1727|    625|            nb = (uint8_t *)_TIFFmallocExt(tif, na);
 1728|    625|            if (nb == 0)
  ------------------
  |  Branch (1728:17): [True: 0, False: 625]
  ------------------
 1729|      0|            {
 1730|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1731|      0|                return (0);
 1732|      0|            }
 1733|    625|            *(uint32_t *)nb = na;
 1734|    625|            nb[sizeof(uint32_t)] = 255;
 1735|    625|            nb[sizeof(uint32_t) + 1] = JPEG_MARKER_DQT;
  ------------------
  |  |  166|    625|#define JPEG_MARKER_DQT 0xDB
  ------------------
 1736|    625|            nb[sizeof(uint32_t) + 2] = 0;
 1737|    625|            nb[sizeof(uint32_t) + 3] = 67;
 1738|    625|            if (OJPEGReadBlock(sp, 65, &nb[sizeof(uint32_t) + 4]) == 0)
  ------------------
  |  Branch (1738:17): [True: 10, False: 615]
  ------------------
 1739|     10|            {
 1740|     10|                _TIFFfreeExt(tif, nb);
 1741|     10|                return (0);
 1742|     10|            }
 1743|    615|            o = nb[sizeof(uint32_t) + 4] & 15;
 1744|    615|            if (3 < o)
  ------------------
  |  Branch (1744:17): [True: 23, False: 592]
  ------------------
 1745|     23|            {
 1746|     23|                TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1747|     23|                _TIFFfreeExt(tif, nb);
 1748|     23|                return (0);
 1749|     23|            }
 1750|    592|            if (sp->qtable[o] != 0)
  ------------------
  |  Branch (1750:17): [True: 512, False: 80]
  ------------------
 1751|    512|                _TIFFfreeExt(tif, sp->qtable[o]);
 1752|    592|            sp->qtable[o] = nb;
 1753|    592|            m = (uint16_t)(m - 65);
 1754|    592|        } while (m > 0);
  ------------------
  |  Branch (1754:18): [True: 325, False: 267]
  ------------------
 1755|    309|    }
 1756|  4.99k|    return (1);
 1757|  5.03k|}
tif_ojpeg.c:OJPEGReadBlock:
 2397|  1.57k|{
 2398|  1.57k|    uint16_t mlen;
 2399|  1.57k|    uint8_t *mmem;
 2400|  1.57k|    uint16_t n;
 2401|  1.57k|    assert(len > 0);
  ------------------
  |  Branch (2401:5): [True: 0, False: 1.57k]
  |  Branch (2401:5): [True: 1.57k, False: 0]
  ------------------
 2402|  1.57k|    mlen = len;
 2403|  1.57k|    mmem = (uint8_t *)mem;
 2404|  1.57k|    do
 2405|  3.76k|    {
 2406|  3.76k|        if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2406:13): [True: 2.19k, False: 1.56k]
  ------------------
 2407|  2.19k|        {
 2408|  2.19k|            if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2408:17): [True: 30, False: 2.16k]
  ------------------
 2409|     30|                return (0);
 2410|  2.19k|            assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2410:13): [True: 0, False: 2.16k]
  |  Branch (2410:13): [True: 2.16k, False: 0]
  ------------------
 2411|  2.16k|        }
 2412|  3.73k|        n = mlen;
 2413|  3.73k|        if (n > sp->in_buffer_togo)
  ------------------
  |  Branch (2413:13): [True: 2.18k, False: 1.54k]
  ------------------
 2414|  2.18k|            n = sp->in_buffer_togo;
 2415|  3.73k|        _TIFFmemcpy(mmem, sp->in_buffer_cur, n);
 2416|  3.73k|        sp->in_buffer_cur += n;
 2417|  3.73k|        sp->in_buffer_togo = (uint16_t)(sp->in_buffer_togo - n);
 2418|  3.73k|        mlen = (uint16_t)(mlen - n);
 2419|  3.73k|        mmem += n;
 2420|  3.73k|    } while (mlen > 0);
  ------------------
  |  Branch (2420:14): [True: 2.18k, False: 1.54k]
  ------------------
 2421|  1.54k|    return (1);
 2422|  1.57k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDht:
 1760|  2.45k|{
 1761|       |    /* this is a table marker, and it is to be saved as a whole for exact
 1762|       |     * pushing on the jpeg stream later on */
 1763|       |    /* TODO: the following assumes there is only one table in this marker... but
 1764|       |     * i'm not quite sure that assumption is guaranteed correct */
 1765|  2.45k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDht";
 1766|  2.45k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1767|  2.45k|    uint16_t m;
 1768|  2.45k|    uint32_t na;
 1769|  2.45k|    uint8_t *nb;
 1770|  2.45k|    uint8_t o;
 1771|  2.45k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1771:9): [True: 6, False: 2.44k]
  ------------------
 1772|      6|        return (0);
 1773|  2.44k|    if (m <= 2)
  ------------------
  |  Branch (1773:9): [True: 6, False: 2.44k]
  ------------------
 1774|      6|    {
 1775|      6|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1775:13): [True: 3, False: 3]
  ------------------
 1776|      3|            TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1777|      6|        return (0);
 1778|      6|    }
 1779|  2.44k|    if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1779:9): [True: 1.49k, False: 948]
  ------------------
 1780|  1.49k|    {
 1781|  1.49k|        OJPEGReadSkip(sp, (uint16_t)(m - 2));
 1782|  1.49k|    }
 1783|    948|    else
 1784|    948|    {
 1785|    948|        na = (uint32_t)(sizeof(uint32_t) + 2 + m);
 1786|    948|        nb = (uint8_t *)_TIFFmallocExt(tif, na);
 1787|    948|        if (nb == 0)
  ------------------
  |  Branch (1787:13): [True: 0, False: 948]
  ------------------
 1788|      0|        {
 1789|      0|            TIFFErrorExtR(tif, module, "Out of memory");
 1790|      0|            return (0);
 1791|      0|        }
 1792|    948|        *(uint32_t *)nb = na;
 1793|    948|        nb[sizeof(uint32_t)] = 255;
 1794|    948|        nb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|    948|#define JPEG_MARKER_DHT 0xC4
  ------------------
 1795|    948|        nb[sizeof(uint32_t) + 2] = (uint8_t)(m >> 8);
 1796|    948|        nb[sizeof(uint32_t) + 3] = (uint8_t)(m & 255);
 1797|    948|        if (OJPEGReadBlock(sp, (uint16_t)(m - 2), &nb[sizeof(uint32_t) + 4]) ==
  ------------------
  |  Branch (1797:13): [True: 20, False: 928]
  ------------------
 1798|    948|            0)
 1799|     20|        {
 1800|     20|            _TIFFfreeExt(tif, nb);
 1801|     20|            return (0);
 1802|     20|        }
 1803|    928|        o = nb[sizeof(uint32_t) + 4];
 1804|    928|        if ((o & 240) == 0)
  ------------------
  |  Branch (1804:13): [True: 409, False: 519]
  ------------------
 1805|    409|        {
 1806|    409|            if (3 < o)
  ------------------
  |  Branch (1806:17): [True: 3, False: 406]
  ------------------
 1807|      3|            {
 1808|      3|                TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1809|      3|                _TIFFfreeExt(tif, nb);
 1810|      3|                return (0);
 1811|      3|            }
 1812|    406|            if (sp->dctable[o] != 0)
  ------------------
  |  Branch (1812:17): [True: 349, False: 57]
  ------------------
 1813|    349|                _TIFFfreeExt(tif, sp->dctable[o]);
 1814|    406|            sp->dctable[o] = nb;
 1815|    406|        }
 1816|    519|        else
 1817|    519|        {
 1818|    519|            if ((o & 240) != 16)
  ------------------
  |  Branch (1818:17): [True: 4, False: 515]
  ------------------
 1819|      4|            {
 1820|      4|                TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1821|      4|                _TIFFfreeExt(tif, nb);
 1822|      4|                return (0);
 1823|      4|            }
 1824|    515|            o &= 15;
 1825|    515|            if (3 < o)
  ------------------
  |  Branch (1825:17): [True: 5, False: 510]
  ------------------
 1826|      5|            {
 1827|      5|                TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1828|      5|                _TIFFfreeExt(tif, nb);
 1829|      5|                return (0);
 1830|      5|            }
 1831|    510|            if (sp->actable[o] != 0)
  ------------------
  |  Branch (1831:17): [True: 478, False: 32]
  ------------------
 1832|    478|                _TIFFfreeExt(tif, sp->actable[o]);
 1833|    510|            sp->actable[o] = nb;
 1834|    510|        }
 1835|    928|    }
 1836|  2.41k|    return (1);
 1837|  2.44k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSof:
 1840|    413|{
 1841|       |    /* this marker needs to be checked, and part of its data needs to be saved
 1842|       |     * for regeneration later on */
 1843|    413|    static const char module[] = "OJPEGReadHeaderInfoSecStreamSof";
 1844|    413|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1845|    413|    uint16_t m;
 1846|    413|    uint16_t n;
 1847|    413|    uint8_t o;
 1848|    413|    uint16_t p;
 1849|    413|    uint16_t q;
 1850|    413|    if (sp->sof_log != 0)
  ------------------
  |  Branch (1850:9): [True: 9, False: 404]
  ------------------
 1851|      9|    {
 1852|      9|        TIFFErrorExtR(tif, module, "Corrupt JPEG data");
 1853|      9|        return (0);
 1854|      9|    }
 1855|    404|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1855:9): [True: 177, False: 227]
  ------------------
 1856|    177|        sp->sof_marker_id = marker_id;
 1857|       |    /* Lf: data length */
 1858|    404|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1858:9): [True: 8, False: 396]
  ------------------
 1859|      8|        return (0);
 1860|    396|    if (m < 11)
  ------------------
  |  Branch (1860:9): [True: 7, False: 389]
  ------------------
 1861|      7|    {
 1862|      7|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1862:13): [True: 3, False: 4]
  ------------------
 1863|      3|            TIFFErrorExtR(tif, module, "Corrupt SOF marker in JPEG data");
 1864|      7|        return (0);
 1865|      7|    }
 1866|    389|    m = (uint16_t)(m - 8);
 1867|    389|    if (m % 3 != 0)
  ------------------
  |  Branch (1867:9): [True: 8, False: 381]
  ------------------
 1868|      8|    {
 1869|      8|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1869:13): [True: 3, False: 5]
  ------------------
 1870|      3|            TIFFErrorExtR(tif, module, "Corrupt SOF marker in JPEG data");
 1871|      8|        return (0);
 1872|      8|    }
 1873|    381|    n = m / 3;
 1874|    381|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1874:9): [True: 167, False: 214]
  ------------------
 1875|    167|    {
 1876|    167|        if (n != sp->samples_per_pixel)
  ------------------
  |  Branch (1876:13): [True: 19, False: 148]
  ------------------
 1877|     19|        {
 1878|     19|            TIFFErrorExtR(
 1879|     19|                tif, module,
 1880|     19|                "JPEG compressed data indicates unexpected number of samples");
 1881|     19|            return (0);
 1882|     19|        }
 1883|    167|    }
 1884|       |    /* P: Sample precision */
 1885|    362|    if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1885:9): [True: 7, False: 355]
  ------------------
 1886|      7|        return (0);
 1887|    355|    if (o != 8)
  ------------------
  |  Branch (1887:9): [True: 17, False: 338]
  ------------------
 1888|     17|    {
 1889|     17|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1889:13): [True: 3, False: 14]
  ------------------
 1890|      3|            TIFFErrorExtR(tif, module,
 1891|      3|                          "JPEG compressed data indicates unexpected number of "
 1892|      3|                          "bits per sample");
 1893|     17|        return (0);
 1894|     17|    }
 1895|       |    /* Y: Number of lines, X: Number of samples per line */
 1896|    338|    if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1896:9): [True: 196, False: 142]
  ------------------
 1897|    196|        OJPEGReadSkip(sp, 4);
 1898|    142|    else
 1899|    142|    {
 1900|       |        /* Y: Number of lines */
 1901|    142|        if (OJPEGReadWord(sp, &p) == 0)
  ------------------
  |  Branch (1901:13): [True: 3, False: 139]
  ------------------
 1902|      3|            return (0);
 1903|    139|        if (((uint32_t)p < sp->image_length) &&
  ------------------
  |  Branch (1903:13): [True: 12, False: 127]
  ------------------
 1904|     12|            ((uint32_t)p < sp->strile_length_total))
  ------------------
  |  Branch (1904:13): [True: 12, False: 0]
  ------------------
 1905|     12|        {
 1906|     12|            TIFFErrorExtR(tif, module,
 1907|     12|                          "JPEG compressed data indicates unexpected height");
 1908|     12|            return (0);
 1909|     12|        }
 1910|    127|        sp->sof_y = p;
 1911|       |        /* X: Number of samples per line */
 1912|    127|        if (OJPEGReadWord(sp, &p) == 0)
  ------------------
  |  Branch (1912:13): [True: 3, False: 124]
  ------------------
 1913|      3|            return (0);
 1914|    124|        if (((uint32_t)p < sp->image_width) && ((uint32_t)p < sp->strile_width))
  ------------------
  |  Branch (1914:13): [True: 52, False: 72]
  |  Branch (1914:48): [True: 30, False: 22]
  ------------------
 1915|     30|        {
 1916|     30|            TIFFErrorExtR(tif, module,
 1917|     30|                          "JPEG compressed data indicates unexpected width");
 1918|     30|            return (0);
 1919|     30|        }
 1920|     94|        if ((uint32_t)p > sp->strile_width)
  ------------------
  |  Branch (1920:13): [True: 6, False: 88]
  ------------------
 1921|      6|        {
 1922|      6|            TIFFErrorExtR(tif, module,
 1923|      6|                          "JPEG compressed data image width exceeds expected "
 1924|      6|                          "image width");
 1925|      6|            return (0);
 1926|      6|        }
 1927|     88|        sp->sof_x = p;
 1928|     88|    }
 1929|       |    /* Nf: Number of image components in frame */
 1930|    284|    if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1930:9): [True: 14, False: 270]
  ------------------
 1931|     14|        return (0);
 1932|    270|    if (o != n)
  ------------------
  |  Branch (1932:9): [True: 46, False: 224]
  ------------------
 1933|     46|    {
 1934|     46|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1934:13): [True: 4, False: 42]
  ------------------
 1935|      4|            TIFFErrorExtR(tif, module, "Corrupt SOF marker in JPEG data");
 1936|     46|        return (0);
 1937|     46|    }
 1938|       |    /* per component stuff */
 1939|       |    /* TODO: double-check that flow implies that n cannot be as big as to make
 1940|       |     * us overflow sof_c, sof_hv and sof_tq arrays */
 1941|  1.72k|    for (q = 0; q < n; q++)
  ------------------
  |  Branch (1941:17): [True: 1.60k, False: 121]
  ------------------
 1942|  1.60k|    {
 1943|       |        /* C: Component identifier */
 1944|  1.60k|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1944:13): [True: 29, False: 1.57k]
  ------------------
 1945|     29|            return (0);
 1946|  1.57k|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1946:13): [True: 200, False: 1.37k]
  ------------------
 1947|    200|            sp->sof_c[q] = o;
 1948|       |        /* H: Horizontal sampling factor, and V: Vertical sampling factor */
 1949|  1.57k|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1949:13): [True: 19, False: 1.55k]
  ------------------
 1950|     19|            return (0);
 1951|  1.55k|        if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1951:13): [True: 1.36k, False: 196]
  ------------------
 1952|  1.36k|        {
 1953|  1.36k|            if (q == 0)
  ------------------
  |  Branch (1953:17): [True: 134, False: 1.22k]
  ------------------
 1954|    134|            {
 1955|    134|                sp->subsampling_hor = (o >> 4);
 1956|    134|                sp->subsampling_ver = (o & 15);
 1957|    134|                if (((sp->subsampling_hor != 1) && (sp->subsampling_hor != 2) &&
  ------------------
  |  Branch (1957:22): [True: 108, False: 26]
  |  Branch (1957:52): [True: 66, False: 42]
  ------------------
 1958|     66|                     (sp->subsampling_hor != 4)) ||
  ------------------
  |  Branch (1958:22): [True: 48, False: 18]
  ------------------
 1959|     86|                    ((sp->subsampling_ver != 1) && (sp->subsampling_ver != 2) &&
  ------------------
  |  Branch (1959:22): [True: 44, False: 42]
  |  Branch (1959:52): [True: 28, False: 16]
  ------------------
 1960|     28|                     (sp->subsampling_ver != 4)))
  ------------------
  |  Branch (1960:22): [True: 21, False: 7]
  ------------------
 1961|     69|                    sp->subsampling_force_desubsampling_inside_decompression =
 1962|     69|                        1;
 1963|    134|            }
 1964|  1.22k|            else
 1965|  1.22k|            {
 1966|  1.22k|                if (o != 17)
  ------------------
  |  Branch (1966:21): [True: 1.11k, False: 109]
  ------------------
 1967|  1.11k|                    sp->subsampling_force_desubsampling_inside_decompression =
 1968|  1.11k|                        1;
 1969|  1.22k|            }
 1970|  1.36k|        }
 1971|    196|        else
 1972|    196|        {
 1973|    196|            sp->sof_hv[q] = o;
 1974|    196|            if (sp->subsampling_force_desubsampling_inside_decompression == 0)
  ------------------
  |  Branch (1974:17): [True: 35, False: 161]
  ------------------
 1975|     35|            {
 1976|     35|                if (q == 0)
  ------------------
  |  Branch (1976:21): [True: 19, False: 16]
  ------------------
 1977|     19|                {
 1978|     19|                    if (o != ((sp->subsampling_hor << 4) | sp->subsampling_ver))
  ------------------
  |  Branch (1978:25): [True: 4, False: 15]
  ------------------
 1979|      4|                    {
 1980|      4|                        TIFFErrorExtR(tif, module,
 1981|      4|                                      "JPEG compressed data indicates "
 1982|      4|                                      "unexpected subsampling values");
 1983|      4|                        return (0);
 1984|      4|                    }
 1985|     19|                }
 1986|     16|                else
 1987|     16|                {
 1988|     16|                    if (o != 17)
  ------------------
  |  Branch (1988:25): [True: 3, False: 13]
  ------------------
 1989|      3|                    {
 1990|      3|                        TIFFErrorExtR(tif, module,
 1991|      3|                                      "JPEG compressed data indicates "
 1992|      3|                                      "unexpected subsampling values");
 1993|      3|                        return (0);
 1994|      3|                    }
 1995|     16|                }
 1996|     35|            }
 1997|    196|        }
 1998|       |        /* Tq: Quantization table destination selector */
 1999|  1.54k|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1999:13): [True: 48, False: 1.50k]
  ------------------
 2000|     48|            return (0);
 2001|  1.50k|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (2001:13): [True: 176, False: 1.32k]
  ------------------
 2002|    176|            sp->sof_tq[q] = o;
 2003|  1.50k|    }
 2004|    121|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (2004:9): [True: 51, False: 70]
  ------------------
 2005|     51|        sp->sof_log = 1;
 2006|    121|    return (1);
 2007|    224|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSos:
 2010|  21.7k|{
 2011|       |    /* this marker needs to be checked, and part of its data needs to be saved
 2012|       |     * for regeneration later on */
 2013|  21.7k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamSos";
 2014|  21.7k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2015|  21.7k|    uint16_t m;
 2016|  21.7k|    uint8_t n;
 2017|  21.7k|    uint8_t o;
 2018|  21.7k|    assert(sp->subsamplingcorrect == 0);
  ------------------
  |  Branch (2018:5): [True: 0, False: 21.7k]
  |  Branch (2018:5): [True: 21.7k, False: 0]
  ------------------
 2019|  21.7k|    if (sp->sof_log == 0)
  ------------------
  |  Branch (2019:9): [True: 3, False: 21.7k]
  ------------------
 2020|      3|    {
 2021|      3|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2022|      3|        return (0);
 2023|      3|    }
 2024|       |    /* Ls */
 2025|  21.7k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (2025:9): [True: 1.82k, False: 19.9k]
  ------------------
 2026|  1.82k|        return (0);
 2027|  19.9k|    if (m != 6 + sp->samples_per_pixel_per_plane * 2)
  ------------------
  |  Branch (2027:9): [True: 7.16k, False: 12.7k]
  ------------------
 2028|  7.16k|    {
 2029|  7.16k|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2030|  7.16k|        return (0);
 2031|  7.16k|    }
 2032|       |    /* Ns */
 2033|  12.7k|    if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2033:9): [True: 282, False: 12.4k]
  ------------------
 2034|    282|        return (0);
 2035|  12.4k|    if (n != sp->samples_per_pixel_per_plane)
  ------------------
  |  Branch (2035:9): [True: 10.2k, False: 2.24k]
  ------------------
 2036|  10.2k|    {
 2037|  10.2k|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2038|  10.2k|        return (0);
 2039|  10.2k|    }
 2040|       |    /* Cs, Td, and Ta */
 2041|  2.75k|    for (o = 0; o < sp->samples_per_pixel_per_plane; o++)
  ------------------
  |  Branch (2041:17): [True: 2.27k, False: 481]
  ------------------
 2042|  2.27k|    {
 2043|       |        /* Cs */
 2044|  2.27k|        if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2044:13): [True: 267, False: 2.00k]
  ------------------
 2045|    267|            return (0);
 2046|  2.00k|        sp->sos_cs[sp->plane_sample_offset + o] = n;
 2047|       |        /* Td and Ta */
 2048|  2.00k|        if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2048:13): [True: 1.49k, False: 508]
  ------------------
 2049|  1.49k|            return (0);
 2050|    508|        sp->sos_tda[sp->plane_sample_offset + o] = n;
 2051|    508|    }
 2052|       |    /* skip Ss, Se, Ah, en Al -> no check, as per Tom Lane recommendation, as
 2053|       |     * per LibJpeg source */
 2054|    481|    OJPEGReadSkip(sp, 3);
 2055|    481|    return (1);
 2056|  2.24k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesQTable:
 2059|  1.36k|{
 2060|  1.36k|    static const char module[] = "OJPEGReadHeaderInfoSecTablesQTable";
 2061|  1.36k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2062|  1.36k|    uint8_t m;
 2063|  1.36k|    uint8_t n;
 2064|  1.36k|    uint32_t oa;
 2065|  1.36k|    uint8_t *ob;
 2066|  1.36k|    uint32_t p;
 2067|  1.36k|    if (sp->qtable_offset[0] == 0)
  ------------------
  |  Branch (2067:9): [True: 108, False: 1.25k]
  ------------------
 2068|    108|    {
 2069|    108|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2070|    108|        return (0);
 2071|    108|    }
 2072|  1.25k|    sp->in_buffer_file_pos_log = 0;
 2073|  4.63k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2073:17): [True: 3.52k, False: 1.10k]
  ------------------
 2074|  3.52k|    {
 2075|  3.52k|        if ((sp->qtable_offset[m] != 0) &&
  ------------------
  |  Branch (2075:13): [True: 1.56k, False: 1.96k]
  ------------------
 2076|  1.56k|            ((m == 0) || (sp->qtable_offset[m] != sp->qtable_offset[m - 1])))
  ------------------
  |  Branch (2076:14): [True: 1.25k, False: 306]
  |  Branch (2076:26): [True: 302, False: 4]
  ------------------
 2077|  1.56k|        {
 2078|  1.65k|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2078:25): [True: 96, False: 1.55k]
  ------------------
 2079|     96|            {
 2080|     96|                if (sp->qtable_offset[m] == sp->qtable_offset[n])
  ------------------
  |  Branch (2080:21): [True: 3, False: 93]
  ------------------
 2081|      3|                {
 2082|      3|                    TIFFErrorExtR(tif, module, "Corrupt JpegQTables tag value");
 2083|      3|                    return (0);
 2084|      3|                }
 2085|     96|            }
 2086|  1.55k|            oa = sizeof(uint32_t) + 69;
 2087|  1.55k|            ob = (uint8_t *)_TIFFmallocExt(tif, oa);
 2088|  1.55k|            if (ob == 0)
  ------------------
  |  Branch (2088:17): [True: 0, False: 1.55k]
  ------------------
 2089|      0|            {
 2090|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2091|      0|                return (0);
 2092|      0|            }
 2093|  1.55k|            *(uint32_t *)ob = oa;
 2094|  1.55k|            ob[sizeof(uint32_t)] = 255;
 2095|  1.55k|            ob[sizeof(uint32_t) + 1] = JPEG_MARKER_DQT;
  ------------------
  |  |  166|  1.55k|#define JPEG_MARKER_DQT 0xDB
  ------------------
 2096|  1.55k|            ob[sizeof(uint32_t) + 2] = 0;
 2097|  1.55k|            ob[sizeof(uint32_t) + 3] = 67;
 2098|  1.55k|            ob[sizeof(uint32_t) + 4] = m;
 2099|  1.55k|            TIFFSeekFile(tif, sp->qtable_offset[m], SEEK_SET);
  ------------------
  |  |  291|  1.55k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2100|  1.55k|            p = (uint32_t)TIFFReadFile(tif, &ob[sizeof(uint32_t) + 5], 64);
  ------------------
  |  |  287|  1.55k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2101|  1.55k|            if (p != 64)
  ------------------
  |  Branch (2101:17): [True: 148, False: 1.40k]
  ------------------
 2102|    148|            {
 2103|    148|                _TIFFfreeExt(tif, ob);
 2104|    148|                return (0);
 2105|    148|            }
 2106|  1.40k|            if (sp->qtable[m] != 0)
  ------------------
  |  Branch (2106:17): [True: 13, False: 1.39k]
  ------------------
 2107|     13|                _TIFFfreeExt(tif, sp->qtable[m]);
 2108|  1.40k|            sp->qtable[m] = ob;
 2109|  1.40k|            sp->sof_tq[m] = m;
 2110|  1.40k|        }
 2111|  1.96k|        else
 2112|  1.96k|            sp->sof_tq[m] = sp->sof_tq[m - 1];
 2113|  3.52k|    }
 2114|  1.10k|    return (1);
 2115|  1.25k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesDcTable:
 2118|  1.10k|{
 2119|  1.10k|    static const char module[] = "OJPEGReadHeaderInfoSecTablesDcTable";
 2120|  1.10k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2121|  1.10k|    uint8_t m;
 2122|  1.10k|    uint8_t n;
 2123|  1.10k|    uint8_t o[16];
 2124|  1.10k|    uint32_t p;
 2125|  1.10k|    uint32_t q;
 2126|  1.10k|    uint32_t ra;
 2127|  1.10k|    uint8_t *rb;
 2128|  1.10k|    if (sp->dctable_offset[0] == 0)
  ------------------
  |  Branch (2128:9): [True: 22, False: 1.08k]
  ------------------
 2129|     22|    {
 2130|     22|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2131|     22|        return (0);
 2132|     22|    }
 2133|  1.08k|    sp->in_buffer_file_pos_log = 0;
 2134|  3.91k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2134:17): [True: 2.97k, False: 938]
  ------------------
 2135|  2.97k|    {
 2136|  2.97k|        if ((sp->dctable_offset[m] != 0) &&
  ------------------
  |  Branch (2136:13): [True: 2.04k, False: 926]
  ------------------
 2137|  2.04k|            ((m == 0) || (sp->dctable_offset[m] != sp->dctable_offset[m - 1])))
  ------------------
  |  Branch (2137:14): [True: 1.08k, False: 962]
  |  Branch (2137:26): [True: 954, False: 8]
  ------------------
 2138|  2.03k|        {
 2139|  2.51k|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2139:25): [True: 479, False: 2.03k]
  ------------------
 2140|    479|            {
 2141|    479|                if (sp->dctable_offset[m] == sp->dctable_offset[n])
  ------------------
  |  Branch (2141:21): [True: 2, False: 477]
  ------------------
 2142|      2|                {
 2143|      2|                    TIFFErrorExtR(tif, module,
 2144|      2|                                  "Corrupt JpegDcTables tag value");
 2145|      2|                    return (0);
 2146|      2|                }
 2147|    479|            }
 2148|  2.03k|            TIFFSeekFile(tif, sp->dctable_offset[m], SEEK_SET);
  ------------------
  |  |  291|  2.03k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2149|  2.03k|            p = (uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  287|  2.03k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2150|  2.03k|            if (p != 16)
  ------------------
  |  Branch (2150:17): [True: 131, False: 1.90k]
  ------------------
 2151|    131|                return (0);
 2152|  1.90k|            q = 0;
 2153|  32.4k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2153:25): [True: 30.4k, False: 1.90k]
  ------------------
 2154|  30.4k|                q += o[n];
 2155|  1.90k|            ra = (uint32_t)(sizeof(uint32_t) + 21 + q);
 2156|  1.90k|            rb = (uint8_t *)_TIFFmallocExt(tif, ra);
 2157|  1.90k|            if (rb == 0)
  ------------------
  |  Branch (2157:17): [True: 0, False: 1.90k]
  ------------------
 2158|      0|            {
 2159|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2160|      0|                return (0);
 2161|      0|            }
 2162|  1.90k|            *(uint32_t *)rb = ra;
 2163|  1.90k|            rb[sizeof(uint32_t)] = 255;
 2164|  1.90k|            rb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|  1.90k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 2165|  1.90k|            rb[sizeof(uint32_t) + 2] = (uint8_t)((19 + q) >> 8);
 2166|  1.90k|            rb[sizeof(uint32_t) + 3] = ((19 + q) & 255);
 2167|  1.90k|            rb[sizeof(uint32_t) + 4] = m;
 2168|  32.4k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2168:25): [True: 30.4k, False: 1.90k]
  ------------------
 2169|  30.4k|                rb[sizeof(uint32_t) + 5 + n] = o[n];
 2170|  1.90k|            p = (uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  287|  1.90k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2171|  1.90k|            if (p != q)
  ------------------
  |  Branch (2171:17): [True: 14, False: 1.89k]
  ------------------
 2172|     14|            {
 2173|     14|                _TIFFfreeExt(tif, rb);
 2174|     14|                return (0);
 2175|     14|            }
 2176|  1.89k|            if (sp->dctable[m] != 0)
  ------------------
  |  Branch (2176:17): [True: 4, False: 1.88k]
  ------------------
 2177|      4|                _TIFFfreeExt(tif, sp->dctable[m]);
 2178|  1.89k|            sp->dctable[m] = rb;
 2179|  1.89k|            sp->sos_tda[m] = (uint8_t)(m << 4);
 2180|  1.89k|        }
 2181|    934|        else
 2182|    934|            sp->sos_tda[m] = sp->sos_tda[m - 1];
 2183|  2.97k|    }
 2184|    938|    return (1);
 2185|  1.08k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesAcTable:
 2188|    938|{
 2189|    938|    static const char module[] = "OJPEGReadHeaderInfoSecTablesAcTable";
 2190|    938|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2191|    938|    uint8_t m;
 2192|    938|    uint8_t n;
 2193|    938|    uint8_t o[16];
 2194|    938|    uint32_t p;
 2195|    938|    uint32_t q;
 2196|    938|    uint32_t ra;
 2197|    938|    uint8_t *rb;
 2198|    938|    if (sp->actable_offset[0] == 0)
  ------------------
  |  Branch (2198:9): [True: 14, False: 924]
  ------------------
 2199|     14|    {
 2200|     14|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2201|     14|        return (0);
 2202|     14|    }
 2203|    924|    sp->in_buffer_file_pos_log = 0;
 2204|  3.15k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2204:17): [True: 2.44k, False: 713]
  ------------------
 2205|  2.44k|    {
 2206|  2.44k|        if ((sp->actable_offset[m] != 0) &&
  ------------------
  |  Branch (2206:13): [True: 1.68k, False: 756]
  ------------------
 2207|  1.68k|            ((m == 0) || (sp->actable_offset[m] != sp->actable_offset[m - 1])))
  ------------------
  |  Branch (2207:14): [True: 924, False: 765]
  |  Branch (2207:26): [True: 732, False: 33]
  ------------------
 2208|  1.65k|        {
 2209|  1.84k|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2209:25): [True: 194, False: 1.65k]
  ------------------
 2210|    194|            {
 2211|    194|                if (sp->actable_offset[m] == sp->actable_offset[n])
  ------------------
  |  Branch (2211:21): [True: 1, False: 193]
  ------------------
 2212|      1|                {
 2213|      1|                    TIFFErrorExtR(tif, module,
 2214|      1|                                  "Corrupt JpegAcTables tag value");
 2215|      1|                    return (0);
 2216|      1|                }
 2217|    194|            }
 2218|  1.65k|            TIFFSeekFile(tif, sp->actable_offset[m], SEEK_SET);
  ------------------
  |  |  291|  1.65k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2219|  1.65k|            p = (uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  287|  1.65k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2220|  1.65k|            if (p != 16)
  ------------------
  |  Branch (2220:17): [True: 200, False: 1.45k]
  ------------------
 2221|    200|                return (0);
 2222|  1.45k|            q = 0;
 2223|  24.7k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2223:25): [True: 23.2k, False: 1.45k]
  ------------------
 2224|  23.2k|                q += o[n];
 2225|  1.45k|            ra = (uint32_t)(sizeof(uint32_t) + 21 + q);
 2226|  1.45k|            rb = (uint8_t *)_TIFFmallocExt(tif, ra);
 2227|  1.45k|            if (rb == 0)
  ------------------
  |  Branch (2227:17): [True: 0, False: 1.45k]
  ------------------
 2228|      0|            {
 2229|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2230|      0|                return (0);
 2231|      0|            }
 2232|  1.45k|            *(uint32_t *)rb = ra;
 2233|  1.45k|            rb[sizeof(uint32_t)] = 255;
 2234|  1.45k|            rb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|  1.45k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 2235|  1.45k|            rb[sizeof(uint32_t) + 2] = (uint8_t)((19 + q) >> 8);
 2236|  1.45k|            rb[sizeof(uint32_t) + 3] = ((19 + q) & 255);
 2237|  1.45k|            rb[sizeof(uint32_t) + 4] = (16 | m);
 2238|  24.7k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2238:25): [True: 23.2k, False: 1.45k]
  ------------------
 2239|  23.2k|                rb[sizeof(uint32_t) + 5 + n] = o[n];
 2240|  1.45k|            p = (uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  287|  1.45k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2241|  1.45k|            if (p != q)
  ------------------
  |  Branch (2241:17): [True: 10, False: 1.44k]
  ------------------
 2242|     10|            {
 2243|     10|                _TIFFfreeExt(tif, rb);
 2244|     10|                return (0);
 2245|     10|            }
 2246|  1.44k|            if (sp->actable[m] != 0)
  ------------------
  |  Branch (2246:17): [True: 3, False: 1.44k]
  ------------------
 2247|      3|                _TIFFfreeExt(tif, sp->actable[m]);
 2248|  1.44k|            sp->actable[m] = rb;
 2249|  1.44k|            sp->sos_tda[m] = (sp->sos_tda[m] | m);
 2250|  1.44k|        }
 2251|    789|        else
 2252|    789|            sp->sos_tda[m] = (sp->sos_tda[m] | (sp->sos_tda[m - 1] & 15));
 2253|  2.44k|    }
 2254|    713|    return (1);
 2255|    924|}
tif_ojpeg.c:OJPEGVSetField:
  560|  28.0k|{
  561|  28.0k|    static const char module[] = "OJPEGVSetField";
  562|  28.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  563|  28.0k|    uint32_t ma;
  564|  28.0k|    uint64_t *mb;
  565|  28.0k|    uint32_t n;
  566|  28.0k|    const TIFFField *fip;
  567|       |
  568|  28.0k|    switch (tag)
  569|  28.0k|    {
  570|  1.02k|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|  1.02k|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (570:9): [True: 1.02k, False: 27.0k]
  ------------------
  571|  1.02k|            sp->jpeg_interchange_format = (uint64_t)va_arg(ap, uint64_t);
  572|  1.02k|            break;
  573|    182|        case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|    182|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (573:9): [True: 182, False: 27.8k]
  ------------------
  574|    182|            sp->jpeg_interchange_format_length = (uint64_t)va_arg(ap, uint64_t);
  575|    182|            break;
  576|    882|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|    882|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (576:9): [True: 882, False: 27.1k]
  ------------------
  577|    882|            sp->subsampling_tag = 1;
  578|    882|            sp->subsampling_hor = (uint8_t)va_arg(ap, uint16_vap);
  579|    882|            sp->subsampling_ver = (uint8_t)va_arg(ap, uint16_vap);
  580|    882|            tif->tif_dir.td_ycbcrsubsampling[0] = sp->subsampling_hor;
  581|    882|            tif->tif_dir.td_ycbcrsubsampling[1] = sp->subsampling_ver;
  582|    882|            break;
  583|  1.32k|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|  1.32k|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (583:9): [True: 1.32k, False: 26.7k]
  ------------------
  584|  1.32k|            ma = (uint32_t)va_arg(ap, uint32_t);
  585|  1.32k|            if (ma != 0)
  ------------------
  |  Branch (585:17): [True: 1.32k, False: 2]
  ------------------
  586|  1.32k|            {
  587|  1.32k|                if (ma > 3)
  ------------------
  |  Branch (587:21): [True: 8, False: 1.31k]
  ------------------
  588|      8|                {
  589|      8|                    TIFFErrorExtR(tif, module,
  590|      8|                                  "JpegQTables tag has incorrect count");
  591|      8|                    return (0);
  592|      8|                }
  593|  1.31k|                sp->qtable_offset_count = (uint8_t)ma;
  594|  1.31k|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  595|  3.41k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (595:29): [True: 2.10k, False: 1.31k]
  ------------------
  596|  2.10k|                    sp->qtable_offset[n] = mb[n];
  597|  1.31k|            }
  598|  1.31k|            break;
  599|  1.31k|        case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|  1.14k|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (599:9): [True: 1.14k, False: 26.8k]
  ------------------
  600|  1.14k|            ma = (uint32_t)va_arg(ap, uint32_t);
  601|  1.14k|            if (ma != 0)
  ------------------
  |  Branch (601:17): [True: 1.13k, False: 4]
  ------------------
  602|  1.13k|            {
  603|  1.13k|                if (ma > 3)
  ------------------
  |  Branch (603:21): [True: 4, False: 1.13k]
  ------------------
  604|      4|                {
  605|      4|                    TIFFErrorExtR(tif, module,
  606|      4|                                  "JpegDcTables tag has incorrect count");
  607|      4|                    return (0);
  608|      4|                }
  609|  1.13k|                sp->dctable_offset_count = (uint8_t)ma;
  610|  1.13k|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  611|  3.61k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (611:29): [True: 2.48k, False: 1.13k]
  ------------------
  612|  2.48k|                    sp->dctable_offset[n] = mb[n];
  613|  1.13k|            }
  614|  1.13k|            break;
  615|  1.13k|        case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|  1.01k|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (615:9): [True: 1.01k, False: 27.0k]
  ------------------
  616|  1.01k|            ma = (uint32_t)va_arg(ap, uint32_t);
  617|  1.01k|            if (ma != 0)
  ------------------
  |  Branch (617:17): [True: 1.01k, False: 3]
  ------------------
  618|  1.01k|            {
  619|  1.01k|                if (ma > 3)
  ------------------
  |  Branch (619:21): [True: 16, False: 999]
  ------------------
  620|     16|                {
  621|     16|                    TIFFErrorExtR(tif, module,
  622|     16|                                  "JpegAcTables tag has incorrect count");
  623|     16|                    return (0);
  624|     16|                }
  625|    999|                sp->actable_offset_count = (uint8_t)ma;
  626|    999|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  627|  3.97k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (627:29): [True: 2.97k, False: 999]
  ------------------
  628|  2.97k|                    sp->actable_offset[n] = mb[n];
  629|    999|            }
  630|  1.00k|            break;
  631|  1.00k|        case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|     11|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (631:9): [True: 11, False: 28.0k]
  ------------------
  632|     11|            sp->jpeg_proc = (uint8_t)va_arg(ap, uint16_vap);
  633|     11|            break;
  634|     21|        case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|     21|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (634:9): [True: 21, False: 28.0k]
  ------------------
  635|     21|            sp->restart_interval = (uint16_t)va_arg(ap, uint16_vap);
  636|     21|            break;
  637|  22.4k|        default:
  ------------------
  |  Branch (637:9): [True: 22.4k, False: 5.61k]
  ------------------
  638|  22.4k|            return (*sp->vsetparent)(tif, tag, ap);
  639|  28.0k|    }
  640|  5.58k|    fip = TIFFFieldWithTag(tif, tag);
  641|  5.58k|    if (fip == NULL) /* shouldn't happen */
  ------------------
  |  Branch (641:9): [True: 0, False: 5.58k]
  ------------------
  642|      0|        return (0);
  643|  5.58k|    TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  268|  5.58k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|  5.58k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|  5.58k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  644|  5.58k|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  125|  5.58k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
  645|  5.58k|    return (1);
  646|  5.58k|}
tif_ojpeg.c:OJPEGFixupTags:
  691|  3.03k|{
  692|  3.03k|    (void)tif;
  693|  3.03k|    return (1);
  694|  3.03k|}
tif_ojpeg.c:OJPEGSetupDecode:
  697|  1.80k|{
  698|  1.80k|    static const char module[] = "OJPEGSetupDecode";
  699|  1.80k|    TIFFWarningExtR(tif, module,
  700|  1.80k|                    "Deprecated and troublesome old-style JPEG compression "
  701|  1.80k|                    "mode, please convert to new-style JPEG compression and "
  702|  1.80k|                    "notify vendor of writing software");
  703|  1.80k|    return (1);
  704|  1.80k|}
tif_ojpeg.c:OJPEGPreDecode:
  707|   303k|{
  708|   303k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  709|   303k|    uint32_t m;
  710|   303k|    if (sp->subsamplingcorrect_done == 0)
  ------------------
  |  Branch (710:9): [True: 54, False: 303k]
  ------------------
  711|     54|        OJPEGSubsamplingCorrect(tif);
  712|   303k|    if (sp->readheader_done == 0)
  ------------------
  |  Branch (712:9): [True: 1.92k, False: 301k]
  ------------------
  713|  1.92k|    {
  714|  1.92k|        if (OJPEGReadHeaderInfo(tif) == 0)
  ------------------
  |  Branch (714:13): [True: 1.12k, False: 795]
  ------------------
  715|  1.12k|            return (0);
  716|  1.92k|    }
  717|   302k|    if (sp->sos_end[s].log == 0)
  ------------------
  |  Branch (717:9): [True: 165k, False: 136k]
  ------------------
  718|   165k|    {
  719|   165k|        if (OJPEGReadSecondarySos(tif, s) == 0)
  ------------------
  |  Branch (719:13): [True: 164k, False: 468]
  ------------------
  720|   164k|            return (0);
  721|   165k|    }
  722|   137k|    if (isTiled(tif))
  ------------------
  |  |  282|   137k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|   137k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 134k, False: 2.82k]
  |  |  ------------------
  ------------------
  723|   134k|        m = tif->tif_dir.td_curtile;
  724|  2.82k|    else
  725|  2.82k|        m = tif->tif_dir.td_curstrip;
  726|   137k|    if ((sp->writeheader_done != 0) &&
  ------------------
  |  Branch (726:9): [True: 125k, False: 11.3k]
  ------------------
  727|   125k|        ((sp->write_cursample != s) || (sp->write_curstrile > m)))
  ------------------
  |  Branch (727:10): [True: 53.6k, False: 72.2k]
  |  Branch (727:40): [True: 1.29k, False: 70.9k]
  ------------------
  728|  54.9k|    {
  729|  54.9k|        if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (729:13): [True: 54.9k, False: 0]
  ------------------
  730|  54.9k|            OJPEGLibjpegSessionAbort(tif);
  731|  54.9k|        sp->writeheader_done = 0;
  732|  54.9k|    }
  733|   137k|    if (sp->writeheader_done == 0)
  ------------------
  |  Branch (733:9): [True: 66.3k, False: 70.9k]
  ------------------
  734|  66.3k|    {
  735|  66.3k|        sp->plane_sample_offset = (uint8_t)s;
  736|  66.3k|        sp->write_cursample = s;
  737|  66.3k|        sp->write_curstrile = s * tif->tif_dir.td_stripsperimage;
  738|  66.3k|        if ((sp->in_buffer_file_pos_log == 0) ||
  ------------------
  |  Branch (738:13): [True: 33.9k, False: 32.3k]
  ------------------
  739|  32.3k|            (sp->in_buffer_file_pos - sp->in_buffer_togo !=
  ------------------
  |  Branch (739:13): [True: 26.0k, False: 6.22k]
  ------------------
  740|  32.3k|             sp->sos_end[s].in_buffer_file_pos))
  741|  60.0k|        {
  742|  60.0k|            sp->in_buffer_source = sp->sos_end[s].in_buffer_source;
  743|  60.0k|            sp->in_buffer_next_strile = sp->sos_end[s].in_buffer_next_strile;
  744|  60.0k|            sp->in_buffer_file_pos = sp->sos_end[s].in_buffer_file_pos;
  745|  60.0k|            sp->in_buffer_file_pos_log = 0;
  746|  60.0k|            sp->in_buffer_file_togo = sp->sos_end[s].in_buffer_file_togo;
  747|  60.0k|            sp->in_buffer_togo = 0;
  748|  60.0k|            sp->in_buffer_cur = 0;
  749|  60.0k|        }
  750|  66.3k|        if (OJPEGWriteHeaderInfo(tif) == 0)
  ------------------
  |  Branch (750:13): [True: 10.4k, False: 55.8k]
  ------------------
  751|  10.4k|            return (0);
  752|  66.3k|    }
  753|       |
  754|   126k|    sp->subsampling_convert_state = 0;
  755|       |
  756|  10.2M|    while (sp->write_curstrile < m)
  ------------------
  |  Branch (756:12): [True: 10.1M, False: 99.4k]
  ------------------
  757|  10.1M|    {
  758|  10.1M|        if (sp->libjpeg_jpeg_query_style == 0)
  ------------------
  |  Branch (758:13): [True: 242k, False: 9.93M]
  ------------------
  759|   242k|        {
  760|   242k|            if (OJPEGPreDecodeSkipRaw(tif) == 0)
  ------------------
  |  Branch (760:17): [True: 945, False: 241k]
  ------------------
  761|    945|                return (0);
  762|   242k|        }
  763|  9.93M|        else
  764|  9.93M|        {
  765|  9.93M|            if (OJPEGPreDecodeSkipScanlines(tif) == 0)
  ------------------
  |  Branch (765:17): [True: 26.4k, False: 9.91M]
  ------------------
  766|  26.4k|                return (0);
  767|  9.93M|        }
  768|  10.1M|        sp->write_curstrile++;
  769|  10.1M|    }
  770|  99.4k|    sp->decoder_ok = 1;
  771|  99.4k|    return (1);
  772|   126k|}
tif_ojpeg.c:OJPEGReadHeaderInfo:
 1169|  1.92k|{
 1170|  1.92k|    static const char module[] = "OJPEGReadHeaderInfo";
 1171|  1.92k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1172|  1.92k|    assert(sp->readheader_done == 0);
  ------------------
  |  Branch (1172:5): [True: 0, False: 1.92k]
  |  Branch (1172:5): [True: 1.92k, False: 0]
  ------------------
 1173|  1.92k|    sp->image_width = tif->tif_dir.td_imagewidth;
 1174|  1.92k|    sp->image_length = tif->tif_dir.td_imagelength;
 1175|  1.92k|    if (isTiled(tif))
  ------------------
  |  |  282|  1.92k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  1.92k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 1.58k, False: 332]
  |  |  ------------------
  ------------------
 1176|  1.58k|    {
 1177|  1.58k|        sp->strile_width = tif->tif_dir.td_tilewidth;
 1178|  1.58k|        sp->strile_length = tif->tif_dir.td_tilelength;
 1179|  1.58k|        sp->strile_length_total =
 1180|  1.58k|            ((sp->image_length + sp->strile_length - 1) / sp->strile_length) *
 1181|  1.58k|            sp->strile_length;
 1182|  1.58k|    }
 1183|    332|    else
 1184|    332|    {
 1185|    332|        sp->strile_width = sp->image_width;
 1186|    332|        sp->strile_length = tif->tif_dir.td_rowsperstrip;
 1187|    332|        if (sp->strile_length == (uint32_t)-1)
  ------------------
  |  Branch (1187:13): [True: 0, False: 332]
  ------------------
 1188|      0|            sp->strile_length = sp->image_length;
 1189|    332|        sp->strile_length_total = sp->image_length;
 1190|    332|    }
 1191|  1.92k|    if (tif->tif_dir.td_samplesperpixel == 1)
  ------------------
  |  Branch (1191:9): [True: 77, False: 1.84k]
  ------------------
 1192|     77|    {
 1193|     77|        sp->samples_per_pixel = 1;
 1194|     77|        sp->plane_sample_offset = 0;
 1195|     77|        sp->samples_per_pixel_per_plane = sp->samples_per_pixel;
 1196|     77|        sp->subsampling_hor = 1;
 1197|     77|        sp->subsampling_ver = 1;
 1198|     77|    }
 1199|  1.84k|    else
 1200|  1.84k|    {
 1201|  1.84k|        if (tif->tif_dir.td_samplesperpixel != 3)
  ------------------
  |  Branch (1201:13): [True: 4, False: 1.83k]
  ------------------
 1202|      4|        {
 1203|      4|            TIFFErrorExtR(tif, module,
 1204|      4|                          "SamplesPerPixel %" PRIu8
 1205|      4|                          " not supported for this compression scheme",
 1206|      4|                          sp->samples_per_pixel);
 1207|      4|            return (0);
 1208|      4|        }
 1209|  1.83k|        sp->samples_per_pixel = 3;
 1210|  1.83k|        sp->plane_sample_offset = 0;
 1211|  1.83k|        if (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.83k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1211:13): [True: 1.01k, False: 824]
  ------------------
 1212|  1.01k|            sp->samples_per_pixel_per_plane = 3;
 1213|    824|        else
 1214|    824|            sp->samples_per_pixel_per_plane = 1;
 1215|  1.83k|    }
 1216|  1.91k|    if (sp->strile_length < sp->image_length)
  ------------------
  |  Branch (1216:9): [True: 387, False: 1.52k]
  ------------------
 1217|    387|    {
 1218|    387|        if (((sp->subsampling_hor != 1) && (sp->subsampling_hor != 2) &&
  ------------------
  |  Branch (1218:14): [True: 161, False: 226]
  |  Branch (1218:44): [True: 7, False: 154]
  ------------------
 1219|      7|             (sp->subsampling_hor != 4)) ||
  ------------------
  |  Branch (1219:14): [True: 3, False: 4]
  ------------------
 1220|    384|            ((sp->subsampling_ver != 1) && (sp->subsampling_ver != 2) &&
  ------------------
  |  Branch (1220:14): [True: 159, False: 225]
  |  Branch (1220:44): [True: 7, False: 152]
  ------------------
 1221|      7|             (sp->subsampling_ver != 4)))
  ------------------
  |  Branch (1221:14): [True: 3, False: 4]
  ------------------
 1222|      6|        {
 1223|      6|            TIFFErrorExtR(tif, module, "Invalid subsampling values");
 1224|      6|            return (0);
 1225|      6|        }
 1226|    381|        if (sp->strile_length % ((uint32_t)sp->subsampling_ver * 8) != 0)
  ------------------
  |  Branch (1226:13): [True: 40, False: 341]
  ------------------
 1227|     40|        {
 1228|     40|            TIFFErrorExtR(tif, module,
 1229|     40|                          "Incompatible vertical subsampling and image "
 1230|     40|                          "strip/tile length");
 1231|     40|            return (0);
 1232|     40|        }
 1233|    341|        {
 1234|       |            /* Values were validated above as 1, 2, or 4. */
 1235|    341|            uint32_t mcu_width = (uint32_t)sp->subsampling_hor * 8;
 1236|    341|            uint32_t mcu_height = (uint32_t)sp->subsampling_ver * 8;
 1237|    341|            uint32_t mcu_cols =
 1238|    341|                TIFFhowmany_32_maxuint_compat(sp->strile_width, mcu_width);
  ------------------
  |  |  322|    341|    (((uint32_t)(x) / (uint32_t)(y)) +                                         \
  |  |  323|    341|     ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
  |  |  ------------------
  |  |  |  Branch (323:7): [True: 288, False: 53]
  |  |  ------------------
  ------------------
 1239|    341|            uint32_t mcu_rows = sp->strile_length / mcu_height;
 1240|    341|            if (mcu_cols == 0 || mcu_rows == 0)
  ------------------
  |  Branch (1240:17): [True: 0, False: 341]
  |  Branch (1240:34): [True: 0, False: 341]
  ------------------
 1241|      0|            {
 1242|      0|                sp->restart_interval = 0;
 1243|      0|            }
 1244|    341|            else
 1245|    341|            {
 1246|    341|                uint32_t restart_interval =
 1247|    341|                    _TIFFMultiply32(tif, mcu_cols, mcu_rows, module);
 1248|    341|                if (restart_interval == 0 || restart_interval > UINT16_MAX)
  ------------------
  |  Branch (1248:21): [True: 0, False: 341]
  |  Branch (1248:46): [True: 5, False: 336]
  ------------------
 1249|      5|                {
 1250|      5|                    TIFFErrorExtR(tif, module,
 1251|      5|                                  "Integer overflow in restart interval");
 1252|      5|                    return (0);
 1253|      5|                }
 1254|    336|                sp->restart_interval = (uint16_t)restart_interval;
 1255|    336|            }
 1256|    341|        }
 1257|    341|    }
 1258|  1.86k|    if (OJPEGReadHeaderInfoSec(tif) == 0)
  ------------------
  |  Branch (1258:9): [True: 1.07k, False: 795]
  ------------------
 1259|  1.07k|        return (0);
 1260|    795|    sp->sos_end[0].log = 1;
 1261|    795|    sp->sos_end[0].in_buffer_source = sp->in_buffer_source;
 1262|    795|    sp->sos_end[0].in_buffer_next_strile = sp->in_buffer_next_strile;
 1263|    795|    sp->sos_end[0].in_buffer_file_pos =
 1264|    795|        sp->in_buffer_file_pos - sp->in_buffer_togo;
 1265|    795|    sp->sos_end[0].in_buffer_file_togo =
 1266|    795|        sp->in_buffer_file_togo + sp->in_buffer_togo;
 1267|    795|    sp->readheader_done = 1;
 1268|    795|    return (1);
 1269|  1.86k|}
tif_ojpeg.c:OJPEGReadSecondarySos:
 1272|   165k|{
 1273|   165k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1274|   165k|    uint8_t m;
 1275|   165k|    assert(s > 0);
  ------------------
  |  Branch (1275:5): [True: 0, False: 165k]
  |  Branch (1275:5): [True: 165k, False: 0]
  ------------------
 1276|   165k|    assert(s < 3);
  ------------------
  |  Branch (1276:5): [True: 0, False: 165k]
  |  Branch (1276:5): [True: 165k, False: 0]
  ------------------
 1277|   165k|    assert(sp->sos_end[0].log != 0);
  ------------------
  |  Branch (1277:5): [True: 0, False: 165k]
  |  Branch (1277:5): [True: 165k, False: 0]
  ------------------
 1278|   165k|    assert(sp->sos_end[s].log == 0);
  ------------------
  |  Branch (1278:5): [True: 0, False: 165k]
  |  Branch (1278:5): [True: 165k, False: 0]
  ------------------
 1279|   165k|    sp->plane_sample_offset = (uint8_t)(s - 1);
 1280|   233k|    while (sp->sos_end[sp->plane_sample_offset].log == 0)
  ------------------
  |  Branch (1280:12): [True: 68.1k, False: 165k]
  ------------------
 1281|  68.1k|        sp->plane_sample_offset--;
 1282|   165k|    sp->in_buffer_source =
 1283|   165k|        sp->sos_end[sp->plane_sample_offset].in_buffer_source;
 1284|   165k|    sp->in_buffer_next_strile =
 1285|   165k|        sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile;
 1286|   165k|    sp->in_buffer_file_pos =
 1287|   165k|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos;
 1288|   165k|    sp->in_buffer_file_pos_log = 0;
 1289|   165k|    sp->in_buffer_file_togo =
 1290|   165k|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo;
 1291|   165k|    sp->in_buffer_togo = 0;
 1292|   165k|    sp->in_buffer_cur = 0;
 1293|   165k|    while (sp->plane_sample_offset < s)
  ------------------
  |  Branch (1293:12): [True: 165k, False: 468]
  ------------------
 1294|   165k|    {
 1295|   165k|        do
 1296|  55.5M|        {
 1297|  55.5M|            if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1297:17): [True: 138k, False: 55.3M]
  ------------------
 1298|   138k|                return (0);
 1299|  55.3M|            if (m == 255)
  ------------------
  |  Branch (1299:17): [True: 3.21M, False: 52.1M]
  ------------------
 1300|  3.21M|            {
 1301|  3.21M|                do
 1302|  8.02M|                {
 1303|  8.02M|                    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1303:25): [True: 5.42k, False: 8.01M]
  ------------------
 1304|  5.42k|                        return (0);
 1305|  8.01M|                    if (m != 255)
  ------------------
  |  Branch (1305:25): [True: 3.21M, False: 4.80M]
  ------------------
 1306|  3.21M|                        break;
 1307|  8.01M|                } while (1);
  ------------------
  |  Branch (1307:26): [True: 4.80M, Folded]
  ------------------
 1308|  3.21M|                if (m == JPEG_MARKER_SOS)
  ------------------
  |  |  165|  3.21M|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1308:21): [True: 21.7k, False: 3.18M]
  ------------------
 1309|  21.7k|                    break;
 1310|  3.21M|            }
 1311|  55.3M|        } while (1);
  ------------------
  |  Branch (1311:18): [True: 55.3M, Folded]
  ------------------
 1312|  21.7k|        sp->plane_sample_offset++;
 1313|  21.7k|        if (OJPEGReadHeaderInfoSecStreamSos(tif) == 0)
  ------------------
  |  Branch (1313:13): [True: 21.2k, False: 468]
  ------------------
 1314|  21.2k|            return (0);
 1315|    468|        sp->sos_end[sp->plane_sample_offset].log = 1;
 1316|    468|        sp->sos_end[sp->plane_sample_offset].in_buffer_source =
 1317|    468|            sp->in_buffer_source;
 1318|    468|        sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile =
 1319|    468|            sp->in_buffer_next_strile;
 1320|    468|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos =
 1321|    468|            sp->in_buffer_file_pos - sp->in_buffer_togo;
 1322|    468|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo =
 1323|    468|            sp->in_buffer_file_togo + sp->in_buffer_togo;
 1324|    468|    }
 1325|    468|    return (1);
 1326|   165k|}
tif_ojpeg.c:OJPEGLibjpegSessionAbort:
 1529|  56.0k|{
 1530|  56.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1531|  56.0k|    assert(sp->libjpeg_session_active != 0);
  ------------------
  |  Branch (1531:5): [True: 0, False: 56.0k]
  |  Branch (1531:5): [True: 56.0k, False: 0]
  ------------------
 1532|  56.0k|    jpeg_destroy(
 1533|  56.0k|        (tiff_ojpeg_common_struct *)(&(sp->libjpeg_jpeg_decompress_struct)));
 1534|  56.0k|    sp->libjpeg_session_active = 0;
 1535|  56.0k|}
tif_ojpeg.c:OJPEGWriteHeaderInfo:
 1329|  66.3k|{
 1330|  66.3k|    static const char module[] = "OJPEGWriteHeaderInfo";
 1331|  66.3k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1332|  66.3k|    uint8_t **m;
 1333|  66.3k|    uint32_t n;
 1334|       |    /* if a previous attempt failed, don't try again */
 1335|  66.3k|    if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (1335:9): [True: 10.2k, False: 56.0k]
  ------------------
 1336|  10.2k|        return 0;
 1337|  56.0k|    sp->out_state = ososSoi;
 1338|  56.0k|    sp->restart_index = 0;
 1339|  56.0k|    jpeg_std_error(&(sp->libjpeg_jpeg_error_mgr));
 1340|  56.0k|    sp->libjpeg_jpeg_error_mgr.output_message =
 1341|  56.0k|        OJPEGLibjpegJpegErrorMgrOutputMessage;
 1342|  56.0k|    sp->libjpeg_jpeg_error_mgr.error_exit = OJPEGLibjpegJpegErrorMgrErrorExit;
 1343|  56.0k|    sp->libjpeg_jpeg_decompress_struct.err = &(sp->libjpeg_jpeg_error_mgr);
 1344|  56.0k|    sp->libjpeg_jpeg_decompress_struct.client_data = (void *)tif;
 1345|  56.0k|    if (jpeg_create_decompress_encap(
  ------------------
  |  Branch (1345:9): [True: 0, False: 56.0k]
  ------------------
 1346|  56.0k|            sp, &(sp->libjpeg_jpeg_decompress_struct)) == 0)
 1347|      0|        return (0);
 1348|  56.0k|    sp->libjpeg_session_active = 1;
 1349|  56.0k|    sp->libjpeg_jpeg_source_mgr.bytes_in_buffer = 0;
 1350|  56.0k|    sp->libjpeg_jpeg_source_mgr.init_source =
 1351|  56.0k|        OJPEGLibjpegJpegSourceMgrInitSource;
 1352|  56.0k|    sp->libjpeg_jpeg_source_mgr.fill_input_buffer =
 1353|  56.0k|        OJPEGLibjpegJpegSourceMgrFillInputBuffer;
 1354|  56.0k|    sp->libjpeg_jpeg_source_mgr.skip_input_data =
 1355|  56.0k|        OJPEGLibjpegJpegSourceMgrSkipInputData;
 1356|  56.0k|    sp->libjpeg_jpeg_source_mgr.resync_to_restart =
 1357|  56.0k|        OJPEGLibjpegJpegSourceMgrResyncToRestart;
 1358|  56.0k|    sp->libjpeg_jpeg_source_mgr.term_source =
 1359|  56.0k|        OJPEGLibjpegJpegSourceMgrTermSource;
 1360|  56.0k|    sp->libjpeg_jpeg_decompress_struct.src = &(sp->libjpeg_jpeg_source_mgr);
 1361|  56.0k|    if (jpeg_read_header_encap(sp, &(sp->libjpeg_jpeg_decompress_struct), 1) ==
  ------------------
  |  Branch (1361:9): [True: 108, False: 55.9k]
  ------------------
 1362|  56.0k|        0)
 1363|    108|        return (0);
 1364|  55.9k|    if ((sp->subsampling_force_desubsampling_inside_decompression == 0) &&
  ------------------
  |  Branch (1364:9): [True: 55.2k, False: 692]
  ------------------
 1365|  55.2k|        (sp->samples_per_pixel_per_plane > 1))
  ------------------
  |  Branch (1365:9): [True: 954, False: 54.3k]
  ------------------
 1366|    954|    {
 1367|    954|        sp->libjpeg_jpeg_decompress_struct.raw_data_out = 1;
 1368|       |#if JPEG_LIB_VERSION >= 70
 1369|       |        sp->libjpeg_jpeg_decompress_struct.do_fancy_upsampling = FALSE;
 1370|       |#endif
 1371|    954|        sp->libjpeg_jpeg_query_style = 0;
 1372|    954|        if (sp->subsampling_convert_log == 0)
  ------------------
  |  Branch (1372:13): [True: 110, False: 844]
  ------------------
 1373|    110|        {
 1374|    110|            assert(sp->subsampling_convert_ycbcrbuf == 0);
  ------------------
  |  Branch (1374:13): [True: 0, False: 110]
  |  Branch (1374:13): [True: 110, False: 0]
  ------------------
 1375|    110|            assert(sp->subsampling_convert_ycbcrimage == 0);
  ------------------
  |  Branch (1375:13): [True: 0, False: 110]
  |  Branch (1375:13): [True: 110, False: 0]
  ------------------
 1376|       |            /* Check for division by zero. */
 1377|    110|            if (sp->subsampling_hor == 0 || sp->subsampling_ver == 0)
  ------------------
  |  Branch (1377:17): [True: 0, False: 110]
  |  Branch (1377:45): [True: 0, False: 110]
  ------------------
 1378|      0|                return (0);
 1379|       |            /* Check for potential overflow in subsampling_convert_ylinelen
 1380|       |             * computation.
 1381|       |             */
 1382|    110|            if (sp->strile_width >
  ------------------
  |  Branch (1382:17): [True: 0, False: 110]
  ------------------
 1383|    110|                UINT32_MAX - ((uint32_t)sp->subsampling_hor * 8 - 1))
 1384|      0|                return (0);
 1385|    110|            sp->subsampling_convert_ylinelen =
 1386|    110|                ((sp->strile_width + (uint32_t)sp->subsampling_hor * 8 - 1) /
 1387|    110|                 ((uint32_t)sp->subsampling_hor * 8) *
 1388|    110|                 ((uint32_t)sp->subsampling_hor * 8));
 1389|    110|            sp->subsampling_convert_ylines = (uint32_t)sp->subsampling_ver * 8;
 1390|    110|            sp->subsampling_convert_clinelen =
 1391|    110|                sp->subsampling_convert_ylinelen / sp->subsampling_hor;
 1392|    110|            sp->subsampling_convert_clines = 8;
 1393|       |            /* Check for potential overflow in buffer length computations.
 1394|       |             * Use 64-bit intermediates to detect uint32_t overflow in
 1395|       |             * ylinelen * ylines, clinelen * clines, and their sum.
 1396|       |             */
 1397|    110|            {
 1398|    110|                uint64_t ybuflen64 =
 1399|    110|                    (uint64_t)sp->subsampling_convert_ylinelen *
 1400|    110|                    sp->subsampling_convert_ylines;
 1401|    110|                uint64_t cbuflen64 =
 1402|    110|                    (uint64_t)sp->subsampling_convert_clinelen *
 1403|    110|                    sp->subsampling_convert_clines;
 1404|    110|                uint64_t ycbcrbuflen64 = ybuflen64 + 2 * cbuflen64;
 1405|    110|                if (ybuflen64 > UINT32_MAX || cbuflen64 > UINT32_MAX ||
  ------------------
  |  Branch (1405:21): [True: 0, False: 110]
  |  Branch (1405:47): [True: 0, False: 110]
  ------------------
 1406|    110|                    ycbcrbuflen64 > UINT32_MAX)
  ------------------
  |  Branch (1406:21): [True: 0, False: 110]
  ------------------
 1407|      0|                {
 1408|      0|                    TIFFErrorExtR(tif, module,
 1409|      0|                                  "Integer overflow in OJPEG buffer size");
 1410|      0|                    return (0);
 1411|      0|                }
 1412|    110|                sp->subsampling_convert_ybuflen = (uint32_t)ybuflen64;
 1413|    110|                sp->subsampling_convert_cbuflen = (uint32_t)cbuflen64;
 1414|    110|                sp->subsampling_convert_ycbcrbuflen = (uint32_t)ycbcrbuflen64;
 1415|    110|            }
 1416|       |            /* The calloc is not normally necessary, except in some edge/broken
 1417|       |             * cases */
 1418|       |            /* for example for a tiled image of height 1 with a tile height of 1
 1419|       |             * and subsampling_hor=subsampling_ver=2 */
 1420|       |            /* In that case, libjpeg will only fill the 8 first lines of the 16
 1421|       |             * lines */
 1422|       |            /* See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16844
 1423|       |             */
 1424|       |            /* Even if this case is allowed (?), its handling is broken because
 1425|       |             * OJPEGPreDecode() should also likely */
 1426|       |            /* reset subsampling_convert_state to 0 when changing tile. */
 1427|      0|            sp->subsampling_convert_ycbcrbuf = (uint8_t *)_TIFFcallocExt(
 1428|    110|                tif, 1, sp->subsampling_convert_ycbcrbuflen);
 1429|    110|            if (sp->subsampling_convert_ycbcrbuf == 0)
  ------------------
  |  Branch (1429:17): [True: 4, False: 106]
  ------------------
 1430|      4|            {
 1431|      4|                TIFFErrorExtR(tif, module, "Out of memory");
 1432|      4|                return (0);
 1433|      4|            }
 1434|    106|            sp->subsampling_convert_ybuf = sp->subsampling_convert_ycbcrbuf;
 1435|    106|            sp->subsampling_convert_cbbuf =
 1436|    106|                sp->subsampling_convert_ybuf + sp->subsampling_convert_ybuflen;
 1437|    106|            sp->subsampling_convert_crbuf =
 1438|    106|                sp->subsampling_convert_cbbuf + sp->subsampling_convert_cbuflen;
 1439|    106|            sp->subsampling_convert_ycbcrimagelen =
 1440|    106|                3 + sp->subsampling_convert_ylines +
 1441|    106|                2 * sp->subsampling_convert_clines;
 1442|    106|            sp->subsampling_convert_ycbcrimage = (uint8_t **)_TIFFmallocExt(
 1443|    106|                tif, (tmsize_t)((size_t)sp->subsampling_convert_ycbcrimagelen *
 1444|    106|                                sizeof(uint8_t *)));
 1445|    106|            if (sp->subsampling_convert_ycbcrimage == 0)
  ------------------
  |  Branch (1445:17): [True: 0, False: 106]
  ------------------
 1446|      0|            {
 1447|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1448|      0|                return (0);
 1449|      0|            }
 1450|    106|            m = sp->subsampling_convert_ycbcrimage;
 1451|    106|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3);
 1452|    106|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3 +
 1453|    106|                               sp->subsampling_convert_ylines);
 1454|    106|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3 +
 1455|    106|                               sp->subsampling_convert_ylines +
 1456|    106|                               sp->subsampling_convert_clines);
 1457|  1.37k|            for (n = 0; n < sp->subsampling_convert_ylines; n++)
  ------------------
  |  Branch (1457:25): [True: 1.27k, False: 106]
  ------------------
 1458|  1.27k|                *m++ = sp->subsampling_convert_ybuf +
 1459|  1.27k|                       n * sp->subsampling_convert_ylinelen;
 1460|    954|            for (n = 0; n < sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1460:25): [True: 848, False: 106]
  ------------------
 1461|    848|                *m++ = sp->subsampling_convert_cbbuf +
 1462|    848|                       n * sp->subsampling_convert_clinelen;
 1463|    954|            for (n = 0; n < sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1463:25): [True: 848, False: 106]
  ------------------
 1464|    848|                *m++ = sp->subsampling_convert_crbuf +
 1465|    848|                       n * sp->subsampling_convert_clinelen;
 1466|    106|            sp->subsampling_convert_clinelenout =
 1467|    106|                sp->strile_width / sp->subsampling_hor +
 1468|    106|                ((sp->strile_width % sp->subsampling_hor) != 0 ? 1 : 0);
  ------------------
  |  Branch (1468:18): [True: 25, False: 81]
  ------------------
 1469|    106|            sp->subsampling_convert_state = 0;
 1470|    106|            sp->error_in_raw_data_decoding = 0;
 1471|       |
 1472|    106|            const uint64_t bpl =
 1473|    106|                (uint64_t)sp->subsampling_convert_clinelenout *
 1474|    106|                ((uint64_t)sp->subsampling_ver * sp->subsampling_hor + 2);
 1475|    106|            if (bpl > UINT32_MAX)
  ------------------
  |  Branch (1475:17): [True: 0, False: 106]
  ------------------
 1476|      0|                return (0);
 1477|    106|            sp->bytes_per_line = (uint32_t)bpl;
 1478|       |
 1479|    106|            sp->lines_per_strile =
 1480|    106|                sp->strile_length / sp->subsampling_ver +
 1481|    106|                ((sp->strile_length % sp->subsampling_ver) != 0 ? 1 : 0);
  ------------------
  |  Branch (1481:18): [True: 12, False: 94]
  ------------------
 1482|    106|            sp->subsampling_convert_log = 1;
 1483|    106|        }
 1484|    954|    }
 1485|  55.0k|    else
 1486|  55.0k|    {
 1487|  55.0k|        sp->libjpeg_jpeg_decompress_struct.jpeg_color_space = JCS_UNKNOWN;
 1488|  55.0k|        sp->libjpeg_jpeg_decompress_struct.out_color_space = JCS_UNKNOWN;
 1489|  55.0k|        sp->libjpeg_jpeg_query_style = 1;
 1490|  55.0k|        sp->bytes_per_line =
 1491|  55.0k|            _TIFFMultiply32(tif, sp->samples_per_pixel_per_plane,
 1492|  55.0k|                            sp->strile_width, "OJPEGWriteHeaderInfo");
 1493|  55.0k|        if (sp->bytes_per_line == 0)
  ------------------
  |  Branch (1493:13): [True: 0, False: 55.0k]
  ------------------
 1494|      0|            return (0);
 1495|  55.0k|        sp->lines_per_strile = sp->strile_length;
 1496|  55.0k|    }
 1497|  55.9k|    if (jpeg_start_decompress_encap(sp,
  ------------------
  |  Branch (1497:9): [True: 68, False: 55.8k]
  ------------------
 1498|  55.9k|                                    &(sp->libjpeg_jpeg_decompress_struct)) == 0)
 1499|     68|        return (0);
 1500|  55.8k|    if (sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width)
  ------------------
  |  Branch (1500:9): [True: 6, False: 55.8k]
  ------------------
 1501|      6|    {
 1502|      6|        TIFFErrorExtR(tif, module,
 1503|      6|                      "jpeg_start_decompress() returned image_width = %u, "
 1504|      6|                      "expected %" PRIu32,
 1505|      6|                      sp->libjpeg_jpeg_decompress_struct.image_width,
 1506|      6|                      sp->strile_width);
 1507|      6|        return 0;
 1508|      6|    }
 1509|  55.8k|    if (sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor !=
  ------------------
  |  Branch (1509:9): [True: 1, False: 55.8k]
  ------------------
 1510|  55.8k|            sp->subsampling_hor ||
 1511|  55.8k|        sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor !=
  ------------------
  |  Branch (1511:9): [True: 1, False: 55.8k]
  ------------------
 1512|  55.8k|            sp->subsampling_ver)
 1513|      2|    {
 1514|      2|        TIFFErrorExtR(tif, module,
 1515|      2|                      "jpeg_start_decompress() returned max_h_samp_factor = %d "
 1516|      2|                      "and max_v_samp_factor = %d, expected %" PRIu8
 1517|      2|                      " and %" PRIu8,
 1518|      2|                      sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor,
 1519|      2|                      sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor,
 1520|      2|                      sp->subsampling_hor, sp->subsampling_ver);
 1521|      2|        return 0;
 1522|      2|    }
 1523|       |
 1524|  55.8k|    sp->writeheader_done = 1;
 1525|  55.8k|    return (1);
 1526|  55.8k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrOutputMessage:
 2805|  51.0k|{
 2806|  51.0k|    char buffer[JMSG_LENGTH_MAX];
 2807|  51.0k|    (*cinfo->err->format_message)(cinfo, buffer);
 2808|  51.0k|    TIFFWarningExtR(((TIFF *)(cinfo->client_data)), "LibJpeg", "%s", buffer);
 2809|  51.0k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrErrorExit:
 2812|    176|{
 2813|    176|    char buffer[JMSG_LENGTH_MAX];
 2814|    176|    (*cinfo->err->format_message)(cinfo, buffer);
 2815|    176|    TIFFErrorExtR(((TIFF *)(cinfo->client_data)), "LibJpeg", "%s", buffer);
 2816|    176|    jpeg_encap_unwind((TIFF *)(cinfo->client_data));
 2817|    176|}
tif_ojpeg.c:jpeg_encap_unwind:
 2797|  27.7k|{
 2798|  27.7k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2799|  27.7k|    LONGJMP(sp->exit_jmpbuf, 1);
  ------------------
  |  |  153|  27.7k|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
 2800|  27.7k|}
tif_ojpeg.c:jpeg_create_decompress_encap:
 2725|  56.0k|{
 2726|  56.0k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  56.0k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2726:9): [True: 0, False: 56.0k]
  ------------------
 2727|      0|        return 0;
 2728|  56.0k|    else
 2729|  56.0k|    {
 2730|       |        jpeg_create_decompress(cinfo);
 2731|  56.0k|        return 1;
 2732|  56.0k|    }
 2733|  56.0k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrInitSource:
 2821|  56.0k|{
 2822|  56.0k|    (void)cinfo;
 2823|  56.0k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrFillInputBuffer:
 2827|   553k|{
 2828|   553k|    TIFF *tif = (TIFF *)cinfo->client_data;
 2829|   553k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2830|   553k|    void *mem = 0;
 2831|   553k|    uint32_t len = 0U;
 2832|   553k|    if (OJPEGWriteStream(tif, &mem, &len) == 0)
  ------------------
  |  Branch (2832:9): [True: 5.44k, False: 548k]
  ------------------
 2833|  5.44k|    {
 2834|  5.44k|        TIFFErrorExtR(tif, "LibJpeg", "Premature end of JPEG data");
 2835|  5.44k|        jpeg_encap_unwind(tif);
 2836|  5.44k|    }
 2837|   553k|    sp->libjpeg_jpeg_source_mgr.bytes_in_buffer = len;
 2838|   553k|    sp->libjpeg_jpeg_source_mgr.next_input_byte = (const JOCTET *)mem;
 2839|   553k|    return (1);
 2840|   553k|}
tif_ojpeg.c:OJPEGWriteStream:
 2454|   553k|{
 2455|   553k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2456|   553k|    *len = 0;
 2457|   553k|    do
 2458|   989k|    {
 2459|   989k|        assert(sp->out_state <= ososEoi);
  ------------------
  |  Branch (2459:9): [True: 0, False: 989k]
  |  Branch (2459:9): [True: 989k, False: 0]
  ------------------
 2460|   989k|        switch (sp->out_state)
 2461|   989k|        {
 2462|  56.0k|            case ososSoi:
  ------------------
  |  Branch (2462:13): [True: 56.0k, False: 933k]
  ------------------
 2463|  56.0k|                OJPEGWriteStreamSoi(tif, mem, len);
 2464|  56.0k|                break;
 2465|  56.0k|            case ososQTable0:
  ------------------
  |  Branch (2465:13): [True: 56.0k, False: 933k]
  ------------------
 2466|  56.0k|                OJPEGWriteStreamQTable(tif, 0, mem, len);
 2467|  56.0k|                break;
 2468|  56.0k|            case ososQTable1:
  ------------------
  |  Branch (2468:13): [True: 56.0k, False: 933k]
  ------------------
 2469|  56.0k|                OJPEGWriteStreamQTable(tif, 1, mem, len);
 2470|  56.0k|                break;
 2471|  56.0k|            case ososQTable2:
  ------------------
  |  Branch (2471:13): [True: 56.0k, False: 933k]
  ------------------
 2472|  56.0k|                OJPEGWriteStreamQTable(tif, 2, mem, len);
 2473|  56.0k|                break;
 2474|  56.0k|            case ososQTable3:
  ------------------
  |  Branch (2474:13): [True: 56.0k, False: 933k]
  ------------------
 2475|  56.0k|                OJPEGWriteStreamQTable(tif, 3, mem, len);
 2476|  56.0k|                break;
 2477|  56.0k|            case ososDcTable0:
  ------------------
  |  Branch (2477:13): [True: 56.0k, False: 933k]
  ------------------
 2478|  56.0k|                OJPEGWriteStreamDcTable(tif, 0, mem, len);
 2479|  56.0k|                break;
 2480|  56.0k|            case ososDcTable1:
  ------------------
  |  Branch (2480:13): [True: 56.0k, False: 933k]
  ------------------
 2481|  56.0k|                OJPEGWriteStreamDcTable(tif, 1, mem, len);
 2482|  56.0k|                break;
 2483|  56.0k|            case ososDcTable2:
  ------------------
  |  Branch (2483:13): [True: 56.0k, False: 933k]
  ------------------
 2484|  56.0k|                OJPEGWriteStreamDcTable(tif, 2, mem, len);
 2485|  56.0k|                break;
 2486|  56.0k|            case ososDcTable3:
  ------------------
  |  Branch (2486:13): [True: 56.0k, False: 933k]
  ------------------
 2487|  56.0k|                OJPEGWriteStreamDcTable(tif, 3, mem, len);
 2488|  56.0k|                break;
 2489|  56.0k|            case ososAcTable0:
  ------------------
  |  Branch (2489:13): [True: 56.0k, False: 933k]
  ------------------
 2490|  56.0k|                OJPEGWriteStreamAcTable(tif, 0, mem, len);
 2491|  56.0k|                break;
 2492|  56.0k|            case ososAcTable1:
  ------------------
  |  Branch (2492:13): [True: 56.0k, False: 933k]
  ------------------
 2493|  56.0k|                OJPEGWriteStreamAcTable(tif, 1, mem, len);
 2494|  56.0k|                break;
 2495|  56.0k|            case ososAcTable2:
  ------------------
  |  Branch (2495:13): [True: 56.0k, False: 933k]
  ------------------
 2496|  56.0k|                OJPEGWriteStreamAcTable(tif, 2, mem, len);
 2497|  56.0k|                break;
 2498|  56.0k|            case ososAcTable3:
  ------------------
  |  Branch (2498:13): [True: 56.0k, False: 933k]
  ------------------
 2499|  56.0k|                OJPEGWriteStreamAcTable(tif, 3, mem, len);
 2500|  56.0k|                break;
 2501|  56.0k|            case ososDri:
  ------------------
  |  Branch (2501:13): [True: 56.0k, False: 933k]
  ------------------
 2502|  56.0k|                OJPEGWriteStreamDri(tif, mem, len);
 2503|  56.0k|                break;
 2504|  56.0k|            case ososSof:
  ------------------
  |  Branch (2504:13): [True: 56.0k, False: 933k]
  ------------------
 2505|  56.0k|                OJPEGWriteStreamSof(tif, mem, len);
 2506|  56.0k|                break;
 2507|  56.0k|            case ososSos:
  ------------------
  |  Branch (2507:13): [True: 56.0k, False: 933k]
  ------------------
 2508|  56.0k|                OJPEGWriteStreamSos(tif, mem, len);
 2509|  56.0k|                break;
 2510|  84.2k|            case ososCompressed:
  ------------------
  |  Branch (2510:13): [True: 84.2k, False: 904k]
  ------------------
 2511|  84.2k|                if (OJPEGWriteStreamCompressed(tif, mem, len) == 0)
  ------------------
  |  Branch (2511:21): [True: 5.44k, False: 78.8k]
  ------------------
 2512|  5.44k|                    return (0);
 2513|  78.8k|                break;
 2514|  78.8k|            case ososRst:
  ------------------
  |  Branch (2514:13): [True: 7.72k, False: 981k]
  ------------------
 2515|  7.72k|                OJPEGWriteStreamRst(tif, mem, len);
 2516|  7.72k|                break;
 2517|    115|            case ososEoi:
  ------------------
  |  Branch (2517:13): [True: 115, False: 989k]
  ------------------
 2518|    115|                OJPEGWriteStreamEoi(tif, mem, len);
 2519|    115|                break;
 2520|      0|            default:
  ------------------
  |  Branch (2520:13): [True: 0, False: 989k]
  ------------------
 2521|      0|                break;
 2522|   989k|        }
 2523|   989k|    } while (*len == 0);
  ------------------
  |  Branch (2523:14): [True: 435k, False: 548k]
  ------------------
 2524|   548k|    return (1);
 2525|   553k|}
tif_ojpeg.c:OJPEGWriteStreamSoi:
 2528|  56.0k|{
 2529|  56.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2530|  56.0k|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2530:5): [True: 0, Folded]
  |  Branch (2530:5): [True: 56.0k, Folded]
  ------------------
 2531|  56.0k|    sp->out_buffer[0] = 255;
 2532|  56.0k|    sp->out_buffer[1] = JPEG_MARKER_SOI;
  ------------------
  |  |  163|  56.0k|#define JPEG_MARKER_SOI 0xD8
  ------------------
 2533|  56.0k|    *len = 2;
 2534|  56.0k|    *mem = (void *)sp->out_buffer;
 2535|  56.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2536|  56.0k|}
tif_ojpeg.c:OJPEGWriteStreamQTable:
 2540|   224k|{
 2541|   224k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2542|   224k|    if (sp->qtable[table_index] != 0)
  ------------------
  |  Branch (2542:9): [True: 72.5k, False: 151k]
  ------------------
 2543|  72.5k|    {
 2544|  72.5k|        *mem = (void *)(sp->qtable[table_index] + sizeof(uint32_t));
 2545|  72.5k|        *len = (uint32_t)(*((uint32_t *)sp->qtable[table_index]) -
 2546|  72.5k|                          sizeof(uint32_t));
 2547|  72.5k|    }
 2548|   224k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2549|   224k|}
tif_ojpeg.c:OJPEGWriteStreamDcTable:
 2553|   224k|{
 2554|   224k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2555|   224k|    if (sp->dctable[table_index] != 0)
  ------------------
  |  Branch (2555:9): [True: 105k, False: 119k]
  ------------------
 2556|   105k|    {
 2557|   105k|        *mem = (void *)(sp->dctable[table_index] + sizeof(uint32_t));
 2558|   105k|        *len = (uint32_t)(*((uint32_t *)sp->dctable[table_index]) -
 2559|   105k|                          sizeof(uint32_t));
 2560|   105k|    }
 2561|   224k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2562|   224k|}
tif_ojpeg.c:OJPEGWriteStreamAcTable:
 2566|   224k|{
 2567|   224k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2568|   224k|    if (sp->actable[table_index] != 0)
  ------------------
  |  Branch (2568:9): [True: 99.2k, False: 125k]
  ------------------
 2569|  99.2k|    {
 2570|  99.2k|        *mem = (void *)(sp->actable[table_index] + sizeof(uint32_t));
 2571|  99.2k|        *len = (uint32_t)(*((uint32_t *)sp->actable[table_index]) -
 2572|  99.2k|                          sizeof(uint32_t));
 2573|  99.2k|    }
 2574|   224k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2575|   224k|}
tif_ojpeg.c:OJPEGWriteStreamDri:
 2578|  56.0k|{
 2579|  56.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2580|  56.0k|    assert(OJPEG_BUFFER >= 6);
  ------------------
  |  Branch (2580:5): [True: 0, Folded]
  |  Branch (2580:5): [True: 56.0k, Folded]
  ------------------
 2581|  56.0k|    if (sp->restart_interval != 0)
  ------------------
  |  Branch (2581:9): [True: 16.3k, False: 39.7k]
  ------------------
 2582|  16.3k|    {
 2583|  16.3k|        sp->out_buffer[0] = 255;
 2584|  16.3k|        sp->out_buffer[1] = JPEG_MARKER_DRI;
  ------------------
  |  |  167|  16.3k|#define JPEG_MARKER_DRI 0xDD
  ------------------
 2585|  16.3k|        sp->out_buffer[2] = 0;
 2586|  16.3k|        sp->out_buffer[3] = 4;
 2587|  16.3k|        sp->out_buffer[4] = (uint8_t)(sp->restart_interval >> 8);
 2588|  16.3k|        sp->out_buffer[5] = (uint8_t)(sp->restart_interval & 255);
 2589|  16.3k|        *len = 6;
 2590|  16.3k|        *mem = (void *)sp->out_buffer;
 2591|  16.3k|    }
 2592|  56.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2593|  56.0k|}
tif_ojpeg.c:OJPEGWriteStreamSof:
 2596|  56.0k|{
 2597|  56.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2598|  56.0k|    uint8_t m;
 2599|  56.0k|    assert(OJPEG_BUFFER >= 2 + 8 + sp->samples_per_pixel_per_plane * 3);
  ------------------
  |  Branch (2599:5): [True: 0, False: 56.0k]
  |  Branch (2599:5): [True: 56.0k, False: 0]
  ------------------
 2600|  56.0k|    assert(255 >= 8 + sp->samples_per_pixel_per_plane * 3);
  ------------------
  |  Branch (2600:5): [True: 0, False: 56.0k]
  |  Branch (2600:5): [True: 56.0k, False: 0]
  ------------------
 2601|  56.0k|    sp->out_buffer[0] = 255;
 2602|  56.0k|    sp->out_buffer[1] = sp->sof_marker_id;
 2603|       |    /* Lf */
 2604|  56.0k|    sp->out_buffer[2] = 0;
 2605|  56.0k|    sp->out_buffer[3] = (uint8_t)(8 + sp->samples_per_pixel_per_plane * 3);
 2606|       |    /* P */
 2607|  56.0k|    sp->out_buffer[4] = 8;
 2608|       |    /* Y */
 2609|  56.0k|    sp->out_buffer[5] = (uint8_t)(sp->sof_y >> 8);
 2610|  56.0k|    sp->out_buffer[6] = (uint8_t)(sp->sof_y & 255);
 2611|       |    /* X */
 2612|  56.0k|    sp->out_buffer[7] = (uint8_t)(sp->sof_x >> 8);
 2613|  56.0k|    sp->out_buffer[8] = (uint8_t)(sp->sof_x & 255);
 2614|       |    /* Nf */
 2615|  56.0k|    sp->out_buffer[9] = sp->samples_per_pixel_per_plane;
 2616|   114k|    for (m = 0; m < sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2616:17): [True: 58.0k, False: 56.0k]
  ------------------
 2617|  58.0k|    {
 2618|       |        /* C */
 2619|  58.0k|        sp->out_buffer[10 + m * 3] = sp->sof_c[sp->plane_sample_offset + m];
 2620|       |        /* H and V */
 2621|  58.0k|        sp->out_buffer[10 + m * 3 + 1] =
 2622|  58.0k|            sp->sof_hv[sp->plane_sample_offset + m];
 2623|       |        /* Tq */
 2624|  58.0k|        sp->out_buffer[10 + m * 3 + 2] =
 2625|  58.0k|            sp->sof_tq[sp->plane_sample_offset + m];
 2626|  58.0k|    }
 2627|  56.0k|    *len = 10 + (uint32_t)sp->samples_per_pixel_per_plane * 3;
 2628|  56.0k|    *mem = (void *)sp->out_buffer;
 2629|  56.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2630|  56.0k|}
tif_ojpeg.c:OJPEGWriteStreamSos:
 2633|  56.0k|{
 2634|  56.0k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2635|  56.0k|    uint8_t m;
 2636|  56.0k|    assert(OJPEG_BUFFER >= 2 + 6 + sp->samples_per_pixel_per_plane * 2);
  ------------------
  |  Branch (2636:5): [True: 0, False: 56.0k]
  |  Branch (2636:5): [True: 56.0k, False: 0]
  ------------------
 2637|  56.0k|    assert(255 >= 6 + sp->samples_per_pixel_per_plane * 2);
  ------------------
  |  Branch (2637:5): [True: 0, False: 56.0k]
  |  Branch (2637:5): [True: 56.0k, False: 0]
  ------------------
 2638|  56.0k|    sp->out_buffer[0] = 255;
 2639|  56.0k|    sp->out_buffer[1] = JPEG_MARKER_SOS;
  ------------------
  |  |  165|  56.0k|#define JPEG_MARKER_SOS 0xDA
  ------------------
 2640|       |    /* Ls */
 2641|  56.0k|    sp->out_buffer[2] = 0;
 2642|  56.0k|    sp->out_buffer[3] = (uint8_t)(6 + sp->samples_per_pixel_per_plane * 2);
 2643|       |    /* Ns */
 2644|  56.0k|    sp->out_buffer[4] = sp->samples_per_pixel_per_plane;
 2645|   114k|    for (m = 0; m < sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2645:17): [True: 58.0k, False: 56.0k]
  ------------------
 2646|  58.0k|    {
 2647|       |        /* Cs */
 2648|  58.0k|        sp->out_buffer[5 + m * 2] = sp->sos_cs[sp->plane_sample_offset + m];
 2649|       |        /* Td and Ta */
 2650|  58.0k|        sp->out_buffer[5 + m * 2 + 1] =
 2651|  58.0k|            sp->sos_tda[sp->plane_sample_offset + m];
 2652|  58.0k|    }
 2653|       |    /* Ss */
 2654|  56.0k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2] = 0;
 2655|       |    /* Se */
 2656|  56.0k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2 + 1] = 63;
 2657|       |    /* Ah and Al */
 2658|  56.0k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2 + 2] = 0;
 2659|  56.0k|    *len = 8 + (uint32_t)sp->samples_per_pixel_per_plane * 2;
 2660|  56.0k|    *mem = (void *)sp->out_buffer;
 2661|  56.0k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2662|  56.0k|}
tif_ojpeg.c:OJPEGWriteStreamCompressed:
 2665|  84.2k|{
 2666|  84.2k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2667|  84.2k|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2667:9): [True: 82.8k, False: 1.37k]
  ------------------
 2668|  82.8k|    {
 2669|  82.8k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2669:13): [True: 5.44k, False: 77.4k]
  ------------------
 2670|  5.44k|            return (0);
 2671|  82.8k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2671:9): [True: 0, False: 77.4k]
  |  Branch (2671:9): [True: 77.4k, False: 0]
  ------------------
 2672|  77.4k|    }
 2673|  78.8k|    *len = sp->in_buffer_togo;
 2674|  78.8k|    *mem = (void *)sp->in_buffer_cur;
 2675|  78.8k|    sp->in_buffer_togo = 0;
 2676|  78.8k|    if (sp->in_buffer_file_togo == 0)
  ------------------
  |  Branch (2676:9): [True: 54.7k, False: 24.0k]
  ------------------
 2677|  54.7k|    {
 2678|  54.7k|        switch (sp->in_buffer_source)
 2679|  54.7k|        {
 2680|  32.5k|            case osibsStrile:
  ------------------
  |  Branch (2680:13): [True: 32.5k, False: 22.1k]
  ------------------
 2681|  32.5k|                if (sp->in_buffer_next_strile < sp->in_buffer_strile_count)
  ------------------
  |  Branch (2681:21): [True: 32.2k, False: 300]
  ------------------
 2682|  32.2k|                    sp->out_state = ososRst;
 2683|    300|                else
 2684|    300|                    sp->out_state = ososEoi;
 2685|  32.5k|                break;
 2686|      0|            case osibsEof:
  ------------------
  |  Branch (2686:13): [True: 0, False: 54.7k]
  ------------------
 2687|      0|                sp->out_state = ososEoi;
 2688|      0|                break;
 2689|      0|            case osibsNotSetYet:
  ------------------
  |  Branch (2689:13): [True: 0, False: 54.7k]
  ------------------
 2690|  22.1k|            case osibsJpegInterchangeFormat:
  ------------------
  |  Branch (2690:13): [True: 22.1k, False: 32.5k]
  ------------------
 2691|  22.1k|            default:
  ------------------
  |  Branch (2691:13): [True: 0, False: 54.7k]
  ------------------
 2692|  22.1k|                break;
 2693|  54.7k|        }
 2694|  54.7k|    }
 2695|  78.8k|    return (1);
 2696|  78.8k|}
tif_ojpeg.c:OJPEGWriteStreamRst:
 2699|  7.72k|{
 2700|  7.72k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2701|  7.72k|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2701:5): [True: 0, Folded]
  |  Branch (2701:5): [True: 7.72k, Folded]
  ------------------
 2702|  7.72k|    sp->out_buffer[0] = 255;
 2703|  7.72k|    sp->out_buffer[1] = (uint8_t)(JPEG_MARKER_RST0 + sp->restart_index);
  ------------------
  |  |  162|  7.72k|#define JPEG_MARKER_RST0 0XD0
  ------------------
 2704|  7.72k|    sp->restart_index++;
 2705|  7.72k|    if (sp->restart_index == 8)
  ------------------
  |  Branch (2705:9): [True: 372, False: 7.35k]
  ------------------
 2706|    372|        sp->restart_index = 0;
 2707|  7.72k|    *len = 2;
 2708|  7.72k|    *mem = (void *)sp->out_buffer;
 2709|  7.72k|    sp->out_state = ososCompressed;
 2710|  7.72k|}
tif_ojpeg.c:OJPEGWriteStreamEoi:
 2713|    115|{
 2714|    115|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2715|    115|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2715:5): [True: 0, Folded]
  |  Branch (2715:5): [True: 115, Folded]
  ------------------
 2716|    115|    sp->out_buffer[0] = 255;
 2717|    115|    sp->out_buffer[1] = JPEG_MARKER_EOI;
  ------------------
  |  |  164|    115|#define JPEG_MARKER_EOI 0xD9
  ------------------
 2718|    115|    *len = 2;
 2719|    115|    *mem = (void *)sp->out_buffer;
 2720|    115|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrResyncToRestart:
 2859|  22.1k|{
 2860|  22.1k|    TIFF *tif = (TIFF *)cinfo->client_data;
 2861|  22.1k|    (void)desired;
 2862|  22.1k|    TIFFErrorExtR(tif, "LibJpeg", "Unexpected error");
 2863|  22.1k|    jpeg_encap_unwind(tif);
 2864|  22.1k|    return (0);
 2865|  22.1k|}
tif_ojpeg.c:jpeg_read_header_encap:
 2740|  56.0k|{
 2741|  56.0k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  56.0k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2741:9): [True: 108, False: 55.9k]
  ------------------
 2742|    108|        return 0;
 2743|  55.9k|    else
 2744|  55.9k|    {
 2745|  55.9k|        jpeg_read_header(cinfo, require_image);
 2746|  55.9k|        return 1;
 2747|  55.9k|    }
 2748|  56.0k|}
tif_ojpeg.c:jpeg_start_decompress_encap:
 2754|  55.9k|{
 2755|  55.9k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  55.9k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2755:9): [True: 68, False: 55.8k]
  ------------------
 2756|     68|        return 0;
 2757|  55.8k|    else
 2758|  55.8k|    {
 2759|  55.8k|        jpeg_start_decompress(cinfo);
 2760|  55.8k|        return 1;
 2761|  55.8k|    }
 2762|  55.9k|}
tif_ojpeg.c:OJPEGPreDecodeSkipRaw:
  775|   242k|{
  776|   242k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  777|   242k|    uint32_t m;
  778|   242k|    m = sp->lines_per_strile;
  779|   242k|    if (sp->subsampling_convert_state != 0)
  ------------------
  |  Branch (779:9): [True: 0, False: 242k]
  ------------------
  780|      0|    {
  781|      0|        if (sp->subsampling_convert_clines - sp->subsampling_convert_state >= m)
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|      0|        {
  783|      0|            sp->subsampling_convert_state += m;
  784|      0|            if (sp->subsampling_convert_state == sp->subsampling_convert_clines)
  ------------------
  |  Branch (784:17): [True: 0, False: 0]
  ------------------
  785|      0|                sp->subsampling_convert_state = 0;
  786|      0|            return (1);
  787|      0|        }
  788|      0|        m -= sp->subsampling_convert_clines - sp->subsampling_convert_state;
  789|      0|        sp->subsampling_convert_state = 0;
  790|      0|        sp->error_in_raw_data_decoding = 0;
  791|      0|    }
  792|  1.20M|    while (m >= sp->subsampling_convert_clines)
  ------------------
  |  Branch (792:12): [True: 965k, False: 241k]
  ------------------
  793|   965k|    {
  794|   965k|        if (jpeg_read_raw_data_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (794:13): [True: 637, False: 964k]
  ------------------
  795|   965k|                                     sp->subsampling_convert_ycbcrimage,
  796|   965k|                                     (uint32_t)sp->subsampling_ver * 8) == 0)
  797|    637|            return (0);
  798|   964k|        m -= sp->subsampling_convert_clines;
  799|   964k|    }
  800|   241k|    if (m > 0)
  ------------------
  |  Branch (800:9): [True: 308, False: 241k]
  ------------------
  801|    308|    {
  802|    308|        if (jpeg_read_raw_data_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (802:13): [True: 308, False: 0]
  ------------------
  803|    308|                                     sp->subsampling_convert_ycbcrimage,
  804|    308|                                     (uint32_t)sp->subsampling_ver * 8) == 0)
  805|    308|            return (0);
  806|      0|        sp->subsampling_convert_state = m;
  807|      0|    }
  808|   241k|    return (1);
  809|   241k|}
tif_ojpeg.c:jpeg_read_raw_data_encap:
 2784|  1.04M|{
 2785|  1.04M|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  1.04M|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2785:9): [True: 980, False: 1.04M]
  ------------------
 2786|    980|        return 0;
 2787|  1.04M|    else
 2788|  1.04M|    {
 2789|  1.04M|        jpeg_read_raw_data(cinfo, (JSAMPIMAGE)data, max_lines);
 2790|  1.04M|        return 1;
 2791|  1.04M|    }
 2792|  1.04M|}
tif_ojpeg.c:OJPEGPreDecodeSkipScanlines:
  812|  9.93M|{
  813|  9.93M|    static const char module[] = "OJPEGPreDecodeSkipScanlines";
  814|  9.93M|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  815|  9.93M|    uint32_t m;
  816|  9.93M|    if (sp->skip_buffer == NULL)
  ------------------
  |  Branch (816:9): [True: 340, False: 9.93M]
  ------------------
  817|    340|    {
  818|    340|        sp->skip_buffer = (uint8_t *)_TIFFmallocExt(tif, sp->bytes_per_line);
  819|    340|        if (sp->skip_buffer == NULL)
  ------------------
  |  Branch (819:13): [True: 0, False: 340]
  ------------------
  820|      0|        {
  821|      0|            TIFFErrorExtR(tif, module, "Out of memory");
  822|      0|            return (0);
  823|      0|        }
  824|    340|    }
  825|   153M|    for (m = 0; m < sp->lines_per_strile; m++)
  ------------------
  |  Branch (825:17): [True: 143M, False: 9.91M]
  ------------------
  826|   143M|    {
  827|   143M|        if (jpeg_read_scanlines_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (827:13): [True: 26.4k, False: 143M]
  ------------------
  828|   143M|                                      &sp->skip_buffer, 1) == 0)
  829|  26.4k|            return (0);
  830|   143M|    }
  831|  9.91M|    return (1);
  832|  9.93M|}
tif_ojpeg.c:jpeg_read_scanlines_encap:
 2769|   172M|{
 2770|   172M|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|   172M|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2770:9): [True: 26.6k, False: 172M]
  ------------------
 2771|  26.6k|        return 0;
 2772|   172M|    else
 2773|   172M|    {
 2774|   172M|        jpeg_read_scanlines(cinfo, (JSAMPARRAY)scanlines, max_lines);
 2775|   172M|        return 1;
 2776|   172M|    }
 2777|   172M|}
tif_ojpeg.c:OJPEGDecode:
  835|   137k|{
  836|   137k|    static const char module[] = "OJPEGDecode";
  837|   137k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  838|   137k|    (void)s;
  839|   137k|    if (!sp->decoder_ok)
  ------------------
  |  Branch (839:9): [True: 0, False: 137k]
  ------------------
  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|   137k|    if (sp->libjpeg_session_active == 0)
  ------------------
  |  Branch (846:9): [True: 19, False: 137k]
  ------------------
  847|     19|    {
  848|     19|        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|     19|        TIFFErrorExtR(tif, module,
  857|     19|                      "Cannot decode: libjpeg_session_active == 0");
  858|     19|        return 0;
  859|     19|    }
  860|   137k|    if (sp->error_in_raw_data_decoding)
  ------------------
  |  Branch (860:9): [True: 5, False: 137k]
  ------------------
  861|      5|    {
  862|      5|        memset(buf, 0, (size_t)cc);
  863|      5|        return 0;
  864|      5|    }
  865|   137k|    if (sp->libjpeg_jpeg_query_style == 0)
  ------------------
  |  Branch (865:9): [True: 28.3k, False: 109k]
  ------------------
  866|  28.3k|    {
  867|  28.3k|        if (OJPEGDecodeRaw(tif, buf, cc) == 0)
  ------------------
  |  Branch (867:13): [True: 36, False: 28.2k]
  ------------------
  868|     36|        {
  869|     36|            memset(buf, 0, (size_t)cc);
  870|     36|            return (0);
  871|     36|        }
  872|  28.3k|    }
  873|   109k|    else
  874|   109k|    {
  875|   109k|        if (OJPEGDecodeScanlines(tif, buf, cc) == 0)
  ------------------
  |  Branch (875:13): [True: 480, False: 108k]
  ------------------
  876|    480|        {
  877|    480|            memset(buf, 0, (size_t)cc);
  878|    480|            return (0);
  879|    480|        }
  880|   109k|    }
  881|   136k|    return (1);
  882|   137k|}
tif_ojpeg.c:OJPEGDecodeRaw:
  885|  28.3k|{
  886|  28.3k|    static const char module[] = "OJPEGDecodeRaw";
  887|  28.3k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  888|  28.3k|    uint8_t *m;
  889|  28.3k|    tmsize_t n;
  890|  28.3k|    uint8_t *oy;
  891|  28.3k|    uint8_t *ocb;
  892|  28.3k|    uint8_t *ocr;
  893|  28.3k|    uint8_t *p;
  894|  28.3k|    uint32_t q;
  895|  28.3k|    uint8_t *r;
  896|  28.3k|    uint8_t sx, sy;
  897|  28.3k|    if (cc % sp->bytes_per_line != 0)
  ------------------
  |  Branch (897:9): [True: 1, False: 28.3k]
  ------------------
  898|      1|    {
  899|      1|        TIFFErrorExtR(tif, module, "Fractional scanline not read");
  900|      1|        return (0);
  901|      1|    }
  902|  28.3k|    if (cc <= 0)
  ------------------
  |  Branch (902:9): [True: 0, False: 28.3k]
  ------------------
  903|      0|        return (0);
  904|  28.3k|    m = buf;
  905|  28.3k|    n = cc;
  906|  28.3k|    do
  907|   651k|    {
  908|   651k|        if (sp->subsampling_convert_state == 0)
  ------------------
  |  Branch (908:13): [True: 81.7k, False: 569k]
  ------------------
  909|  81.7k|        {
  910|  81.7k|            if (jpeg_read_raw_data_encap(
  ------------------
  |  Branch (910:17): [True: 35, False: 81.7k]
  ------------------
  911|  81.7k|                    sp, &(sp->libjpeg_jpeg_decompress_struct),
  912|  81.7k|                    sp->subsampling_convert_ycbcrimage,
  913|  81.7k|                    (uint32_t)sp->subsampling_ver * 8) == 0)
  914|     35|            {
  915|     35|                sp->error_in_raw_data_decoding = 1;
  916|     35|                return (0);
  917|     35|            }
  918|  81.7k|        }
  919|   651k|        oy = sp->subsampling_convert_ybuf +
  920|   651k|             sp->subsampling_convert_state * sp->subsampling_ver *
  921|   651k|                 sp->subsampling_convert_ylinelen;
  922|   651k|        ocb = sp->subsampling_convert_cbbuf +
  923|   651k|              sp->subsampling_convert_state * sp->subsampling_convert_clinelen;
  924|   651k|        ocr = sp->subsampling_convert_crbuf +
  925|   651k|              sp->subsampling_convert_state * sp->subsampling_convert_clinelen;
  926|   651k|        p = m;
  927|  71.2M|        for (q = 0; q < sp->subsampling_convert_clinelenout; q++)
  ------------------
  |  Branch (927:21): [True: 70.5M, False: 651k]
  ------------------
  928|  70.5M|        {
  929|  70.5M|            r = oy;
  930|   172M|            for (sy = 0; sy < sp->subsampling_ver; sy++)
  ------------------
  |  Branch (930:26): [True: 102M, False: 70.5M]
  ------------------
  931|   102M|            {
  932|   290M|                for (sx = 0; sx < sp->subsampling_hor; sx++)
  ------------------
  |  Branch (932:30): [True: 188M, False: 102M]
  ------------------
  933|   188M|                    *p++ = *r++;
  934|   102M|                r += sp->subsampling_convert_ylinelen - sp->subsampling_hor;
  935|   102M|            }
  936|  70.5M|            oy += sp->subsampling_hor;
  937|  70.5M|            *p++ = *ocb++;
  938|  70.5M|            *p++ = *ocr++;
  939|  70.5M|        }
  940|   651k|        sp->subsampling_convert_state++;
  941|   651k|        if (sp->subsampling_convert_state == sp->subsampling_convert_clines)
  ------------------
  |  Branch (941:13): [True: 81.2k, False: 570k]
  ------------------
  942|  81.2k|            sp->subsampling_convert_state = 0;
  943|   651k|        m += sp->bytes_per_line;
  944|   651k|        n -= sp->bytes_per_line;
  945|   651k|    } while (n > 0);
  ------------------
  |  Branch (945:14): [True: 623k, False: 28.2k]
  ------------------
  946|  28.2k|    return (1);
  947|  28.3k|}
tif_ojpeg.c:OJPEGDecodeScanlines:
  950|   109k|{
  951|   109k|    static const char module[] = "OJPEGDecodeScanlines";
  952|   109k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  953|   109k|    uint8_t *m;
  954|   109k|    tmsize_t n;
  955|   109k|    if (cc % sp->bytes_per_line != 0)
  ------------------
  |  Branch (955:9): [True: 278, False: 108k]
  ------------------
  956|    278|    {
  957|    278|        TIFFErrorExtR(tif, module, "Fractional scanline not read");
  958|    278|        return (0);
  959|    278|    }
  960|   108k|    if (cc <= 0)
  ------------------
  |  Branch (960:9): [True: 0, False: 108k]
  ------------------
  961|      0|        return (0);
  962|   108k|    m = buf;
  963|   108k|    n = cc;
  964|   108k|    do
  965|  29.0M|    {
  966|  29.0M|        if (jpeg_read_scanlines_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (966:13): [True: 202, False: 29.0M]
  ------------------
  967|  29.0M|                                      &m, 1) == 0)
  968|    202|            return (0);
  969|  29.0M|        m += sp->bytes_per_line;
  970|  29.0M|        n -= sp->bytes_per_line;
  971|  29.0M|    } while (n > 0);
  ------------------
  |  Branch (971:14): [True: 28.9M, False: 108k]
  ------------------
  972|   108k|    return (1);
  973|   108k|}
tif_ojpeg.c:OJPEGPostDecode:
  976|   136k|{
  977|   136k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  978|   136k|    (void)buf;
  979|   136k|    (void)cc;
  980|       |    /* This function somehow incorrectly assumes that a whole strile was read,
  981|       |     */
  982|       |    /* which is not true when TIFFReadScanline() is called, */
  983|       |    /* and may thus incorrectly consider it has read the whole image, causing */
  984|       |    /* OJPEGLibjpegSessionAbort() to be called prematurely. */
  985|       |    /* So this logic should be fixed to take into account cc, or disable */
  986|       |    /* the scan line reading interface. */
  987|       |    /* Triggered by https://gitlab.com/libtiff/libtiff/-/issues/337 */
  988|   136k|    sp->write_curstrile++;
  989|   136k|    if (sp->write_curstrile % tif->tif_dir.td_stripsperimage == 0)
  ------------------
  |  Branch (989:9): [True: 713, False: 136k]
  ------------------
  990|    713|    {
  991|    713|        assert(sp->libjpeg_session_active != 0);
  ------------------
  |  Branch (991:9): [True: 0, False: 713]
  |  Branch (991:9): [True: 713, False: 0]
  ------------------
  992|    713|        OJPEGLibjpegSessionAbort(tif);
  993|    713|        sp->writeheader_done = 0;
  994|    713|    }
  995|   136k|}
tif_ojpeg.c:OJPEGCleanup:
 1038|  3.18k|{
 1039|  3.18k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1040|  3.18k|    if (sp != 0)
  ------------------
  |  Branch (1040:9): [True: 3.18k, False: 0]
  ------------------
 1041|  3.18k|    {
 1042|  3.18k|        tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1043|  3.18k|        tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1044|  3.18k|        tif->tif_tagmethods.printdir = sp->printdir;
 1045|  3.18k|        if (sp->qtable[0] != 0)
  ------------------
  |  Branch (1045:13): [True: 1.22k, False: 1.96k]
  ------------------
 1046|  1.22k|            _TIFFfreeExt(tif, sp->qtable[0]);
 1047|  3.18k|        if (sp->qtable[1] != 0)
  ------------------
  |  Branch (1047:13): [True: 190, False: 2.99k]
  ------------------
 1048|    190|            _TIFFfreeExt(tif, sp->qtable[1]);
 1049|  3.18k|        if (sp->qtable[2] != 0)
  ------------------
  |  Branch (1049:13): [True: 46, False: 3.13k]
  ------------------
 1050|     46|            _TIFFfreeExt(tif, sp->qtable[2]);
 1051|  3.18k|        if (sp->qtable[3] != 0)
  ------------------
  |  Branch (1051:13): [True: 18, False: 3.16k]
  ------------------
 1052|     18|            _TIFFfreeExt(tif, sp->qtable[3]);
 1053|  3.18k|        if (sp->dctable[0] != 0)
  ------------------
  |  Branch (1053:13): [True: 1.01k, False: 2.17k]
  ------------------
 1054|  1.01k|            _TIFFfreeExt(tif, sp->dctable[0]);
 1055|  3.18k|        if (sp->dctable[1] != 0)
  ------------------
  |  Branch (1055:13): [True: 455, False: 2.73k]
  ------------------
 1056|    455|            _TIFFfreeExt(tif, sp->dctable[1]);
 1057|  3.18k|        if (sp->dctable[2] != 0)
  ------------------
  |  Branch (1057:13): [True: 452, False: 2.73k]
  ------------------
 1058|    452|            _TIFFfreeExt(tif, sp->dctable[2]);
 1059|  3.18k|        if (sp->dctable[3] != 0)
  ------------------
  |  Branch (1059:13): [True: 23, False: 3.16k]
  ------------------
 1060|     23|            _TIFFfreeExt(tif, sp->dctable[3]);
 1061|  3.18k|        if (sp->actable[0] != 0)
  ------------------
  |  Branch (1061:13): [True: 841, False: 2.34k]
  ------------------
 1062|    841|            _TIFFfreeExt(tif, sp->actable[0]);
 1063|  3.18k|        if (sp->actable[1] != 0)
  ------------------
  |  Branch (1063:13): [True: 464, False: 2.72k]
  ------------------
 1064|    464|            _TIFFfreeExt(tif, sp->actable[1]);
 1065|  3.18k|        if (sp->actable[2] != 0)
  ------------------
  |  Branch (1065:13): [True: 159, False: 3.02k]
  ------------------
 1066|    159|            _TIFFfreeExt(tif, sp->actable[2]);
 1067|  3.18k|        if (sp->actable[3] != 0)
  ------------------
  |  Branch (1067:13): [True: 10, False: 3.17k]
  ------------------
 1068|     10|            _TIFFfreeExt(tif, sp->actable[3]);
 1069|  3.18k|        if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (1069:13): [True: 389, False: 2.79k]
  ------------------
 1070|    389|            OJPEGLibjpegSessionAbort(tif);
 1071|  3.18k|        if (sp->subsampling_convert_ycbcrbuf != 0)
  ------------------
  |  Branch (1071:13): [True: 106, False: 3.07k]
  ------------------
 1072|    106|            _TIFFfreeExt(tif, sp->subsampling_convert_ycbcrbuf);
 1073|  3.18k|        if (sp->subsampling_convert_ycbcrimage != 0)
  ------------------
  |  Branch (1073:13): [True: 106, False: 3.07k]
  ------------------
 1074|    106|            _TIFFfreeExt(tif, sp->subsampling_convert_ycbcrimage);
 1075|  3.18k|        if (sp->skip_buffer != 0)
  ------------------
  |  Branch (1075:13): [True: 340, False: 2.84k]
  ------------------
 1076|    340|            _TIFFfreeExt(tif, sp->skip_buffer);
 1077|  3.18k|        _TIFFfreeExt(tif, sp);
 1078|       |        tif->tif_data = NULL;
 1079|  3.18k|        _TIFFSetDefaultCompressionState(tif);
 1080|  3.18k|    }
 1081|  3.18k|}

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

TIFFInitPackBits:
  354|    306|{
  355|    306|    (void)scheme;
  356|    306|    tif->tif_decoderow = PackBitsDecode;
  357|    306|    tif->tif_decodestrip = PackBitsDecode;
  358|    306|    tif->tif_decodetile = PackBitsDecode;
  359|    306|#ifndef PACKBITS_READ_ONLY
  360|    306|    tif->tif_preencode = PackBitsPreEncode;
  361|    306|    tif->tif_postencode = PackBitsPostEncode;
  362|    306|    tif->tif_encoderow = PackBitsEncode;
  363|    306|    tif->tif_encodestrip = PackBitsEncodeChunk;
  364|    306|    tif->tif_encodetile = PackBitsEncodeChunk;
  365|    306|#endif
  366|    306|    tif->tif_getmaxcompressionratio = PackBitsGetMaxCompressionRatio;
  367|       |
  368|    306|    return (1);
  369|    306|}
tif_packbits.c:PackBitsDecode:
  275|  5.15k|{
  276|  5.15k|    static const char module[] = "PackBitsDecode";
  277|  5.15k|    TIFFByteCursor in = {tif->tif_rawcp, tif->tif_rawcc};
  278|  5.15k|    TIFFByteCursor out = {op, occ};
  279|  5.15k|    uint8_t c = 0;
  280|  5.15k|    long n;
  281|       |
  282|  5.15k|    (void)s;
  283|   311k|    while (in.left > 0 && out.left > 0)
  ------------------
  |  Branch (283:12): [True: 311k, False: 412]
  |  Branch (283:27): [True: 310k, False: 935]
  ------------------
  284|   310k|    {
  285|   310k|        (void)_TIFFByteCursorGetU8(&in, &c);
  286|   310k|        n = (long)(int8_t)c;
  287|   310k|        if (n < 0)
  ------------------
  |  Branch (287:13): [True: 93.9k, False: 216k]
  ------------------
  288|  93.9k|        {                  /* replicate next byte -n+1 times */
  289|  93.9k|            if (n == -128) /* nop */
  ------------------
  |  Branch (289:17): [True: 3.50k, False: 90.4k]
  ------------------
  290|  3.50k|                continue;
  291|  90.4k|            n = -n + 1;
  292|  90.4k|            if (out.left < (tmsize_t)n)
  ------------------
  |  Branch (292:17): [True: 604, False: 89.8k]
  ------------------
  293|    604|            {
  294|    604|                TIFFWarningExtR(tif, module,
  295|    604|                                "Discarding %" TIFF_SSIZE_FORMAT
  296|    604|                                " bytes to avoid buffer overrun",
  297|    604|                                (tmsize_t)n - out.left);
  298|    604|                n = (long)out.left;
  299|    604|            }
  300|  90.4k|            if (!_TIFFByteCursorGetU8(&in, &c))
  ------------------
  |  Branch (300:17): [True: 399, False: 90.0k]
  ------------------
  301|    399|            {
  302|    399|                TIFFWarningExtR(
  303|    399|                    tif, module,
  304|    399|                    "Terminating PackBitsDecode due to lack of data.");
  305|    399|                break;
  306|    399|            }
  307|  90.0k|            if (!_TIFFByteCursorFill(&out, c, (tmsize_t)n))
  ------------------
  |  Branch (307:17): [True: 0, False: 90.0k]
  ------------------
  308|      0|                break; /* unreachable: n was clamped to out.left above */
  309|  90.0k|        }
  310|   216k|        else
  311|   216k|        { /* copy next n+1 bytes literally */
  312|   216k|            if (out.left < (tmsize_t)(n + 1))
  ------------------
  |  Branch (312:17): [True: 387, False: 216k]
  ------------------
  313|    387|            {
  314|    387|                TIFFWarningExtR(tif, module,
  315|    387|                                "Discarding %" TIFF_SSIZE_FORMAT
  316|    387|                                " bytes to avoid buffer overrun",
  317|    387|                                (tmsize_t)n - out.left + 1);
  318|    387|                n = (long)out.left - 1;
  319|    387|            }
  320|   216k|            if (in.left < (tmsize_t)(n + 1))
  ------------------
  |  Branch (320:17): [True: 3.41k, False: 213k]
  ------------------
  321|  3.41k|            {
  322|  3.41k|                TIFFWarningExtR(
  323|  3.41k|                    tif, module,
  324|  3.41k|                    "Terminating PackBitsDecode due to lack of data.");
  325|  3.41k|                break;
  326|  3.41k|            }
  327|   213k|            if (!_TIFFByteCursorCopy(&out, &in, (tmsize_t)(n + 1)))
  ------------------
  |  Branch (327:17): [True: 0, False: 213k]
  ------------------
  328|      0|                break; /* unreachable: both counts were checked above */
  329|   213k|        }
  330|   310k|    }
  331|  5.15k|    tif->tif_rawcp = in.p;
  332|  5.15k|    tif->tif_rawcc = in.left;
  333|  5.15k|    if (out.left > 0)
  ------------------
  |  Branch (333:9): [True: 4.21k, False: 942]
  ------------------
  334|  4.21k|    {
  335|  4.21k|        memset(out.p, 0, (size_t)out.left);
  336|  4.21k|        TIFFErrorExtR(tif, module, "Not enough data for scanline %" PRIu32,
  337|  4.21k|                      tif->tif_dir.td_row);
  338|  4.21k|        return (0);
  339|  4.21k|    }
  340|    942|    return (1);
  341|  5.15k|}
tif_packbits.c:PackBitsGetMaxCompressionRatio:
  344|      1|{
  345|      1|    (void)tif;
  346|       |
  347|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
  348|       |     * the maximum compression rate. */
  349|       |
  350|      1|    return 64;
  351|      1|}

TIFFInitPixarLog:
 1853|    503|{
 1854|    503|    static const char module[] = "TIFFInitPixarLog";
 1855|       |
 1856|    503|    PixarLogState *sp;
 1857|       |
 1858|    503|    (void)scheme;
 1859|    503|    assert(scheme == COMPRESSION_PIXARLOG);
  ------------------
  |  Branch (1859:5): [True: 0, False: 503]
  |  Branch (1859:5): [True: 503, False: 0]
  ------------------
 1860|       |
 1861|       |    /*
 1862|       |     * Merge codec-specific tag information.
 1863|       |     */
 1864|    503|    if (!_TIFFMergeFields(tif, pixarlogFields, TIFFArrayCount(pixarlogFields)))
  ------------------
  |  |  354|    503|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1864:9): [True: 0, False: 503]
  ------------------
 1865|      0|    {
 1866|      0|        TIFFErrorExtR(tif, module,
 1867|      0|                      "Merging PixarLog codec-specific tags failed");
 1868|      0|        return 0;
 1869|      0|    }
 1870|       |
 1871|       |    /*
 1872|       |     * Allocate state block so tag methods have storage to record values.
 1873|       |     */
 1874|    503|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(PixarLogState));
 1875|    503|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1875:9): [True: 0, False: 503]
  ------------------
 1876|      0|        goto bad;
 1877|    503|    sp = (PixarLogState *)tif->tif_data;
 1878|    503|    _TIFFmemset(sp, 0, sizeof(*sp));
 1879|    503|    sp->stream.data_type = Z_BINARY;
 1880|    503|    sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  765|    503|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
 1881|       |
 1882|       |    /*
 1883|       |     * Install codec methods.
 1884|       |     */
 1885|    503|    tif->tif_fixuptags = PixarLogFixupTags;
 1886|    503|    tif->tif_setupdecode = PixarLogSetupDecode;
 1887|    503|    tif->tif_predecode = PixarLogPreDecode;
 1888|    503|    tif->tif_decoderow = PixarLogDecode;
 1889|    503|    tif->tif_decodestrip = PixarLogDecode;
 1890|    503|    tif->tif_decodetile = PixarLogDecode;
 1891|    503|    tif->tif_setupencode = PixarLogSetupEncode;
 1892|    503|    tif->tif_preencode = PixarLogPreEncode;
 1893|    503|    tif->tif_postencode = PixarLogPostEncode;
 1894|    503|    tif->tif_encoderow = PixarLogEncode;
 1895|    503|    tif->tif_encodestrip = PixarLogEncode;
 1896|    503|    tif->tif_encodetile = PixarLogEncode;
 1897|    503|    tif->tif_close = PixarLogClose;
 1898|    503|    tif->tif_cleanup = PixarLogCleanup;
 1899|    503|    tif->tif_getmaxcompressionratio = PixarLogGetMaxCompressionRatio;
 1900|       |
 1901|       |    /* Override SetField so we can handle our private pseudo-tag */
 1902|    503|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1903|    503|    tif->tif_tagmethods.vgetfield = PixarLogVGetField; /* hook for codec tags */
 1904|    503|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1905|    503|    tif->tif_tagmethods.vsetfield = PixarLogVSetField; /* hook for codec tags */
 1906|       |
 1907|       |    /* Default values for codec-specific fields */
 1908|    503|    sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */
 1909|    503|    sp->state = 0;
 1910|       |
 1911|       |    /* we don't wish to use the predictor,
 1912|       |     * the default is none, which predictor value 1
 1913|       |     */
 1914|    503|    (void)TIFFPredictorInit(tif);
 1915|       |
 1916|       |    /*
 1917|       |     * build the companding tables
 1918|       |     */
 1919|    503|    if (!PixarLogMakeTables(tif, sp))
  ------------------
  |  Branch (1919:9): [True: 0, False: 503]
  ------------------
 1920|      0|    {
 1921|      0|        TIFFErrorExtR(tif, module,
 1922|      0|                      "Failed to allocate memory for PixarLog tables");
 1923|      0|        return (0);
 1924|      0|    }
 1925|       |
 1926|    503|    return (1);
 1927|      0|bad:
 1928|      0|    TIFFErrorExtR(tif, module, "No space for PixarLog state block");
 1929|      0|    return (0);
 1930|    503|}
tif_pixarlog.c:PixarLogFixupTags:
  823|    479|{
  824|    479|    (void)tif;
  825|    479|    return (1);
  826|    479|}
tif_pixarlog.c:PixarLogSetupDecode:
  829|    481|{
  830|    481|    static const char module[] = "PixarLogSetupDecode";
  831|    481|    TIFFDirectory *td = &tif->tif_dir;
  832|    481|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|    481|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  833|    481|    tmsize_t tbuf_size;
  834|    481|    uint32_t segment_width, segment_height;
  835|       |
  836|    481|    assert(sp != NULL);
  ------------------
  |  Branch (836:5): [True: 0, False: 481]
  |  Branch (836:5): [True: 481, False: 0]
  ------------------
  837|       |
  838|       |    /* This function can possibly be called several times by */
  839|       |    /* PredictorSetupDecode() if this function succeeds but */
  840|       |    /* PredictorSetup() fails */
  841|    481|    if ((sp->state & PLSTATE_INIT) != 0)
  ------------------
  |  |  615|    481|#define PLSTATE_INIT 1
  ------------------
  |  Branch (841:9): [True: 1, False: 480]
  ------------------
  842|      1|        return 1;
  843|       |
  844|    480|    if (isTiled(tif))
  ------------------
  |  |  282|    480|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    480|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 269, False: 211]
  |  |  ------------------
  ------------------
  845|    269|    {
  846|    269|        segment_width = td->td_tilewidth;
  847|    269|        segment_height = td->td_tilelength;
  848|    269|    }
  849|    211|    else
  850|    211|    {
  851|    211|        segment_width = td->td_imagewidth;
  852|    211|        segment_height = td->td_rowsperstrip;
  853|    211|        if (segment_height > td->td_imagelength)
  ------------------
  |  Branch (853:13): [True: 191, False: 20]
  ------------------
  854|    191|            segment_height = td->td_imagelength;
  855|    211|    }
  856|       |
  857|       |    /* Make sure no byte swapping happens on the data
  858|       |     * after decompression. */
  859|    480|    tif->tif_postdecode = _TIFFNoPostDecode;
  860|       |
  861|       |    /* for some reason, we can't do this in TIFFInitPixarLog */
  862|       |
  863|    480|    sp->stride =
  864|    480|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    480|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (864:10): [True: 469, False: 11]
  ------------------
  865|    480|                                                    : 1);
  866|       |    /* multiply_ms() reports its own failures. Stop at the first one rather
  867|       |     * than pass its zero result on to be reported again. */
  868|    480|    tbuf_size = multiply_ms(tif, module, sp->stride, segment_width);
  869|    480|    if (tbuf_size != 0)
  ------------------
  |  Branch (869:9): [True: 480, False: 0]
  ------------------
  870|    480|        tbuf_size = multiply_ms(tif, module, tbuf_size, segment_height);
  871|    480|    if (tbuf_size != 0)
  ------------------
  |  Branch (871:9): [True: 480, False: 0]
  ------------------
  872|    480|        tbuf_size =
  873|    480|            multiply_ms(tif, module, tbuf_size, (tmsize_t)sizeof(uint16_t));
  874|       |    /* add one more stride in case input ends mid-stride */
  875|    480|    tbuf_size =
  876|    480|        add_ms(tbuf_size, (tmsize_t)(sizeof(uint16_t) * (size_t)sp->stride));
  877|    480|    if (tbuf_size == 0)
  ------------------
  |  Branch (877:9): [True: 0, False: 480]
  ------------------
  878|      0|        return (0); /* TODO: this is an error return without error report
  879|       |                       through TIFFErrorExt */
  880|    480|    sp->tbuf = (uint16_t *)_TIFFmallocExt(tif, tbuf_size);
  881|    480|    if (sp->tbuf == NULL)
  ------------------
  |  Branch (881:9): [True: 10, False: 470]
  ------------------
  882|     10|        return (0);
  883|    470|    sp->tbuf_size = tbuf_size;
  884|    470|    if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
  ------------------
  |  |  765|    470|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (884:9): [True: 470, False: 0]
  ------------------
  885|    470|        sp->user_datafmt = PixarLogGuessDataFmt(td);
  886|    470|    if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
  ------------------
  |  |  765|    470|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (886:9): [True: 28, False: 442]
  ------------------
  887|     28|    {
  888|     28|        _TIFFfreeExt(tif, sp->tbuf);
  889|     28|        sp->tbuf = NULL;
  890|     28|        sp->tbuf_size = 0;
  891|     28|        TIFFErrorExtR(tif, module,
  892|     28|                      "PixarLog compression can't handle bits depth/data "
  893|     28|                      "format combination (depth: %" PRIu16 ")",
  894|     28|                      td->td_bitspersample);
  895|     28|        return (0);
  896|     28|    }
  897|       |
  898|    442|    if (inflateInit(&sp->stream) != Z_OK)
  ------------------
  |  Branch (898:9): [True: 0, False: 442]
  ------------------
  899|      0|    {
  900|      0|        _TIFFfreeExt(tif, sp->tbuf);
  901|      0|        sp->tbuf = NULL;
  902|      0|        sp->tbuf_size = 0;
  903|      0|        TIFFErrorExtR(tif, module, "%s",
  904|      0|                      sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (904:23): [True: 0, False: 0]
  ------------------
  905|      0|        return (0);
  906|      0|    }
  907|    442|    else
  908|    442|    {
  909|    442|        sp->state |= PLSTATE_INIT;
  ------------------
  |  |  615|    442|#define PLSTATE_INIT 1
  ------------------
  910|    442|        return (1);
  911|    442|    }
  912|    442|}
tif_pixarlog.c:multiply_ms:
  806|  1.44k|{
  807|  1.44k|    return _TIFFMultiplySSize(tif, m1, m2, module);
  808|  1.44k|}
tif_pixarlog.c:add_ms:
  811|    480|{
  812|    480|    assert(m1 >= 0 && m2 >= 0);
  ------------------
  |  Branch (812:5): [True: 0, False: 480]
  |  Branch (812:5): [True: 0, False: 0]
  |  Branch (812:5): [True: 480, False: 0]
  |  Branch (812:5): [True: 480, False: 0]
  ------------------
  813|       |    /* if either input is zero, assume overflow already occurred */
  814|    480|    if (m1 == 0 || m2 == 0)
  ------------------
  |  Branch (814:9): [True: 0, False: 480]
  |  Branch (814:20): [True: 0, False: 480]
  ------------------
  815|      0|        return 0;
  816|    480|    else if (m1 > TIFF_TMSIZE_T_MAX - m2)
  ------------------
  |  |   68|    480|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (816:14): [True: 0, False: 480]
  ------------------
  817|      0|        return 0;
  818|       |
  819|    480|    return m1 + m2;
  820|    480|}
tif_pixarlog.c:PixarLogGuessDataFmt:
  768|    470|{
  769|    470|    int guess = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  765|    470|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  770|    470|    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|    470|    switch (td->td_bitspersample)
  776|    470|    {
  777|    120|        case 32:
  ------------------
  |  Branch (777:9): [True: 120, False: 350]
  ------------------
  778|    120|            if (format == SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|    120|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (778:17): [True: 119, False: 1]
  ------------------
  779|    119|                guess = PIXARLOGDATAFMT_FLOAT;
  ------------------
  |  |  720|    119|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  780|    120|            break;
  781|    125|        case 16:
  ------------------
  |  Branch (781:9): [True: 125, False: 345]
  ------------------
  782|    125|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|    250|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|    124|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (782:17): [True: 1, False: 124]
  |  Branch (782:48): [True: 121, False: 3]
  ------------------
  783|    122|                guess = PIXARLOGDATAFMT_16BIT;
  ------------------
  |  |  719|    122|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  784|    125|            break;
  785|     17|        case 12:
  ------------------
  |  Branch (785:9): [True: 17, False: 453]
  ------------------
  786|     17|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
  ------------------
  |  |  337|     34|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
  ------------------
  |  |  335|     17|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
  |  Branch (786:17): [True: 0, False: 17]
  |  Branch (786:48): [True: 16, False: 1]
  ------------------
  787|     16|                guess = PIXARLOGDATAFMT_12BITPICIO;
  ------------------
  |  |  718|     16|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  788|     17|            break;
  789|     18|        case 11:
  ------------------
  |  Branch (789:9): [True: 18, False: 452]
  ------------------
  790|     18|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|     36|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|     17|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (790:17): [True: 1, False: 17]
  |  Branch (790:48): [True: 16, False: 1]
  ------------------
  791|     17|                guess = PIXARLOGDATAFMT_11BITLOG;
  ------------------
  |  |  717|     17|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  792|     18|            break;
  793|    171|        case 8:
  ------------------
  |  Branch (793:9): [True: 171, False: 299]
  ------------------
  794|    171|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|    342|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|    170|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (794:17): [True: 1, False: 170]
  |  Branch (794:48): [True: 167, False: 3]
  ------------------
  795|    168|                guess = PIXARLOGDATAFMT_8BIT;
  ------------------
  |  |  715|    168|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  796|    171|            break;
  797|     19|        default:
  ------------------
  |  Branch (797:9): [True: 19, False: 451]
  ------------------
  798|     19|            break;
  799|    470|    }
  800|       |
  801|    470|    return guess;
  802|    470|}
tif_pixarlog.c:PixarLogPreDecode:
  918|  9.47k|{
  919|  9.47k|    static const char module[] = "PixarLogPreDecode";
  920|  9.47k|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|  9.47k|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  921|       |
  922|  9.47k|    (void)s;
  923|  9.47k|    assert(sp != NULL);
  ------------------
  |  Branch (923:5): [True: 0, False: 9.47k]
  |  Branch (923:5): [True: 9.47k, False: 0]
  ------------------
  924|  9.47k|    sp->stream.next_in = tif->tif_rawdata;
  925|  9.47k|    assert(sizeof(sp->stream.avail_in) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (925:5): [True: 0, Folded]
  |  Branch (925:5): [True: 9.47k, Folded]
  ------------------
  926|       |         we need to simplify this code to reflect a ZLib that is likely updated
  927|       |         to deal with 8byte memory sizes, though this code will respond
  928|       |         appropriately even before we simplify it */
  929|  9.47k|    sp->stream.avail_in = (uInt)tif->tif_rawcc;
  930|  9.47k|    if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
  ------------------
  |  Branch (930:9): [True: 0, False: 9.47k]
  ------------------
  931|      0|    {
  932|      0|        TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
  933|      0|        return (0);
  934|      0|    }
  935|  9.47k|    return (inflateReset(&sp->stream) == Z_OK);
  936|  9.47k|}
tif_pixarlog.c:PixarLogDecode:
  939|  12.2k|{
  940|  12.2k|    static const char module[] = "PixarLogDecode";
  941|  12.2k|    TIFFDirectory *td = &tif->tif_dir;
  942|  12.2k|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|  12.2k|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  943|  12.2k|    tmsize_t i;
  944|  12.2k|    tmsize_t nsamples;
  945|  12.2k|    tmsize_t llen;
  946|  12.2k|    uint32_t row_width;
  947|  12.2k|    uint16_t *up;
  948|  12.2k|    uint8_t *op_start = op;
  949|       |
  950|  12.2k|    switch (sp->user_datafmt)
  951|  12.2k|    {
  952|  1.46k|        case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|  1.46k|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (952:9): [True: 1.46k, False: 10.7k]
  ------------------
  953|  1.46k|            nsamples = (tmsize_t)((uint64_t)occ /
  954|  1.46k|                                  sizeof(float)); /* XXX float == 32 bits */
  955|  1.46k|            break;
  956|  4.31k|        case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|  4.31k|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (956:9): [True: 4.31k, False: 7.93k]
  ------------------
  957|  4.94k|        case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|  4.94k|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (957:9): [True: 631, False: 11.6k]
  ------------------
  958|  5.49k|        case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|  5.49k|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (958:9): [True: 547, False: 11.7k]
  ------------------
  959|  5.49k|            nsamples =
  960|  5.49k|                (tmsize_t)((uint64_t)occ /
  961|  5.49k|                           sizeof(uint16_t)); /* XXX uint16_t == 16 bits */
  962|  5.49k|            break;
  963|  5.29k|        case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|  5.29k|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (963:9): [True: 5.29k, False: 6.95k]
  ------------------
  964|  5.29k|        case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|  5.29k|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (964:9): [True: 0, False: 12.2k]
  ------------------
  965|  5.29k|            nsamples = occ;
  966|  5.29k|            break;
  967|      0|        default:
  ------------------
  |  Branch (967:9): [True: 0, False: 12.2k]
  ------------------
  968|      0|            TIFFErrorExtR(tif, module,
  969|      0|                          "%" PRIu16 " bit input not supported in PixarLog",
  970|      0|                          td->td_bitspersample);
  971|      0|            memset(op, 0, (size_t)occ);
  972|      0|            return 0;
  973|  12.2k|    }
  974|       |
  975|  12.2k|    row_width = isTiled(tif) ? td->td_tilewidth : td->td_imagewidth;
  ------------------
  |  |  282|  12.2k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  12.2k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 9.23k, False: 3.02k]
  |  |  ------------------
  ------------------
  976|       |    /* stride (≤ td_samplesperpixel, max 65535) × row_width: fits tmsize_t */
  977|  12.2k|    llen = (tmsize_t)sp->stride * row_width;
  978|       |
  979|       |    /* Fix: ABGR with stride=3 expands 3 samples to 4 output bytes per pixel */
  980|  12.2k|    if (sp->user_datafmt == PIXARLOGDATAFMT_8BITABGR && sp->stride == 3)
  ------------------
  |  |  716|  24.5k|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (980:9): [True: 0, False: 12.2k]
  |  Branch (980:57): [True: 0, False: 0]
  ------------------
  981|      0|    {
  982|       |        /* row_width × 4: fits tmsize_t (row_width is uint32) */
  983|      0|        tmsize_t required = (tmsize_t)row_width * 4;
  984|      0|        tmsize_t max_rows;
  985|      0|        tmsize_t max_nsamples;
  986|       |
  987|       |        /*
  988|       |         * Ensure at least one expanded output row fits.
  989|       |         */
  990|      0|        if (occ < required)
  ------------------
  |  Branch (990:13): [True: 0, False: 0]
  ------------------
  991|      0|        {
  992|      0|            TIFFErrorExtR(tif, module,
  993|      0|                          "Output buffer too small for PixarLog ABGR data");
  994|      0|            memset(op, 0, (size_t)occ);
  995|      0|            return (0);
  996|      0|        }
  997|       |
  998|       |        /*
  999|       |         * The caller-provided output buffer size must represent a whole
 1000|       |         * number of expanded ABGR scanlines.
 1001|       |         */
 1002|      0|        if (occ % required)
  ------------------
  |  Branch (1002:13): [True: 0, False: 0]
  ------------------
 1003|      0|        {
 1004|      0|            TIFFErrorExtR(
 1005|      0|                tif, module,
 1006|      0|                "Fractional scanline not supported for PixarLog ABGR data");
 1007|      0|            memset(op, 0, (size_t)occ);
 1008|      0|            return (0);
 1009|      0|        }
 1010|       |
 1011|       |        /*
 1012|       |         * PixarLogDecode() may process multiple rows per call
 1013|       |         * (e.g. strip decoding). Limit nsamples so the total
 1014|       |         * output written by the loop below never exceeds occ.
 1015|       |         */
 1016|      0|        max_rows = occ / required;
 1017|      0|        max_nsamples = max_rows * llen;
 1018|       |
 1019|      0|        if (nsamples > max_nsamples)
  ------------------
  |  Branch (1019:13): [True: 0, False: 0]
  ------------------
 1020|      0|        {
 1021|      0|            TIFFErrorExtR(tif, module,
 1022|      0|                          "Output buffer too small for PixarLog ABGR data");
 1023|      0|            memset(op, 0, (size_t)occ);
 1024|      0|            return (0);
 1025|      0|        }
 1026|      0|    }
 1027|       |
 1028|  12.2k|    (void)s;
 1029|  12.2k|    assert(sp != NULL);
  ------------------
  |  Branch (1029:5): [True: 0, False: 12.2k]
  |  Branch (1029:5): [True: 12.2k, False: 0]
  ------------------
 1030|       |
 1031|  12.2k|    sp->stream.next_in = tif->tif_rawcp;
 1032|  12.2k|    sp->stream.avail_in = (uInt)tif->tif_rawcc;
 1033|       |
 1034|  12.2k|    sp->stream.next_out = (unsigned char *)sp->tbuf;
 1035|  12.2k|    assert(sizeof(sp->stream.avail_out) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (1035:5): [True: 0, Folded]
  |  Branch (1035:5): [True: 12.2k, Folded]
  ------------------
 1036|       |         we need to simplify this code to reflect a ZLib that is likely updated
 1037|       |         to deal with 8byte memory sizes, though this code will respond
 1038|       |         appropriately even before we simplify it */
 1039|  12.2k|    sp->stream.avail_out = (uInt)((unsigned long)nsamples * sizeof(uint16_t));
 1040|  12.2k|    if (sp->stream.avail_out != (unsigned long)nsamples * sizeof(uint16_t))
  ------------------
  |  Branch (1040:9): [True: 0, False: 12.2k]
  ------------------
 1041|      0|    {
 1042|      0|        TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
 1043|      0|        memset(op, 0, (size_t)occ);
 1044|      0|        return (0);
 1045|      0|    }
 1046|       |    /* Check that we will not fill more than what was allocated */
 1047|  12.2k|    if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
  ------------------
  |  Branch (1047:9): [True: 1, False: 12.2k]
  ------------------
 1048|      1|    {
 1049|      1|        TIFFErrorExtR(tif, module, "sp->stream.avail_out > sp->tbuf_size");
 1050|      1|        memset(op, 0, (size_t)occ);
 1051|      1|        return (0);
 1052|      1|    }
 1053|  12.2k|    do
 1054|  13.8k|    {
 1055|  13.8k|        int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
 1056|  13.8k|        if (state == Z_STREAM_END)
  ------------------
  |  Branch (1056:13): [True: 261, False: 13.6k]
  ------------------
 1057|    261|        {
 1058|    261|            break; /* XXX */
 1059|    261|        }
 1060|  13.6k|        if (state == Z_DATA_ERROR)
  ------------------
  |  Branch (1060:13): [True: 5.23k, False: 8.37k]
  ------------------
 1061|  5.23k|        {
 1062|  5.23k|            TIFFErrorExtR(tif, module,
 1063|  5.23k|                          "Decoding error at scanline %" PRIu32 ", %s",
 1064|  5.23k|                          tif->tif_dir.td_row,
 1065|  5.23k|                          sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1065:27): [True: 5.23k, False: 0]
  ------------------
 1066|  5.23k|            memset(op, 0, (size_t)occ);
 1067|  5.23k|            return (0);
 1068|  5.23k|        }
 1069|  8.37k|        if (state != Z_OK)
  ------------------
  |  Branch (1069:13): [True: 1.74k, False: 6.62k]
  ------------------
 1070|  1.74k|        {
 1071|  1.74k|            TIFFErrorExtR(tif, module, "ZLib error: %s",
 1072|  1.74k|                          sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1072:27): [True: 0, False: 1.74k]
  ------------------
 1073|  1.74k|            memset(op, 0, (size_t)occ);
 1074|  1.74k|            return (0);
 1075|  1.74k|        }
 1076|  8.37k|    } while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (1076:14): [True: 1.61k, False: 5.01k]
  ------------------
 1077|       |
 1078|       |    /* hopefully, we got all the bytes we needed */
 1079|  5.27k|    if (sp->stream.avail_out != 0)
  ------------------
  |  Branch (1079:9): [True: 261, False: 5.01k]
  ------------------
 1080|    261|    {
 1081|    261|        TIFFErrorExtR(tif, module,
 1082|    261|                      "Not enough data at scanline %" PRIu32
 1083|    261|                      " (short %u bytes)",
 1084|    261|                      tif->tif_dir.td_row, sp->stream.avail_out);
 1085|    261|        memset(op, 0, (size_t)occ);
 1086|    261|        return (0);
 1087|    261|    }
 1088|       |
 1089|  5.01k|    tif->tif_rawcp = sp->stream.next_in;
 1090|  5.01k|    tif->tif_rawcc = sp->stream.avail_in;
 1091|       |
 1092|  5.01k|    up = sp->tbuf;
 1093|       |    /* Swap bytes in the data if from a different endian machine. */
 1094|  5.01k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|  5.01k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1094:9): [True: 0, False: 5.01k]
  ------------------
 1095|      0|        TIFFSwabArrayOfShort(up, nsamples);
 1096|       |
 1097|       |    /*
 1098|       |     * if llen is not an exact multiple of nsamples, the decode operation
 1099|       |     * may overflow the output buffer, so truncate it enough to prevent
 1100|       |     * that but still salvage as much data as possible.
 1101|       |     */
 1102|  5.01k|    if (nsamples % llen)
  ------------------
  |  Branch (1102:9): [True: 335, False: 4.67k]
  ------------------
 1103|    335|    {
 1104|    335|        TIFFWarningExtR(tif, module,
 1105|    335|                        "stride %" TIFF_SSIZE_FORMAT
 1106|    335|                        " is not a multiple of sample count, "
 1107|    335|                        "%" TIFF_SSIZE_FORMAT ", data truncated.",
 1108|    335|                        llen, nsamples);
 1109|    335|        nsamples -= nsamples % llen;
 1110|    335|    }
 1111|       |
 1112|  12.6k|    for (i = 0; i < nsamples; i += llen, up += llen)
  ------------------
  |  Branch (1112:17): [True: 7.67k, False: 5.01k]
  ------------------
 1113|  7.67k|    {
 1114|  7.67k|        switch (sp->user_datafmt)
 1115|  7.67k|        {
 1116|  1.44k|            case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|  1.44k|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (1116:13): [True: 1.44k, False: 6.23k]
  ------------------
 1117|  1.44k|                horizontalAccumulateF(up, llen, sp->stride, op, sp->ToLinearF);
 1118|  1.44k|                op += (unsigned long)llen * sizeof(float);
 1119|  1.44k|                break;
 1120|  2.88k|            case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|  2.88k|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (1120:13): [True: 2.88k, False: 4.79k]
  ------------------
 1121|  2.88k|                horizontalAccumulate16(up, llen, sp->stride, op,
 1122|  2.88k|                                       sp->ToLinear16);
 1123|  2.88k|                op += (unsigned long)llen * sizeof(uint16_t);
 1124|  2.88k|                break;
 1125|    615|            case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|    615|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (1125:13): [True: 615, False: 7.05k]
  ------------------
 1126|    615|                horizontalAccumulate12(up, llen, sp->stride, op, sp->ToLinearF);
 1127|    615|                op += (unsigned long)llen * sizeof(int16_t);
 1128|    615|                break;
 1129|    277|            case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|    277|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (1129:13): [True: 277, False: 7.39k]
  ------------------
 1130|    277|                horizontalAccumulate11(up, llen, sp->stride, op);
 1131|    277|                op += (unsigned long)llen * sizeof(uint16_t);
 1132|    277|                break;
 1133|  2.45k|            case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|  2.45k|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (1133:13): [True: 2.45k, False: 5.21k]
  ------------------
 1134|  2.45k|                horizontalAccumulate8(up, llen, sp->stride, (unsigned char *)op,
 1135|  2.45k|                                      sp->ToLinear8);
 1136|  2.45k|                op += (unsigned long)llen * sizeof(unsigned char);
 1137|  2.45k|                break;
 1138|      0|            case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|      0|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (1138:13): [True: 0, False: 7.67k]
  ------------------
 1139|      0|                horizontalAccumulate8abgr(up, llen, sp->stride,
 1140|      0|                                          (unsigned char *)op, sp->ToLinear8);
 1141|       |
 1142|       |                /* For stride == 3 (RGB), horizontalAccumulate8abgr expands to 4
 1143|       |                 * bytes/pixel (ABGR) */
 1144|      0|                if (sp->stride == 3)
  ------------------
  |  Branch (1144:21): [True: 0, False: 0]
  ------------------
 1145|      0|                    op += (unsigned long)row_width * 4;
 1146|      0|                else
 1147|      0|                    op += (unsigned long)llen * sizeof(unsigned char);
 1148|      0|                break;
 1149|      0|            default:
  ------------------
  |  Branch (1149:13): [True: 0, False: 7.67k]
  ------------------
 1150|      0|                TIFFErrorExtR(tif, module, "Unsupported bits/sample: %" PRIu16,
 1151|      0|                              td->td_bitspersample);
 1152|      0|                memset(op, 0, (size_t)occ);
 1153|      0|                return (0);
 1154|  7.67k|        }
 1155|  7.67k|    }
 1156|       |
 1157|       |    /* A partial final row was not reconstructed. Do not expose its old data. */
 1158|  5.01k|    if (op - op_start < occ)
  ------------------
  |  Branch (1158:9): [True: 335, False: 4.67k]
  ------------------
 1159|    335|        memset(op, 0, (size_t)(occ - (op - op_start)));
 1160|       |
 1161|  5.01k|    return (1);
 1162|  5.01k|}
tif_pixarlog.c:horizontalAccumulateF:
  153|  1.44k|{
  154|  1.44k|    unsigned int cr, cg, cb, ca, mask;
  155|  1.44k|    float t0, t1, t2, t3;
  156|       |
  157|  1.44k|    if (n >= stride)
  ------------------
  |  Branch (157:9): [True: 1.44k, False: 0]
  ------------------
  158|  1.44k|    {
  159|  1.44k|        mask = CODE_MASK;
  ------------------
  |  |  104|  1.44k|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  160|  1.44k|        if (stride == 3)
  ------------------
  |  Branch (160:13): [True: 161, False: 1.28k]
  ------------------
  161|    161|        {
  162|    161|            t0 = ToLinearF[cr = (wp[0] & mask)];
  163|    161|            t1 = ToLinearF[cg = (wp[1] & mask)];
  164|    161|            t2 = ToLinearF[cb = (wp[2] & mask)];
  165|    161|            PixarLogStoreFloatNativeUnaligned(op, t0);
  166|    161|            PixarLogStoreFloatNativeUnaligned(op + sizeof(float), t1);
  167|    161|            PixarLogStoreFloatNativeUnaligned(op + 2 * sizeof(float), t2);
  168|    161|            n -= 3;
  169|    390|            while (n > 0)
  ------------------
  |  Branch (169:20): [True: 229, False: 161]
  ------------------
  170|    229|            {
  171|    229|                wp += 3;
  172|    229|                op += 3 * sizeof(float);
  173|    229|                n -= 3;
  174|    229|                t0 = ToLinearF[(cr += wp[0]) & mask];
  175|    229|                t1 = ToLinearF[(cg += wp[1]) & mask];
  176|    229|                t2 = ToLinearF[(cb += wp[2]) & mask];
  177|    229|                PixarLogStoreFloatNativeUnaligned(op, t0);
  178|    229|                PixarLogStoreFloatNativeUnaligned(op + sizeof(float), t1);
  179|    229|                PixarLogStoreFloatNativeUnaligned(op + 2 * sizeof(float), t2);
  180|    229|            }
  181|    161|        }
  182|  1.28k|        else if (stride == 4)
  ------------------
  |  Branch (182:18): [True: 186, False: 1.09k]
  ------------------
  183|    186|        {
  184|    186|            t0 = ToLinearF[cr = (wp[0] & mask)];
  185|    186|            t1 = ToLinearF[cg = (wp[1] & mask)];
  186|    186|            t2 = ToLinearF[cb = (wp[2] & mask)];
  187|    186|            t3 = ToLinearF[ca = (wp[3] & mask)];
  188|    186|            PixarLogStoreFloatNativeUnaligned(op, t0);
  189|    186|            PixarLogStoreFloatNativeUnaligned(op + sizeof(float), t1);
  190|    186|            PixarLogStoreFloatNativeUnaligned(op + 2 * sizeof(float), t2);
  191|    186|            PixarLogStoreFloatNativeUnaligned(op + 3 * sizeof(float), t3);
  192|    186|            n -= 4;
  193|    426|            while (n > 0)
  ------------------
  |  Branch (193:20): [True: 240, False: 186]
  ------------------
  194|    240|            {
  195|    240|                wp += 4;
  196|    240|                op += 4 * sizeof(float);
  197|    240|                n -= 4;
  198|    240|                t0 = ToLinearF[(cr += wp[0]) & mask];
  199|    240|                t1 = ToLinearF[(cg += wp[1]) & mask];
  200|    240|                t2 = ToLinearF[(cb += wp[2]) & mask];
  201|    240|                t3 = ToLinearF[(ca += wp[3]) & mask];
  202|    240|                PixarLogStoreFloatNativeUnaligned(op, t0);
  203|    240|                PixarLogStoreFloatNativeUnaligned(op + sizeof(float), t1);
  204|    240|                PixarLogStoreFloatNativeUnaligned(op + 2 * sizeof(float), t2);
  205|    240|                PixarLogStoreFloatNativeUnaligned(op + 3 * sizeof(float), t3);
  206|    240|            }
  207|    186|        }
  208|  1.09k|        else
  209|  1.09k|        {
  210|  1.09k|            REPEAT(stride,
  ------------------
  |  |  110|  1.09k|    {                                                                          \
  |  |  111|  1.09k|        int i;                                                                 \
  |  |  112|  1.09k|        i = n;                                                                 \
  |  |  113|  1.09k|        do                                                                     \
  |  |  114|  2.34k|        {                                                                      \
  |  |  115|  2.34k|            i--;                                                               \
  |  |  116|  2.34k|            op;                                                                \
  |  |  117|  2.34k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 1.24k, False: 1.09k]
  |  |  ------------------
  |  |  118|  1.09k|    }
  ------------------
  211|  1.09k|                   PixarLogStoreFloatNativeUnaligned(op, ToLinearF[*wp & mask]);
  212|  1.09k|                   wp++; op += sizeof(float))
  213|  1.09k|            n -= stride;
  214|  2.32k|            while (n > 0)
  ------------------
  |  Branch (214:20): [True: 1.22k, False: 1.09k]
  ------------------
  215|  1.22k|            {
  216|  1.22k|                REPEAT(stride, *wp = (uint16_t)(*wp + wp[-stride]);
  ------------------
  |  |  110|  1.22k|    {                                                                          \
  |  |  111|  1.22k|        int i;                                                                 \
  |  |  112|  1.22k|        i = n;                                                                 \
  |  |  113|  1.22k|        do                                                                     \
  |  |  114|  1.95k|        {                                                                      \
  |  |  115|  1.95k|            i--;                                                               \
  |  |  116|  1.95k|            op;                                                                \
  |  |  117|  1.95k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 732, False: 1.22k]
  |  |  ------------------
  |  |  118|  1.22k|    }
  ------------------
  217|  1.22k|                       PixarLogStoreFloatNativeUnaligned(op,
  218|  1.22k|                                                         ToLinearF[*wp & mask]);
  219|  1.22k|                       wp++; op += sizeof(float))
  220|  1.22k|                n -= stride;
  221|  1.22k|            }
  222|  1.09k|        }
  223|  1.44k|    }
  224|  1.44k|}
tif_pixarlog.c:PixarLogStoreFloatNativeUnaligned:
  135|  7.17k|{
  136|  7.17k|    memcpy(cp, &v, sizeof(v));
  137|  7.17k|}
tif_pixarlog.c:horizontalAccumulate16:
  317|  2.88k|{
  318|  2.88k|    unsigned int cr, cg, cb, ca, mask;
  319|       |
  320|  2.88k|    if (n >= stride)
  ------------------
  |  Branch (320:9): [True: 2.88k, False: 0]
  ------------------
  321|  2.88k|    {
  322|  2.88k|        mask = CODE_MASK;
  ------------------
  |  |  104|  2.88k|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  323|  2.88k|        if (stride == 3)
  ------------------
  |  Branch (323:13): [True: 473, False: 2.40k]
  ------------------
  324|    473|        {
  325|    473|            PixarLogStore16NativeUnaligned(op, ToLinear16[cr = (wp[0] & mask)]);
  326|    473|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  327|    473|                                           ToLinear16[cg = (wp[1] & mask)]);
  328|    473|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  329|    473|                                           ToLinear16[cb = (wp[2] & mask)]);
  330|    473|            n -= 3;
  331|  1.86k|            while (n > 0)
  ------------------
  |  Branch (331:20): [True: 1.39k, False: 473]
  ------------------
  332|  1.39k|            {
  333|  1.39k|                wp += 3;
  334|  1.39k|                op += 3 * sizeof(uint16_t);
  335|  1.39k|                n -= 3;
  336|  1.39k|                PixarLogStore16NativeUnaligned(
  337|  1.39k|                    op, ToLinear16[(cr += wp[0]) & mask]);
  338|  1.39k|                PixarLogStore16NativeUnaligned(
  339|  1.39k|                    op + sizeof(uint16_t), ToLinear16[(cg += wp[1]) & mask]);
  340|  1.39k|                PixarLogStore16NativeUnaligned(
  341|  1.39k|                    op + 2 * sizeof(uint16_t),
  342|  1.39k|                    ToLinear16[(cb += wp[2]) & mask]);
  343|  1.39k|            }
  344|    473|        }
  345|  2.40k|        else if (stride == 4)
  ------------------
  |  Branch (345:18): [True: 871, False: 1.53k]
  ------------------
  346|    871|        {
  347|    871|            PixarLogStore16NativeUnaligned(op, ToLinear16[cr = (wp[0] & mask)]);
  348|    871|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  349|    871|                                           ToLinear16[cg = (wp[1] & mask)]);
  350|    871|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  351|    871|                                           ToLinear16[cb = (wp[2] & mask)]);
  352|    871|            PixarLogStore16NativeUnaligned(op + 3 * sizeof(uint16_t),
  353|    871|                                           ToLinear16[ca = (wp[3] & mask)]);
  354|    871|            n -= 4;
  355|  4.35k|            while (n > 0)
  ------------------
  |  Branch (355:20): [True: 3.48k, False: 871]
  ------------------
  356|  3.48k|            {
  357|  3.48k|                wp += 4;
  358|  3.48k|                op += 4 * sizeof(uint16_t);
  359|  3.48k|                n -= 4;
  360|  3.48k|                PixarLogStore16NativeUnaligned(
  361|  3.48k|                    op, ToLinear16[(cr += wp[0]) & mask]);
  362|  3.48k|                PixarLogStore16NativeUnaligned(
  363|  3.48k|                    op + sizeof(uint16_t), ToLinear16[(cg += wp[1]) & mask]);
  364|  3.48k|                PixarLogStore16NativeUnaligned(
  365|  3.48k|                    op + 2 * sizeof(uint16_t),
  366|  3.48k|                    ToLinear16[(cb += wp[2]) & mask]);
  367|  3.48k|                PixarLogStore16NativeUnaligned(
  368|  3.48k|                    op + 3 * sizeof(uint16_t),
  369|  3.48k|                    ToLinear16[(ca += wp[3]) & mask]);
  370|  3.48k|            }
  371|    871|        }
  372|  1.53k|        else
  373|  1.53k|        {
  374|  1.53k|            REPEAT(stride,
  ------------------
  |  |  110|  1.53k|    {                                                                          \
  |  |  111|  1.53k|        int i;                                                                 \
  |  |  112|  1.53k|        i = n;                                                                 \
  |  |  113|  1.53k|        do                                                                     \
  |  |  114|  4.09k|        {                                                                      \
  |  |  115|  4.09k|            i--;                                                               \
  |  |  116|  4.09k|            op;                                                                \
  |  |  117|  4.09k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 2.55k, False: 1.53k]
  |  |  ------------------
  |  |  118|  1.53k|    }
  ------------------
  375|  1.53k|                   PixarLogStore16NativeUnaligned(op, ToLinear16[*wp & mask]);
  376|  1.53k|                   wp++; op += sizeof(uint16_t))
  377|  1.53k|            n -= stride;
  378|  3.69k|            while (n > 0)
  ------------------
  |  Branch (378:20): [True: 2.15k, False: 1.53k]
  ------------------
  379|  2.15k|            {
  380|  2.15k|                REPEAT(
  ------------------
  |  |  110|  2.15k|    {                                                                          \
  |  |  111|  2.15k|        int i;                                                                 \
  |  |  112|  2.15k|        i = n;                                                                 \
  |  |  113|  2.15k|        do                                                                     \
  |  |  114|  5.71k|        {                                                                      \
  |  |  115|  5.71k|            i--;                                                               \
  |  |  116|  5.71k|            op;                                                                \
  |  |  117|  5.71k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 3.55k, False: 2.15k]
  |  |  ------------------
  |  |  118|  2.15k|    }
  ------------------
  381|  2.15k|                    stride, *wp = (uint16_t)(*wp + wp[-stride]);
  382|  2.15k|                    PixarLogStore16NativeUnaligned(op, ToLinear16[*wp & mask]);
  383|  2.15k|                    wp++; op += sizeof(uint16_t))
  384|  2.15k|                n -= stride;
  385|  2.15k|            }
  386|  1.53k|        }
  387|  2.88k|    }
  388|  2.88k|}
tif_pixarlog.c:PixarLogStore16NativeUnaligned:
  147|  33.7k|{
  148|  33.7k|    memcpy(cp, &v, sizeof(v));
  149|  33.7k|}
tif_pixarlog.c:horizontalAccumulate12:
  228|    615|{
  229|    615|    unsigned int cr, cg, cb, ca, mask;
  230|    615|    float t0, t1, t2, t3;
  231|       |
  232|    615|#define SCALE12 2048.0f
  233|    615|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  234|       |
  235|    615|    if (n >= stride)
  ------------------
  |  Branch (235:9): [True: 615, False: 0]
  ------------------
  236|    615|    {
  237|    615|        mask = CODE_MASK;
  ------------------
  |  |  104|    615|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  238|    615|        if (stride == 3)
  ------------------
  |  Branch (238:13): [True: 0, False: 615]
  ------------------
  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|    615|        else if (stride == 4)
  ------------------
  |  Branch (264:18): [True: 0, False: 615]
  ------------------
  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|    615|        else
  297|    615|        {
  298|    615|            REPEAT(stride, t0 = ToLinearF[*wp & mask] * SCALE12;
  ------------------
  |  |  110|    615|    {                                                                          \
  |  |  111|    615|        int i;                                                                 \
  |  |  112|    615|        i = n;                                                                 \
  |  |  113|    615|        do                                                                     \
  |  |  114|    615|        {                                                                      \
  |  |  115|    615|            i--;                                                               \
  |  |  116|  1.23k|            op;                                                                \
  |  |  ------------------
  |  |  |  Branch (116:13): [True: 364, False: 251]
  |  |  ------------------
  |  |  117|    615|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 0, False: 615]
  |  |  ------------------
  |  |  118|    615|    }
  ------------------
  299|    615|                   PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  300|    615|                   wp++; op += sizeof(uint16_t))
  301|    615|            n -= stride;
  302|    615|            while (n > 0)
  ------------------
  |  Branch (302:20): [True: 0, False: 615]
  ------------------
  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|    615|        }
  312|    615|    }
  313|    615|}
tif_pixarlog.c:horizontalAccumulate11:
  396|    277|{
  397|    277|    unsigned int cr, cg, cb, ca, mask;
  398|       |
  399|    277|    if (n >= stride)
  ------------------
  |  Branch (399:9): [True: 277, False: 0]
  ------------------
  400|    277|    {
  401|    277|        mask = CODE_MASK;
  ------------------
  |  |  104|    277|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  402|    277|        if (stride == 3)
  ------------------
  |  Branch (402:13): [True: 0, False: 277]
  ------------------
  403|      0|        {
  404|      0|            PixarLogStore16NativeUnaligned(op, wp[0]);
  405|      0|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t), wp[1]);
  406|      0|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t), wp[2]);
  407|      0|            cr = wp[0];
  408|      0|            cg = wp[1];
  409|      0|            cb = wp[2];
  410|      0|            n -= 3;
  411|      0|            while (n > 0)
  ------------------
  |  Branch (411:20): [True: 0, False: 0]
  ------------------
  412|      0|            {
  413|      0|                wp += 3;
  414|      0|                op += 3 * sizeof(uint16_t);
  415|      0|                n -= 3;
  416|      0|                PixarLogStore16NativeUnaligned(
  417|      0|                    op, (uint16_t)((cr += wp[0]) & mask));
  418|      0|                PixarLogStore16NativeUnaligned(
  419|      0|                    op + sizeof(uint16_t), (uint16_t)((cg += wp[1]) & mask));
  420|      0|                PixarLogStore16NativeUnaligned(
  421|      0|                    op + 2 * sizeof(uint16_t),
  422|      0|                    (uint16_t)((cb += wp[2]) & mask));
  423|      0|            }
  424|      0|        }
  425|    277|        else if (stride == 4)
  ------------------
  |  Branch (425:18): [True: 0, False: 277]
  ------------------
  426|      0|        {
  427|      0|            PixarLogStore16NativeUnaligned(op, wp[0]);
  428|      0|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t), wp[1]);
  429|      0|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t), wp[2]);
  430|      0|            PixarLogStore16NativeUnaligned(op + 3 * sizeof(uint16_t), wp[3]);
  431|      0|            cr = wp[0];
  432|      0|            cg = wp[1];
  433|      0|            cb = wp[2];
  434|      0|            ca = wp[3];
  435|      0|            n -= 4;
  436|      0|            while (n > 0)
  ------------------
  |  Branch (436:20): [True: 0, False: 0]
  ------------------
  437|      0|            {
  438|      0|                wp += 4;
  439|      0|                op += 4 * sizeof(uint16_t);
  440|      0|                n -= 4;
  441|      0|                PixarLogStore16NativeUnaligned(
  442|      0|                    op, (uint16_t)((cr += wp[0]) & mask));
  443|      0|                PixarLogStore16NativeUnaligned(
  444|      0|                    op + sizeof(uint16_t), (uint16_t)((cg += wp[1]) & mask));
  445|      0|                PixarLogStore16NativeUnaligned(
  446|      0|                    op + 2 * sizeof(uint16_t),
  447|      0|                    (uint16_t)((cb += wp[2]) & mask));
  448|      0|                PixarLogStore16NativeUnaligned(
  449|      0|                    op + 3 * sizeof(uint16_t),
  450|      0|                    (uint16_t)((ca += wp[3]) & mask));
  451|      0|            }
  452|      0|        }
  453|    277|        else
  454|    277|        {
  455|    277|            REPEAT(stride,
  ------------------
  |  |  110|    277|    {                                                                          \
  |  |  111|    277|        int i;                                                                 \
  |  |  112|    277|        i = n;                                                                 \
  |  |  113|    277|        do                                                                     \
  |  |  114|    277|        {                                                                      \
  |  |  115|    277|            i--;                                                               \
  |  |  116|    277|            op;                                                                \
  |  |  117|    277|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 0, False: 277]
  |  |  ------------------
  |  |  118|    277|    }
  ------------------
  456|    277|                   PixarLogStore16NativeUnaligned(op, (uint16_t)(*wp & mask));
  457|    277|                   wp++; op += sizeof(uint16_t))
  458|    277|            n -= stride;
  459|    277|            while (n > 0)
  ------------------
  |  Branch (459:20): [True: 0, False: 277]
  ------------------
  460|      0|            {
  461|      0|                REPEAT(
  ------------------
  |  |  110|      0|    {                                                                          \
  |  |  111|      0|        int i;                                                                 \
  |  |  112|      0|        i = n;                                                                 \
  |  |  113|      0|        do                                                                     \
  |  |  114|      0|        {                                                                      \
  |  |  115|      0|            i--;                                                               \
  |  |  116|      0|            op;                                                                \
  |  |  117|      0|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  118|      0|    }
  ------------------
  462|      0|                    stride, *wp = (uint16_t)(*wp + wp[-stride]);
  463|      0|                    PixarLogStore16NativeUnaligned(op, (uint16_t)(*wp & mask));
  464|      0|                    wp++; op += sizeof(uint16_t))
  465|      0|                n -= stride;
  466|      0|            }
  467|    277|        }
  468|    277|    }
  469|    277|}
tif_pixarlog.c:horizontalAccumulate8:
  473|  2.45k|{
  474|  2.45k|    unsigned int cr, cg, cb, ca, mask;
  475|       |
  476|  2.45k|    if (n >= stride)
  ------------------
  |  Branch (476:9): [True: 2.45k, False: 0]
  ------------------
  477|  2.45k|    {
  478|  2.45k|        mask = CODE_MASK;
  ------------------
  |  |  104|  2.45k|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  479|  2.45k|        if (stride == 3)
  ------------------
  |  Branch (479:13): [True: 560, False: 1.89k]
  ------------------
  480|    560|        {
  481|    560|            op[0] = ToLinear8[cr = (wp[0] & mask)];
  482|    560|            op[1] = ToLinear8[cg = (wp[1] & mask)];
  483|    560|            op[2] = ToLinear8[cb = (wp[2] & mask)];
  484|    560|            n -= 3;
  485|  2.59k|            while (n > 0)
  ------------------
  |  Branch (485:20): [True: 2.03k, False: 560]
  ------------------
  486|  2.03k|            {
  487|  2.03k|                n -= 3;
  488|  2.03k|                wp += 3;
  489|  2.03k|                op += 3;
  490|  2.03k|                op[0] = ToLinear8[(cr += wp[0]) & mask];
  491|  2.03k|                op[1] = ToLinear8[(cg += wp[1]) & mask];
  492|  2.03k|                op[2] = ToLinear8[(cb += wp[2]) & mask];
  493|  2.03k|            }
  494|    560|        }
  495|  1.89k|        else if (stride == 4)
  ------------------
  |  Branch (495:18): [True: 659, False: 1.23k]
  ------------------
  496|    659|        {
  497|    659|            op[0] = ToLinear8[cr = (wp[0] & mask)];
  498|    659|            op[1] = ToLinear8[cg = (wp[1] & mask)];
  499|    659|            op[2] = ToLinear8[cb = (wp[2] & mask)];
  500|    659|            op[3] = ToLinear8[ca = (wp[3] & mask)];
  501|    659|            n -= 4;
  502|  4.31k|            while (n > 0)
  ------------------
  |  Branch (502:20): [True: 3.65k, False: 659]
  ------------------
  503|  3.65k|            {
  504|  3.65k|                n -= 4;
  505|  3.65k|                wp += 4;
  506|  3.65k|                op += 4;
  507|  3.65k|                op[0] = ToLinear8[(cr += wp[0]) & mask];
  508|  3.65k|                op[1] = ToLinear8[(cg += wp[1]) & mask];
  509|  3.65k|                op[2] = ToLinear8[(cb += wp[2]) & mask];
  510|  3.65k|                op[3] = ToLinear8[(ca += wp[3]) & mask];
  511|  3.65k|            }
  512|    659|        }
  513|  1.23k|        else
  514|  1.23k|        {
  515|  1.23k|            REPEAT(stride, *op = ToLinear8[*wp & mask]; wp++; op++)
  ------------------
  |  |  110|  1.23k|    {                                                                          \
  |  |  111|  1.23k|        int i;                                                                 \
  |  |  112|  1.23k|        i = n;                                                                 \
  |  |  113|  1.23k|        do                                                                     \
  |  |  114|  2.38k|        {                                                                      \
  |  |  115|  2.38k|            i--;                                                               \
  |  |  116|  2.38k|            op;                                                                \
  |  |  117|  2.38k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 1.14k, False: 1.23k]
  |  |  ------------------
  |  |  118|  1.23k|    }
  ------------------
  516|  1.23k|            n -= stride;
  517|  9.80k|            while (n > 0)
  ------------------
  |  Branch (517:20): [True: 8.56k, False: 1.23k]
  ------------------
  518|  8.56k|            {
  519|  8.56k|                REPEAT(stride, *wp = (uint16_t)(*wp + wp[-stride]);
  ------------------
  |  |  110|  8.56k|    {                                                                          \
  |  |  111|  8.56k|        int i;                                                                 \
  |  |  112|  8.56k|        i = n;                                                                 \
  |  |  113|  8.56k|        do                                                                     \
  |  |  114|  13.3k|        {                                                                      \
  |  |  115|  13.3k|            i--;                                                               \
  |  |  116|  13.3k|            op;                                                                \
  |  |  117|  13.3k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 4.82k, False: 8.56k]
  |  |  ------------------
  |  |  118|  8.56k|    }
  ------------------
  520|  8.56k|                       *op = ToLinear8[*wp & mask]; wp++; op++)
  521|  8.56k|                n -= stride;
  522|  8.56k|            }
  523|  1.23k|        }
  524|  2.45k|    }
  525|  2.45k|}
tif_pixarlog.c:PixarLogCleanup:
 1712|    503|{
 1713|    503|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1714|       |
 1715|    503|    assert(sp != 0);
  ------------------
  |  Branch (1715:5): [True: 0, False: 503]
  |  Branch (1715:5): [True: 503, False: 0]
  ------------------
 1716|       |
 1717|    503|    (void)TIFFPredictorCleanup(tif);
 1718|       |
 1719|    503|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1720|    503|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1721|       |
 1722|    503|    if (sp->FromLT2)
  ------------------
  |  Branch (1722:9): [True: 503, False: 0]
  ------------------
 1723|    503|        _TIFFfreeExt(tif, sp->FromLT2);
 1724|    503|    if (sp->From14)
  ------------------
  |  Branch (1724:9): [True: 503, False: 0]
  ------------------
 1725|    503|        _TIFFfreeExt(tif, sp->From14);
 1726|    503|    if (sp->From8)
  ------------------
  |  Branch (1726:9): [True: 503, False: 0]
  ------------------
 1727|    503|        _TIFFfreeExt(tif, sp->From8);
 1728|    503|    if (sp->ToLinearF)
  ------------------
  |  Branch (1728:9): [True: 503, False: 0]
  ------------------
 1729|    503|        _TIFFfreeExt(tif, sp->ToLinearF);
 1730|    503|    if (sp->ToLinear16)
  ------------------
  |  Branch (1730:9): [True: 503, False: 0]
  ------------------
 1731|    503|        _TIFFfreeExt(tif, sp->ToLinear16);
 1732|    503|    if (sp->ToLinear8)
  ------------------
  |  Branch (1732:9): [True: 503, False: 0]
  ------------------
 1733|    503|        _TIFFfreeExt(tif, sp->ToLinear8);
 1734|    503|    if (sp->state & PLSTATE_INIT)
  ------------------
  |  |  615|    503|#define PLSTATE_INIT 1
  ------------------
  |  Branch (1734:9): [True: 442, False: 61]
  ------------------
 1735|    442|    {
 1736|    442|        if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (1736:13): [True: 442, False: 0]
  ------------------
 1737|    442|            inflateEnd(&sp->stream);
 1738|      0|        else
 1739|      0|            deflateEnd(&sp->stream);
 1740|    442|    }
 1741|    503|    if (sp->tbuf)
  ------------------
  |  Branch (1741:9): [True: 442, False: 61]
  ------------------
 1742|    442|        _TIFFfreeExt(tif, sp->tbuf);
 1743|    503|    _TIFFfreeExt(tif, sp);
 1744|    503|    tif->tif_data = NULL;
 1745|       |
 1746|    503|    _TIFFSetDefaultCompressionState(tif);
 1747|    503|}
tif_pixarlog.c:PixarLogGetMaxCompressionRatio:
 1843|      1|{
 1844|      1|    (void)tif;
 1845|       |    /* cf https://zlib.net/zlib_tech.html */
 1846|      1|    const uint64_t MAX_DEFLATE_RATIO = 1032;
 1847|       |
 1848|       |    /* security margin as I don't understand what this codec does */
 1849|      1|    return MAX_DEFLATE_RATIO * (uint64_t)4;
 1850|      1|}
tif_pixarlog.c:PixarLogVGetField:
 1819|   278k|{
 1820|   278k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1821|       |
 1822|   278k|    switch (tag)
 1823|   278k|    {
 1824|      0|        case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  740|      0|#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
  ------------------
  |  Branch (1824:9): [True: 0, False: 278k]
  ------------------
 1825|      0|            *va_arg(ap, int *) = sp->quality;
 1826|      0|            break;
 1827|      0|        case TIFFTAG_PIXARLOGDATAFMT:
  ------------------
  |  |  714|      0|#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
  ------------------
  |  Branch (1827:9): [True: 0, False: 278k]
  ------------------
 1828|      0|            *va_arg(ap, int *) = sp->user_datafmt;
 1829|      0|            break;
 1830|   278k|        default:
  ------------------
  |  Branch (1830:9): [True: 278k, False: 0]
  ------------------
 1831|   278k|            return (*sp->vgetparent)(tif, tag, ap);
 1832|   278k|    }
 1833|      0|    return (1);
 1834|   278k|}
tif_pixarlog.c:PixarLogVSetField:
 1750|  2.75k|{
 1751|  2.75k|    static const char module[] = "PixarLogVSetField";
 1752|  2.75k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1753|  2.75k|    int result;
 1754|       |
 1755|  2.75k|    switch (tag)
 1756|  2.75k|    {
 1757|      0|        case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  740|      0|#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
  ------------------
  |  Branch (1757:9): [True: 0, False: 2.75k]
  ------------------
 1758|      0|            sp->quality = (int)va_arg(ap, int);
 1759|      0|            if (tif->tif_mode != O_RDONLY && (sp->state & PLSTATE_INIT))
  ------------------
  |  |  615|      0|#define PLSTATE_INIT 1
  ------------------
  |  Branch (1759:17): [True: 0, False: 0]
  |  Branch (1759:46): [True: 0, False: 0]
  ------------------
 1760|      0|            {
 1761|      0|                if (deflateParams(&sp->stream, sp->quality,
  ------------------
  |  Branch (1761:21): [True: 0, False: 0]
  ------------------
 1762|      0|                                  Z_DEFAULT_STRATEGY) != Z_OK)
 1763|      0|                {
 1764|      0|                    TIFFErrorExtR(tif, module, "ZLib error: %s",
 1765|      0|                                  sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1765:35): [True: 0, False: 0]
  ------------------
 1766|      0|                    return (0);
 1767|      0|                }
 1768|      0|            }
 1769|      0|            return (1);
 1770|      0|        case TIFFTAG_PIXARLOGDATAFMT:
  ------------------
  |  |  714|      0|#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
  ------------------
  |  Branch (1770:9): [True: 0, False: 2.75k]
  ------------------
 1771|      0|            sp->user_datafmt = (int)va_arg(ap, int);
 1772|       |            /* Tweak the TIFF header so that the rest of libtiff knows what
 1773|       |             * size of data will be passed between app and library, and
 1774|       |             * assume that the app knows what it is doing and is not
 1775|       |             * confused by these header manipulations...
 1776|       |             */
 1777|      0|            switch (sp->user_datafmt)
 1778|      0|            {
 1779|      0|                case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|      0|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (1779:17): [True: 0, False: 0]
  ------------------
 1780|      0|                case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|      0|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (1780:17): [True: 0, False: 0]
  ------------------
 1781|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1782|      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 */
  ------------------
 1783|      0|                    break;
 1784|      0|                case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|      0|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (1784:17): [True: 0, False: 0]
  ------------------
 1785|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1786|      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 */
  ------------------
 1787|      0|                    break;
 1788|      0|                case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|      0|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (1788:17): [True: 0, False: 0]
  ------------------
 1789|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1790|      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 */
  ------------------
 1791|      0|                    break;
 1792|      0|                case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|      0|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (1792:17): [True: 0, False: 0]
  ------------------
 1793|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1794|      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 */
  ------------------
 1795|      0|                    break;
 1796|      0|                case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|      0|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (1796:17): [True: 0, False: 0]
  ------------------
 1797|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1798|      0|                    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT,
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
 1799|      0|                                 SAMPLEFORMAT_IEEEFP);
  ------------------
  |  |  336|      0|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
 1800|      0|                    break;
 1801|      0|                default:
  ------------------
  |  Branch (1801:17): [True: 0, False: 0]
  ------------------
 1802|      0|                    break;
 1803|      0|            }
 1804|       |            /*
 1805|       |             * Must recalculate sizes should bits/sample change.
 1806|       |             */
 1807|      0|            tif->tif_dir.td_tilesize =
 1808|      0|                isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
  ------------------
  |  |  282|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1809|      0|            tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 1810|      0|            result = 1; /* NB: pseudo tag */
 1811|      0|            break;
 1812|  2.75k|        default:
  ------------------
  |  Branch (1812:9): [True: 2.75k, False: 0]
  ------------------
 1813|  2.75k|            result = (*sp->vsetparent)(tif, tag, ap);
 1814|  2.75k|    }
 1815|  2.75k|    return (result);
 1816|  2.75k|}
tif_pixarlog.c:PixarLogMakeTables:
  630|    503|{
  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|    503|    int nlin, lt2size;
  644|    503|    int i, j;
  645|    503|    double b, c, linstep, v;
  646|    503|    float *ToLinearF;
  647|    503|    uint16_t *ToLinear16;
  648|    503|    unsigned char *ToLinear8;
  649|    503|    uint16_t *FromLT2;
  650|    503|    uint16_t *From14; /* Really for 16-bit data, but we shift down 2 */
  651|    503|    uint16_t *From8;
  652|       |
  653|    503|    c = log(RATIO);
  ------------------
  |  |  102|    503|#define RATIO 1.004  /* nominal ratio for log part */
  ------------------
  654|    503|    nlin = (int)(1. / c); /* nlin must be an integer */
  655|    503|    c = 1. / nlin;
  656|    503|    b = exp(-c * ONE); /* multiplicative scale factor [b*exp(c*ONE) = 1] */
  ------------------
  |  |  101|    503|#define ONE 1250     /* token value of 1.0 exactly */
  ------------------
  657|    503|    linstep = b * c * exp(1.);
  658|       |
  659|    503|    LogK1 = (float)(1. / c); /* if (v >= 2)  token = k1*log(v*k2) */
  660|    503|    LogK2 = (float)(1. / b);
  661|    503|    lt2size = (int)(2. / linstep) + 1;
  662|    503|    FromLT2 = (uint16_t *)_TIFFmallocExt(
  663|    503|        tif, (tmsize_t)((size_t)lt2size * sizeof(uint16_t)));
  664|    503|    From14 = (uint16_t *)_TIFFmallocExt(tif, 16384 * sizeof(uint16_t));
  665|    503|    From8 = (uint16_t *)_TIFFmallocExt(tif, 256 * sizeof(uint16_t));
  666|    503|    ToLinearF = (float *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(float));
  ------------------
  |  |  100|    503|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  667|    503|    ToLinear16 = (uint16_t *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(uint16_t));
  ------------------
  |  |  100|    503|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  668|    503|    ToLinear8 =
  669|    503|        (unsigned char *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(unsigned char));
  ------------------
  |  |  100|    503|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  670|    503|    if (FromLT2 == NULL || From14 == NULL || From8 == NULL ||
  ------------------
  |  Branch (670:9): [True: 0, False: 503]
  |  Branch (670:28): [True: 0, False: 503]
  |  Branch (670:46): [True: 0, False: 503]
  ------------------
  671|    503|        ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL)
  ------------------
  |  Branch (671:9): [True: 0, False: 503]
  |  Branch (671:30): [True: 0, False: 503]
  |  Branch (671:52): [True: 0, False: 503]
  ------------------
  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|    503|    j = 0;
  695|       |
  696|   126k|    for (i = 0; i < nlin; i++)
  ------------------
  |  Branch (696:17): [True: 125k, False: 503]
  ------------------
  697|   125k|    {
  698|   125k|        v = i * linstep;
  699|   125k|        ToLinearF[j++] = (float)v;
  700|   125k|    }
  701|       |
  702|   904k|    for (i = nlin; i < TSIZE; i++)
  ------------------
  |  |   99|   904k|#define TSIZE 2048   /* decode table size (11-bit tokens) */
  ------------------
  |  Branch (702:20): [True: 904k, False: 503]
  ------------------
  703|   904k|        ToLinearF[j++] = (float)(b * exp(c * i));
  704|       |
  705|    503|    ToLinearF[2048] = ToLinearF[2047];
  706|       |
  707|  1.03M|    for (i = 0; i < TSIZEP1; i++)
  ------------------
  |  |  100|  1.03M|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  |  Branch (707:17): [True: 1.03M, False: 503]
  ------------------
  708|  1.03M|    {
  709|  1.03M|        v = (double)ToLinearF[i] * 65535.0 + 0.5;
  710|  1.03M|        ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16_t)v;
  ------------------
  |  Branch (710:25): [True: 401k, False: 628k]
  ------------------
  711|  1.03M|        v = (double)ToLinearF[i] * 255.0 + 0.5;
  712|  1.03M|        ToLinear8[i] = (v > 255.0) ? 255 : (unsigned char)v;
  ------------------
  |  Branch (712:24): [True: 401k, False: 628k]
  ------------------
  713|  1.03M|    }
  714|       |
  715|    503|    j = 0;
  716|  13.7M|    for (i = 0; i < lt2size; i++)
  ------------------
  |  Branch (716:17): [True: 13.7M, False: 503]
  ------------------
  717|  13.7M|    {
  718|  13.7M|        if ((i * linstep) * (i * linstep) >
  ------------------
  |  Branch (718:13): [True: 715k, False: 13.0M]
  ------------------
  719|  13.7M|            (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  720|   715k|            j++;
  721|  13.7M|        FromLT2[i] = (uint16_t)j;
  722|  13.7M|    }
  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|    503|    j = 0;
  730|  8.24M|    for (i = 0; i < 16384; i++)
  ------------------
  |  Branch (730:17): [True: 8.24M, False: 503]
  ------------------
  731|  8.24M|    {
  732|  8.86M|        while ((i / 16383.) * (i / 16383.) >
  ------------------
  |  Branch (732:16): [True: 628k, False: 8.24M]
  ------------------
  733|  8.86M|               (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  734|   628k|            j++;
  735|  8.24M|        From14[i] = (uint16_t)j;
  736|  8.24M|    }
  737|       |
  738|    503|    j = 0;
  739|   129k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (739:17): [True: 128k, False: 503]
  ------------------
  740|   128k|    {
  741|   757k|        while ((i / 255.) * (i / 255.) >
  ------------------
  |  Branch (741:16): [True: 628k, False: 128k]
  ------------------
  742|   757k|               (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  743|   628k|            j++;
  744|   128k|        From8[i] = (uint16_t)j;
  745|   128k|    }
  746|       |
  747|    503|    Fltsize = (float)(lt2size / 2);
  748|       |
  749|    503|    sp->ToLinearF = ToLinearF;
  750|    503|    sp->ToLinear16 = ToLinear16;
  751|    503|    sp->ToLinear8 = ToLinear8;
  752|    503|    sp->FromLT2 = FromLT2;
  753|    503|    sp->From14 = From14;
  754|    503|    sp->From8 = From8;
  755|       |
  756|    503|    return 1;
  757|    503|}

TIFFPredictorInit:
 1209|  2.42k|{
 1210|  2.42k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  2.42k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1211|       |
 1212|  2.42k|    assert(sp != 0);
  ------------------
  |  Branch (1212:5): [True: 0, False: 2.42k]
  |  Branch (1212:5): [True: 2.42k, False: 0]
  ------------------
 1213|       |
 1214|       |    /*
 1215|       |     * Merge codec-specific tag information.
 1216|       |     */
 1217|  2.42k|    if (!_TIFFMergeFields(tif, predictFields, TIFFArrayCount(predictFields)))
  ------------------
  |  |  354|  2.42k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1217:9): [True: 0, False: 2.42k]
  ------------------
 1218|      0|    {
 1219|      0|        TIFFErrorExtR(tif, "TIFFPredictorInit",
 1220|      0|                      "Merging Predictor codec-specific tags failed");
 1221|      0|        return 0;
 1222|      0|    }
 1223|       |
 1224|       |    /*
 1225|       |     * Override parent get/set field methods.
 1226|       |     */
 1227|  2.42k|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1228|  2.42k|    tif->tif_tagmethods.vgetfield =
 1229|  2.42k|        PredictorVGetField; /* hook for predictor tag */
 1230|  2.42k|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1231|  2.42k|    tif->tif_tagmethods.vsetfield =
 1232|  2.42k|        PredictorVSetField; /* hook for predictor tag */
 1233|  2.42k|    sp->printdir = tif->tif_tagmethods.printdir;
 1234|  2.42k|    tif->tif_tagmethods.printdir =
 1235|  2.42k|        PredictorPrintDir; /* hook for predictor tag */
 1236|       |
 1237|  2.42k|    sp->setupdecode = tif->tif_setupdecode;
 1238|  2.42k|    tif->tif_setupdecode = PredictorSetupDecode;
 1239|  2.42k|    sp->setupencode = tif->tif_setupencode;
 1240|  2.42k|    tif->tif_setupencode = PredictorSetupEncode;
 1241|       |
 1242|  2.42k|    sp->predictor = 1;      /* default value */
 1243|  2.42k|    sp->encodepfunc = NULL; /* no predictor routine */
 1244|       |    sp->decodepfunc = NULL; /* no predictor routine */
 1245|  2.42k|    return 1;
 1246|  2.42k|}
TIFFPredictorCleanup:
 1249|  2.42k|{
 1250|  2.42k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  2.42k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1251|       |
 1252|  2.42k|    assert(sp != 0);
  ------------------
  |  Branch (1252:5): [True: 0, False: 2.42k]
  |  Branch (1252:5): [True: 2.42k, False: 0]
  ------------------
 1253|       |
 1254|  2.42k|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1255|  2.42k|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1256|  2.42k|    tif->tif_tagmethods.printdir = sp->printdir;
 1257|  2.42k|    tif->tif_setupdecode = sp->setupdecode;
 1258|  2.42k|    tif->tif_setupencode = sp->setupencode;
 1259|       |
 1260|  2.42k|    return 1;
 1261|  2.42k|}
tif_predict.c:PredictorVGetField:
 1163|   297k|{
 1164|   297k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|   297k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1165|       |
 1166|   297k|    assert(sp != NULL);
  ------------------
  |  Branch (1166:5): [True: 0, False: 297k]
  |  Branch (1166:5): [True: 297k, False: 0]
  ------------------
 1167|   297k|    assert(sp->vgetparent != NULL);
  ------------------
  |  Branch (1167:5): [True: 0, False: 297k]
  |  Branch (1167:5): [True: 297k, False: 0]
  ------------------
 1168|       |
 1169|   297k|    switch (tag)
 1170|   297k|    {
 1171|      0|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|      0|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1171:9): [True: 0, False: 297k]
  ------------------
 1172|      0|            *va_arg(ap, uint16_t *) = (uint16_t)sp->predictor;
 1173|      0|            break;
 1174|   297k|        default:
  ------------------
  |  Branch (1174:9): [True: 297k, False: 0]
  ------------------
 1175|   297k|            return (*sp->vgetparent)(tif, tag, ap);
 1176|   297k|    }
 1177|      0|    return 1;
 1178|   297k|}
tif_predict.c:PredictorVSetField:
 1143|  14.1k|{
 1144|  14.1k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  14.1k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1145|       |
 1146|  14.1k|    assert(sp != NULL);
  ------------------
  |  Branch (1146:5): [True: 0, False: 14.1k]
  |  Branch (1146:5): [True: 14.1k, False: 0]
  ------------------
 1147|  14.1k|    assert(sp->vsetparent != NULL);
  ------------------
  |  Branch (1147:5): [True: 0, False: 14.1k]
  |  Branch (1147:5): [True: 14.1k, False: 0]
  ------------------
 1148|       |
 1149|  14.1k|    switch (tag)
 1150|  14.1k|    {
 1151|    521|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|    521|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1151:9): [True: 521, False: 13.6k]
  ------------------
 1152|    521|            sp->predictor = (uint16_t)va_arg(ap, uint16_vap);
 1153|    521|            TIFFSetFieldBit(tif, FIELD_PREDICTOR);
  ------------------
  |  |  268|    521|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  266|    521|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  265|    521|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1154|    521|            break;
 1155|  13.6k|        default:
  ------------------
  |  Branch (1155:9): [True: 13.6k, False: 521]
  ------------------
 1156|  13.6k|            return (*sp->vsetparent)(tif, tag, ap);
 1157|  14.1k|    }
 1158|    521|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  125|    521|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1159|    521|    return 1;
 1160|  14.1k|}
tif_predict.c:PredictorSetupDecode:
  128|  2.46k|{
  129|  2.46k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  2.46k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  130|  2.46k|    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|  2.46k|    if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))
  ------------------
  |  Branch (135:9): [True: 38, False: 2.42k]
  |  Branch (135:37): [True: 24, False: 2.40k]
  ------------------
  136|     62|        return 0;
  137|       |
  138|  2.40k|    if (sp->predictor == 2)
  ------------------
  |  Branch (138:9): [True: 345, False: 2.05k]
  ------------------
  139|    345|    {
  140|    345|        switch (td->td_bitspersample)
  141|    345|        {
  142|    113|            case 8:
  ------------------
  |  Branch (142:13): [True: 113, False: 232]
  ------------------
  143|    113|                sp->decodepfunc = horAcc8;
  144|    113|                break;
  145|     81|            case 16:
  ------------------
  |  Branch (145:13): [True: 81, False: 264]
  ------------------
  146|     81|                sp->decodepfunc = horAcc16;
  147|     81|                break;
  148|     69|            case 32:
  ------------------
  |  Branch (148:13): [True: 69, False: 276]
  ------------------
  149|     69|                sp->decodepfunc = horAcc32;
  150|     69|                break;
  151|     82|            case 64:
  ------------------
  |  Branch (151:13): [True: 82, False: 263]
  ------------------
  152|     82|                sp->decodepfunc = horAcc64;
  153|     82|                break;
  154|      0|            default:
  ------------------
  |  Branch (154:13): [True: 0, False: 345]
  ------------------
  155|      0|                break;
  156|    345|        }
  157|       |        /*
  158|       |         * Override default decoding method with one that does the
  159|       |         * predictor stuff.
  160|       |         */
  161|    345|        if (tif->tif_decoderow != PredictorDecodeRow)
  ------------------
  |  Branch (161:13): [True: 345, False: 0]
  ------------------
  162|    345|        {
  163|    345|            sp->decoderow = tif->tif_decoderow;
  164|    345|            tif->tif_decoderow = PredictorDecodeRow;
  165|    345|            sp->decodestrip = tif->tif_decodestrip;
  166|    345|            tif->tif_decodestrip = PredictorDecodeTile;
  167|    345|            sp->decodetile = tif->tif_decodetile;
  168|    345|            tif->tif_decodetile = PredictorDecodeTile;
  169|    345|        }
  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|    345|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|    345|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (178:13): [True: 106, False: 239]
  ------------------
  179|    106|        {
  180|    106|            if (sp->decodepfunc == horAcc16)
  ------------------
  |  Branch (180:17): [True: 25, False: 81]
  ------------------
  181|     25|            {
  182|     25|                sp->decodepfunc = swabHorAcc16;
  183|     25|                tif->tif_postdecode = _TIFFNoPostDecode;
  184|     25|            }
  185|     81|            else if (sp->decodepfunc == horAcc32)
  ------------------
  |  Branch (185:22): [True: 23, False: 58]
  ------------------
  186|     23|            {
  187|     23|                sp->decodepfunc = swabHorAcc32;
  188|     23|                tif->tif_postdecode = _TIFFNoPostDecode;
  189|     23|            }
  190|     58|            else if (sp->decodepfunc == horAcc64)
  ------------------
  |  Branch (190:22): [True: 55, False: 3]
  ------------------
  191|     55|            {
  192|     55|                sp->decodepfunc = swabHorAcc64;
  193|     55|                tif->tif_postdecode = _TIFFNoPostDecode;
  194|     55|            }
  195|    106|        }
  196|    345|    }
  197|       |
  198|  2.05k|    else if (sp->predictor == 3)
  ------------------
  |  Branch (198:14): [True: 94, False: 1.96k]
  ------------------
  199|     94|    {
  200|     94|        sp->decodepfunc = fpAcc;
  201|       |        /*
  202|       |         * Override default decoding method with one that does the
  203|       |         * predictor stuff.
  204|       |         */
  205|     94|        if (tif->tif_decoderow != PredictorDecodeRow)
  ------------------
  |  Branch (205:13): [True: 94, False: 0]
  ------------------
  206|     94|        {
  207|     94|            sp->decoderow = tif->tif_decoderow;
  208|     94|            tif->tif_decoderow = PredictorDecodeRow;
  209|     94|            sp->decodestrip = tif->tif_decodestrip;
  210|     94|            tif->tif_decodestrip = PredictorDecodeTile;
  211|     94|            sp->decodetile = tif->tif_decodetile;
  212|     94|            tif->tif_decodetile = PredictorDecodeTile;
  213|     94|        }
  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|     94|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  129|     94|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (219:13): [True: 23, False: 71]
  ------------------
  220|     23|        {
  221|     23|            tif->tif_postdecode = _TIFFNoPostDecode;
  222|     23|        }
  223|     94|    }
  224|       |
  225|  2.40k|    return 1;
  226|  2.40k|}
tif_predict.c:PredictorSetup:
   64|  2.42k|{
   65|  2.42k|    static const char module[] = "PredictorSetup";
   66|       |
   67|  2.42k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  2.42k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
   68|  2.42k|    TIFFDirectory *td = &tif->tif_dir;
   69|       |
   70|  2.42k|    switch (sp->predictor) /* no differencing */
   71|  2.42k|    {
   72|  1.96k|        case PREDICTOR_NONE:
  ------------------
  |  |  304|  1.96k|#define PREDICTOR_NONE 1                   /* no prediction scheme used */
  ------------------
  |  Branch (72:9): [True: 1.96k, False: 463]
  ------------------
   73|  1.96k|            return 1;
   74|    355|        case PREDICTOR_HORIZONTAL:
  ------------------
  |  |  305|    355|#define PREDICTOR_HORIZONTAL 2             /* horizontal differencing */
  ------------------
  |  Branch (74:9): [True: 355, False: 2.07k]
  ------------------
   75|    355|            if (td->td_bitspersample != 8 && td->td_bitspersample != 16 &&
  ------------------
  |  Branch (75:17): [True: 242, False: 113]
  |  Branch (75:46): [True: 161, False: 81]
  ------------------
   76|    161|                td->td_bitspersample != 32 && td->td_bitspersample != 64)
  ------------------
  |  Branch (76:17): [True: 92, False: 69]
  |  Branch (76:47): [True: 10, False: 82]
  ------------------
   77|     10|            {
   78|     10|                TIFFErrorExtR(tif, module,
   79|     10|                              "Horizontal differencing \"Predictor\" not "
   80|     10|                              "supported with %" PRIu16 "-bit samples",
   81|     10|                              td->td_bitspersample);
   82|     10|                return 0;
   83|     10|            }
   84|    345|            break;
   85|    345|        case PREDICTOR_FLOATINGPOINT:
  ------------------
  |  |  306|     99|#define PREDICTOR_FLOATINGPOINT 3          /* floating point predictor */
  ------------------
  |  Branch (85:9): [True: 99, False: 2.32k]
  ------------------
   86|     99|            if (td->td_sampleformat != SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|     99|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (86:17): [True: 3, False: 96]
  ------------------
   87|      3|            {
   88|      3|                TIFFErrorExtR(
   89|      3|                    tif, module,
   90|      3|                    "Floating point \"Predictor\" not supported with %" PRIu16
   91|      3|                    " data format",
   92|      3|                    td->td_sampleformat);
   93|      3|                return 0;
   94|      3|            }
   95|     96|            if (td->td_bitspersample != 16 && td->td_bitspersample != 24 &&
  ------------------
  |  Branch (95:17): [True: 78, False: 18]
  |  Branch (95:47): [True: 66, False: 12]
  ------------------
   96|     66|                td->td_bitspersample != 32 && td->td_bitspersample != 64)
  ------------------
  |  Branch (96:17): [True: 11, False: 55]
  |  Branch (96:47): [True: 2, False: 9]
  ------------------
   97|      2|            { /* Should 64 be allowed? */
   98|      2|                TIFFErrorExtR(
   99|      2|                    tif, module,
  100|      2|                    "Floating point \"Predictor\" not supported with %" PRIu16
  101|      2|                    "-bit samples",
  102|      2|                    td->td_bitspersample);
  103|      2|                return 0;
  104|      2|            }
  105|     94|            break;
  106|     94|        default:
  ------------------
  |  Branch (106:9): [True: 9, False: 2.41k]
  ------------------
  107|      9|            TIFFErrorExtR(tif, module, "\"Predictor\" value %d not supported",
  108|      9|                          sp->predictor);
  109|      9|            return 0;
  110|  2.42k|    }
  111|    439|    sp->stride =
  112|    439|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    439|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (112:10): [True: 428, False: 11]
  ------------------
  113|    439|                                                    : 1);
  114|       |    /*
  115|       |     * Calculate the scanline/tile-width size in bytes.
  116|       |     */
  117|    439|    if (isTiled(tif))
  ------------------
  |  |  282|    439|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|    439|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (282:22): [True: 109, False: 330]
  |  |  ------------------
  ------------------
  118|    109|        sp->rowsize = TIFFTileRowSize(tif);
  119|    330|    else
  120|    330|        sp->rowsize = TIFFScanlineSize(tif);
  121|    439|    if (sp->rowsize == 0)
  ------------------
  |  Branch (121:9): [True: 0, False: 439]
  ------------------
  122|      0|        return 0;
  123|       |
  124|    439|    return 1;
  125|    439|}
tif_predict.c:horAcc8:
  446|  2.23k|{
  447|  2.23k|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|  2.23k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  448|       |
  449|  2.23k|    uint8_t *cp = cp0;
  450|  2.23k|    if ((cc % stride) != 0)
  ------------------
  |  Branch (450:9): [True: 0, False: 2.23k]
  ------------------
  451|      0|    {
  452|      0|        TIFFErrorExtR(tif, "horAcc8", "%s", "(cc%stride)!=0");
  453|      0|        return 0;
  454|      0|    }
  455|       |
  456|  2.23k|    if (cc > stride)
  ------------------
  |  Branch (456:9): [True: 1.54k, False: 689]
  ------------------
  457|  1.54k|    {
  458|       |        /*
  459|       |         * Pipeline the most common cases.
  460|       |         */
  461|  1.54k|        if (stride == 1)
  ------------------
  |  Branch (461:13): [True: 759, False: 788]
  ------------------
  462|    759|        {
  463|    759|            uint32_t acc = cp[0];
  464|    759|            tmsize_t i = stride;
  465|  2.26k|            for (; i < cc - 3; i += 4)
  ------------------
  |  Branch (465:20): [True: 1.51k, False: 759]
  ------------------
  466|  1.51k|            {
  467|  1.51k|                cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
  468|  1.51k|                cp[i + 1] = (uint8_t)((acc += cp[i + 1]) & 0xff);
  469|  1.51k|                cp[i + 2] = (uint8_t)((acc += cp[i + 2]) & 0xff);
  470|  1.51k|                cp[i + 3] = (uint8_t)((acc += cp[i + 3]) & 0xff);
  471|  1.51k|            }
  472|  1.66k|            for (; i < cc; i++)
  ------------------
  |  Branch (472:20): [True: 902, False: 759]
  ------------------
  473|    902|            {
  474|    902|                cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
  475|    902|            }
  476|    759|        }
  477|    788|        else if (stride == 3)
  ------------------
  |  Branch (477:18): [True: 232, False: 556]
  ------------------
  478|    232|        {
  479|    232|            uint32_t cr = cp[0];
  480|    232|            uint32_t cg = cp[1];
  481|    232|            uint32_t cb = cp[2];
  482|    232|            tmsize_t i = stride;
  483|  1.54k|            for (; i < cc; i += stride)
  ------------------
  |  Branch (483:20): [True: 1.31k, False: 232]
  ------------------
  484|  1.31k|            {
  485|  1.31k|                cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
  486|  1.31k|                cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
  487|  1.31k|                cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
  488|  1.31k|            }
  489|    232|        }
  490|    556|        else if (stride == 4)
  ------------------
  |  Branch (490:18): [True: 259, False: 297]
  ------------------
  491|    259|        {
  492|    259|            uint32_t cr = cp[0];
  493|    259|            uint32_t cg = cp[1];
  494|    259|            uint32_t cb = cp[2];
  495|    259|            uint32_t ca = cp[3];
  496|    259|            tmsize_t i = stride;
  497|  2.23k|            for (; i < cc; i += stride)
  ------------------
  |  Branch (497:20): [True: 1.97k, False: 259]
  ------------------
  498|  1.97k|            {
  499|  1.97k|                cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
  500|  1.97k|                cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
  501|  1.97k|                cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
  502|  1.97k|                cp[i + 3] = (uint8_t)((ca += cp[i + 3]) & 0xff);
  503|  1.97k|            }
  504|    259|        }
  505|    297|        else
  506|    297|        {
  507|    297|            cc -= stride;
  508|    297|            do
  509|  1.44k|            {
  510|  1.44k|                REPEAT4(stride,
  ------------------
  |  |  327|  1.44k|    switch (n)                                                                 \
  |  |  328|  1.44k|    {                                                                          \
  |  |  329|  1.13k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 1.13k, False: 306]
  |  |  ------------------
  |  |  330|  1.13k|        {                                                                      \
  |  |  331|  1.13k|            tmsize_t i;                                                        \
  |  |  332|  2.82k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 1.68k, False: 1.13k]
  |  |  ------------------
  |  |  333|  1.68k|            {                                                                  \
  |  |  334|  1.68k|                op;                                                            \
  |  |  335|  1.68k|            }                                                                  \
  |  |  336|  1.13k|        } /*-fallthrough*/                                                     \
  |  |  337|  1.13k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 0, False: 1.44k]
  |  |  ------------------
  |  |  338|  1.13k|            op; /*-fallthrough*/                                               \
  |  |  339|  1.13k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 0, False: 1.44k]
  |  |  ------------------
  |  |  340|  1.13k|            op; /*-fallthrough*/                                               \
  |  |  341|  1.44k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 306, False: 1.13k]
  |  |  ------------------
  |  |  342|  1.44k|            op; /*-fallthrough*/                                               \
  |  |  343|  1.44k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 0, False: 1.44k]
  |  |  ------------------
  |  |  344|  1.44k|            op; /*-fallthrough*/                                               \
  |  |  345|  1.44k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 1.44k]
  |  |  ------------------
  |  |  346|  1.44k|    }
  ------------------
  511|  1.44k|                        cp[stride] = (uint8_t)((cp[stride] + *cp) & 0xff);
  512|  1.44k|                        cp++)
  513|  1.44k|                cc -= stride;
  514|  1.44k|            } while (cc > 0);
  ------------------
  |  Branch (514:22): [True: 1.14k, False: 297]
  ------------------
  515|    297|        }
  516|  1.54k|    }
  517|  2.23k|    return 1;
  518|  2.23k|}
tif_predict.c:horAcc16:
  530|  2.27k|{
  531|  2.27k|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|  2.27k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  532|  2.27k|    uint8_t *cp = cp0;
  533|  2.27k|    tmsize_t wc = cc / 2;
  534|       |
  535|  2.27k|    if ((cc % (2 * stride)) != 0)
  ------------------
  |  Branch (535:9): [True: 0, False: 2.27k]
  ------------------
  536|      0|    {
  537|      0|        TIFFErrorExtR(tif, "horAcc16", "%s", "cc%(2*stride))!=0");
  538|      0|        return 0;
  539|      0|    }
  540|       |
  541|  2.27k|    if (wc > stride)
  ------------------
  |  Branch (541:9): [True: 1.82k, False: 445]
  ------------------
  542|  1.82k|    {
  543|  1.82k|        wc -= stride;
  544|  1.82k|        do
  545|  15.7k|        {
  546|  15.7k|            REPEAT4(stride,
  ------------------
  |  |  327|  15.7k|    switch (n)                                                                 \
  |  |  328|  15.7k|    {                                                                          \
  |  |  329|    594|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 594, False: 15.1k]
  |  |  ------------------
  |  |  330|    594|        {                                                                      \
  |  |  331|    594|            tmsize_t i;                                                        \
  |  |  332|  2.04k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 1.44k, False: 594]
  |  |  ------------------
  |  |  333|  1.44k|            {                                                                  \
  |  |  334|  1.44k|                op;                                                            \
  |  |  335|  1.44k|            }                                                                  \
  |  |  336|    594|        } /*-fallthrough*/                                                     \
  |  |  337|  3.73k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 3.14k, False: 12.6k]
  |  |  ------------------
  |  |  338|  3.73k|            op; /*-fallthrough*/                                               \
  |  |  339|  13.7k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 10.0k, False: 5.70k]
  |  |  ------------------
  |  |  340|  13.7k|            op; /*-fallthrough*/                                               \
  |  |  341|  14.0k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 282, False: 15.4k]
  |  |  ------------------
  |  |  342|  14.0k|            op; /*-fallthrough*/                                               \
  |  |  343|  15.7k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 1.68k, False: 14.0k]
  |  |  ------------------
  |  |  344|  15.7k|            op; /*-fallthrough*/                                               \
  |  |  345|  15.7k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 15.7k]
  |  |  ------------------
  |  |  346|  15.7k|    }
  ------------------
  547|  15.7k|                    PredictorAccumulate16NativeUnaligned(cp + 2 * stride, cp);
  548|  15.7k|                    cp += 2)
  549|  15.7k|            wc -= stride;
  550|  15.7k|        } while (wc > 0);
  ------------------
  |  Branch (550:18): [True: 13.9k, False: 1.82k]
  ------------------
  551|  1.82k|    }
  552|  2.27k|    return 1;
  553|  2.27k|}
tif_predict.c:PredictorAccumulate16NativeUnaligned:
  365|  48.7k|{
  366|  48.7k|    uint16_t thisval;
  367|  48.7k|    uint16_t prevval;
  368|  48.7k|    memcpy(&thisval, current, sizeof(thisval));
  369|  48.7k|    memcpy(&prevval, previous, sizeof(prevval));
  370|  48.7k|    thisval =
  371|  48.7k|        (uint16_t)(((unsigned int)thisval + (unsigned int)prevval) & 0xffff);
  372|  48.7k|    memcpy(current, &thisval, sizeof(thisval));
  373|  48.7k|}
tif_predict.c:horAcc32:
  565|    911|{
  566|    911|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    911|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  567|    911|    uint8_t *cp = cp0;
  568|    911|    tmsize_t wc = cc / 4;
  569|       |
  570|    911|    if ((cc % (4 * stride)) != 0)
  ------------------
  |  Branch (570:9): [True: 0, False: 911]
  ------------------
  571|      0|    {
  572|      0|        TIFFErrorExtR(tif, "horAcc32", "%s", "cc%(4*stride))!=0");
  573|      0|        return 0;
  574|      0|    }
  575|       |
  576|    911|    if (wc > stride)
  ------------------
  |  Branch (576:9): [True: 409, False: 502]
  ------------------
  577|    409|    {
  578|    409|        wc -= stride;
  579|    409|        do
  580|  1.58k|        {
  581|  1.58k|            REPEAT4(stride,
  ------------------
  |  |  327|  1.58k|    switch (n)                                                                 \
  |  |  328|  1.58k|    {                                                                          \
  |  |  329|    428|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 428, False: 1.15k]
  |  |  ------------------
  |  |  330|    428|        {                                                                      \
  |  |  331|    428|            tmsize_t i;                                                        \
  |  |  332|  1.09k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 666, False: 428]
  |  |  ------------------
  |  |  333|    666|            {                                                                  \
  |  |  334|    666|                op;                                                            \
  |  |  335|    666|            }                                                                  \
  |  |  336|    428|        } /*-fallthrough*/                                                     \
  |  |  337|    643|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 215, False: 1.36k]
  |  |  ------------------
  |  |  338|    643|            op; /*-fallthrough*/                                               \
  |  |  339|    882|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 239, False: 1.34k]
  |  |  ------------------
  |  |  340|    882|            op; /*-fallthrough*/                                               \
  |  |  341|  1.09k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 212, False: 1.36k]
  |  |  ------------------
  |  |  342|  1.09k|            op; /*-fallthrough*/                                               \
  |  |  343|  1.58k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 487, False: 1.09k]
  |  |  ------------------
  |  |  344|  1.58k|            op; /*-fallthrough*/                                               \
  |  |  345|  1.58k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 1.58k]
  |  |  ------------------
  |  |  346|  1.58k|    }
  ------------------
  582|  1.58k|                    PredictorAccumulate32NativeUnaligned(cp + 4 * stride, cp);
  583|  1.58k|                    cp += 4)
  584|  1.58k|            wc -= stride;
  585|  1.58k|        } while (wc > 0);
  ------------------
  |  Branch (585:18): [True: 1.17k, False: 409]
  ------------------
  586|    409|    }
  587|    911|    return 1;
  588|    911|}
tif_predict.c:PredictorAccumulate32NativeUnaligned:
  378|  4.86k|{
  379|  4.86k|    uint32_t thisval;
  380|  4.86k|    uint32_t prevval;
  381|  4.86k|    memcpy(&thisval, current, sizeof(thisval));
  382|  4.86k|    memcpy(&prevval, previous, sizeof(prevval));
  383|  4.86k|    thisval += prevval;
  384|  4.86k|    memcpy(current, &thisval, sizeof(thisval));
  385|  4.86k|}
tif_predict.c:horAcc64:
  600|    425|{
  601|    425|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    425|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  602|    425|    uint8_t *cp = cp0;
  603|    425|    tmsize_t wc = cc / 8;
  604|       |
  605|    425|    if ((cc % (8 * stride)) != 0)
  ------------------
  |  Branch (605:9): [True: 0, False: 425]
  ------------------
  606|      0|    {
  607|      0|        TIFFErrorExtR(tif, "horAcc64", "%s", "cc%(8*stride))!=0");
  608|      0|        return 0;
  609|      0|    }
  610|       |
  611|    425|    if (wc > stride)
  ------------------
  |  Branch (611:9): [True: 306, False: 119]
  ------------------
  612|    306|    {
  613|    306|        wc -= stride;
  614|    306|        do
  615|  4.38k|        {
  616|  4.38k|            REPEAT4(stride,
  ------------------
  |  |  327|  4.38k|    switch (n)                                                                 \
  |  |  328|  4.38k|    {                                                                          \
  |  |  329|  3.02k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 3.02k, False: 1.36k]
  |  |  ------------------
  |  |  330|  3.02k|        {                                                                      \
  |  |  331|  3.02k|            tmsize_t i;                                                        \
  |  |  332|  6.42k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 3.40k, False: 3.02k]
  |  |  ------------------
  |  |  333|  3.40k|            {                                                                  \
  |  |  334|  3.40k|                op;                                                            \
  |  |  335|  3.40k|            }                                                                  \
  |  |  336|  3.02k|        } /*-fallthrough*/                                                     \
  |  |  337|  3.57k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 553, False: 3.82k]
  |  |  ------------------
  |  |  338|  3.57k|            op; /*-fallthrough*/                                               \
  |  |  339|  3.77k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 204, False: 4.17k]
  |  |  ------------------
  |  |  340|  3.77k|            op; /*-fallthrough*/                                               \
  |  |  341|  4.01k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 234, False: 4.14k]
  |  |  ------------------
  |  |  342|  4.01k|            op; /*-fallthrough*/                                               \
  |  |  343|  4.38k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 369, False: 4.01k]
  |  |  ------------------
  |  |  344|  4.38k|            op; /*-fallthrough*/                                               \
  |  |  345|  4.38k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 4.38k]
  |  |  ------------------
  |  |  346|  4.38k|    }
  ------------------
  617|  4.38k|                    PredictorAccumulate64NativeUnaligned(cp + 8 * stride, cp);
  618|  4.38k|                    cp += 8)
  619|  4.38k|            wc -= stride;
  620|  4.38k|        } while (wc > 0);
  ------------------
  |  Branch (620:18): [True: 4.07k, False: 306]
  ------------------
  621|    306|    }
  622|    425|    return 1;
  623|    425|}
tif_predict.c:PredictorAccumulate64NativeUnaligned:
  390|  19.1k|{
  391|  19.1k|    uint64_t thisval;
  392|  19.1k|    uint64_t prevval;
  393|  19.1k|    memcpy(&thisval, current, sizeof(thisval));
  394|  19.1k|    memcpy(&prevval, previous, sizeof(prevval));
  395|  19.1k|    thisval += prevval;
  396|  19.1k|    memcpy(current, &thisval, sizeof(thisval));
  397|  19.1k|}
tif_predict.c:PredictorDecodeRow:
  746|  3.18k|{
  747|  3.18k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  3.18k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  748|       |
  749|  3.18k|    assert(sp != NULL);
  ------------------
  |  Branch (749:5): [True: 0, False: 3.18k]
  |  Branch (749:5): [True: 3.18k, False: 0]
  ------------------
  750|  3.18k|    assert(sp->decoderow != NULL);
  ------------------
  |  Branch (750:5): [True: 0, False: 3.18k]
  |  Branch (750:5): [True: 3.18k, False: 0]
  ------------------
  751|  3.18k|    assert(sp->decodepfunc != NULL);
  ------------------
  |  Branch (751:5): [True: 0, False: 3.18k]
  |  Branch (751:5): [True: 3.18k, False: 0]
  ------------------
  752|       |
  753|  3.18k|    if ((*sp->decoderow)(tif, op0, occ0, s))
  ------------------
  |  Branch (753:9): [True: 3.05k, False: 133]
  ------------------
  754|  3.05k|    {
  755|  3.05k|        return (*sp->decodepfunc)(tif, op0, occ0);
  756|  3.05k|    }
  757|    133|    else
  758|    133|        return 0;
  759|  3.18k|}
tif_predict.c:PredictorDecodeTile:
  770|  5.99k|{
  771|  5.99k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  5.99k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  772|       |
  773|  5.99k|    assert(sp != NULL);
  ------------------
  |  Branch (773:5): [True: 0, False: 5.99k]
  |  Branch (773:5): [True: 5.99k, False: 0]
  ------------------
  774|  5.99k|    assert(sp->decodetile != NULL);
  ------------------
  |  Branch (774:5): [True: 0, False: 5.99k]
  |  Branch (774:5): [True: 5.99k, False: 0]
  ------------------
  775|       |
  776|  5.99k|    if ((*sp->decodetile)(tif, op0, occ0, s))
  ------------------
  |  Branch (776:9): [True: 1.55k, False: 4.43k]
  ------------------
  777|  1.55k|    {
  778|  1.55k|        tmsize_t rowsize = sp->rowsize;
  779|  1.55k|        assert(rowsize > 0);
  ------------------
  |  Branch (779:9): [True: 0, False: 1.55k]
  |  Branch (779:9): [True: 1.55k, False: 0]
  ------------------
  780|  1.55k|        if ((occ0 % rowsize) != 0)
  ------------------
  |  Branch (780:13): [True: 70, False: 1.48k]
  ------------------
  781|     70|        {
  782|     70|            TIFFErrorExtR(tif, "PredictorDecodeTile", "%s",
  783|     70|                          "occ0%rowsize != 0");
  784|     70|            return 0;
  785|     70|        }
  786|  1.55k|        assert(sp->decodepfunc != NULL);
  ------------------
  |  Branch (786:9): [True: 0, False: 1.48k]
  |  Branch (786:9): [True: 1.48k, False: 0]
  ------------------
  787|  5.36k|        while (occ0 > 0)
  ------------------
  |  Branch (787:16): [True: 3.87k, False: 1.48k]
  ------------------
  788|  3.87k|        {
  789|  3.87k|            if (!(*sp->decodepfunc)(tif, op0, rowsize))
  ------------------
  |  Branch (789:17): [True: 0, False: 3.87k]
  ------------------
  790|      0|                return 0;
  791|  3.87k|            occ0 -= rowsize;
  792|  3.87k|            op0 += rowsize;
  793|  3.87k|        }
  794|  1.48k|        return 1;
  795|  1.48k|    }
  796|  4.43k|    else
  797|  4.43k|        return 0;
  798|  5.99k|}
tif_predict.c:swabHorAcc16:
  521|    563|{
  522|    563|    tmsize_t wc = cc / 2;
  523|       |
  524|    563|    PredictorSwabByteStream16(cp0, wc);
  525|    563|    return horAcc16(tif, cp0, cc);
  526|    563|}
tif_predict.c:PredictorSwabByteStream16:
  400|    563|{
  401|  29.4k|    while (n-- > 0)
  ------------------
  |  Branch (401:12): [True: 28.9k, False: 563]
  ------------------
  402|  28.9k|    {
  403|  28.9k|        uint8_t tmp = cp[0];
  404|  28.9k|        cp[0] = cp[1];
  405|  28.9k|        cp[1] = tmp;
  406|  28.9k|        cp += 2;
  407|  28.9k|    }
  408|    563|}
tif_predict.c:swabHorAcc32:
  556|    520|{
  557|    520|    tmsize_t wc = cc / 4;
  558|       |
  559|    520|    PredictorSwabByteStream32(cp0, wc);
  560|    520|    return horAcc32(tif, cp0, cc);
  561|    520|}
tif_predict.c:PredictorSwabByteStream32:
  411|    520|{
  412|  4.72k|    while (n-- > 0)
  ------------------
  |  Branch (412:12): [True: 4.20k, False: 520]
  ------------------
  413|  4.20k|    {
  414|  4.20k|        uint8_t tmp = cp[0];
  415|  4.20k|        cp[0] = cp[3];
  416|  4.20k|        cp[3] = tmp;
  417|  4.20k|        tmp = cp[1];
  418|  4.20k|        cp[1] = cp[2];
  419|  4.20k|        cp[2] = tmp;
  420|  4.20k|        cp += 4;
  421|  4.20k|    }
  422|    520|}
tif_predict.c:swabHorAcc64:
  591|    292|{
  592|    292|    tmsize_t wc = cc / 8;
  593|       |
  594|    292|    PredictorSwabByteStream64(cp0, wc);
  595|    292|    return horAcc64(tif, cp0, cc);
  596|    292|}
tif_predict.c:PredictorSwabByteStream64:
  425|    292|{
  426|  20.1k|    while (n-- > 0)
  ------------------
  |  Branch (426:12): [True: 19.8k, False: 292]
  ------------------
  427|  19.8k|    {
  428|  19.8k|        uint8_t tmp = cp[0];
  429|  19.8k|        cp[0] = cp[7];
  430|  19.8k|        cp[7] = tmp;
  431|  19.8k|        tmp = cp[1];
  432|  19.8k|        cp[1] = cp[6];
  433|  19.8k|        cp[6] = tmp;
  434|  19.8k|        tmp = cp[2];
  435|  19.8k|        cp[2] = cp[5];
  436|  19.8k|        cp[5] = tmp;
  437|  19.8k|        tmp = cp[3];
  438|  19.8k|        cp[3] = cp[4];
  439|  19.8k|        cp[4] = tmp;
  440|  19.8k|        cp += 8;
  441|  19.8k|    }
  442|    292|}
tif_predict.c:fpAcc:
  629|  1.08k|{
  630|  1.08k|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|  1.08k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  631|  1.08k|    uint32_t bps = tif->tif_dir.td_bitspersample / 8;
  632|  1.08k|    tmsize_t wc = cc / bps;
  633|  1.08k|    tmsize_t count = cc;
  634|  1.08k|    uint8_t *cp = cp0;
  635|  1.08k|    uint8_t *tmp;
  636|       |
  637|  1.08k|    if (cc % (bps * stride) != 0)
  ------------------
  |  Branch (637:9): [True: 0, False: 1.08k]
  ------------------
  638|      0|    {
  639|      0|        TIFFErrorExtR(tif, "fpAcc", "%s", "cc%(bps*stride))!=0");
  640|      0|        return 0;
  641|      0|    }
  642|       |
  643|  1.08k|    tmp = (uint8_t *)_TIFFmallocExt(tif, cc);
  644|  1.08k|    if (!tmp)
  ------------------
  |  Branch (644:9): [True: 0, False: 1.08k]
  ------------------
  645|      0|        return 0;
  646|       |
  647|  1.08k|    if (stride == 1)
  ------------------
  |  Branch (647:9): [True: 676, False: 412]
  ------------------
  648|    676|    {
  649|       |        /* Optimization of general case */
  650|    676|#define OP                                                                     \
  651|    676|    do                                                                         \
  652|    676|    {                                                                          \
  653|    676|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  654|    676|        ++cp;                                                                  \
  655|    676|    } while (0)
  656|  1.57k|        for (; count > 8; count -= 8)
  ------------------
  |  Branch (656:16): [True: 894, False: 676]
  ------------------
  657|    894|        {
  658|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  659|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  660|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  661|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  662|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  663|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  664|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  665|    894|            OP;
  ------------------
  |  |  651|    894|    do                                                                         \
  |  |  652|    894|    {                                                                          \
  |  |  653|    894|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    894|        ++cp;                                                                  \
  |  |  655|    894|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 894]
  |  |  ------------------
  ------------------
  666|    894|        }
  667|  2.55k|        for (; count > 1; count -= 1)
  ------------------
  |  Branch (667:16): [True: 1.88k, False: 676]
  ------------------
  668|  1.88k|        {
  669|  1.88k|            OP;
  ------------------
  |  |  651|  1.88k|    do                                                                         \
  |  |  652|  1.88k|    {                                                                          \
  |  |  653|  1.88k|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|  1.88k|        ++cp;                                                                  \
  |  |  655|  1.88k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 1.88k]
  |  |  ------------------
  ------------------
  670|  1.88k|        }
  671|    676|#undef OP
  672|    676|    }
  673|    412|    else
  674|    412|    {
  675|  2.61k|        while (count > stride)
  ------------------
  |  Branch (675:16): [True: 2.20k, False: 412]
  ------------------
  676|  2.20k|        {
  677|  2.20k|            REPEAT4(stride, cp[stride] = (uint8_t)((cp[stride] + cp[0]) & 0xff);
  ------------------
  |  |  327|  2.20k|    switch (n)                                                                 \
  |  |  328|  2.20k|    {                                                                          \
  |  |  329|    277|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 277, False: 1.92k]
  |  |  ------------------
  |  |  330|    277|        {                                                                      \
  |  |  331|    277|            tmsize_t i;                                                        \
  |  |  332|  2.40k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 2.12k, False: 277]
  |  |  ------------------
  |  |  333|  2.12k|            {                                                                  \
  |  |  334|  2.12k|                op;                                                            \
  |  |  335|  2.12k|            }                                                                  \
  |  |  336|    277|        } /*-fallthrough*/                                                     \
  |  |  337|    903|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 626, False: 1.57k]
  |  |  ------------------
  |  |  338|    903|            op; /*-fallthrough*/                                               \
  |  |  339|  1.42k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 517, False: 1.68k]
  |  |  ------------------
  |  |  340|  1.42k|            op; /*-fallthrough*/                                               \
  |  |  341|  2.20k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 780, False: 1.42k]
  |  |  ------------------
  |  |  342|  2.20k|            op; /*-fallthrough*/                                               \
  |  |  343|  2.20k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 0, False: 2.20k]
  |  |  ------------------
  |  |  344|  2.20k|            op; /*-fallthrough*/                                               \
  |  |  345|  2.20k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 2.20k]
  |  |  ------------------
  |  |  346|  2.20k|    }
  ------------------
  678|  2.20k|                    cp++)
  679|  2.20k|            count -= stride;
  680|  2.20k|        }
  681|    412|    }
  682|       |
  683|  1.08k|    _TIFFmemcpy(tmp, cp0, cc);
  684|  1.08k|    cp = (uint8_t *)cp0;
  685|  1.08k|    count = 0;
  686|       |
  687|  1.08k|#if defined(__x86_64__) || (defined(_M_X64) && !defined(_M_ARM64EC))
  688|  1.08k|    if (bps == 4)
  ------------------
  |  Branch (688:9): [True: 788, False: 300]
  ------------------
  689|    788|    {
  690|       |        /* Optimization of general case */
  691|    937|        for (; count + 15 < wc; count += 16)
  ------------------
  |  Branch (691:16): [True: 149, False: 788]
  ------------------
  692|    149|        {
  693|       |            /* Interlace 4*16 byte values */
  694|       |
  695|    149|            __m128i xmm0 =
  696|    149|                _mm_loadu_si128((const __m128i *)(tmp + count + 3 * wc));
  697|    149|            __m128i xmm1 =
  698|    149|                _mm_loadu_si128((const __m128i *)(tmp + count + 2 * wc));
  699|    149|            __m128i xmm2 =
  700|    149|                _mm_loadu_si128((const __m128i *)(tmp + count + 1 * wc));
  701|    149|            __m128i xmm3 =
  702|    149|                _mm_loadu_si128((const __m128i *)(tmp + count + 0 * wc));
  703|       |            /* (xmm0_0, xmm1_0, xmm0_1, xmm1_1, xmm0_2, xmm1_2, ...) */
  704|    149|            __m128i tmp0 = _mm_unpacklo_epi8(xmm0, xmm1);
  705|       |            /* (xmm0_8, xmm1_8, xmm0_9, xmm1_9, xmm0_10, xmm1_10, ...) */
  706|    149|            __m128i tmp1 = _mm_unpackhi_epi8(xmm0, xmm1);
  707|       |            /* (xmm2_0, xmm3_0, xmm2_1, xmm3_1, xmm2_2, xmm3_2, ...) */
  708|    149|            __m128i tmp2 = _mm_unpacklo_epi8(xmm2, xmm3);
  709|       |            /* (xmm2_8, xmm3_8, xmm2_9, xmm3_9, xmm2_10, xmm3_10, ...) */
  710|    149|            __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|    149|            __m128i tmp2_0 = _mm_unpacklo_epi16(tmp0, tmp2);
  714|    149|            __m128i tmp2_1 = _mm_unpackhi_epi16(tmp0, tmp2);
  715|    149|            __m128i tmp2_2 = _mm_unpacklo_epi16(tmp1, tmp3);
  716|    149|            __m128i tmp2_3 = _mm_unpackhi_epi16(tmp1, tmp3);
  717|    149|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 0 * 16), tmp2_0);
  718|    149|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 1 * 16), tmp2_1);
  719|    149|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 2 * 16), tmp2_2);
  720|    149|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 3 * 16), tmp2_3);
  721|    149|        }
  722|    788|    }
  723|  1.08k|#endif
  724|       |
  725|  3.79k|    for (; count < wc; count++)
  ------------------
  |  Branch (725:12): [True: 2.71k, False: 1.08k]
  ------------------
  726|  2.71k|    {
  727|  2.71k|        uint32_t byte;
  728|  13.4k|        for (byte = 0; byte < bps; byte++)
  ------------------
  |  Branch (728:24): [True: 10.7k, False: 2.71k]
  ------------------
  729|  10.7k|        {
  730|       |#if WORDS_BIGENDIAN
  731|       |            cp[bps * count + byte] = tmp[byte * wc + count];
  732|       |#else
  733|  10.7k|            cp[bps * count + byte] = tmp[(bps - byte - 1) * wc + count];
  734|  10.7k|#endif
  735|  10.7k|        }
  736|  2.71k|    }
  737|  1.08k|    _TIFFfreeExt(tif, tmp);
  738|  1.08k|    return 1;
  739|  1.08k|}

TIFFReadScanline:
  492|  1.12M|{
  493|  1.12M|    int e;
  494|       |
  495|  1.12M|    if (!TIFFCheckRead(tif, 0))
  ------------------
  |  Branch (495:9): [True: 0, False: 1.12M]
  ------------------
  496|      0|        return (-1);
  497|  1.12M|    if ((e = TIFFSeek(tif, row, sample)) != 0)
  ------------------
  |  Branch (497:9): [True: 1.11M, False: 566]
  ------------------
  498|  1.11M|    {
  499|       |        /*
  500|       |         * Decompress desired row into user buffer.
  501|       |         */
  502|  1.11M|        e = (*tif->tif_decoderow)(tif, (uint8_t *)buf,
  503|  1.11M|                                  tif->tif_dir.td_scanlinesize, sample);
  504|       |
  505|       |        /* we are now poised at the beginning of the next row */
  506|  1.11M|        tif->tif_dir.td_row = row + 1;
  507|       |
  508|  1.11M|        if (e > 0)
  ------------------
  |  Branch (508:13): [True: 1.11M, False: 1.25k]
  ------------------
  509|  1.11M|            (*tif->tif_postdecode)(tif, (uint8_t *)buf,
  510|  1.11M|                                   tif->tif_dir.td_scanlinesize);
  511|  1.11M|    }
  512|    566|    else
  513|    566|    {
  514|       |        /* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
  515|    566|        if (buf)
  ------------------
  |  Branch (515:13): [True: 566, False: 0]
  ------------------
  516|    566|            memset(buf, 0, (size_t)tif->tif_dir.td_scanlinesize);
  517|    566|    }
  518|  1.12M|    return (e > 0 ? 1 : -1);
  ------------------
  |  Branch (518:13): [True: 1.11M, False: 1.81k]
  ------------------
  519|  1.12M|}
TIFFReadEncodedStrip:
  574|   327k|{
  575|   327k|    static const char module[] = "TIFFReadEncodedStrip";
  576|   327k|    TIFFDirectory *td = &tif->tif_dir;
  577|   327k|    tmsize_t stripsize;
  578|   327k|    uint16_t plane;
  579|       |
  580|   327k|    if ((size < 0) && (size != (tmsize_t)(-1)))
  ------------------
  |  Branch (580:9): [True: 0, False: 327k]
  |  Branch (580:23): [True: 0, False: 0]
  ------------------
  581|      0|    {
  582|      0|        TIFFErrorExtR(tif, module, "Invalid size %" TIFF_SSIZE_FORMAT, size);
  ------------------
  |  |  142|      0|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  583|      0|        return ((tmsize_t)(-1));
  584|      0|    }
  585|   327k|    stripsize = TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
  586|   327k|    if (stripsize == ((tmsize_t)(-1)))
  ------------------
  |  Branch (586:9): [True: 0, False: 327k]
  ------------------
  587|      0|        return ((tmsize_t)(-1));
  588|       |
  589|       |    /* shortcut to avoid an extra memcpy() */
  590|   327k|    if (td->td_compression == COMPRESSION_NONE && size != (tmsize_t)(-1) &&
  ------------------
  |  |  182|   654k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (590:9): [True: 39.6k, False: 287k]
  |  Branch (590:51): [True: 39.6k, False: 0]
  ------------------
  591|  39.6k|        size >= stripsize && !isMapped(tif) &&
  ------------------
  |  |  283|   366k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  39.6k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (591:9): [True: 39.6k, False: 4]
  |  Branch (591:30): [True: 39.6k, False: 0]
  ------------------
  592|  39.6k|        ((tif->tif_flags & TIFF_NOREADRAW) == 0))
  ------------------
  |  |  141|  39.6k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (592:9): [True: 39.6k, False: 0]
  ------------------
  593|  39.6k|    {
  594|  39.6k|        if (TIFFReadRawStrip1(tif, strip, buf, stripsize, module) != stripsize)
  ------------------
  |  Branch (594:13): [True: 6.53k, False: 33.0k]
  ------------------
  595|  6.53k|            return ((tmsize_t)(-1));
  596|       |
  597|  33.0k|        if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  284|  66.1k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (597:13): [True: 771, False: 32.3k]
  ------------------
  598|    771|            (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  130|    771|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (598:13): [True: 771, False: 0]
  ------------------
  599|    771|            TIFFReverseBits((uint8_t *)buf, stripsize);
  600|       |
  601|  33.0k|        (*tif->tif_postdecode)(tif, (uint8_t *)buf, stripsize);
  602|  33.0k|        return (stripsize);
  603|  39.6k|    }
  604|       |
  605|   287k|    if ((size != (tmsize_t)(-1)) && (size < stripsize))
  ------------------
  |  Branch (605:9): [True: 287k, False: 0]
  |  Branch (605:37): [True: 6, False: 287k]
  ------------------
  606|      6|        stripsize = size;
  607|   287k|    if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (607:9): [True: 243k, False: 44.2k]
  ------------------
  608|   243k|    {
  609|       |        /* The output buf may be NULL, in particular if TIFFTAG_FAXFILLFUNC
  610|       |           is being used. Thus, memset must be conditional on buf not NULL. */
  611|   243k|        if (buf)
  ------------------
  |  Branch (611:13): [True: 243k, False: 0]
  ------------------
  612|   243k|            memset(buf, 0, (size_t)stripsize);
  613|   243k|        return ((tmsize_t)(-1));
  614|   243k|    }
  615|  44.2k|    if ((*tif->tif_decodestrip)(tif, (uint8_t *)buf, stripsize, plane) <= 0)
  ------------------
  |  Branch (615:9): [True: 36.2k, False: 7.91k]
  ------------------
  616|  36.2k|        return ((tmsize_t)(-1));
  617|  7.91k|    (*tif->tif_postdecode)(tif, (uint8_t *)buf, stripsize);
  618|  7.91k|    return (stripsize);
  619|  44.2k|}
_TIFFReadEncodedStripAndAllocBuffer:
  631|   212k|{
  632|   212k|    tmsize_t this_stripsize;
  633|   212k|    uint16_t plane;
  634|       |
  635|   212k|    if (*buf != NULL)
  ------------------
  |  Branch (635:9): [True: 210k, False: 2.60k]
  ------------------
  636|   210k|    {
  637|   210k|        return TIFFReadEncodedStrip(tif, strip, *buf, size_to_read);
  638|   210k|    }
  639|       |
  640|  2.60k|    this_stripsize = TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
  641|  2.60k|    if (this_stripsize == ((tmsize_t)(-1)))
  ------------------
  |  Branch (641:9): [True: 0, False: 2.60k]
  ------------------
  642|      0|        return ((tmsize_t)(-1));
  643|       |
  644|  2.60k|    if ((size_to_read != (tmsize_t)(-1)) && (size_to_read < this_stripsize))
  ------------------
  |  Branch (644:9): [True: 2.60k, False: 0]
  |  Branch (644:45): [True: 0, False: 2.60k]
  ------------------
  645|      0|        this_stripsize = size_to_read;
  646|  2.60k|    if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (646:9): [True: 377, False: 2.22k]
  ------------------
  647|    377|        return ((tmsize_t)(-1));
  648|       |
  649|       |    /* Sanity checks to avoid excessive memory allocation */
  650|       |    /* Max compression ratio experimentally determined. Might be fragile...
  651|       |     * Only apply this heuristics to situations where the memory allocation
  652|       |     * would be big, to avoid breaking nominal use cases.
  653|       |     */
  654|  2.22k|    if (bufsizetoalloc > 100 * 1024 * 1024)
  ------------------
  |  Branch (654:9): [True: 0, False: 2.22k]
  ------------------
  655|      0|    {
  656|      0|        const uint64_t maxCompressionRatio = TIFFGetMaxCompressionRatio(tif);
  657|      0|        if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (657:13): [True: 0, False: 0]
  ------------------
  658|      0|            (uint64_t)tif->tif_rawdatasize <
  ------------------
  |  Branch (658:13): [True: 0, False: 0]
  ------------------
  659|      0|                (uint64_t)this_stripsize / maxCompressionRatio)
  660|      0|        {
  661|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
  662|      0|                          "Likely invalid strip byte count for strip %u. "
  663|      0|                          "Uncompressed strip size is %" PRIu64 ", "
  664|      0|                          "compressed one is %" PRIu64,
  665|      0|                          strip, (uint64_t)this_stripsize,
  666|      0|                          (uint64_t)tif->tif_rawdatasize);
  667|      0|            return ((tmsize_t)(-1));
  668|      0|        }
  669|      0|    }
  670|       |
  671|  2.22k|    *buf = _TIFFcallocExt(tif, 1, bufsizetoalloc);
  672|  2.22k|    if (*buf == NULL)
  ------------------
  |  Branch (672:9): [True: 6, False: 2.21k]
  ------------------
  673|      6|    {
  674|      6|        TIFFErrorExtR(tif, TIFFFileName(tif), "No space for strip buffer");
  675|      6|        return ((tmsize_t)(-1));
  676|      6|    }
  677|       |
  678|  2.21k|    if ((*tif->tif_decodestrip)(tif, (uint8_t *)*buf, this_stripsize, plane) <=
  ------------------
  |  Branch (678:9): [True: 630, False: 1.58k]
  ------------------
  679|  2.21k|        0)
  680|    630|        return ((tmsize_t)(-1));
  681|  1.58k|    (*tif->tif_postdecode)(tif, (uint8_t *)*buf, this_stripsize);
  682|  1.58k|    return (this_stripsize);
  683|  2.21k|}
TIFFFillStrip:
  830|   298k|{
  831|   298k|    static const char module[] = "TIFFFillStrip";
  832|   298k|    TIFFDirectory *td = &tif->tif_dir;
  833|       |
  834|   298k|    if ((tif->tif_flags & TIFF_NOREADRAW) == 0)
  ------------------
  |  |  141|   298k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (834:9): [True: 295k, False: 3.14k]
  ------------------
  835|   295k|    {
  836|   295k|        uint64_t bytecount = TIFFGetStrileByteCount(tif, strip);
  837|   295k|        if (bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX)
  ------------------
  |  |   49|  57.3k|#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
  ------------------
  |  Branch (837:13): [True: 237k, False: 57.3k]
  |  Branch (837:31): [True: 688, False: 56.7k]
  ------------------
  838|   238k|        {
  839|   238k|            TIFFErrorExtR(tif, module,
  840|   238k|                          "Invalid strip byte count %" PRIu64
  841|   238k|                          ", strip %" PRIu32,
  842|   238k|                          bytecount, strip);
  843|   238k|            return (0);
  844|   238k|        }
  845|       |
  846|       |        /* To avoid excessive memory allocations: */
  847|  56.7k|        const tmsize_t stripsize = TIFFStripSize(tif);
  848|  56.7k|        if (stripsize > 0)
  ------------------
  |  Branch (848:13): [True: 56.7k, False: 0]
  ------------------
  849|  56.7k|        {
  850|  56.7k|            if (bytecount > 1024 * 1024 &&
  ------------------
  |  Branch (850:17): [True: 1.80k, False: 54.9k]
  ------------------
  851|  1.80k|                (bytecount - 4096) / 10 > (uint64_t)stripsize)
  ------------------
  |  Branch (851:17): [True: 1.45k, False: 350]
  ------------------
  852|  1.45k|            {
  853|       |                /* Byte count should normally not be larger than a number of */
  854|       |                /* times the uncompressed size plus some margin */
  855|       |                /* 10 and 4096 are just values that could be adjusted. */
  856|       |                /* Hopefully they are safe enough for all codecs */
  857|       |                /* What happens next will depend on whether only the bytecount
  858|       |                 */
  859|       |                /* was corrupted to a large value but the strip/tile data is */
  860|       |                /* fine. In that situation most codecs should work fine and */
  861|       |                /* only used part of the tile/strip data. If the strip/tile */
  862|       |                /* data is corrupted too, then codecs will later error out. */
  863|  1.45k|                uint64_t newbytecount = (uint64_t)stripsize * 10 + 4096;
  864|  1.45k|                TIFFWarningExtR(tif, module,
  865|  1.45k|                                "Too large strip byte count %" PRIu64
  866|  1.45k|                                ", strip %" PRIu32 ". Limiting to %" PRIu64,
  867|  1.45k|                                bytecount, strip, newbytecount);
  868|  1.45k|                bytecount = newbytecount;
  869|  1.45k|            }
  870|  55.2k|            else if (stripsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (870:22): [True: 2, False: 55.2k]
  ------------------
  871|      2|            {
  872|       |                /* Max compression ratio experimentally determined. Might be
  873|       |                 * fragile... Only apply this heuristics to situations where the
  874|       |                 * memory allocation would be big, to avoid breaking nominal use
  875|       |                 * cases.
  876|       |                 */
  877|      2|                const uint64_t maxCompressionRatio =
  878|      2|                    TIFFGetMaxCompressionRatio(tif);
  879|      2|                if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (879:21): [True: 0, False: 2]
  ------------------
  880|      0|                    bytecount < (uint64_t)stripsize / maxCompressionRatio)
  ------------------
  |  Branch (880:21): [True: 0, False: 0]
  ------------------
  881|      0|                {
  882|      0|                    TIFFErrorExtR(
  883|      0|                        tif, module,
  884|      0|                        "Likely invalid strip byte count for strip %u. "
  885|      0|                        "Uncompressed strip size is %" PRIu64 ", "
  886|      0|                        "compressed one is %" PRIu64,
  887|      0|                        strip, (uint64_t)stripsize, bytecount);
  888|      0|                    return 0;
  889|      0|                }
  890|      2|            }
  891|  56.7k|        }
  892|       |
  893|  56.7k|        if (isMapped(tif))
  ------------------
  |  |  283|  56.7k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  56.7k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 56.7k]
  |  |  ------------------
  ------------------
  894|      0|        {
  895|       |            /*
  896|       |             * We must check for overflow, potentially causing
  897|       |             * an OOB read. Instead of simple
  898|       |             *
  899|       |             *  TIFFGetStrileOffset(tif, strip)+bytecount > tif->tif_size
  900|       |             *
  901|       |             * comparison (which can overflow) we do the following
  902|       |             * two comparisons:
  903|       |             */
  904|      0|            if (bytecount > (uint64_t)tif->tif_size ||
  ------------------
  |  Branch (904:17): [True: 0, False: 0]
  ------------------
  905|      0|                TIFFGetStrileOffset(tif, strip) >
  ------------------
  |  Branch (905:17): [True: 0, False: 0]
  ------------------
  906|      0|                    (uint64_t)tif->tif_size - bytecount)
  907|      0|            {
  908|       |                /*
  909|       |                 * This error message might seem strange, but
  910|       |                 * it's what would happen if a read were done
  911|       |                 * instead.
  912|       |                 */
  913|      0|                TIFFErrorExtR(
  914|      0|                    tif, module,
  915|       |
  916|      0|                    "Read error on strip %" PRIu32 "; "
  917|      0|                    "got %" PRIu64 " bytes, expected %" PRIu64,
  918|      0|                    strip,
  919|      0|                    NoSanitizeSubUInt64((uint64_t)tif->tif_size,
  920|      0|                                        TIFFGetStrileOffset(tif, strip)),
  921|      0|                    bytecount);
  922|      0|                tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  123|      0|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
  923|      0|                return (0);
  924|      0|            }
  925|      0|        }
  926|       |
  927|  56.7k|        if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  283|   113k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  56.7k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 56.7k]
  |  |  ------------------
  ------------------
                      if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  284|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  |  |  ------------------
  |  |  |  Branch (284:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  928|      0|                              (tif->tif_flags & TIFF_NOBITREV)))
  ------------------
  |  |  130|      0|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (928:31): [True: 0, False: 0]
  ------------------
  929|      0|        {
  930|       |            /*
  931|       |             * The image is mapped into memory and we either don't
  932|       |             * need to flip bits or the compression routine is
  933|       |             * going to handle this operation itself.  In this
  934|       |             * case, avoid copying the raw data and instead just
  935|       |             * reference the data from the memory mapped file
  936|       |             * image.  This assumes that the decompression
  937|       |             * routines do not modify the contents of the raw data
  938|       |             * buffer (if they try to, the application will get a
  939|       |             * fault since the file is mapped read-only).
  940|       |             */
  941|      0|            if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
  ------------------
  |  |  131|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (941:17): [True: 0, False: 0]
  |  Branch (941:53): [True: 0, False: 0]
  ------------------
  942|      0|            {
  943|      0|                _TIFFfreeExt(tif, tif->tif_rawdata);
  944|      0|                tif->tif_rawdata = NULL;
  945|      0|                tif->tif_rawdatasize = 0;
  946|      0|            }
  947|      0|            tif->tif_flags &= ~TIFF_MYBUFFER;
  ------------------
  |  |  131|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  948|      0|            tif->tif_rawdatasize = (tmsize_t)bytecount;
  949|      0|            tif->tif_rawdata =
  950|      0|                tif->tif_base + (tmsize_t)TIFFGetStrileOffset(tif, strip);
  951|      0|            tif->tif_rawdataoff = 0;
  952|      0|            tif->tif_rawdataloaded = (tmsize_t)bytecount;
  953|       |
  954|       |            /*
  955|       |             * When we have tif_rawdata reference directly into the memory
  956|       |             * mapped file we need to be pretty careful about how we use the
  957|       |             * rawdata.  It is not a general purpose working buffer as it
  958|       |             * normally otherwise is.  So we keep track of this fact to avoid
  959|       |             * using it improperly.
  960|       |             */
  961|      0|            tif->tif_flags |= TIFF_BUFFERMMAP;
  ------------------
  |  |  148|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  962|      0|        }
  963|  56.7k|        else
  964|  56.7k|        {
  965|       |            /*
  966|       |             * Expand raw data buffer, if needed, to hold data
  967|       |             * strip coming from file (perhaps should set upper
  968|       |             * bound on the size of a buffer we'll use?).
  969|       |             */
  970|  56.7k|            tmsize_t bytecountm;
  971|  56.7k|            bytecountm = (tmsize_t)bytecount;
  972|  56.7k|            if ((uint64_t)bytecountm != bytecount)
  ------------------
  |  Branch (972:17): [True: 0, False: 56.7k]
  ------------------
  973|      0|            {
  974|      0|                TIFFErrorExtR(tif, module, "Integer overflow");
  975|      0|                return (0);
  976|      0|            }
  977|  56.7k|            if (bytecountm > tif->tif_rawdatasize)
  ------------------
  |  Branch (977:17): [True: 4.96k, False: 51.7k]
  ------------------
  978|  4.96k|            {
  979|  4.96k|                tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  123|  4.96k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
  980|  4.96k|                if ((tif->tif_flags & TIFF_MYBUFFER) == 0)
  ------------------
  |  |  131|  4.96k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (980:21): [True: 0, False: 4.96k]
  ------------------
  981|      0|                {
  982|      0|                    TIFFErrorExtR(
  983|      0|                        tif, module,
  984|      0|                        "Data buffer too small to hold strip %" PRIu32, strip);
  985|      0|                    return (0);
  986|      0|                }
  987|  4.96k|            }
  988|  56.7k|            if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  148|  56.7k|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (988:17): [True: 0, False: 56.7k]
  ------------------
  989|      0|            {
  990|      0|                tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  123|      0|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
  991|      0|                tif->tif_rawdata = NULL;
  992|      0|                tif->tif_rawdatasize = 0;
  993|      0|                tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  148|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  994|      0|            }
  995|       |
  996|  56.7k|            if (isMapped(tif))
  ------------------
  |  |  283|  56.7k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  56.7k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 56.7k]
  |  |  ------------------
  ------------------
  997|      0|            {
  998|      0|                if (bytecountm > tif->tif_rawdatasize &&
  ------------------
  |  Branch (998:21): [True: 0, False: 0]
  ------------------
  999|      0|                    !TIFFReadBufferSetup(tif, 0, bytecountm))
  ------------------
  |  Branch (999:21): [True: 0, False: 0]
  ------------------
 1000|      0|                {
 1001|      0|                    return (0);
 1002|      0|                }
 1003|      0|                if (TIFFReadRawStrip1(tif, strip, tif->tif_rawdata, bytecountm,
  ------------------
  |  Branch (1003:21): [True: 0, False: 0]
  ------------------
 1004|      0|                                      module) != bytecountm)
 1005|      0|                {
 1006|      0|                    return (0);
 1007|      0|                }
 1008|      0|            }
 1009|  56.7k|            else
 1010|  56.7k|            {
 1011|  56.7k|                if (TIFFReadRawStripOrTile2(tif, strip, 1, bytecountm,
  ------------------
  |  Branch (1011:21): [True: 4.58k, False: 52.1k]
  ------------------
 1012|  56.7k|                                            module) != bytecountm)
 1013|  4.58k|                {
 1014|  4.58k|                    return (0);
 1015|  4.58k|                }
 1016|  56.7k|            }
 1017|       |
 1018|  52.1k|            tif->tif_rawdataoff = 0;
 1019|  52.1k|            tif->tif_rawdataloaded = bytecountm;
 1020|       |
 1021|  52.1k|            if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  284|   104k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1021:17): [True: 2.24k, False: 49.8k]
  ------------------
 1022|  2.24k|                (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  130|  2.24k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1022:17): [True: 1.88k, False: 364]
  ------------------
 1023|  1.88k|                TIFFReverseBits(tif->tif_rawdata, bytecountm);
 1024|  52.1k|        }
 1025|  56.7k|    }
 1026|  55.2k|    return (TIFFStartStrip(tif, strip));
 1027|   298k|}
TIFFReadTile:
 1040|   398k|{
 1041|   398k|    bool overflow = false;
 1042|   398k|    uint32_t tile;
 1043|       |
 1044|   398k|    if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (1044:9): [True: 0, False: 398k]
  |  Branch (1044:35): [True: 493, False: 398k]
  ------------------
 1045|    493|        return ((tmsize_t)(-1));
 1046|       |    /* An overflow returns 0, which is also a valid tile. */
 1047|   398k|    tile = _TIFFComputeTileExt(tif, x, y, z, s, &overflow);
 1048|   398k|    if (overflow)
  ------------------
  |  Branch (1048:9): [True: 0, False: 398k]
  ------------------
 1049|      0|        return ((tmsize_t)(-1));
 1050|   398k|    return (TIFFReadEncodedTile(tif, tile, buf, (tmsize_t)(-1)));
 1051|   398k|}
TIFFReadEncodedTile:
 1058|  1.43M|{
 1059|  1.43M|    static const char module[] = "TIFFReadEncodedTile";
 1060|  1.43M|    TIFFDirectory *td = &tif->tif_dir;
 1061|  1.43M|    tmsize_t tilesize = tif->tif_dir.td_tilesize;
 1062|       |
 1063|  1.43M|    if ((size < 0) && (size != (tmsize_t)(-1)))
  ------------------
  |  Branch (1063:9): [True: 1.43M, False: 0]
  |  Branch (1063:23): [True: 0, False: 1.43M]
  ------------------
 1064|      0|    {
 1065|      0|        TIFFErrorExtR(tif, module, "Invalid size %" TIFF_SSIZE_FORMAT, size);
  ------------------
  |  |  142|      0|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
 1066|      0|        return ((tmsize_t)(-1));
 1067|      0|    }
 1068|  1.43M|    if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (1068:9): [True: 0, False: 1.43M]
  ------------------
 1069|      0|        return ((tmsize_t)(-1));
 1070|  1.43M|    if (tile >= td->td_nstrips)
  ------------------
  |  Branch (1070:9): [True: 0, False: 1.43M]
  ------------------
 1071|      0|    {
 1072|      0|        TIFFErrorExtR(tif, module,
 1073|      0|                      "%" PRIu32 ": Tile out of range, max %" PRIu32, tile,
 1074|      0|                      td->td_nstrips);
 1075|      0|        return ((tmsize_t)(-1));
 1076|      0|    }
 1077|       |
 1078|       |    /* shortcut to avoid an extra memcpy() */
 1079|  1.43M|    if (td->td_compression == COMPRESSION_NONE && size != (tmsize_t)(-1) &&
  ------------------
  |  |  182|  2.87M|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (1079:9): [True: 2, False: 1.43M]
  |  Branch (1079:51): [True: 0, False: 2]
  ------------------
 1080|      0|        size >= tilesize && !isMapped(tif) &&
  ------------------
  |  |  283|  1.43M|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|      0|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (1080:9): [True: 0, False: 0]
  |  Branch (1080:29): [True: 0, False: 0]
  ------------------
 1081|      0|        ((tif->tif_flags & TIFF_NOREADRAW) == 0))
  ------------------
  |  |  141|      0|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1081:9): [True: 0, False: 0]
  ------------------
 1082|      0|    {
 1083|      0|        if (TIFFReadRawTile1(tif, tile, buf, tilesize, module) != tilesize)
  ------------------
  |  Branch (1083:13): [True: 0, False: 0]
  ------------------
 1084|      0|            return ((tmsize_t)(-1));
 1085|       |
 1086|      0|        if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  284|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1086:13): [True: 0, False: 0]
  ------------------
 1087|      0|            (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  130|      0|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1087:13): [True: 0, False: 0]
  ------------------
 1088|      0|            TIFFReverseBits((uint8_t *)buf, tilesize);
 1089|       |
 1090|      0|        (*tif->tif_postdecode)(tif, (uint8_t *)buf, tilesize);
 1091|      0|        return (tilesize);
 1092|      0|    }
 1093|       |
 1094|  1.43M|    if (size == (tmsize_t)(-1))
  ------------------
  |  Branch (1094:9): [True: 1.43M, False: 0]
  ------------------
 1095|  1.43M|        size = tilesize;
 1096|      0|    else if (size > tilesize)
  ------------------
  |  Branch (1096:14): [True: 0, False: 0]
  ------------------
 1097|      0|        size = tilesize;
 1098|  1.43M|    if (!TIFFFillTile(tif, tile))
  ------------------
  |  Branch (1098:9): [True: 1.12M, False: 312k]
  ------------------
 1099|  1.12M|    {
 1100|       |        /* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
 1101|  1.12M|        if (buf)
  ------------------
  |  Branch (1101:13): [True: 1.12M, False: 0]
  ------------------
 1102|  1.12M|            memset(buf, 0, (size_t)size);
 1103|  1.12M|        return ((tmsize_t)(-1));
 1104|  1.12M|    }
 1105|   312k|    if ((*tif->tif_decodetile)(tif, (uint8_t *)buf, size,
  ------------------
  |  Branch (1105:9): [True: 128k, False: 183k]
  ------------------
 1106|   312k|                               (uint16_t)(tile / td->td_stripsperimage)) <= 0)
 1107|   128k|        return ((tmsize_t)(-1));
 1108|   183k|    (*tif->tif_postdecode)(tif, (uint8_t *)buf, size);
 1109|   183k|    return (size);
 1110|   312k|}
_TIFFReadTileAndAllocBuffer:
 1121|  1.05M|{
 1122|  1.05M|    bool overflow = false;
 1123|  1.05M|    uint32_t tile;
 1124|       |
 1125|  1.05M|    if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (1125:9): [True: 0, False: 1.05M]
  |  Branch (1125:35): [True: 0, False: 1.05M]
  ------------------
 1126|      0|        return ((tmsize_t)(-1));
 1127|       |    /* An overflow returns 0, which is also a valid tile. */
 1128|  1.05M|    tile = _TIFFComputeTileExt(tif, x, y, z, s, &overflow);
 1129|  1.05M|    if (overflow)
  ------------------
  |  Branch (1129:9): [True: 0, False: 1.05M]
  ------------------
 1130|      0|        return ((tmsize_t)(-1));
 1131|  1.05M|    return (_TIFFReadEncodedTileAndAllocBuffer(tif, tile, buf, bufsizetoalloc,
 1132|  1.05M|                                               (tmsize_t)(-1)));
 1133|  1.05M|}
_TIFFReadEncodedTileAndAllocBuffer:
 1144|  1.05M|{
 1145|  1.05M|    static const char module[] = "_TIFFReadEncodedTileAndAllocBuffer";
 1146|  1.05M|    TIFFDirectory *td = &tif->tif_dir;
 1147|  1.05M|    tmsize_t tilesize = tif->tif_dir.td_tilesize;
 1148|       |
 1149|  1.05M|    if (*buf != NULL)
  ------------------
  |  Branch (1149:9): [True: 1.04M, False: 10.4k]
  ------------------
 1150|  1.04M|    {
 1151|  1.04M|        return TIFFReadEncodedTile(tif, tile, *buf, size_to_read);
 1152|  1.04M|    }
 1153|       |
 1154|  10.4k|    if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (1154:9): [True: 0, False: 10.4k]
  ------------------
 1155|      0|        return ((tmsize_t)(-1));
 1156|  10.4k|    if (tile >= td->td_nstrips)
  ------------------
  |  Branch (1156:9): [True: 0, False: 10.4k]
  ------------------
 1157|      0|    {
 1158|      0|        TIFFErrorExtR(tif, module,
 1159|      0|                      "%" PRIu32 ": Tile out of range, max %" PRIu32, tile,
 1160|      0|                      td->td_nstrips);
 1161|      0|        return ((tmsize_t)(-1));
 1162|      0|    }
 1163|       |
 1164|  10.4k|    if (!TIFFFillTile(tif, tile))
  ------------------
  |  Branch (1164:9): [True: 1.91k, False: 8.52k]
  ------------------
 1165|  1.91k|        return ((tmsize_t)(-1));
 1166|       |
 1167|       |    /* Sanity checks to avoid excessive memory allocation */
 1168|       |    /* Cf https://gitlab.com/libtiff/libtiff/-/issues/479 */
 1169|  8.52k|    if (td->td_compression == COMPRESSION_NONE)
  ------------------
  |  |  182|  8.52k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (1169:9): [True: 61, False: 8.46k]
  ------------------
 1170|     61|    {
 1171|     61|        const uint64_t bytecount = TIFFGetStrileByteCount(tif, tile);
 1172|     61|        if (bytecount != (uint64_t)tilesize)
  ------------------
  |  Branch (1172:13): [True: 57, False: 4]
  ------------------
 1173|     57|        {
 1174|     57|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1175|     57|                          "Invalid tile byte count for tile %u. "
 1176|     57|                          "Expected %" PRIu64 ", got %" PRIu64,
 1177|     57|                          tile, (uint64_t)tilesize, bytecount);
 1178|     57|            return ((tmsize_t)(-1));
 1179|     57|        }
 1180|     61|    }
 1181|  8.46k|    else
 1182|  8.46k|    {
 1183|       |        /* Max compression ratio experimentally determined. Might be fragile...
 1184|       |         * Only apply this heuristics to situations where the memory allocation
 1185|       |         * would be big, to avoid breaking nominal use cases.
 1186|       |         */
 1187|  8.46k|        if (bufsizetoalloc > 100 * 1024 * 1024)
  ------------------
  |  Branch (1187:13): [True: 11, False: 8.45k]
  ------------------
 1188|     11|        {
 1189|     11|            const uint64_t maxCompressionRatio =
 1190|     11|                TIFFGetMaxCompressionRatio(tif);
 1191|     11|            if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (1191:17): [True: 7, False: 4]
  ------------------
 1192|      7|                (uint64_t)tif->tif_rawdatasize <
  ------------------
  |  Branch (1192:17): [True: 7, False: 0]
  ------------------
 1193|      7|                    (uint64_t)tilesize / maxCompressionRatio)
 1194|      7|            {
 1195|      7|                TIFFErrorExtR(tif, TIFFFileName(tif),
 1196|      7|                              "Likely invalid tile byte count for tile %u. "
 1197|      7|                              "Uncompressed tile size is %" PRIu64 ", "
 1198|      7|                              "compressed one is %" PRIu64,
 1199|      7|                              tile, (uint64_t)tilesize,
 1200|      7|                              (uint64_t)tif->tif_rawdatasize);
 1201|      7|                return ((tmsize_t)(-1));
 1202|      7|            }
 1203|     11|        }
 1204|  8.46k|    }
 1205|       |
 1206|  8.46k|    *buf = _TIFFmallocExt(tif, bufsizetoalloc);
 1207|  8.46k|    if (*buf == NULL)
  ------------------
  |  Branch (1207:9): [True: 30, False: 8.43k]
  ------------------
 1208|     30|    {
 1209|     30|        TIFFErrorExtR(tif, TIFFFileName(tif), "No space for tile buffer");
 1210|     30|        return ((tmsize_t)(-1));
 1211|     30|    }
 1212|  8.43k|    _TIFFmemset(*buf, 0, bufsizetoalloc);
 1213|       |
 1214|  8.43k|    if (size_to_read == (tmsize_t)(-1))
  ------------------
  |  Branch (1214:9): [True: 8.43k, False: 0]
  ------------------
 1215|  8.43k|        size_to_read = tilesize;
 1216|      0|    else if (size_to_read > tilesize)
  ------------------
  |  Branch (1216:14): [True: 0, False: 0]
  ------------------
 1217|      0|        size_to_read = tilesize;
 1218|  8.43k|    if ((*tif->tif_decodetile)(tif, (uint8_t *)*buf, size_to_read,
  ------------------
  |  Branch (1218:9): [True: 3.41k, False: 5.02k]
  ------------------
 1219|  8.43k|                               (uint16_t)(tile / td->td_stripsperimage)) <= 0)
 1220|  3.41k|        return ((tmsize_t)(-1));
 1221|  5.02k|    (*tif->tif_postdecode)(tif, (uint8_t *)*buf, size_to_read);
 1222|  5.02k|    return (size_to_read);
 1223|  8.43k|}
TIFFFillTile:
 1336|  1.44M|{
 1337|  1.44M|    static const char module[] = "TIFFFillTile";
 1338|  1.44M|    TIFFDirectory *td = &tif->tif_dir;
 1339|       |
 1340|  1.44M|    if ((tif->tif_flags & TIFF_NOREADRAW) == 0)
  ------------------
  |  |  141|  1.44M|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1340:9): [True: 1.14M, False: 300k]
  ------------------
 1341|  1.14M|    {
 1342|  1.14M|        uint64_t bytecount = TIFFGetStrileByteCount(tif, tile);
 1343|  1.14M|        if (bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX)
  ------------------
  |  |   49|   422k|#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
  ------------------
  |  Branch (1343:13): [True: 726k, False: 422k]
  |  Branch (1343:31): [True: 843, False: 421k]
  ------------------
 1344|   727k|        {
 1345|   727k|            TIFFErrorExtR(tif, module,
 1346|   727k|                          "%" PRIu64 ": Invalid tile byte count, tile %" PRIu32,
 1347|   727k|                          bytecount, tile);
 1348|   727k|            return (0);
 1349|   727k|        }
 1350|       |
 1351|       |        /* To avoid excessive memory allocations: */
 1352|   421k|        const tmsize_t tilesize = TIFFTileSize(tif);
 1353|   421k|        if (tilesize > 0)
  ------------------
  |  Branch (1353:13): [True: 421k, False: 0]
  ------------------
 1354|   421k|        {
 1355|   421k|            if (bytecount > 1024 * 1024 &&
  ------------------
  |  Branch (1355:17): [True: 39.5k, False: 382k]
  ------------------
 1356|  39.5k|                (bytecount - 4096) / 10 > (uint64_t)tilesize)
  ------------------
  |  Branch (1356:17): [True: 38.8k, False: 771]
  ------------------
 1357|  38.8k|            {
 1358|       |                /* Byte count should normally not be larger than a number of */
 1359|       |                /* times the uncompressed size plus some margin */
 1360|       |                /* 10 and 4096 are just values that could be adjusted. */
 1361|       |                /* Hopefully they are safe enough for all codecs */
 1362|       |                /* What happens next will depend on whether only the bytecount
 1363|       |                 */
 1364|       |                /* was corrupted to a large value but the strip/tile data is */
 1365|       |                /* fine. In that situation most codecs should work fine and */
 1366|       |                /* only used part of the tile/strip data. If the strip/tile */
 1367|       |                /* data is corrupted too, then codecs will later error out. */
 1368|  38.8k|                uint64_t newbytecount = (uint64_t)tilesize * 10 + 4096;
 1369|  38.8k|                TIFFWarningExtR(tif, module,
 1370|  38.8k|                                "Too large tile byte count %" PRIu64
 1371|  38.8k|                                ", tile %" PRIu32 ". Limiting to %" PRIu64,
 1372|  38.8k|                                bytecount, tile, newbytecount);
 1373|  38.8k|                bytecount = newbytecount;
 1374|  38.8k|            }
 1375|   383k|            else if (tilesize > 100 * 1024 * 1024)
  ------------------
  |  Branch (1375:22): [True: 13, False: 383k]
  ------------------
 1376|     13|            {
 1377|       |                /* Max compression ratio experimentally determined. Might be
 1378|       |                 * fragile... Only apply this heuristics to situations where the
 1379|       |                 * memory allocation would be big, to avoid breaking nominal use
 1380|       |                 * cases.
 1381|       |                 */
 1382|     13|                const uint64_t maxCompressionRatio =
 1383|     13|                    TIFFGetMaxCompressionRatio(tif);
 1384|     13|                if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (1384:21): [True: 0, False: 13]
  ------------------
 1385|      0|                    bytecount < (uint64_t)tilesize / maxCompressionRatio)
  ------------------
  |  Branch (1385:21): [True: 0, False: 0]
  ------------------
 1386|      0|                {
 1387|      0|                    TIFFErrorExtR(tif, module,
 1388|      0|                                  "Likely invalid tile byte count for tile %u. "
 1389|      0|                                  "Uncompressed tile size is %" PRIu64 ", "
 1390|      0|                                  "compressed one is %" PRIu64,
 1391|      0|                                  tile, (uint64_t)tilesize, bytecount);
 1392|      0|                    return 0;
 1393|      0|                }
 1394|     13|            }
 1395|   421k|        }
 1396|       |
 1397|   421k|        if (isMapped(tif))
  ------------------
  |  |  283|   421k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|   421k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 421k]
  |  |  ------------------
  ------------------
 1398|      0|        {
 1399|       |            /*
 1400|       |             * We must check for overflow, potentially causing
 1401|       |             * an OOB read. Instead of simple
 1402|       |             *
 1403|       |             *  TIFFGetStrileOffset(tif, tile)+bytecount > tif->tif_size
 1404|       |             *
 1405|       |             * comparison (which can overflow) we do the following
 1406|       |             * two comparisons:
 1407|       |             */
 1408|      0|            if (bytecount > (uint64_t)tif->tif_size ||
  ------------------
  |  Branch (1408:17): [True: 0, False: 0]
  ------------------
 1409|      0|                TIFFGetStrileOffset(tif, tile) >
  ------------------
  |  Branch (1409:17): [True: 0, False: 0]
  ------------------
 1410|      0|                    (uint64_t)tif->tif_size - bytecount)
 1411|      0|            {
 1412|      0|                tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  128|      0|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1413|      0|                return (0);
 1414|      0|            }
 1415|      0|        }
 1416|       |
 1417|   421k|        if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  283|   843k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|   421k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 421k]
  |  |  ------------------
  ------------------
                      if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  284|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  |  |  ------------------
  |  |  |  Branch (284:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1418|      0|                              (tif->tif_flags & TIFF_NOBITREV)))
  ------------------
  |  |  130|      0|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1418:31): [True: 0, False: 0]
  ------------------
 1419|      0|        {
 1420|       |            /*
 1421|       |             * The image is mapped into memory and we either don't
 1422|       |             * need to flip bits or the compression routine is
 1423|       |             * going to handle this operation itself.  In this
 1424|       |             * case, avoid copying the raw data and instead just
 1425|       |             * reference the data from the memory mapped file
 1426|       |             * image.  This assumes that the decompression
 1427|       |             * routines do not modify the contents of the raw data
 1428|       |             * buffer (if they try to, the application will get a
 1429|       |             * fault since the file is mapped read-only).
 1430|       |             */
 1431|      0|            if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
  ------------------
  |  |  131|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (1431:17): [True: 0, False: 0]
  |  Branch (1431:53): [True: 0, False: 0]
  ------------------
 1432|      0|            {
 1433|      0|                _TIFFfreeExt(tif, tif->tif_rawdata);
 1434|      0|                tif->tif_rawdata = NULL;
 1435|      0|                tif->tif_rawdatasize = 0;
 1436|      0|            }
 1437|      0|            tif->tif_flags &= ~TIFF_MYBUFFER;
  ------------------
  |  |  131|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
 1438|       |
 1439|      0|            tif->tif_rawdatasize = (tmsize_t)bytecount;
 1440|      0|            tif->tif_rawdata =
 1441|      0|                tif->tif_base + (tmsize_t)TIFFGetStrileOffset(tif, tile);
 1442|      0|            tif->tif_rawdataoff = 0;
 1443|      0|            tif->tif_rawdataloaded = (tmsize_t)bytecount;
 1444|      0|            tif->tif_flags |= TIFF_BUFFERMMAP;
  ------------------
  |  |  148|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
 1445|      0|        }
 1446|   421k|        else
 1447|   421k|        {
 1448|       |            /*
 1449|       |             * Expand raw data buffer, if needed, to hold data
 1450|       |             * tile coming from file (perhaps should set upper
 1451|       |             * bound on the size of a buffer we'll use?).
 1452|       |             */
 1453|   421k|            tmsize_t bytecountm;
 1454|   421k|            bytecountm = (tmsize_t)bytecount;
 1455|   421k|            if ((uint64_t)bytecountm != bytecount)
  ------------------
  |  Branch (1455:17): [True: 0, False: 421k]
  ------------------
 1456|      0|            {
 1457|      0|                TIFFErrorExtR(tif, module, "Integer overflow");
 1458|      0|                return (0);
 1459|      0|            }
 1460|   421k|            if (bytecountm > tif->tif_rawdatasize)
  ------------------
  |  Branch (1460:17): [True: 12.5k, False: 409k]
  ------------------
 1461|  12.5k|            {
 1462|  12.5k|                tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  128|  12.5k|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1463|  12.5k|                if ((tif->tif_flags & TIFF_MYBUFFER) == 0)
  ------------------
  |  |  131|  12.5k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (1463:21): [True: 0, False: 12.5k]
  ------------------
 1464|      0|                {
 1465|      0|                    TIFFErrorExtR(tif, module,
 1466|      0|                                  "Data buffer too small to hold tile %" PRIu32,
 1467|      0|                                  tile);
 1468|      0|                    return (0);
 1469|      0|                }
 1470|  12.5k|            }
 1471|   421k|            if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  148|   421k|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (1471:17): [True: 0, False: 421k]
  ------------------
 1472|      0|            {
 1473|      0|                tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  128|      0|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1474|      0|                tif->tif_rawdata = NULL;
 1475|      0|                tif->tif_rawdatasize = 0;
 1476|      0|                tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  148|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
 1477|      0|            }
 1478|       |
 1479|   421k|            if (isMapped(tif))
  ------------------
  |  |  283|   421k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|   421k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (283:23): [True: 0, False: 421k]
  |  |  ------------------
  ------------------
 1480|      0|            {
 1481|      0|                if (bytecountm > tif->tif_rawdatasize &&
  ------------------
  |  Branch (1481:21): [True: 0, False: 0]
  ------------------
 1482|      0|                    !TIFFReadBufferSetup(tif, 0, bytecountm))
  ------------------
  |  Branch (1482:21): [True: 0, False: 0]
  ------------------
 1483|      0|                {
 1484|      0|                    return (0);
 1485|      0|                }
 1486|      0|                if (TIFFReadRawTile1(tif, tile, tif->tif_rawdata, bytecountm,
  ------------------
  |  Branch (1486:21): [True: 0, False: 0]
  ------------------
 1487|      0|                                     module) != bytecountm)
 1488|      0|                {
 1489|      0|                    return (0);
 1490|      0|                }
 1491|      0|            }
 1492|   421k|            else
 1493|   421k|            {
 1494|   421k|                if (TIFFReadRawStripOrTile2(tif, tile, 0, bytecountm, module) !=
  ------------------
  |  Branch (1494:21): [True: 52.2k, False: 369k]
  ------------------
 1495|   421k|                    bytecountm)
 1496|  52.2k|                {
 1497|  52.2k|                    return (0);
 1498|  52.2k|                }
 1499|   421k|            }
 1500|       |
 1501|   369k|            tif->tif_rawdataoff = 0;
 1502|   369k|            tif->tif_rawdataloaded = bytecountm;
 1503|       |
 1504|   369k|            if (tif->tif_rawdata != NULL &&
  ------------------
  |  Branch (1504:17): [True: 369k, False: 0]
  ------------------
 1505|   369k|                !isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  284|   739k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1505:17): [True: 1.26k, False: 368k]
  ------------------
 1506|  1.26k|                (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  130|  1.26k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1506:17): [True: 738, False: 525]
  ------------------
 1507|    738|                TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdataloaded);
 1508|   369k|        }
 1509|   421k|    }
 1510|   669k|    return (TIFFStartTile(tif, tile));
 1511|  1.44M|}
_TIFFNoPostDecode:
 1869|  1.20M|{
 1870|  1.20M|    (void)tif;
 1871|  1.20M|    (void)buf;
 1872|  1.20M|    (void)cc;
 1873|  1.20M|}
_TIFFSwab16BitData:
 1876|  2.85k|{
 1877|  2.85k|    (void)tif;
 1878|  2.85k|    assert((cc & 1) == 0);
  ------------------
  |  Branch (1878:5): [True: 0, False: 2.85k]
  |  Branch (1878:5): [True: 2.85k, False: 0]
  ------------------
 1879|  2.85k|    TIFFSwabArrayOfShort((uint16_t *)buf, cc / 2);
 1880|  2.85k|}
_TIFFSwab24BitData:
 1883|    249|{
 1884|    249|    (void)tif;
 1885|    249|    assert((cc % 3) == 0);
  ------------------
  |  Branch (1885:5): [True: 0, False: 249]
  |  Branch (1885:5): [True: 249, False: 0]
  ------------------
 1886|    249|    TIFFSwabArrayOfTriples((uint8_t *)buf, cc / 3);
 1887|    249|}
_TIFFSwab32BitData:
 1890|    389|{
 1891|    389|    (void)tif;
 1892|    389|    assert((cc & 3) == 0);
  ------------------
  |  Branch (1892:5): [True: 0, False: 389]
  |  Branch (1892:5): [True: 389, False: 0]
  ------------------
 1893|    389|    TIFFSwabArrayOfLong((uint32_t *)buf, cc / 4);
 1894|    389|}
_TIFFSwab64BitData:
 1897|    233|{
 1898|    233|    (void)tif;
 1899|    233|    assert((cc & 7) == 0);
  ------------------
  |  Branch (1899:5): [True: 0, False: 233]
  |  Branch (1899:5): [True: 233, False: 0]
  ------------------
 1900|    233|    TIFFSwabArrayOfDouble((double *)buf, cc / 8);
 1901|    233|}
tif_read.c:TIFFSeek:
  329|  1.12M|{
  330|  1.12M|    TIFFDirectory *td = &tif->tif_dir;
  331|  1.12M|    uint32_t strip;
  332|  1.12M|    int whole_strip;
  333|  1.12M|    tmsize_t read_ahead = 0;
  334|       |
  335|       |    /*
  336|       |    ** Establish what strip we are working from.
  337|       |    */
  338|  1.12M|    if (row >= td->td_imagelength)
  ------------------
  |  Branch (338:9): [True: 0, False: 1.12M]
  ------------------
  339|      0|    { /* out of range */
  340|      0|        TIFFErrorExtR(tif, tif->tif_name,
  341|      0|                      "%" PRIu32 ": Row out of range, max %" PRIu32 "", row,
  342|      0|                      td->td_imagelength);
  343|      0|        return (0);
  344|      0|    }
  345|  1.12M|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (345:9): [True: 0, False: 1.12M]
  ------------------
  346|      0|    {
  347|      0|        TIFFErrorExtR(tif, tif->tif_name,
  348|      0|                      "Cannot compute strip: RowsPerStrip is zero");
  349|      0|        return (0);
  350|      0|    }
  351|  1.12M|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.12M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (351:9): [True: 25.2k, False: 1.09M]
  ------------------
  352|  25.2k|    {
  353|  25.2k|        uint64_t sample_offset;
  354|  25.2k|        uint64_t strip64;
  355|  25.2k|        if (sample >= td->td_samplesperpixel)
  ------------------
  |  Branch (355:13): [True: 0, False: 25.2k]
  ------------------
  356|      0|        {
  357|      0|            TIFFErrorExtR(tif, tif->tif_name,
  358|      0|                          "%" PRIu16 ": Sample out of range, max %" PRIu16 "",
  359|      0|                          sample, td->td_samplesperpixel);
  360|      0|            return (0);
  361|      0|        }
  362|  25.2k|        sample_offset =
  363|  25.2k|            _TIFFMultiply64(tif, sample, td->td_stripsperimage, "TIFFSeek");
  364|  25.2k|        if (sample_offset == 0 && sample != 0 && td->td_stripsperimage != 0)
  ------------------
  |  Branch (364:13): [True: 25.2k, False: 0]
  |  Branch (364:35): [True: 0, False: 25.2k]
  |  Branch (364:50): [True: 0, False: 0]
  ------------------
  365|      0|            return (0);
  366|  25.2k|        strip64 = _TIFFAdd64(tif, sample_offset, row / td->td_rowsperstrip,
  367|  25.2k|                             "TIFFSeek");
  368|  25.2k|        if (strip64 == 0 &&
  ------------------
  |  Branch (368:13): [True: 22.2k, False: 2.95k]
  ------------------
  369|  22.2k|            (sample_offset != 0 || (row / td->td_rowsperstrip) != 0))
  ------------------
  |  Branch (369:14): [True: 0, False: 22.2k]
  |  Branch (369:36): [True: 0, False: 22.2k]
  ------------------
  370|      0|            return (0);
  371|  25.2k|        strip = _TIFFCastUInt64ToUInt32(tif, strip64, "TIFFSeek");
  372|  25.2k|        if (strip == 0 && strip64 != 0)
  ------------------
  |  Branch (372:13): [True: 22.2k, False: 2.95k]
  |  Branch (372:27): [True: 0, False: 22.2k]
  ------------------
  373|      0|            return (0);
  374|  25.2k|    }
  375|  1.09M|    else
  376|  1.09M|        strip = row / td->td_rowsperstrip;
  377|       |
  378|       |    /*
  379|       |     * Do we want to treat this strip as one whole chunk or
  380|       |     * read it a few lines at a time?
  381|       |     */
  382|       |#if defined(CHUNKY_STRIP_READ_SUPPORT)
  383|       |    whole_strip = TIFFGetStrileByteCount(tif, strip) < 10 || isMapped(tif);
  384|       |    if (td->td_compression == COMPRESSION_LERC ||
  385|       |        td->td_compression == COMPRESSION_JBIG)
  386|       |    {
  387|       |        /* Ideally plugins should have a way to declare they don't support
  388|       |         * chunk strip */
  389|       |        whole_strip = 1;
  390|       |    }
  391|       |
  392|       |    if (!whole_strip)
  393|       |    {
  394|       |        /* 16 is for YCbCr mode where we may need to read 16 */
  395|       |        /* lines at a time to get a decompressed line, and 5000 */
  396|       |        /* is some constant value, for example for JPEG tables */
  397|       |
  398|       |        /* coverity[dead_error_line:SUPPRESS] */
  399|       |        if (tif->tif_dir.td_scanlinesize < TIFF_TMSIZE_T_MAX / 16 &&
  400|       |            tif->tif_dir.td_scanlinesize * 16 < TIFF_TMSIZE_T_MAX - 5000)
  401|       |        {
  402|       |            read_ahead = tif->tif_dir.td_scanlinesize * 16 + 5000;
  403|       |        }
  404|       |        else
  405|       |        {
  406|       |            read_ahead = tif->tif_dir.td_scanlinesize;
  407|       |        }
  408|       |    }
  409|       |#else
  410|  1.12M|    whole_strip = 1;
  411|  1.12M|#endif
  412|       |
  413|       |    /*
  414|       |     * If we haven't loaded this strip, do so now, possibly
  415|       |     * only reading the first part.
  416|       |     */
  417|  1.12M|    if (strip != tif->tif_dir.td_curstrip)
  ------------------
  |  Branch (417:9): [True: 8.01k, False: 1.11M]
  ------------------
  418|  8.01k|    { /* different strip, refill */
  419|       |
  420|  8.01k|        if (whole_strip)
  ------------------
  |  Branch (420:13): [True: 8.01k, False: 0]
  ------------------
  421|  8.01k|        {
  422|  8.01k|            if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (422:17): [True: 564, False: 7.45k]
  ------------------
  423|    564|                return (0);
  424|  8.01k|        }
  425|       |#if defined(CHUNKY_STRIP_READ_SUPPORT)
  426|       |        else
  427|       |        {
  428|       |            if (!TIFFFillStripPartial(tif, strip, read_ahead, 1))
  429|       |                return 0;
  430|       |        }
  431|       |#endif
  432|  8.01k|    }
  433|       |
  434|       |#if defined(CHUNKY_STRIP_READ_SUPPORT)
  435|       |    /*
  436|       |    ** If we already have some data loaded, do we need to read some more?
  437|       |    */
  438|       |    else if (!whole_strip)
  439|       |    {
  440|       |        /* coverity[dead_error_line:SUPPRESS] */
  441|       |        if (((tif->tif_rawdata + tif->tif_rawdataloaded) - tif->tif_rawcp) <
  442|       |                read_ahead &&
  443|       |            (uint64_t)tif->tif_rawdataoff + tif->tif_rawdataloaded <
  444|       |                TIFFGetStrileByteCount(tif, strip))
  445|       |        {
  446|       |            if (!TIFFFillStripPartial(tif, strip, read_ahead, 0))
  447|       |                return 0;
  448|       |        }
  449|       |    }
  450|       |#endif
  451|       |
  452|  1.11M|    if (row < tif->tif_dir.td_row)
  ------------------
  |  Branch (452:9): [True: 13, False: 1.11M]
  ------------------
  453|     13|    {
  454|       |        /*
  455|       |         * Moving backwards within the same strip: backup
  456|       |         * to the start and then decode forward (below).
  457|       |         *
  458|       |         * NB: If you're planning on lots of random access within a
  459|       |         * strip, it's better to just read and decode the entire
  460|       |         * strip, and then access the decoded data in a random fashion.
  461|       |         */
  462|       |
  463|     13|        if (tif->tif_rawdataoff != 0)
  ------------------
  |  Branch (463:13): [True: 0, False: 13]
  ------------------
  464|      0|        {
  465|      0|            if (!TIFFFillStripPartial(tif, (int)strip, read_ahead, 1))
  ------------------
  |  Branch (465:17): [True: 0, False: 0]
  ------------------
  466|      0|                return 0;
  467|      0|        }
  468|     13|        else
  469|     13|        {
  470|     13|            if (!TIFFStartStrip(tif, strip))
  ------------------
  |  Branch (470:17): [True: 2, False: 11]
  ------------------
  471|      2|                return (0);
  472|     13|        }
  473|     13|    }
  474|       |
  475|  1.11M|    if (row != tif->tif_dir.td_row)
  ------------------
  |  Branch (475:9): [True: 0, False: 1.11M]
  ------------------
  476|      0|    {
  477|       |        /*
  478|       |         * Seek forward to the desired row.
  479|       |         */
  480|       |
  481|       |        /* TODO: Will this really work with partial buffers? */
  482|       |
  483|      0|        if (!(*tif->tif_seek)(tif, row - tif->tif_dir.td_row))
  ------------------
  |  Branch (483:13): [True: 0, False: 0]
  ------------------
  484|      0|            return (0);
  485|      0|        tif->tif_dir.td_row = row;
  486|      0|    }
  487|       |
  488|  1.11M|    return (1);
  489|  1.11M|}
tif_read.c:TIFFReadAndRealloc:
   56|   478k|{
   57|   478k|#if SIZEOF_SIZE_T == 8
   58|   478k|    tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  |   43|   478k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
   59|   478k|#endif
   60|   478k|    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|   899k|    while (already_read < size)
  ------------------
  |  Branch (83:12): [True: 478k, False: 421k]
  ------------------
   84|   478k|    {
   85|   478k|        tmsize_t bytes_read;
   86|   478k|        tmsize_t to_read = size - already_read;
   87|   478k|#if SIZEOF_SIZE_T == 8
   88|   478k|        if (to_read >= threshold && threshold < MAX_THRESHOLD &&
  ------------------
  |  |   46|   482k|    (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|  4.54k|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|  4.54k|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|  4.54k|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |   47|   482k|     INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  |   43|  4.54k|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (88:13): [True: 4.54k, False: 473k]
  |  Branch (88:37): [True: 4.54k, False: 0]
  ------------------
   89|  4.54k|            already_read + to_read + rawdata_offset > tif->tif_rawdatasize)
  ------------------
  |  Branch (89:13): [True: 4.23k, False: 301]
  ------------------
   90|  4.23k|        {
   91|  4.23k|            to_read = threshold;
   92|  4.23k|            threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  |   44|  4.23k|#define THRESHOLD_MULTIPLIER 10
  ------------------
   93|  4.23k|        }
   94|   478k|#endif
   95|   478k|        if (already_read + to_read + rawdata_offset > tif->tif_rawdatasize)
  ------------------
  |  Branch (95:13): [True: 14.2k, False: 463k]
  ------------------
   96|  14.2k|        {
   97|  14.2k|            uint8_t *new_rawdata;
   98|  14.2k|            tmsize_t new_rawdatasize;
   99|  14.2k|            assert((tif->tif_flags & TIFF_MYBUFFER) != 0);
  ------------------
  |  Branch (99:13): [True: 0, False: 14.2k]
  |  Branch (99:13): [True: 14.2k, False: 0]
  ------------------
  100|  14.2k|            new_rawdatasize = (tmsize_t)TIFFroundup_64(
  ------------------
  |  |  331|  14.2k|#define TIFFroundup_64(x, y) ((uint64_t)(TIFFhowmany_64(x, y) * (uint64_t)(y)))
  |  |  ------------------
  |  |  |  |  328|  14.2k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  |  |  ------------------
  ------------------
  101|  14.2k|                (uint64_t)already_read + (uint64_t)to_read +
  102|  14.2k|                    (uint64_t)rawdata_offset,
  103|  14.2k|                1024);
  104|  14.2k|            if (new_rawdatasize == 0)
  ------------------
  |  Branch (104:17): [True: 0, False: 14.2k]
  ------------------
  105|      0|            {
  106|      0|                TIFFErrorExtR(tif, module, "Invalid buffer size");
  107|      0|                return 0;
  108|      0|            }
  109|  14.2k|            new_rawdata = (uint8_t *)_TIFFreallocExt(tif, tif->tif_rawdata,
  110|  14.2k|                                                     new_rawdatasize);
  111|  14.2k|            if (new_rawdata == 0)
  ------------------
  |  Branch (111:17): [True: 798, False: 13.4k]
  ------------------
  112|    798|            {
  113|    798|                TIFFErrorExtR(tif, module,
  114|    798|                              "No space for data buffer at scanline %" PRIu32,
  115|    798|                              tif->tif_dir.td_row);
  116|    798|                _TIFFfreeExt(tif, tif->tif_rawdata);
  117|    798|                tif->tif_rawdata = 0;
  118|    798|                tif->tif_rawdatasize = 0;
  119|    798|                return 0;
  120|    798|            }
  121|  13.4k|            tif->tif_rawdatasize = new_rawdatasize;
  122|  13.4k|            tif->tif_rawdata = new_rawdata;
  123|  13.4k|        }
  124|   477k|        if (tif->tif_rawdata == NULL)
  ------------------
  |  Branch (124:13): [True: 0, False: 477k]
  ------------------
  125|      0|        {
  126|       |            /* should not happen in practice but helps CoverityScan */
  127|      0|            return 0;
  128|      0|        }
  129|       |
  130|   477k|        bytes_read = TIFFReadFile(
  ------------------
  |  |  287|   477k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  131|   477k|            tif, tif->tif_rawdata + rawdata_offset + already_read, to_read);
  132|   477k|        if (bytes_read < 0)
  ------------------
  |  Branch (132:13): [True: 0, False: 477k]
  ------------------
  133|       |            /* Treat read errors as short reads before updating offsets. */
  134|      0|            bytes_read = 0;
  135|   477k|        already_read += bytes_read;
  136|   477k|        if (bytes_read != to_read)
  ------------------
  |  Branch (136:13): [True: 55.5k, False: 421k]
  ------------------
  137|  55.5k|        {
  138|  55.5k|            memset(
  139|  55.5k|                tif->tif_rawdata + rawdata_offset + already_read, 0,
  140|  55.5k|                (size_t)(tif->tif_rawdatasize - rawdata_offset - already_read));
  141|  55.5k|            if (is_strip)
  ------------------
  |  Branch (141:17): [True: 4.25k, False: 51.2k]
  ------------------
  142|  4.25k|            {
  143|  4.25k|                TIFFErrorExtR(tif, module,
  144|  4.25k|                              "Read error at scanline %" PRIu32
  145|  4.25k|                              "; got %" TIFF_SSIZE_FORMAT " bytes, "
  146|  4.25k|                              "expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|  4.25k|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  147|  4.25k|                              tif->tif_dir.td_row, already_read, size);
  148|  4.25k|            }
  149|  51.2k|            else
  150|  51.2k|            {
  151|  51.2k|                TIFFErrorExtR(tif, module,
  152|  51.2k|                              "Read error at row %" PRIu32 ", col %" PRIu32
  153|  51.2k|                              ", tile %" PRIu32 "; "
  154|  51.2k|                              "got %" TIFF_SSIZE_FORMAT
  155|  51.2k|                              " bytes, expected %" TIFF_SSIZE_FORMAT "",
  156|  51.2k|                              tif->tif_dir.td_row, tif->tif_dir.td_col,
  157|  51.2k|                              strip_or_tile, already_read, size);
  158|  51.2k|            }
  159|  55.5k|            return 0;
  160|  55.5k|        }
  161|   477k|    }
  162|   421k|    return 1;
  163|   478k|}
tif_read.c:TIFFReadEncodedStripGetStripSize:
  528|   329k|{
  529|   329k|    static const char module[] = "TIFFReadEncodedStrip";
  530|   329k|    TIFFDirectory *td = &tif->tif_dir;
  531|   329k|    uint32_t rowsperstrip;
  532|   329k|    uint32_t stripsperplane;
  533|   329k|    uint32_t stripinplane;
  534|   329k|    uint32_t rows;
  535|   329k|    tmsize_t stripsize;
  536|   329k|    if (!TIFFCheckRead(tif, 0))
  ------------------
  |  Branch (536:9): [True: 0, False: 329k]
  ------------------
  537|      0|        return ((tmsize_t)(-1));
  538|   329k|    if (strip >= td->td_nstrips)
  ------------------
  |  Branch (538:9): [True: 0, False: 329k]
  ------------------
  539|      0|    {
  540|      0|        TIFFErrorExtR(tif, module,
  541|      0|                      "%" PRIu32 ": Strip out of range, max %" PRIu32, strip,
  542|      0|                      td->td_nstrips);
  543|      0|        return ((tmsize_t)(-1));
  544|      0|    }
  545|       |
  546|   329k|    rowsperstrip = td->td_rowsperstrip;
  547|   329k|    if (rowsperstrip > td->td_imagelength)
  ------------------
  |  Branch (547:9): [True: 1.69k, False: 328k]
  ------------------
  548|  1.69k|        rowsperstrip = td->td_imagelength;
  549|   329k|    if (rowsperstrip == 0)
  ------------------
  |  Branch (549:9): [True: 0, False: 329k]
  ------------------
  550|      0|    {
  551|      0|        TIFFErrorExtR(tif, module, "rowsperstrip is zero");
  552|      0|        return ((tmsize_t)(-1));
  553|      0|    }
  554|   329k|    stripsperplane =
  555|   329k|        TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  322|   329k|    (((uint32_t)(x) / (uint32_t)(y)) +                                         \
  |  |  323|   329k|     ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
  |  |  ------------------
  |  |  |  Branch (323:7): [True: 272k, False: 57.8k]
  |  |  ------------------
  ------------------
  556|   329k|    stripinplane = (strip % stripsperplane);
  557|   329k|    if (pplane)
  ------------------
  |  Branch (557:9): [True: 329k, False: 0]
  ------------------
  558|   329k|        *pplane = (uint16_t)(strip / stripsperplane);
  559|   329k|    rows = td->td_imagelength - stripinplane * rowsperstrip;
  560|   329k|    if (rows > rowsperstrip)
  ------------------
  |  Branch (560:9): [True: 327k, False: 2.68k]
  ------------------
  561|   327k|        rows = rowsperstrip;
  562|   329k|    stripsize = TIFFVStripSize(tif, rows);
  563|   329k|    if (stripsize == 0)
  ------------------
  |  Branch (563:9): [True: 0, False: 329k]
  ------------------
  564|      0|        return ((tmsize_t)(-1));
  565|   329k|    return stripsize;
  566|   329k|}
tif_read.c:TIFFReadRawStrip1:
  687|  39.6k|{
  688|  39.6k|    assert((tif->tif_flags & TIFF_NOREADRAW) == 0);
  ------------------
  |  Branch (688:5): [True: 0, False: 39.6k]
  |  Branch (688:5): [True: 39.6k, False: 0]
  ------------------
  689|  39.6k|    if (!isMapped(tif))
  ------------------
  |  |  283|  39.6k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  133|  39.6k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (689:9): [True: 39.6k, False: 0]
  ------------------
  690|  39.6k|    {
  691|  39.6k|        tmsize_t cc;
  692|       |
  693|  39.6k|        if (!SeekOK(tif, TIFFGetStrileOffset(tif, strip)))
  ------------------
  |  |  307|  39.6k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (693:13): [True: 241, False: 39.3k]
  ------------------
  694|    241|        {
  695|    241|            TIFFErrorExtR(tif, module,
  696|    241|                          "Seek error at scanline %" PRIu32 ", strip %" PRIu32,
  697|    241|                          tif->tif_dir.td_row, strip);
  698|    241|            return ((tmsize_t)(-1));
  699|    241|        }
  700|  39.3k|        cc = TIFFReadFile(tif, buf, size);
  ------------------
  |  |  287|  39.3k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  701|  39.3k|        if (cc != size)
  ------------------
  |  Branch (701:13): [True: 6.29k, False: 33.0k]
  ------------------
  702|  6.29k|        {
  703|  6.29k|            TIFFErrorExtR(tif, module,
  704|  6.29k|                          "Read error at scanline %" PRIu32
  705|  6.29k|                          "; got %" TIFF_SSIZE_FORMAT
  706|  6.29k|                          " bytes, expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|  6.29k|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  707|  6.29k|                          tif->tif_dir.td_row, cc, size);
  708|  6.29k|            return ((tmsize_t)(-1));
  709|  6.29k|        }
  710|  39.3k|    }
  711|      0|    else
  712|      0|    {
  713|      0|        tmsize_t ma = 0;
  714|      0|        tmsize_t n;
  715|      0|        if ((TIFFGetStrileOffset(tif, strip) > (uint64_t)TIFF_TMSIZE_T_MAX) ||
  ------------------
  |  |   68|      0|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (715:13): [True: 0, False: 0]
  ------------------
  716|      0|            ((ma = (tmsize_t)TIFFGetStrileOffset(tif, strip)) > tif->tif_size))
  ------------------
  |  Branch (716:13): [True: 0, False: 0]
  ------------------
  717|      0|        {
  718|      0|            n = 0;
  719|      0|        }
  720|      0|        else if (ma > TIFF_TMSIZE_T_MAX - size)
  ------------------
  |  |   68|      0|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (720:18): [True: 0, False: 0]
  ------------------
  721|      0|        {
  722|      0|            n = 0;
  723|      0|        }
  724|      0|        else
  725|      0|        {
  726|      0|            tmsize_t mb = ma + size;
  727|      0|            if (mb > tif->tif_size)
  ------------------
  |  Branch (727:17): [True: 0, False: 0]
  ------------------
  728|      0|                n = tif->tif_size - ma;
  729|      0|            else
  730|      0|                n = size;
  731|      0|        }
  732|      0|        if (n != size)
  ------------------
  |  Branch (732:13): [True: 0, False: 0]
  ------------------
  733|      0|        {
  734|      0|            TIFFErrorExtR(tif, module,
  735|      0|                          "Read error at scanline %" PRIu32 ", strip %" PRIu32
  736|      0|                          "; got %" TIFF_SSIZE_FORMAT
  737|      0|                          " bytes, expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|      0|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  738|      0|                          tif->tif_dir.td_row, strip, n, size);
  739|      0|            return ((tmsize_t)(-1));
  740|      0|        }
  741|      0|        _TIFFmemcpy(buf, tif->tif_base + ma, size);
  742|      0|    }
  743|  33.0k|    return (size);
  744|  39.6k|}
tif_read.c:TIFFReadRawStripOrTile2:
  749|   478k|{
  750|   478k|    assert(!isMapped(tif));
  ------------------
  |  Branch (750:5): [True: 0, False: 478k]
  |  Branch (750:5): [True: 478k, False: 0]
  ------------------
  751|   478k|    assert((tif->tif_flags & TIFF_NOREADRAW) == 0);
  ------------------
  |  Branch (751:5): [True: 0, False: 478k]
  |  Branch (751:5): [True: 478k, False: 0]
  ------------------
  752|       |
  753|   478k|    if (!SeekOK(tif, TIFFGetStrileOffset(tif, strip_or_tile)))
  ------------------
  |  |  307|   478k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (753:9): [True: 532, False: 478k]
  ------------------
  754|    532|    {
  755|    532|        if (is_strip)
  ------------------
  |  Branch (755:13): [True: 326, False: 206]
  ------------------
  756|    326|        {
  757|    326|            TIFFErrorExtR(tif, module,
  758|    326|                          "Seek error at scanline %" PRIu32 ", strip %" PRIu32,
  759|    326|                          tif->tif_dir.td_row, strip_or_tile);
  760|    326|        }
  761|    206|        else
  762|    206|        {
  763|    206|            TIFFErrorExtR(
  764|    206|                tif, module,
  765|    206|                "Seek error at row %" PRIu32 ", col %" PRIu32 ", tile %" PRIu32,
  766|    206|                tif->tif_dir.td_row, tif->tif_dir.td_col, strip_or_tile);
  767|    206|        }
  768|    532|        return ((tmsize_t)(-1));
  769|    532|    }
  770|       |
  771|   478k|    if (!TIFFReadAndRealloc(tif, size, 0, is_strip, strip_or_tile, module))
  ------------------
  |  Branch (771:9): [True: 56.3k, False: 421k]
  ------------------
  772|  56.3k|    {
  773|  56.3k|        return ((tmsize_t)(-1));
  774|  56.3k|    }
  775|       |
  776|   421k|    return (size);
  777|   478k|}
tif_read.c:TIFFStartStrip:
 1588|  55.2k|{
 1589|  55.2k|    static const char module[] = "TIFFStartStrip";
 1590|  55.2k|    TIFFDirectory *td = &tif->tif_dir;
 1591|       |
 1592|  55.2k|    if ((tif->tif_flags & TIFF_CODERSETUP) == 0)
  ------------------
  |  |  127|  55.2k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  |  Branch (1592:9): [True: 4.22k, False: 51.0k]
  ------------------
 1593|  4.22k|    {
 1594|  4.22k|        if (!(*tif->tif_setupdecode)(tif))
  ------------------
  |  Branch (1594:13): [True: 84, False: 4.13k]
  ------------------
 1595|     84|            return (0);
 1596|  4.13k|        tif->tif_flags |= TIFF_CODERSETUP;
  ------------------
  |  |  127|  4.13k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
 1597|  4.13k|    }
 1598|  55.2k|    if (td->td_stripsperimage == 0)
  ------------------
  |  Branch (1598:9): [True: 0, False: 55.2k]
  ------------------
 1599|      0|    {
 1600|      0|        TIFFErrorExtR(tif, module, "Zero strips per image");
 1601|      0|        return 0;
 1602|      0|    }
 1603|  55.2k|    tif->tif_dir.td_curstrip = strip;
 1604|  55.2k|    if (TIFFSafeModMul32(tif, module, strip, td->td_stripsperimage,
  ------------------
  |  |  346|  55.2k|    ((dimension) == 0 || ((index) % (count) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (346:5): [True: 0, False: 55.2k]
  |  |  |  Branch (346:6): [True: 0, False: 55.2k]
  |  |  |  Branch (346:26): [True: 17.3k, False: 37.8k]
  |  |  ------------------
  |  |  347|  55.2k|         ? ((result) = 0, 0)                                                   \
  |  |  348|  55.2k|         : (((result) = _TIFFMultiply32((tif), (index) % (count), (dimension), \
  |  |  349|  37.8k|                                        (module))) == 0))
  ------------------
 1605|  55.2k|                         td->td_rowsperstrip, tif->tif_dir.td_row))
 1606|      0|        return 0;
 1607|  55.2k|    tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  144|  55.2k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 1608|       |
 1609|  55.2k|    if (tif->tif_flags & TIFF_NOREADRAW)
  ------------------
  |  |  141|  55.2k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1609:9): [True: 3.14k, False: 52.0k]
  ------------------
 1610|  3.14k|    {
 1611|  3.14k|        tif->tif_rawcp = NULL;
 1612|  3.14k|        tif->tif_rawcc = 0;
 1613|  3.14k|    }
 1614|  52.0k|    else
 1615|  52.0k|    {
 1616|  52.0k|        tif->tif_rawcp = tif->tif_rawdata;
 1617|  52.0k|        if (tif->tif_rawdataloaded > 0)
  ------------------
  |  Branch (1617:13): [True: 52.0k, False: 0]
  ------------------
 1618|  52.0k|            tif->tif_rawcc = tif->tif_rawdataloaded;
 1619|      0|        else
 1620|      0|            tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, strip);
 1621|  52.0k|    }
 1622|  55.2k|    if ((*tif->tif_predecode)(tif, (uint16_t)(strip / td->td_stripsperimage)) ==
  ------------------
  |  Branch (1622:9): [True: 1.30k, False: 53.8k]
  ------------------
 1623|  55.2k|        0)
 1624|  1.30k|    {
 1625|       |        /* Needed for example for scanline access, if tif_predecode */
 1626|       |        /* fails, and we try to read the same strip again. Without invalidating
 1627|       |         */
 1628|       |        /* tif_curstrip, we'd call tif_decoderow() on a possibly invalid */
 1629|       |        /* codec state. */
 1630|  1.30k|        tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  123|  1.30k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
 1631|  1.30k|        return 0;
 1632|  1.30k|    }
 1633|  53.8k|    return 1;
 1634|  55.2k|}
tif_read.c:TIFFStartTile:
 1641|   669k|{
 1642|   669k|    static const char module[] = "TIFFStartTile";
 1643|   669k|    TIFFDirectory *td = &tif->tif_dir;
 1644|   669k|    uint32_t howmany32;
 1645|       |
 1646|   669k|    if ((tif->tif_flags & TIFF_CODERSETUP) == 0)
  ------------------
  |  |  127|   669k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  |  Branch (1646:9): [True: 10.1k, False: 659k]
  ------------------
 1647|  10.1k|    {
 1648|  10.1k|        if (!(*tif->tif_setupdecode)(tif))
  ------------------
  |  Branch (1648:13): [True: 68, False: 10.0k]
  ------------------
 1649|     68|            return (0);
 1650|  10.0k|        tif->tif_flags |= TIFF_CODERSETUP;
  ------------------
  |  |  127|  10.0k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
 1651|  10.0k|    }
 1652|   669k|    tif->tif_dir.td_curtile = tile;
 1653|   669k|    if (td->td_tilewidth == 0)
  ------------------
  |  Branch (1653:9): [True: 0, False: 669k]
  ------------------
 1654|      0|    {
 1655|      0|        TIFFErrorExtR(tif, module, "Zero tilewidth");
 1656|      0|        return 0;
 1657|      0|    }
 1658|   669k|    howmany32 = TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth);
  ------------------
  |  |  316|   669k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 669k, False: 0]
  |  |  ------------------
  |  |  317|   669k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|   669k|         : 0U)
  ------------------
 1659|   669k|    if (howmany32 == 0)
  ------------------
  |  Branch (1659:9): [True: 0, False: 669k]
  ------------------
 1660|      0|    {
 1661|      0|        TIFFErrorExtR(tif, module, "Zero tiles");
 1662|      0|        return 0;
 1663|      0|    }
 1664|   669k|    if (td->td_tilelength == 0)
  ------------------
  |  Branch (1664:9): [True: 0, False: 669k]
  ------------------
 1665|      0|    {
 1666|      0|        TIFFErrorExtR(tif, module, "Zero tilelength");
 1667|      0|        return 0;
 1668|      0|    }
 1669|   669k|    if (TIFFSafeModMul32(tif, module, tile, howmany32, td->td_tilelength,
  ------------------
  |  |  346|   669k|    ((dimension) == 0 || ((index) % (count) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (346:5): [True: 227, False: 669k]
  |  |  |  Branch (346:6): [True: 0, False: 669k]
  |  |  |  Branch (346:26): [True: 176k, False: 492k]
  |  |  ------------------
  |  |  347|   669k|         ? ((result) = 0, 0)                                                   \
  |  |  348|   669k|         : (((result) = _TIFFMultiply32((tif), (index) % (count), (dimension), \
  |  |  349|   492k|                                        (module))) == 0))
  ------------------
 1670|   669k|                         tif->tif_dir.td_row))
 1671|    227|        return 0;
 1672|   669k|    howmany32 = TIFFhowmany_32(td->td_imagelength, td->td_tilelength);
  ------------------
  |  |  316|   669k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 669k, False: 0]
  |  |  ------------------
  |  |  317|   669k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|   669k|         : 0U)
  ------------------
 1673|   669k|    if (howmany32 == 0)
  ------------------
  |  Branch (1673:9): [True: 0, False: 669k]
  ------------------
 1674|      0|    {
 1675|      0|        TIFFErrorExtR(tif, module, "Zero tiles");
 1676|      0|        return 0;
 1677|      0|    }
 1678|   669k|    if (TIFFSafeModMul32(tif, module, tile, howmany32, td->td_tilewidth,
  ------------------
  |  |  346|   669k|    ((dimension) == 0 || ((index) % (count) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (346:5): [True: 395, False: 669k]
  |  |  |  Branch (346:6): [True: 0, False: 669k]
  |  |  |  Branch (346:26): [True: 442k, False: 227k]
  |  |  ------------------
  |  |  347|   669k|         ? ((result) = 0, 0)                                                   \
  |  |  348|   669k|         : (((result) = _TIFFMultiply32((tif), (index) % (count), (dimension), \
  |  |  349|   227k|                                        (module))) == 0))
  ------------------
 1679|   669k|                         tif->tif_dir.td_col))
 1680|    395|        return 0;
 1681|   669k|    tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  144|   669k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 1682|   669k|    if (tif->tif_flags & TIFF_NOREADRAW)
  ------------------
  |  |  141|   669k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1682:9): [True: 300k, False: 368k]
  ------------------
 1683|   300k|    {
 1684|   300k|        tif->tif_rawcp = NULL;
 1685|   300k|        tif->tif_rawcc = 0;
 1686|   300k|    }
 1687|   368k|    else
 1688|   368k|    {
 1689|   368k|        tif->tif_rawcp = tif->tif_rawdata;
 1690|   368k|        if (tif->tif_rawdataloaded > 0)
  ------------------
  |  Branch (1690:13): [True: 368k, False: 0]
  ------------------
 1691|   368k|            tif->tif_rawcc = tif->tif_rawdataloaded;
 1692|      0|        else
 1693|      0|            tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, tile);
 1694|   368k|    }
 1695|   669k|    return (
 1696|   669k|        (*tif->tif_predecode)(tif, (uint16_t)(tile / td->td_stripsperimage)));
 1697|   669k|}
tif_read.c:TIFFCheckRead:
 1700|  4.34M|{
 1701|  4.34M|    if (tif->tif_mode == O_WRONLY)
  ------------------
  |  Branch (1701:9): [True: 0, False: 4.34M]
  ------------------
 1702|      0|    {
 1703|      0|        TIFFErrorExtR(tif, tif->tif_name, "File not open for reading");
 1704|      0|        return (0);
 1705|      0|    }
 1706|  4.34M|    if (tiles ^ isTiled(tif))
  ------------------
  |  |  282|  4.34M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  132|  4.34M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1706:9): [True: 0, False: 4.34M]
  ------------------
 1707|      0|    {
 1708|      0|        TIFFErrorExtR(tif, tif->tif_name,
 1709|      0|                      tiles ? "Can not read tiles from a striped image"
  ------------------
  |  Branch (1709:23): [True: 0, False: 0]
  ------------------
 1710|      0|                            : "Can not read scanlines from a tiled image");
 1711|      0|        return (0);
 1712|      0|    }
 1713|       |
 1714|       |    /*
 1715|       |     * A scanline write can leave the encoder holding pointers into the raw
 1716|       |     * data buffer until TIFFFlushData() calls its postencode routine.  A
 1717|       |     * subsequent read may resize that buffer while loading a strile.  Finish
 1718|       |     * the pending write before the read can invalidate those pointers.
 1719|       |     *
 1720|       |     * Also invalidate the current strile.  In particular, a read of the next
 1721|       |     * row in the same strip must reload the strip and run predecode instead of
 1722|       |     * continuing from the encoder's row/strile state.
 1723|       |     */
 1724|  4.34M|    if (tif->tif_flags & TIFF_BUF4WRITE)
  ------------------
  |  |  144|  4.34M|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
  |  Branch (1724:9): [True: 0, False: 4.34M]
  ------------------
 1725|      0|    {
 1726|      0|        if (!TIFFFlushData(tif))
  ------------------
  |  Branch (1726:13): [True: 0, False: 0]
  ------------------
 1727|      0|            return (0);
 1728|      0|        tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  144|      0|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 1729|      0|        tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  123|      0|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
 1730|      0|        tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  128|      0|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1731|      0|    }
 1732|  4.34M|    return (1);
 1733|  4.34M|}

TIFFComputeStrip:
   36|   329k|{
   37|   329k|    static const char module[] = "TIFFComputeStrip";
   38|   329k|    TIFFDirectory *td = &tif->tif_dir;
   39|   329k|    uint32_t strip;
   40|       |
   41|   329k|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (41:9): [True: 0, False: 329k]
  ------------------
   42|      0|    {
   43|      0|        TIFFErrorExtR(tif, module,
   44|      0|                      "Cannot compute strip: RowsPerStrip is zero");
   45|      0|        return 0;
   46|      0|    }
   47|   329k|    strip = row / td->td_rowsperstrip;
   48|   329k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|   329k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (48:9): [True: 118k, False: 211k]
  ------------------
   49|   118k|    {
   50|   118k|        uint64_t sample_offset;
   51|   118k|        uint64_t strip64;
   52|   118k|        if (sample >= td->td_samplesperpixel)
  ------------------
  |  Branch (52:13): [True: 18.7k, False: 99.2k]
  ------------------
   53|  18.7k|        {
   54|  18.7k|            TIFFErrorExtR(tif, module, "%lu: Sample out of range, max %lu",
   55|  18.7k|                          (unsigned long)sample,
   56|  18.7k|                          (unsigned long)td->td_samplesperpixel);
   57|  18.7k|            return (0);
   58|  18.7k|        }
   59|  99.2k|        sample_offset = _TIFFMultiply64(tif, sample, td->td_stripsperimage,
   60|  99.2k|                                        "TIFFComputeStrip");
   61|  99.2k|        if (sample_offset == 0 && sample != 0 && td->td_stripsperimage != 0)
  ------------------
  |  Branch (61:13): [True: 56.8k, False: 42.4k]
  |  Branch (61:35): [True: 0, False: 56.8k]
  |  Branch (61:50): [True: 0, False: 0]
  ------------------
   62|      0|            return (0);
   63|  99.2k|        strip64 = _TIFFAdd64(tif, sample_offset, strip, "TIFFComputeStrip");
   64|  99.2k|        if (strip64 == 0 && (sample_offset != 0 || strip != 0))
  ------------------
  |  Branch (64:13): [True: 219, False: 99.0k]
  |  Branch (64:30): [True: 0, False: 219]
  |  Branch (64:52): [True: 0, False: 219]
  ------------------
   65|      0|            return (0);
   66|  99.2k|        strip = _TIFFCastUInt64ToUInt32(tif, strip64, "TIFFComputeStrip");
   67|  99.2k|        if (strip == 0 && strip64 != 0)
  ------------------
  |  Branch (67:13): [True: 219, False: 99.0k]
  |  Branch (67:27): [True: 0, False: 219]
  ------------------
   68|      0|            return (0);
   69|  99.2k|    }
   70|   311k|    return (strip);
   71|   329k|}
TIFFNumberOfStrips:
   77|  14.0k|{
   78|  14.0k|    TIFFDirectory *td = &tif->tif_dir;
   79|  14.0k|    uint32_t nstrips;
   80|       |
   81|  14.0k|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (81:9): [True: 0, False: 14.0k]
  ------------------
   82|      0|    {
   83|      0|        TIFFWarningExtR(tif, "TIFFNumberOfStrips", "RowsPerStrip is zero");
   84|      0|        return 0;
   85|      0|    }
   86|  14.0k|    nstrips = (td->td_rowsperstrip == (uint32_t)-1
  ------------------
  |  Branch (86:16): [True: 9.03k, False: 4.98k]
  ------------------
   87|  14.0k|                   ? 1
   88|  14.0k|                   : TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
  ------------------
  |  |  316|  4.98k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 4.95k, False: 32]
  |  |  ------------------
  |  |  317|  4.98k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  4.98k|         : 0U)
  ------------------
   89|  14.0k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  14.0k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (89:9): [True: 452, False: 13.5k]
  ------------------
   90|    452|        nstrips =
   91|    452|            _TIFFMultiply32(tif, nstrips, (uint32_t)td->td_samplesperpixel,
   92|    452|                            "TIFFNumberOfStrips");
   93|  14.0k|    return (nstrips);
   94|  14.0k|}
_TIFFStrileSize64:
  101|  1.09M|{
  102|  1.09M|    static const char module[] = "_TIFFStrileSize64";
  103|  1.09M|    TIFFDirectory *td = &tif->tif_dir;
  104|  1.09M|    if (isStrip)
  ------------------
  |  Branch (104:9): [True: 618k, False: 478k]
  ------------------
  105|   618k|    {
  106|   618k|        if (nrows == (uint32_t)(-1))
  ------------------
  |  Branch (106:13): [True: 21, False: 618k]
  ------------------
  107|     21|            nrows = td->td_imagelength;
  108|   618k|    }
  109|   478k|    else
  110|   478k|    {
  111|   478k|        if (td->td_tilelength == 0 || td->td_tilewidth == 0 ||
  ------------------
  |  Branch (111:13): [True: 0, False: 478k]
  |  Branch (111:39): [True: 338, False: 477k]
  ------------------
  112|   477k|            td->td_tiledepth == 0)
  ------------------
  |  Branch (112:13): [True: 6, False: 477k]
  ------------------
  113|    344|            return (0);
  114|   478k|    }
  115|  1.09M|    if ((td->td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|  1.09M|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (115:9): [True: 953k, False: 142k]
  ------------------
  116|   953k|        (td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|   953k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                      (td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  285|   379k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  136|   379k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (116:9): [True: 379k, False: 574k]
  |  Branch (116:54): [True: 301k, False: 77.8k]
  ------------------
  117|   301k|    {
  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|   301k|        uint16_t ycbcrsubsampling[2];
  127|   301k|        uint16_t samplingblock_samples;
  128|   301k|        uint32_t samplingblocks_hor;
  129|   301k|        uint32_t samplingblocks_ver;
  130|   301k|        uint64_t samplingrow_samples;
  131|   301k|        uint64_t samplingrow_size;
  132|   301k|        if (td->td_samplesperpixel != 3)
  ------------------
  |  Branch (132:13): [True: 38, False: 301k]
  ------------------
  133|     38|        {
  134|     38|            TIFFErrorExtR(tif, module, "Invalid td_samplesperpixel value");
  135|     38|            return 0;
  136|     38|        }
  137|   301k|        TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|   301k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  138|   301k|                              ycbcrsubsampling + 0, ycbcrsubsampling + 1);
  139|   301k|        if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 &&
  ------------------
  |  Branch (139:14): [True: 291k, False: 9.84k]
  |  Branch (139:42): [True: 277k, False: 13.5k]
  ------------------
  140|   277k|             ycbcrsubsampling[0] != 4) ||
  ------------------
  |  Branch (140:14): [True: 14, False: 277k]
  ------------------
  141|   301k|            (ycbcrsubsampling[1] != 1 && ycbcrsubsampling[1] != 2 &&
  ------------------
  |  Branch (141:14): [True: 298k, False: 2.88k]
  |  Branch (141:42): [True: 9.38k, False: 289k]
  ------------------
  142|  9.38k|             ycbcrsubsampling[1] != 4) ||
  ------------------
  |  Branch (142:14): [True: 5, False: 9.38k]
  ------------------
  143|   301k|            (ycbcrsubsampling[0] == 0 || ycbcrsubsampling[1] == 0))
  ------------------
  |  Branch (143:14): [True: 0, False: 301k]
  |  Branch (143:42): [True: 0, False: 301k]
  ------------------
  144|     19|        {
  145|     19|            TIFFErrorExtR(tif, module, "Invalid YCbCr subsampling (%dx%d)",
  146|     19|                          ycbcrsubsampling[0], ycbcrsubsampling[1]);
  147|     19|            return 0;
  148|     19|        }
  149|   301k|        samplingblock_samples =
  150|   301k|            (uint16_t)(ycbcrsubsampling[0] * ycbcrsubsampling[1] + 2);
  151|   301k|        const uint32_t width = isStrip ? td->td_imagewidth : td->td_tilewidth;
  ------------------
  |  Branch (151:32): [True: 287k, False: 13.5k]
  ------------------
  152|   301k|        samplingblocks_hor = TIFFhowmany_32(width, ycbcrsubsampling[0]);
  ------------------
  |  |  316|   301k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 301k, False: 3]
  |  |  ------------------
  |  |  317|   301k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|   301k|         : 0U)
  ------------------
  153|   301k|        samplingblocks_ver = TIFFhowmany_32(nrows, ycbcrsubsampling[1]);
  ------------------
  |  |  316|   301k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 301k, False: 103]
  |  |  ------------------
  |  |  317|   301k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|   301k|         : 0U)
  ------------------
  154|   301k|        samplingrow_samples = _TIFFMultiply64(tif, samplingblocks_hor,
  155|   301k|                                              samplingblock_samples, module);
  156|   301k|        samplingrow_size = TIFFhowmany8_64(_TIFFMultiply64(
  ------------------
  |  |  330|   301k|    (((x) & 0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
  |  |  ------------------
  |  |  |  Branch (330:6): [True: 1.07k, False: 300k]
  |  |  ------------------
  ------------------
  157|   301k|            tif, samplingrow_samples, td->td_bitspersample, module));
  158|   301k|        return (
  159|   301k|            _TIFFMultiply64(tif, samplingrow_size, samplingblocks_ver, module));
  160|   301k|    }
  161|   794k|    else
  162|   794k|        return (_TIFFMultiply64(tif, nrows,
  163|   794k|                                isStrip ? TIFFScanlineSize64(tif)
  ------------------
  |  Branch (163:33): [True: 330k, False: 464k]
  ------------------
  164|   794k|                                        : TIFFTileRowSize64(tif),
  165|   794k|                                module));
  166|  1.09M|}
TIFFVStripSize64:
  172|   618k|{
  173|   618k|    return _TIFFStrileSize64(tif, nrows, /* isStrip = */ TRUE);
  ------------------
  |  |   74|   618k|#define TRUE 1
  ------------------
  174|   618k|}
TIFFVStripSize:
  177|   542k|{
  178|   542k|    static const char module[] = "TIFFVStripSize";
  179|   542k|    uint64_t m;
  180|   542k|    m = TIFFVStripSize64(tif, nrows);
  181|   542k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  182|   542k|}
TIFFStripSize64:
  231|  74.5k|{
  232|  74.5k|    TIFFDirectory *td = &tif->tif_dir;
  233|  74.5k|    uint32_t rps = td->td_rowsperstrip;
  234|  74.5k|    if (rps > td->td_imagelength)
  ------------------
  |  Branch (234:9): [True: 13.5k, False: 60.9k]
  ------------------
  235|  13.5k|        rps = td->td_imagelength;
  236|  74.5k|    return (TIFFVStripSize64(tif, rps));
  237|  74.5k|}
TIFFStripSize:
  239|  71.5k|{
  240|  71.5k|    static const char module[] = "TIFFStripSize";
  241|  71.5k|    uint64_t m;
  242|  71.5k|    m = TIFFStripSize64(tif);
  243|  71.5k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  244|  71.5k|}
TIFFScanlineSize64:
  292|   365k|{
  293|   365k|    static const char module[] = "TIFFScanlineSize64";
  294|   365k|    TIFFDirectory *td = &tif->tif_dir;
  295|   365k|    uint64_t scanline_size;
  296|   365k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|   365k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (296:9): [True: 229k, False: 135k]
  ------------------
  297|   229k|    {
  298|   229k|        if ((td->td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|   229k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (298:13): [True: 8.16k, False: 221k]
  ------------------
  299|  8.16k|            (td->td_samplesperpixel == 3) && (!isUpSampled(tif)))
  ------------------
  |  |  285|  8.11k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  136|  8.11k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (299:13): [True: 8.11k, False: 50]
  |  Branch (299:46): [True: 6.04k, False: 2.07k]
  ------------------
  300|  6.04k|        {
  301|  6.04k|            uint16_t ycbcrsubsampling[2];
  302|  6.04k|            uint16_t samplingblock_samples;
  303|  6.04k|            uint32_t samplingblocks_hor;
  304|  6.04k|            uint64_t samplingrow_samples;
  305|  6.04k|            uint64_t samplingrow_size;
  306|  6.04k|            if (td->td_samplesperpixel != 3)
  ------------------
  |  Branch (306:17): [True: 0, False: 6.04k]
  ------------------
  307|      0|            {
  308|      0|                TIFFErrorExtR(tif, module, "Invalid td_samplesperpixel value");
  309|      0|                return 0;
  310|      0|            }
  311|  6.04k|            TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|  6.04k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  312|  6.04k|                                  ycbcrsubsampling + 0, ycbcrsubsampling + 1);
  313|  6.04k|            if (((ycbcrsubsampling[0] != 1) && (ycbcrsubsampling[0] != 2) &&
  ------------------
  |  Branch (313:18): [True: 5.59k, False: 446]
  |  Branch (313:48): [True: 589, False: 5.01k]
  ------------------
  314|    589|                 (ycbcrsubsampling[0] != 4)) ||
  ------------------
  |  Branch (314:18): [True: 24, False: 565]
  ------------------
  315|  6.02k|                ((ycbcrsubsampling[1] != 1) && (ycbcrsubsampling[1] != 2) &&
  ------------------
  |  Branch (315:18): [True: 5.38k, False: 638]
  |  Branch (315:48): [True: 280, False: 5.10k]
  ------------------
  316|    280|                 (ycbcrsubsampling[1] != 4)) ||
  ------------------
  |  Branch (316:18): [True: 15, False: 265]
  ------------------
  317|  6.00k|                ((ycbcrsubsampling[0] == 0) || (ycbcrsubsampling[1] == 0)))
  ------------------
  |  Branch (317:18): [True: 0, False: 6.00k]
  |  Branch (317:48): [True: 0, False: 6.00k]
  ------------------
  318|     39|            {
  319|     39|                TIFFErrorExtR(tif, module, "Invalid YCbCr subsampling");
  320|     39|                return 0;
  321|     39|            }
  322|  6.00k|            samplingblock_samples =
  323|  6.00k|                (uint16_t)(ycbcrsubsampling[0] * ycbcrsubsampling[1] + 2);
  324|  6.00k|            samplingblocks_hor =
  325|  6.00k|                TIFFhowmany_32(td->td_imagewidth, ycbcrsubsampling[0]);
  ------------------
  |  |  316|  6.00k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 5.98k, False: 25]
  |  |  ------------------
  |  |  317|  6.00k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  6.00k|         : 0U)
  ------------------
  326|  6.00k|            samplingrow_samples = _TIFFMultiply64(
  327|  6.00k|                tif, samplingblocks_hor, samplingblock_samples, module);
  328|  6.00k|            samplingrow_size =
  329|  6.00k|                TIFFhowmany_64(_TIFFMultiply64(tif, samplingrow_samples,
  ------------------
  |  |  328|  6.00k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  330|  6.00k|                                               td->td_bitspersample, module),
  331|  6.00k|                               8);
  332|  6.00k|            scanline_size = (samplingrow_size / ycbcrsubsampling[1]);
  333|  6.00k|        }
  334|   223k|        else
  335|   223k|        {
  336|   223k|            uint64_t scanline_samples;
  337|   223k|            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|   223k|            scanline_samples = _TIFFMultiply64(tif, scanline_width,
  356|   223k|                                               td->td_samplesperpixel, module);
  357|   223k|            scanline_size =
  358|   223k|                TIFFhowmany_64(_TIFFMultiply64(tif, scanline_samples,
  ------------------
  |  |  328|   223k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  359|   223k|                                               td->td_bitspersample, module),
  360|   223k|                               8);
  361|   223k|        }
  362|   229k|    }
  363|   135k|    else
  364|   135k|    {
  365|   135k|        scanline_size =
  366|   135k|            TIFFhowmany_64(_TIFFMultiply64(tif, td->td_imagewidth,
  ------------------
  |  |  328|   135k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  367|   135k|                                           td->td_bitspersample, module),
  368|   135k|                           8);
  369|   135k|    }
  370|   365k|    if (scanline_size == 0)
  ------------------
  |  Branch (370:9): [True: 2.22k, False: 363k]
  ------------------
  371|  2.22k|    {
  372|  2.22k|        TIFFErrorExtR(tif, module, "Computed scanline size is zero");
  373|  2.22k|        return 0;
  374|  2.22k|    }
  375|   363k|    return (scanline_size);
  376|   365k|}
TIFFScanlineSize:
  378|  32.9k|{
  379|  32.9k|    static const char module[] = "TIFFScanlineSize";
  380|  32.9k|    uint64_t m;
  381|  32.9k|    m = TIFFScanlineSize64(tif);
  382|  32.9k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  383|  32.9k|}

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

TIFFInitThunderScan:
  213|    116|{
  214|    116|    (void)scheme;
  215|       |
  216|    116|    tif->tif_setupdecode = ThunderSetupDecode;
  217|    116|    tif->tif_decoderow = ThunderDecodeRow;
  218|    116|    tif->tif_decodestrip = ThunderDecodeRow;
  219|    116|    return (1);
  220|    116|}
tif_thunder.c:ThunderSetupDecode:
   70|    115|{
   71|    115|    static const char module[] = "ThunderSetupDecode";
   72|       |
   73|    115|    if (tif->tif_dir.td_bitspersample != 4)
  ------------------
  |  Branch (73:9): [True: 3, False: 112]
  ------------------
   74|      3|    {
   75|      3|        TIFFErrorExtR(tif, module,
   76|      3|                      "Wrong bitspersample value (%d), Thunder decoder only "
   77|      3|                      "supports 4bits per sample.",
   78|      3|                      (int)tif->tif_dir.td_bitspersample);
   79|      3|        return 0;
   80|      3|    }
   81|    112|    if (tif->tif_dir.td_samplesperpixel != 1 &&
  ------------------
  |  Branch (81:9): [True: 2, False: 110]
  ------------------
   82|      2|        tif->tif_dir.td_planarconfig != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|      2|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (82:9): [True: 1, False: 1]
  ------------------
   83|      1|    {
   84|      1|        TIFFErrorExtR(tif, module,
   85|      1|                      "Samples/pixel shall be 1 for ThunderScan decoding, "
   86|      1|                      "or PlanarConfiguration must be set to Separate.");
   87|      1|        return 0;
   88|      1|    }
   89|       |
   90|    111|    return (1);
   91|    112|}
tif_thunder.c:ThunderDecodeRow:
  183|  1.58k|{
  184|  1.58k|    static const char module[] = "ThunderDecodeRow";
  185|  1.58k|    uint8_t *row = buf;
  186|       |
  187|  1.58k|    (void)s;
  188|  1.58k|    if (occ % tif->tif_dir.td_scanlinesize)
  ------------------
  |  Branch (188:9): [True: 0, False: 1.58k]
  ------------------
  189|      0|    {
  190|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  191|      0|        return (0);
  192|      0|    }
  193|  4.34k|    while (occ > 0)
  ------------------
  |  Branch (193:12): [True: 3.63k, False: 718]
  ------------------
  194|  3.63k|    {
  195|  3.63k|        if (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth))
  ------------------
  |  Branch (195:13): [True: 871, False: 2.76k]
  ------------------
  196|    871|        {
  197|       |            /*
  198|       |             * ThunderDecode only clears the tail of the scanline it was
  199|       |             * working on. Clear this scanline and every row after it, so a
  200|       |             * failed decode cannot hand the caller whatever its buffer
  201|       |             * happened to contain.
  202|       |             */
  203|    871|            memset(row, 0, (size_t)occ);
  204|    871|            return (0);
  205|    871|        }
  206|  2.76k|        occ -= tif->tif_dir.td_scanlinesize;
  207|  2.76k|        row += tif->tif_dir.td_scanlinesize;
  208|  2.76k|    }
  209|    718|    return (1);
  210|  1.58k|}
tif_thunder.c:ThunderDecode:
   94|  3.63k|{
   95|  3.63k|    static const char module[] = "ThunderDecode";
   96|  3.63k|    unsigned char *bp;
   97|  3.63k|    tmsize_t cc;
   98|  3.63k|    unsigned int lastpixel;
   99|  3.63k|    tmsize_t npixels;
  100|  3.63k|    uint8_t *op = op0;
  101|       |
  102|  3.63k|    bp = (unsigned char *)tif->tif_rawcp;
  103|  3.63k|    cc = tif->tif_rawcc;
  104|  3.63k|    lastpixel = 0;
  105|  3.63k|    npixels = 0;
  106|  39.5k|    while (cc > 0 && npixels < maxpixels)
  ------------------
  |  Branch (106:12): [True: 38.8k, False: 612]
  |  Branch (106:22): [True: 35.8k, False: 3.01k]
  ------------------
  107|  35.8k|    {
  108|  35.8k|        int n, delta;
  109|       |
  110|  35.8k|        n = *bp++;
  111|  35.8k|        cc--;
  112|  35.8k|        switch (n & THUNDER_CODE)
  ------------------
  |  |   45|  35.8k|#define THUNDER_CODE 0xc0 /* mask for 2-bit code word */
  ------------------
  113|  35.8k|        {
  114|  14.5k|            case THUNDER_RUN: /* pixel run */
  ------------------
  |  |   47|  14.5k|#define THUNDER_RUN 0x00        /* run of pixels w/ encoded count */
  ------------------
  |  Branch (114:13): [True: 14.5k, False: 21.3k]
  ------------------
  115|       |                /*
  116|       |                 * Replicate the last pixel n times,
  117|       |                 * where n is the lower-order 6 bits.
  118|       |                 */
  119|  14.5k|                if (n == 0)
  ------------------
  |  Branch (119:21): [True: 6.70k, False: 7.79k]
  ------------------
  120|  6.70k|                    break;
  121|  7.79k|                if (npixels & 1)
  ------------------
  |  Branch (121:21): [True: 3.58k, False: 4.21k]
  ------------------
  122|  3.58k|                {
  123|  3.58k|                    op[0] |= (uint8_t)lastpixel;
  124|  3.58k|                    lastpixel = *op++;
  125|  3.58k|                    npixels++;
  126|  3.58k|                    n--;
  127|  3.58k|                }
  128|  4.21k|                else
  129|  4.21k|                    lastpixel |= lastpixel << 4;
  130|  7.79k|                npixels += n;
  131|  7.79k|                if (npixels > maxpixels)
  ------------------
  |  Branch (131:21): [True: 387, False: 7.41k]
  ------------------
  132|    387|                    break;
  133|  42.9k|                for (; n > 0; n -= 2)
  ------------------
  |  Branch (133:24): [True: 35.5k, False: 7.41k]
  ------------------
  134|  35.5k|                    *op++ = (uint8_t)lastpixel;
  135|  7.41k|                if (n == -1)
  ------------------
  |  Branch (135:21): [True: 3.74k, False: 3.66k]
  ------------------
  136|  3.74k|                    *--op &= 0xf0;
  137|  7.41k|                lastpixel &= 0xf;
  138|  7.41k|                break;
  139|  11.0k|            case THUNDER_2BITDELTAS: /* 2-bit deltas */
  ------------------
  |  |   48|  11.0k|#define THUNDER_2BITDELTAS 0x40 /* 3 pixels w/ encoded 2-bit deltas */
  ------------------
  |  Branch (139:13): [True: 11.0k, False: 24.8k]
  ------------------
  140|  11.0k|                if ((delta = ((n >> 4) & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  11.0k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (140:21): [True: 8.65k, False: 2.36k]
  ------------------
  141|  8.65k|                    SETPIXEL(op,
  ------------------
  |  |   58|  8.65k|    {                                                                          \
  |  |   59|  8.65k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  8.65k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 8.65k, False: 0]
  |  |  ------------------
  |  |   61|  8.65k|        {                                                                      \
  |  |   62|  8.65k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 3.81k, False: 4.84k]
  |  |  ------------------
  |  |   63|  8.65k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  8.65k|            else                                                               \
  |  |   65|  8.65k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  8.65k|        }                                                                      \
  |  |   67|  8.65k|    }
  ------------------
  142|  11.0k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  143|  11.0k|                if ((delta = ((n >> 2) & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  11.0k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (143:21): [True: 8.88k, False: 2.14k]
  ------------------
  144|  8.88k|                    SETPIXEL(op,
  ------------------
  |  |   58|  8.88k|    {                                                                          \
  |  |   59|  8.88k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  8.88k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 8.11k, False: 765]
  |  |  ------------------
  |  |   61|  8.88k|        {                                                                      \
  |  |   62|  8.11k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 3.88k, False: 4.23k]
  |  |  ------------------
  |  |   63|  8.11k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  8.11k|            else                                                               \
  |  |   65|  8.11k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  8.11k|        }                                                                      \
  |  |   67|  8.88k|    }
  ------------------
  145|  11.0k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  146|  11.0k|                if ((delta = (n & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  11.0k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (146:21): [True: 8.35k, False: 2.67k]
  ------------------
  147|  8.35k|                    SETPIXEL(op,
  ------------------
  |  |   58|  8.35k|    {                                                                          \
  |  |   59|  8.35k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  8.35k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 7.57k, False: 773]
  |  |  ------------------
  |  |   61|  8.35k|        {                                                                      \
  |  |   62|  7.57k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 3.83k, False: 3.74k]
  |  |  ------------------
  |  |   63|  7.57k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  7.57k|            else                                                               \
  |  |   65|  7.57k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  7.57k|        }                                                                      \
  |  |   67|  8.35k|    }
  ------------------
  148|  11.0k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  149|  11.0k|                break;
  150|  6.73k|            case THUNDER_3BITDELTAS: /* 3-bit deltas */
  ------------------
  |  |   50|  6.73k|#define THUNDER_3BITDELTAS 0x80 /* 2 pixels w/ encoded 3-bit deltas */
  ------------------
  |  Branch (150:13): [True: 6.73k, False: 29.1k]
  ------------------
  151|  6.73k|                if ((delta = ((n >> 3) & 7)) != DELTA3_SKIP)
  ------------------
  |  |   51|  6.73k|#define DELTA3_SKIP 4           /* skip code for 3-bit deltas */
  ------------------
  |  Branch (151:21): [True: 4.59k, False: 2.13k]
  ------------------
  152|  4.59k|                    SETPIXEL(
  ------------------
  |  |   58|  4.59k|    {                                                                          \
  |  |   59|  4.59k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  4.59k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 4.59k, False: 0]
  |  |  ------------------
  |  |   61|  4.59k|        {                                                                      \
  |  |   62|  4.59k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 1.51k, False: 3.07k]
  |  |  ------------------
  |  |   63|  4.59k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  4.59k|            else                                                               \
  |  |   65|  4.59k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  4.59k|        }                                                                      \
  |  |   67|  4.59k|    }
  ------------------
  153|  6.73k|                        op, (unsigned)((int)lastpixel + threebitdeltas[delta]));
  154|  6.73k|                if ((delta = (n & 7)) != DELTA3_SKIP)
  ------------------
  |  |   51|  6.73k|#define DELTA3_SKIP 4           /* skip code for 3-bit deltas */
  ------------------
  |  Branch (154:21): [True: 6.25k, False: 473]
  ------------------
  155|  6.25k|                    SETPIXEL(
  ------------------
  |  |   58|  6.25k|    {                                                                          \
  |  |   59|  6.25k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  6.25k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 5.87k, False: 387]
  |  |  ------------------
  |  |   61|  6.25k|        {                                                                      \
  |  |   62|  5.87k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 3.49k, False: 2.37k]
  |  |  ------------------
  |  |   63|  5.87k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  5.87k|            else                                                               \
  |  |   65|  5.87k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  5.87k|        }                                                                      \
  |  |   67|  6.25k|    }
  ------------------
  156|  6.73k|                        op, (unsigned)((int)lastpixel + threebitdeltas[delta]));
  157|  6.73k|                break;
  158|  3.61k|            case THUNDER_RAW: /* raw data */
  ------------------
  |  |   52|  3.61k|#define THUNDER_RAW 0xc0        /* raw data encoded */
  ------------------
  |  Branch (158:13): [True: 3.61k, False: 32.2k]
  ------------------
  159|  3.61k|                SETPIXEL(op, n);
  ------------------
  |  |   58|  3.61k|    {                                                                          \
  |  |   59|  3.61k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  3.61k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 3.61k, False: 0]
  |  |  ------------------
  |  |   61|  3.61k|        {                                                                      \
  |  |   62|  3.61k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 1.60k, False: 2.00k]
  |  |  ------------------
  |  |   63|  3.61k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  3.61k|            else                                                               \
  |  |   65|  3.61k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  3.61k|        }                                                                      \
  |  |   67|  3.61k|    }
  ------------------
  160|  3.61k|                break;
  161|      0|            default:
  ------------------
  |  Branch (161:13): [True: 0, False: 35.8k]
  ------------------
  162|      0|                break;
  163|  35.8k|        }
  164|  35.8k|    }
  165|  3.63k|    tif->tif_rawcp = (uint8_t *)bp;
  166|  3.63k|    tif->tif_rawcc = cc;
  167|  3.63k|    if (npixels != maxpixels)
  ------------------
  |  Branch (167:9): [True: 871, False: 2.76k]
  ------------------
  168|    871|    {
  169|    871|        uint8_t *op_end = op0 + (maxpixels + 1) / 2;
  170|    871|        memset(op, 0, (size_t)(op_end - op));
  171|    871|        TIFFErrorExtR(tif, module,
  172|    871|                      "%s data at scanline %lu (%" PRIu64 " != %" PRIu64 ")",
  173|    871|                      npixels < maxpixels ? "Not enough" : "Too much",
  ------------------
  |  Branch (173:23): [True: 484, False: 387]
  ------------------
  174|    871|                      (unsigned long)tif->tif_dir.td_row, (uint64_t)npixels,
  175|    871|                      (uint64_t)maxpixels);
  176|    871|        return (0);
  177|    871|    }
  178|       |
  179|  2.76k|    return (1);
  180|  3.63k|}

_TIFFComputeTileExt:
   49|  1.44M|{
   50|  1.44M|    static const char module[] = "TIFFComputeTile";
   51|  1.44M|    TIFFDirectory *td = &tif->tif_dir;
   52|  1.44M|    uint32_t dx = td->td_tilewidth;
   53|  1.44M|    uint32_t dy = td->td_tilelength;
   54|  1.44M|    uint32_t dz = td->td_tiledepth;
   55|  1.44M|    uint32_t tile = 1;
   56|  1.44M|    bool overflow = false;
   57|       |
   58|  1.44M|    if (td->td_imagedepth == 1)
  ------------------
  |  Branch (58:9): [True: 1.44M, False: 308]
  ------------------
   59|  1.44M|        z = 0;
   60|  1.44M|    if (dx == (uint32_t)-1)
  ------------------
  |  Branch (60:9): [True: 0, False: 1.44M]
  ------------------
   61|      0|        dx = td->td_imagewidth;
   62|  1.44M|    if (dy == (uint32_t)-1)
  ------------------
  |  Branch (62:9): [True: 0, False: 1.44M]
  ------------------
   63|      0|        dy = td->td_imagelength;
   64|  1.44M|    if (dz == (uint32_t)-1)
  ------------------
  |  Branch (64:9): [True: 276, False: 1.44M]
  ------------------
   65|    276|        dz = td->td_imagedepth;
   66|  1.44M|    if (dx != 0 && dy != 0 && dz != 0)
  ------------------
  |  Branch (66:9): [True: 1.44M, False: 0]
  |  Branch (66:20): [True: 1.44M, False: 0]
  |  Branch (66:31): [True: 1.44M, False: 0]
  ------------------
   67|  1.44M|    {
   68|  1.44M|        uint32_t xpt = TIFFhowmany_32(td->td_imagewidth, dx);
  ------------------
  |  |  316|  1.44M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 1.44M, False: 0]
  |  |  ------------------
  |  |  317|  1.44M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  1.44M|         : 0U)
  ------------------
   69|  1.44M|        uint32_t ypt = TIFFhowmany_32(td->td_imagelength, dy);
  ------------------
  |  |  316|  1.44M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 1.44M, False: 0]
  |  |  ------------------
  |  |  317|  1.44M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  1.44M|         : 0U)
  ------------------
   70|  1.44M|        uint32_t zpt = TIFFhowmany_32(td->td_imagedepth, dz);
  ------------------
  |  |  316|  1.44M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 1.44M, False: 0]
  |  |  ------------------
  |  |  317|  1.44M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  1.44M|         : 0U)
  ------------------
   71|  1.44M|        uint32_t xpt_ypt = _TIFFMultiply32Ext(tif, xpt, ypt, module, &overflow);
   72|  1.44M|        uint32_t xpt_ypt_zpt =
   73|  1.44M|            _TIFFMultiply32Ext(tif, xpt_ypt, zpt, module, &overflow);
   74|  1.44M|        uint64_t tile64;
   75|       |
   76|  1.44M|        if (overflow)
  ------------------
  |  Branch (76:13): [True: 0, False: 1.44M]
  ------------------
   77|      0|            goto overflowed;
   78|       |        /* A product of two uint32_t values cannot overflow uint64_t. */
   79|  1.44M|        tile64 = _TIFFAdd64Ext(tif, (uint64_t)xpt_ypt * (z / dz),
   80|  1.44M|                               (uint64_t)xpt * (y / dy), module, &overflow);
   81|  1.44M|        tile64 = _TIFFAdd64Ext(tif, tile64, x / dx, module, &overflow);
   82|  1.44M|        if (overflow)
  ------------------
  |  Branch (82:13): [True: 0, False: 1.44M]
  ------------------
   83|      0|            goto overflowed;
   84|  1.44M|        if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.44M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (84:13): [True: 401k, False: 1.04M]
  ------------------
   85|   401k|        {
   86|   401k|            if (s >= td->td_samplesperpixel)
  ------------------
  |  Branch (86:17): [True: 0, False: 401k]
  ------------------
   87|      0|            {
   88|      0|                TIFFErrorExtR(tif, module, "%lu: Sample out of range, max %lu",
   89|      0|                              (unsigned long)s,
   90|      0|                              (unsigned long)td->td_samplesperpixel);
   91|      0|                return (0);
   92|      0|            }
   93|       |            /* A uint32_t times a uint16_t cannot overflow uint64_t. */
   94|   401k|            tile64 = _TIFFAdd64Ext(tif, (uint64_t)xpt_ypt_zpt * s, tile64,
   95|   401k|                                   module, &overflow);
   96|   401k|        }
   97|  1.44M|        tile = _TIFFCastUInt64ToUInt32Ext(tif, tile64, module, &overflow);
   98|  1.44M|        if (overflow)
  ------------------
  |  Branch (98:13): [True: 0, False: 1.44M]
  ------------------
   99|      0|            goto overflowed;
  100|  1.44M|    }
  101|  1.44M|    return (tile);
  102|       |
  103|      0|overflowed:
  104|      0|    if (pOverflowed != NULL)
  ------------------
  |  Branch (104:9): [True: 0, False: 0]
  ------------------
  105|      0|        *pOverflowed = true;
  106|      0|    return (0);
  107|  1.44M|}
TIFFCheckTile:
  114|  1.44M|{
  115|  1.44M|    TIFFDirectory *td = &tif->tif_dir;
  116|       |
  117|  1.44M|    if (x >= td->td_imagewidth)
  ------------------
  |  Branch (117:9): [True: 0, False: 1.44M]
  ------------------
  118|      0|    {
  119|      0|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Col out of range, max %lu",
  120|      0|                      (unsigned long)x, (unsigned long)(td->td_imagewidth - 1));
  121|      0|        return (0);
  122|      0|    }
  123|  1.44M|    if (y >= td->td_imagelength)
  ------------------
  |  Branch (123:9): [True: 0, False: 1.44M]
  ------------------
  124|      0|    {
  125|      0|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Row out of range, max %lu",
  126|      0|                      (unsigned long)y,
  127|      0|                      (unsigned long)(td->td_imagelength - 1));
  128|      0|        return (0);
  129|      0|    }
  130|  1.44M|    if (z >= td->td_imagedepth)
  ------------------
  |  Branch (130:9): [True: 0, False: 1.44M]
  ------------------
  131|      0|    {
  132|      0|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Depth out of range, max %lu",
  133|      0|                      (unsigned long)z, (unsigned long)(td->td_imagedepth - 1));
  134|      0|        return (0);
  135|      0|    }
  136|  1.44M|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  266|  2.89M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (136:9): [True: 402k, False: 1.04M]
  ------------------
  137|   402k|        s >= td->td_samplesperpixel)
  ------------------
  |  Branch (137:9): [True: 493, False: 401k]
  ------------------
  138|    493|    {
  139|    493|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Sample out of range, max %lu",
  140|    493|                      (unsigned long)s,
  141|    493|                      (unsigned long)(td->td_samplesperpixel - 1));
  142|    493|        return (0);
  143|    493|    }
  144|  1.44M|    return (1);
  145|  1.44M|}
TIFFNumberOfTiles:
  151|  10.9k|{
  152|  10.9k|    TIFFDirectory *td = &tif->tif_dir;
  153|  10.9k|    uint32_t dx = td->td_tilewidth;
  154|  10.9k|    uint32_t dy = td->td_tilelength;
  155|  10.9k|    uint32_t dz = td->td_tiledepth;
  156|  10.9k|    uint32_t ntiles;
  157|       |
  158|  10.9k|    if (dx == (uint32_t)-1)
  ------------------
  |  Branch (158:9): [True: 3, False: 10.9k]
  ------------------
  159|      3|        dx = td->td_imagewidth;
  160|  10.9k|    if (dy == (uint32_t)-1)
  ------------------
  |  Branch (160:9): [True: 6, False: 10.9k]
  ------------------
  161|      6|        dy = td->td_imagelength;
  162|  10.9k|    if (dz == (uint32_t)-1)
  ------------------
  |  Branch (162:9): [True: 9, False: 10.9k]
  ------------------
  163|      9|        dz = td->td_imagedepth;
  164|  10.9k|    ntiles =
  165|  10.9k|        (dx == 0 || dy == 0 || dz == 0)
  ------------------
  |  Branch (165:10): [True: 49, False: 10.8k]
  |  Branch (165:21): [True: 62, False: 10.8k]
  |  Branch (165:32): [True: 1, False: 10.8k]
  ------------------
  166|  10.9k|            ? 0
  167|  10.9k|            : _TIFFMultiply32(
  168|  10.8k|                  tif,
  169|  10.8k|                  _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),
  ------------------
  |  |  316|  10.8k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 10.7k, False: 4]
  |  |  ------------------
  |  |  317|  10.8k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  10.8k|         : 0U)
  ------------------
  170|  10.8k|                                  TIFFhowmany_32(td->td_imagelength, dy),
  ------------------
  |  |  316|  10.8k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 10.7k, False: 20]
  |  |  ------------------
  |  |  317|  10.8k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  10.8k|         : 0U)
  ------------------
  171|  10.8k|                                  "TIFFNumberOfTiles"),
  172|  10.8k|                  TIFFhowmany_32(td->td_imagedepth, dz), "TIFFNumberOfTiles");
  ------------------
  |  |  316|  10.8k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (316:6): [True: 10.8k, False: 2]
  |  |  ------------------
  |  |  317|  10.8k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  318|  10.8k|         : 0U)
  ------------------
  173|  10.9k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  10.9k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (173:9): [True: 1.10k, False: 9.81k]
  ------------------
  174|  1.10k|        ntiles = _TIFFMultiply32(tif, ntiles, td->td_samplesperpixel,
  175|  1.10k|                                 "TIFFNumberOfTiles");
  176|  10.9k|    return (ntiles);
  177|  10.9k|}
TIFFTileRowSize64:
  183|  1.43M|{
  184|  1.43M|    static const char module[] = "TIFFTileRowSize64";
  185|  1.43M|    TIFFDirectory *td = &tif->tif_dir;
  186|  1.43M|    uint64_t rowsize;
  187|  1.43M|    uint64_t tilerowsize;
  188|       |
  189|  1.43M|    if (td->td_tilelength == 0)
  ------------------
  |  Branch (189:9): [True: 0, False: 1.43M]
  ------------------
  190|      0|    {
  191|      0|        TIFFErrorExtR(tif, module, "Tile length is zero");
  192|      0|        return 0;
  193|      0|    }
  194|  1.43M|    if (td->td_tilewidth == 0)
  ------------------
  |  Branch (194:9): [True: 0, False: 1.43M]
  ------------------
  195|      0|    {
  196|      0|        TIFFErrorExtR(tif, module, "Tile width is zero");
  197|      0|        return (0);
  198|      0|    }
  199|  1.43M|    rowsize = _TIFFMultiply64(tif, td->td_bitspersample, td->td_tilewidth,
  200|  1.43M|                              "TIFFTileRowSize");
  201|  1.43M|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.43M|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (201:9): [True: 1.25M, False: 177k]
  ------------------
  202|  1.25M|    {
  203|  1.25M|        if (td->td_samplesperpixel == 0)
  ------------------
  |  Branch (203:13): [True: 0, False: 1.25M]
  ------------------
  204|      0|        {
  205|      0|            TIFFErrorExtR(tif, module, "Samples per pixel is zero");
  206|      0|            return 0;
  207|      0|        }
  208|  1.25M|        rowsize = _TIFFMultiply64(tif, rowsize, td->td_samplesperpixel,
  209|  1.25M|                                  "TIFFTileRowSize");
  210|  1.25M|    }
  211|  1.43M|    tilerowsize = TIFFhowmany8_64(rowsize);
  ------------------
  |  |  330|  1.43M|    (((x) & 0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
  |  |  ------------------
  |  |  |  Branch (330:6): [True: 466k, False: 968k]
  |  |  ------------------
  ------------------
  212|  1.43M|    if (tilerowsize == 0)
  ------------------
  |  Branch (212:9): [True: 2, False: 1.43M]
  ------------------
  213|      2|    {
  214|      2|        TIFFErrorExtR(tif, module, "Computed tile row size is zero");
  215|      2|        return 0;
  216|      2|    }
  217|  1.43M|    return (tilerowsize);
  218|  1.43M|}
TIFFTileRowSize:
  220|   971k|{
  221|   971k|    static const char module[] = "TIFFTileRowSize";
  222|   971k|    uint64_t m;
  223|   971k|    m = TIFFTileRowSize64(tif);
  224|   971k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  225|   971k|}
TIFFVTileSize64:
  231|   478k|{
  232|   478k|    return _TIFFStrileSize64(tif, nrows, /* isStrip = */ FALSE);
  ------------------
  |  |   75|   478k|#define FALSE 0
  ------------------
  233|   478k|}
TIFFTileSize64:
  247|   476k|{
  248|   476k|    return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength));
  249|   476k|}
TIFFTileSize:
  251|   444k|{
  252|   444k|    static const char module[] = "TIFFTileSize";
  253|   444k|    uint64_t m;
  254|   444k|    m = TIFFTileSize64(tif);
  255|   444k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  256|   444k|}

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

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

TIFFInitZIP:
  714|  1.06k|{
  715|  1.06k|    static const char module[] = "TIFFInitZIP";
  716|  1.06k|    ZIPState *sp;
  717|       |
  718|  1.06k|    assert((scheme == COMPRESSION_DEFLATE) ||
  ------------------
  |  Branch (718:5): [True: 1.06k, False: 0]
  |  Branch (718:5): [True: 0, False: 0]
  |  Branch (718:5): [True: 6, False: 1.05k]
  |  Branch (718:5): [True: 1.05k, False: 0]
  ------------------
  719|  1.06k|           (scheme == COMPRESSION_ADOBE_DEFLATE));
  720|       |#ifdef NDEBUG
  721|       |    (void)scheme;
  722|       |#endif
  723|       |
  724|       |    /*
  725|       |     * Merge codec-specific tag information.
  726|       |     */
  727|  1.06k|    if (!_TIFFMergeFields(tif, zipFields, TIFFArrayCount(zipFields)))
  ------------------
  |  |  354|  1.06k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (727:9): [True: 0, False: 1.06k]
  ------------------
  728|      0|    {
  729|      0|        TIFFErrorExtR(tif, module,
  730|      0|                      "Merging Deflate codec-specific tags failed");
  731|      0|        return 0;
  732|      0|    }
  733|       |
  734|       |    /*
  735|       |     * Allocate state block so tag methods have storage to record values.
  736|       |     */
  737|  1.06k|    tif->tif_data = (uint8_t *)_TIFFcallocExt(tif, 1, sizeof(ZIPState));
  738|  1.06k|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (738:9): [True: 0, False: 1.06k]
  ------------------
  739|      0|        goto bad;
  740|  1.06k|    sp = GetZIPState(tif);
  ------------------
  |  |   88|  1.06k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  741|  1.06k|    sp->stream.zalloc = TIFF_zalloc;
  742|  1.06k|    sp->stream.zfree = TIFF_zfree;
  743|  1.06k|    sp->stream.opaque = tif;
  744|  1.06k|    sp->stream.data_type = Z_BINARY;
  745|       |
  746|       |    /*
  747|       |     * Override parent get/set field methods.
  748|       |     */
  749|  1.06k|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  750|  1.06k|    tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */
  751|  1.06k|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  752|  1.06k|    tif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */
  753|       |
  754|       |    /* Default values for codec-specific fields */
  755|  1.06k|    sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */
  756|  1.06k|    sp->state = 0;
  757|       |#if LIBDEFLATE_SUPPORT
  758|       |    sp->subcodec = DEFLATE_SUBCODEC_LIBDEFLATE;
  759|       |#else
  760|  1.06k|    sp->subcodec = DEFLATE_SUBCODEC_ZLIB;
  ------------------
  |  |  767|  1.06k|#define DEFLATE_SUBCODEC_ZLIB 0
  ------------------
  761|  1.06k|#endif
  762|       |
  763|       |    /*
  764|       |     * Install codec methods.
  765|       |     */
  766|  1.06k|    tif->tif_fixuptags = ZIPFixupTags;
  767|  1.06k|    tif->tif_setupdecode = ZIPSetupDecode;
  768|  1.06k|    tif->tif_predecode = ZIPPreDecode;
  769|  1.06k|    tif->tif_decoderow = ZIPDecode;
  770|  1.06k|    tif->tif_decodestrip = ZIPDecode;
  771|  1.06k|    tif->tif_decodetile = ZIPDecode;
  772|  1.06k|    tif->tif_setupencode = ZIPSetupEncode;
  773|  1.06k|    tif->tif_preencode = ZIPPreEncode;
  774|  1.06k|    tif->tif_postencode = ZIPPostEncode;
  775|  1.06k|    tif->tif_encoderow = ZIPEncode;
  776|  1.06k|    tif->tif_encodestrip = ZIPEncode;
  777|  1.06k|    tif->tif_encodetile = ZIPEncode;
  778|  1.06k|    tif->tif_cleanup = ZIPCleanup;
  779|  1.06k|    tif->tif_getmaxcompressionratio = ZIPGetMaxCompressionRatio;
  780|       |    /*
  781|       |     * Setup predictor setup.
  782|       |     */
  783|  1.06k|    (void)TIFFPredictorInit(tif);
  784|  1.06k|    return (1);
  785|      0|bad:
  786|      0|    TIFFErrorExtR(tif, module, "No space for ZIP state block");
  787|      0|    return (0);
  788|  1.06k|}
tif_zip.c:TIFF_zalloc:
  688|  1.62k|{
  689|  1.62k|    static const char module[] = "TIFF_zalloc";
  690|  1.62k|    TIFF *tif = (TIFF *)opaque;
  691|       |
  692|  1.62k|    if (items > ~(size_t)0 / size)
  ------------------
  |  Branch (692:9): [True: 0, False: 1.62k]
  ------------------
  693|      0|    {
  694|      0|        TIFFErrorExtR(tif, module, "Overflow");
  695|      0|        return NULL;
  696|      0|    }
  697|       |
  698|  1.62k|    return _TIFFmallocExt(tif, items * size);
  699|  1.62k|}
tif_zip.c:TIFF_zfree:
  702|  1.62k|{
  703|  1.62k|    _TIFFfreeExt((TIFF *)opaque, ptr);
  704|  1.62k|}
tif_zip.c:ZIPVGetField:
  661|  11.4k|{
  662|  11.4k|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|  11.4k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  663|       |
  664|  11.4k|    switch (tag)
  665|  11.4k|    {
  666|      0|        case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  739|      0|#define TIFFTAG_ZIPQUALITY 65557      /* compression quality level */
  ------------------
  |  Branch (666:9): [True: 0, False: 11.4k]
  ------------------
  667|      0|            *va_arg(ap, int *) = sp->zipquality;
  668|      0|            break;
  669|       |
  670|      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 (670:9): [True: 0, False: 11.4k]
  ------------------
  671|      0|            *va_arg(ap, int *) = sp->subcodec;
  672|      0|            break;
  673|       |
  674|  11.4k|        default:
  ------------------
  |  Branch (674:9): [True: 11.4k, False: 0]
  ------------------
  675|  11.4k|            return (*sp->vgetparent)(tif, tag, ap);
  676|  11.4k|    }
  677|      0|    return (1);
  678|  11.4k|}
tif_zip.c:ZIPVSetField:
  594|  5.13k|{
  595|  5.13k|    static const char module[] = "ZIPVSetField";
  596|  5.13k|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|  5.13k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  597|       |
  598|  5.13k|    switch (tag)
  599|  5.13k|    {
  600|      0|        case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  739|      0|#define TIFFTAG_ZIPQUALITY 65557      /* compression quality level */
  ------------------
  |  Branch (600:9): [True: 0, False: 5.13k]
  ------------------
  601|      0|            sp->zipquality = (int)va_arg(ap, int);
  602|      0|            if (sp->zipquality < Z_DEFAULT_COMPRESSION ||
  ------------------
  |  Branch (602:17): [True: 0, False: 0]
  ------------------
  603|      0|                sp->zipquality > LIBDEFLATE_MAX_COMPRESSION_LEVEL)
  ------------------
  |  |   46|      0|#define LIBDEFLATE_MAX_COMPRESSION_LEVEL 12
  ------------------
  |  Branch (603:17): [True: 0, False: 0]
  ------------------
  604|      0|            {
  605|      0|                TIFFErrorExtR(
  606|      0|                    tif, module,
  607|      0|                    "Invalid ZipQuality value. Should be in [-1,%d] range",
  608|      0|                    LIBDEFLATE_MAX_COMPRESSION_LEVEL);
  ------------------
  |  |   46|      0|#define LIBDEFLATE_MAX_COMPRESSION_LEVEL 12
  ------------------
  609|      0|                return 0;
  610|      0|            }
  611|       |
  612|      0|            if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|      0|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (612:17): [True: 0, False: 0]
  ------------------
  613|      0|            {
  614|      0|                int cappedQuality = sp->zipquality;
  615|      0|                if (cappedQuality > Z_BEST_COMPRESSION)
  ------------------
  |  Branch (615:21): [True: 0, False: 0]
  ------------------
  616|      0|                    cappedQuality = Z_BEST_COMPRESSION;
  617|      0|                if (deflateParams(&sp->stream, cappedQuality,
  ------------------
  |  Branch (617:21): [True: 0, False: 0]
  ------------------
  618|      0|                                  Z_DEFAULT_STRATEGY) != Z_OK)
  619|      0|                {
  620|      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]
  |  |  ------------------
  ------------------
  621|      0|                    return (0);
  622|      0|                }
  623|      0|            }
  624|       |
  625|       |#if LIBDEFLATE_SUPPORT
  626|       |            if (sp->libdeflate_enc)
  627|       |            {
  628|       |                libdeflate_free_compressor(sp->libdeflate_enc);
  629|       |                sp->libdeflate_enc = NULL;
  630|       |            }
  631|       |#endif
  632|       |
  633|      0|            return (1);
  634|       |
  635|      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 (635:9): [True: 0, False: 5.13k]
  ------------------
  636|      0|            sp->subcodec = (int)va_arg(ap, int);
  637|      0|            if (sp->subcodec != DEFLATE_SUBCODEC_ZLIB &&
  ------------------
  |  |  767|      0|#define DEFLATE_SUBCODEC_ZLIB 0
  ------------------
  |  Branch (637:17): [True: 0, False: 0]
  ------------------
  638|      0|                sp->subcodec != DEFLATE_SUBCODEC_LIBDEFLATE)
  ------------------
  |  |  768|      0|#define DEFLATE_SUBCODEC_LIBDEFLATE 1
  ------------------
  |  Branch (638:17): [True: 0, False: 0]
  ------------------
  639|      0|            {
  640|      0|                TIFFErrorExtR(tif, module, "Invalid DeflateCodec value.");
  641|      0|                return 0;
  642|      0|            }
  643|      0|#if !LIBDEFLATE_SUPPORT
  644|      0|            if (sp->subcodec == DEFLATE_SUBCODEC_LIBDEFLATE)
  ------------------
  |  |  768|      0|#define DEFLATE_SUBCODEC_LIBDEFLATE 1
  ------------------
  |  Branch (644:17): [True: 0, False: 0]
  ------------------
  645|      0|            {
  646|      0|                TIFFErrorExtR(tif, module,
  647|      0|                              "DeflateCodec = DEFLATE_SUBCODEC_LIBDEFLATE "
  648|      0|                              "unsupported in this build");
  649|      0|                return 0;
  650|      0|            }
  651|      0|#endif
  652|      0|            return 1;
  653|       |
  654|  5.13k|        default:
  ------------------
  |  Branch (654:9): [True: 5.13k, False: 0]
  ------------------
  655|  5.13k|            return (*sp->vsetparent)(tif, tag, ap);
  656|  5.13k|    }
  657|       |    /*NOTREACHED*/
  658|  5.13k|}
tif_zip.c:ZIPFixupTags:
   96|  1.02k|{
   97|  1.02k|    (void)tif;
   98|  1.02k|    return (1);
   99|  1.02k|}
tif_zip.c:ZIPSetupDecode:
  102|  1.01k|{
  103|  1.01k|    static const char module[] = "ZIPSetupDecode";
  104|  1.01k|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|  1.01k|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|  1.01k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  105|       |
  106|  1.01k|    assert(sp != NULL);
  ------------------
  |  Branch (106:5): [True: 0, False: 1.01k]
  |  Branch (106:5): [True: 1.01k, False: 0]
  ------------------
  107|       |
  108|       |    /* if we were last encoding, terminate this mode */
  109|  1.01k|    if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|  1.01k|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (109:9): [True: 0, False: 1.01k]
  ------------------
  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|  1.01k|    if ((sp->state & ZSTATE_INIT_DECODE) == 0 &&
  ------------------
  |  |   81|  1.01k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (118:9): [True: 1.01k, False: 1]
  ------------------
  119|  1.01k|        inflateInit(&sp->stream) != Z_OK)
  ------------------
  |  Branch (119:9): [True: 0, False: 1.01k]
  ------------------
  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|  1.01k|    else
  125|  1.01k|    {
  126|  1.01k|        sp->state |= ZSTATE_INIT_DECODE;
  ------------------
  |  |   81|  1.01k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  127|  1.01k|        return (1);
  128|  1.01k|    }
  129|  1.01k|}
tif_zip.c:ZIPPreDecode:
  145|  40.8k|{
  146|  40.8k|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|  40.8k|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|  40.8k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  147|       |
  148|  40.8k|    (void)s;
  149|  40.8k|    assert(sp != NULL);
  ------------------
  |  Branch (149:5): [True: 0, False: 40.8k]
  |  Branch (149:5): [True: 40.8k, False: 0]
  ------------------
  150|       |
  151|  40.8k|    if ((sp->state & ZSTATE_INIT_DECODE) == 0)
  ------------------
  |  |   81|  40.8k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (151:9): [True: 0, False: 40.8k]
  ------------------
  152|      0|        tif->tif_setupdecode(tif);
  153|       |
  154|       |#if LIBDEFLATE_SUPPORT
  155|       |    sp->libdeflate_state = -1;
  156|       |#endif
  157|  40.8k|    sp->stream.next_in = tif->tif_rawdata;
  158|  40.8k|    assert(sizeof(sp->stream.avail_in) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (158:5): [True: 0, Folded]
  |  Branch (158:5): [True: 40.8k, 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|  40.8k|    sp->stream.avail_in =
  163|  40.8k|        TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)tif->tif_rawcc);
  164|  40.8k|    if (inflateReset(&sp->stream) == Z_OK)
  ------------------
  |  Branch (164:9): [True: 40.8k, False: 0]
  ------------------
  165|  40.8k|    {
  166|  40.8k|        sp->read_error = 0;
  167|  40.8k|        return 1;
  168|  40.8k|    }
  169|      0|    return 0;
  170|  40.8k|}
tif_zip.c:TIFF_CLAMP_UINT64_TO_INT32_MAX:
  137|   317k|{
  138|       |    return (uInt)TIFF_MIN_UINT64(v, INT32_MAX);
  139|   317k|}
tif_zip.c:TIFF_MIN_UINT64:
  132|   317k|{
  133|   317k|    return a < b ? a : b;
  ------------------
  |  Branch (133:12): [True: 317k, False: 0]
  ------------------
  134|   317k|}
tif_zip.c:ZIPDecode:
  173|   127k|{
  174|   127k|    static const char module[] = "ZIPDecode";
  175|   127k|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|   127k|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|   127k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  176|       |
  177|   127k|    (void)s;
  178|   127k|    assert(sp != NULL);
  ------------------
  |  Branch (178:5): [True: 0, False: 127k]
  |  Branch (178:5): [True: 127k, False: 0]
  ------------------
  179|   127k|    assert(sp->state == ZSTATE_INIT_DECODE);
  ------------------
  |  Branch (179:5): [True: 0, False: 127k]
  |  Branch (179:5): [True: 127k, False: 0]
  ------------------
  180|       |
  181|   127k|    if (sp->read_error)
  ------------------
  |  Branch (181:9): [True: 16, False: 127k]
  ------------------
  182|     16|    {
  183|     16|        memset(op, 0, (size_t)occ);
  184|     16|        TIFFErrorExtR(tif, module,
  185|     16|                      "ZIPDecode: Scanline %" PRIu32 " cannot be read due to "
  186|     16|                      "previous error",
  187|     16|                      tif->tif_dir.td_row);
  188|     16|        return 0;
  189|     16|    }
  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|       |            if (res == LIBDEFLATE_SUCCESS)
  246|       |            {
  247|       |                tif->tif_rawcp += tif->tif_rawcc;
  248|       |                tif->tif_rawcc = 0;
  249|       |                return 1;
  250|       |            }
  251|       |
  252|       |            /* There are odd files in the wild where the last strip, when it
  253|       |             * is smaller in height than td_rowsperstrip, actually contains
  254|       |             * data for td_rowsperstrip lines. libdeflate reports them as
  255|       |             * LIBDEFLATE_INSUFFICIENT_SPACE and leaves the output buffer
  256|       |             * undefined (stored blocks are not copied at all), so decode them
  257|       |             * again with zlib, which stops at occ and ignores the extra data.
  258|       |             */
  259|       |            if (res == LIBDEFLATE_INSUFFICIENT_SPACE)
  260|       |                break;
  261|       |
  262|       |            memset(op, 0, (size_t)occ);
  263|       |            TIFFErrorExtR(tif, module, "Decoding error at scanline %lu",
  264|       |                          (unsigned long)tif->tif_dir.td_row);
  265|       |            sp->read_error = 1;
  266|       |            return 0;
  267|       |        }
  268|       |    } while (0);
  269|       |    sp->libdeflate_state = 0;
  270|       |#endif /* LIBDEFLATE_SUPPORT */
  271|       |
  272|   127k|    sp->stream.next_in = tif->tif_rawcp;
  273|       |
  274|   127k|    sp->stream.next_out = op;
  275|   127k|    assert(sizeof(sp->stream.avail_out) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (275:5): [True: 0, Folded]
  |  Branch (275:5): [True: 127k, Folded]
  ------------------
  276|       |         we need to simplify this code to reflect a ZLib that is likely updated
  277|       |         to deal with 8byte memory sizes, though this code will respond
  278|       |         appropriately even before we simplify it */
  279|   127k|    do
  280|   138k|    {
  281|   138k|        int state;
  282|   138k|        uInt avail_in_before =
  283|   138k|            TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)tif->tif_rawcc);
  284|   138k|        uInt avail_out_before = TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)occ);
  285|   138k|        sp->stream.avail_in = avail_in_before;
  286|   138k|        sp->stream.avail_out = avail_out_before;
  287|   138k|        state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
  288|   138k|        tif->tif_rawcc -= (avail_in_before - sp->stream.avail_in);
  289|   138k|        occ -= (avail_out_before - sp->stream.avail_out);
  290|   138k|        if (state == Z_STREAM_END)
  ------------------
  |  Branch (290:13): [True: 211, False: 138k]
  ------------------
  291|    211|            break;
  292|   138k|        if (state == Z_DATA_ERROR)
  ------------------
  |  Branch (292:13): [True: 26.7k, False: 111k]
  ------------------
  293|  26.7k|        {
  294|  26.7k|            memset(sp->stream.next_out, 0, (size_t)occ);
  295|  26.7k|            TIFFErrorExtR(tif, module, "Decoding error at scanline %lu, %s",
  296|  26.7k|                          (unsigned long)tif->tif_dir.td_row, SAFE_MSG(sp));
  ------------------
  |  |   60|  26.7k|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 0, False: 26.7k]
  |  |  ------------------
  ------------------
  297|  26.7k|            sp->read_error = 1;
  298|  26.7k|            return (0);
  299|  26.7k|        }
  300|   111k|        if (state != Z_OK)
  ------------------
  |  Branch (300:13): [True: 11.3k, False: 100k]
  ------------------
  301|  11.3k|        {
  302|  11.3k|            memset(sp->stream.next_out, 0, (size_t)occ);
  303|  11.3k|            TIFFErrorExtR(tif, module, "ZLib error: %s", SAFE_MSG(sp));
  ------------------
  |  |   60|  11.3k|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 11.3k, False: 0]
  |  |  ------------------
  ------------------
  304|  11.3k|            sp->read_error = 1;
  305|  11.3k|            return (0);
  306|  11.3k|        }
  307|   111k|    } while (occ > 0);
  ------------------
  |  Branch (307:14): [True: 11.0k, False: 89.2k]
  ------------------
  308|  89.4k|    if (occ != 0)
  ------------------
  |  Branch (308:9): [True: 211, False: 89.2k]
  ------------------
  309|    211|    {
  310|    211|        TIFFErrorExtR(tif, module,
  311|    211|                      "Not enough data at scanline %lu (short %" PRIu64
  312|    211|                      " bytes)",
  313|    211|                      (unsigned long)tif->tif_dir.td_row, (uint64_t)occ);
  314|    211|        memset(sp->stream.next_out, 0, (size_t)occ);
  315|    211|        sp->read_error = 1;
  316|    211|        return (0);
  317|    211|    }
  318|       |
  319|  89.2k|    tif->tif_rawcp = sp->stream.next_in;
  320|       |
  321|  89.2k|    return (1);
  322|  89.4k|}
tif_zip.c:ZIPCleanup:
  559|  1.06k|{
  560|  1.06k|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|  1.06k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  561|       |
  562|  1.06k|    assert(sp != 0);
  ------------------
  |  Branch (562:5): [True: 0, False: 1.06k]
  |  Branch (562:5): [True: 1.06k, False: 0]
  ------------------
  563|       |
  564|  1.06k|    (void)TIFFPredictorCleanup(tif);
  565|       |
  566|  1.06k|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
  567|  1.06k|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
  568|       |
  569|  1.06k|    if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|  1.06k|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (569:9): [True: 0, False: 1.06k]
  ------------------
  570|      0|    {
  571|      0|        deflateEnd(&sp->stream);
  572|      0|        sp->state = 0;
  573|      0|    }
  574|  1.06k|    else if (sp->state & ZSTATE_INIT_DECODE)
  ------------------
  |  |   81|  1.06k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (574:14): [True: 1.01k, False: 55]
  ------------------
  575|  1.01k|    {
  576|  1.01k|        inflateEnd(&sp->stream);
  577|  1.01k|        sp->state = 0;
  578|  1.01k|    }
  579|       |
  580|       |#if LIBDEFLATE_SUPPORT
  581|       |    if (sp->libdeflate_dec)
  582|       |        libdeflate_free_decompressor(sp->libdeflate_dec);
  583|       |    if (sp->libdeflate_enc)
  584|       |        libdeflate_free_compressor(sp->libdeflate_enc);
  585|       |#endif
  586|       |
  587|  1.06k|    _TIFFfreeExt(tif, sp);
  588|  1.06k|    tif->tif_data = NULL;
  589|       |
  590|  1.06k|    _TIFFSetDefaultCompressionState(tif);
  591|  1.06k|}
tif_zip.c:ZIPGetMaxCompressionRatio:
  707|      1|{
  708|      1|    (void)tif;
  709|       |    /* cf https://zlib.net/zlib_tech.html */
  710|      1|    return 1032;
  711|      1|}

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

inflate_fast:
  215|  67.0k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
  216|  67.0k|    struct inflate_state FAR *state;
  217|  67.0k|    z_const unsigned char FAR *in;      /* local strm->next_in */
  218|  67.0k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
  219|  67.0k|    unsigned char FAR *out;     /* local strm->next_out */
  220|  67.0k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
  221|  67.0k|    unsigned char FAR *end;     /* while out < end, enough space available */
  222|       |#ifdef INFLATE_STRICT
  223|       |    unsigned dmax;              /* maximum distance from zlib header */
  224|       |#endif
  225|  67.0k|    unsigned wsize;             /* window size or zero if not using window */
  226|  67.0k|    unsigned whave;             /* valid bytes in the window */
  227|  67.0k|    unsigned wnext;             /* window write index */
  228|  67.0k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
  229|  67.0k|#if Z_INFLATE_FETCH != 8
  230|  67.0k|    int back;                   /* decoding into the window: inflateBack() */
  231|  67.0k|#endif
  232|  67.0k|    unsigned long hold;         /* local strm->hold */
  233|  67.0k|    unsigned bits;              /* local strm->bits */
  234|  67.0k|    code const FAR *lcode;      /* local strm->lencode */
  235|  67.0k|    code const FAR *dcode;      /* local strm->distcode */
  236|  67.0k|    unsigned lmask;             /* mask for first level of length codes */
  237|  67.0k|    unsigned dmask;             /* mask for first level of distance codes */
  238|  67.0k|    code const *here;           /* retrieved table entry */
  239|  67.0k|    unsigned op;                /* code bits, operation, extra bits, or */
  240|       |                                /*  window position, window bytes to copy */
  241|  67.0k|    unsigned len;               /* match length, unused bytes */
  242|  67.0k|    unsigned dist;              /* match distance */
  243|  67.0k|    unsigned char FAR *from;    /* where to copy match from */
  244|  67.0k|#if Z_INFLATE_FETCH == 64
  245|  67.0k|    Z_U8 hold8;                 /* 64-bit bit buffer of the fast loop */
  ------------------
  |  |   56|  67.0k|#    define Z_U8 unsigned long
  ------------------
  246|  67.0k|    z_const unsigned char FAR *last8;   /* two refills fit after in */
  247|  67.0k|    unsigned char FAR *end8;    /* room for two literals, a match, 15 more */
  248|  67.0k|#endif
  249|       |#if Z_INFLATE_FETCH == 32
  250|       |    Z_U4 hold4;                 /* 32-bit bit buffer of the fast loop */
  251|       |    z_const unsigned char FAR *last4;   /* three refills fit after in */
  252|       |    unsigned char FAR *end4;    /* room for a match and fifteen more */
  253|       |#endif
  254|       |
  255|       |    /* copy state to local variables */
  256|  67.0k|    state = (struct inflate_state FAR *)strm->state;
  257|  67.0k|    in = strm->next_in;
  258|  67.0k|    last = in + (strm->avail_in - 5);
  259|  67.0k|    out = strm->next_out;
  260|  67.0k|    beg = out - (start - strm->avail_out);
  261|  67.0k|    end = out + (strm->avail_out - 257);
  262|       |#ifdef INFLATE_STRICT
  263|       |    dmax = state->dmax;
  264|       |#endif
  265|  67.0k|    wsize = state->wsize;
  266|  67.0k|    whave = state->whave;
  267|  67.0k|    wnext = state->wnext;
  268|  67.0k|    window = state->window;
  269|  67.0k|#if Z_INFLATE_FETCH != 8
  270|       |    /* For inflateBack(), only use the loop at the end, which does not write
  271|       |       past the end of the copy. */
  272|  67.0k|    back = window != Z_NULL && out + strm->avail_out == window + wsize;
  ------------------
  |  |  216|   134k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (272:12): [True: 61.2k, False: 5.86k]
  |  Branch (272:32): [True: 0, False: 61.2k]
  ------------------
  273|  67.0k|#endif
  274|  67.0k|    hold = state->hold;
  275|  67.0k|    bits = state->bits;
  276|  67.0k|    lcode = state->lencode;
  277|  67.0k|    dcode = state->distcode;
  278|  67.0k|    lmask = (1U << state->lenbits) - 1;
  279|  67.0k|    dmask = (1U << state->distbits) - 1;
  280|       |
  281|  67.0k|#if Z_INFLATE_FETCH == 64
  282|       |    /* Fast loop, while sixteen bytes are available at in (two refills of eight
  283|       |       bytes, the first advancing in by up to seven) and the output has room
  284|       |       for the longest match plus 17 bytes (one iteration can write two
  285|       |       literals and then a match, and copy_back() may write 15 bytes past the
  286|       |       match). Each length/literal code starts with at least 56 bits in hold8,
  287|       |       enough for a length/distance pair (at most 48 bits). */
  288|  67.0k|    if (!back && strm->avail_in >= 16 && strm->avail_out >= 2 + 258 + 15) {
  ------------------
  |  Branch (288:9): [True: 67.0k, False: 0]
  |  Branch (288:18): [True: 61.2k, False: 5.86k]
  |  Branch (288:42): [True: 59.9k, False: 1.29k]
  ------------------
  289|  59.9k|        last8 = in + (strm->avail_in - 16);
  290|  59.9k|        end8 = out + (strm->avail_out - (2 + 258 + 15));
  291|  59.9k|        hold8 = hold;
  292|  2.05M|        do {
  293|  2.05M|            hold8 |= load64(in) << bits;
  294|  2.05M|            in += (63 - bits) >> 3;
  295|  2.05M|            bits |= 56;
  296|  2.05M|            here = lcode + (hold8 & lmask);
  297|  2.05M|            if (here->op == 0) {        /* up to three literals a refill */
  ------------------
  |  Branch (297:17): [True: 1.13M, False: 918k]
  ------------------
  298|  1.13M|                hold8 >>= here->bits;
  299|  1.13M|                bits -= here->bits;
  300|  1.13M|                TRACE_LITERAL(here);
  301|  1.13M|                *out++ = (unsigned char)(here->val);
  302|  1.13M|                here = lcode + (hold8 & lmask);
  303|  1.13M|                if (here->op == 0) {
  ------------------
  |  Branch (303:21): [True: 1.02M, False: 109k]
  ------------------
  304|  1.02M|                    hold8 >>= here->bits;
  305|  1.02M|                    bits -= here->bits;
  306|  1.02M|                    TRACE_LITERAL(here);
  307|  1.02M|                    *out++ = (unsigned char)(here->val);
  308|  1.02M|                    here = lcode + (hold8 & lmask);
  309|  1.02M|                    if (here->op == 0) {
  ------------------
  |  Branch (309:25): [True: 591k, False: 436k]
  ------------------
  310|   591k|                        hold8 >>= here->bits;
  311|   591k|                        bits -= here->bits;
  312|   591k|                        TRACE_LITERAL(here);
  313|   591k|                        *out++ = (unsigned char)(here->val);
  314|   591k|                        continue;
  315|   591k|                    }
  316|  1.02M|                }
  317|   546k|                hold8 |= load64(in) << bits;    /* 56 bits for a pair */
  318|   546k|                in += (63 - bits) >> 3;
  319|   546k|                bits |= 56;
  320|   546k|            }
  321|  2.22M|          dolen8:
  322|  2.22M|            op = (unsigned)(here->bits);
  323|  2.22M|            hold8 >>= op;
  324|  2.22M|            bits -= op;
  325|  2.22M|            op = (unsigned)(here->op);
  326|  2.22M|            if (op == 0) {                      /* literal */
  ------------------
  |  Branch (326:17): [True: 13.1k, False: 2.21M]
  ------------------
  327|  13.1k|                TRACE_LITERAL(here);
  328|  13.1k|                *out++ = (unsigned char)(here->val);
  329|  13.1k|            }
  330|  2.21M|            else if (op & 16) {                 /* length base */
  ------------------
  |  Branch (330:22): [True: 1.44M, False: 773k]
  ------------------
  331|  1.44M|                len = (unsigned)(here->val);
  332|  1.44M|                op &= 15;                       /* number of extra bits */
  333|  1.44M|                len += (unsigned)hold8 & ((1U << op) - 1);
  334|  1.44M|                hold8 >>= op;
  335|  1.44M|                bits -= op;
  336|  1.44M|                Tracevv((stderr, "inflate:         length %u\n", len));
  337|  1.44M|                here = dcode + (hold8 & dmask);
  338|  1.47M|              dodist8:
  339|  1.47M|                op = (unsigned)(here->bits);
  340|  1.47M|                hold8 >>= op;
  341|  1.47M|                bits -= op;
  342|  1.47M|                op = (unsigned)(here->op);
  343|  1.47M|                if (op & 16) {                  /* distance base */
  ------------------
  |  Branch (343:21): [True: 1.44M, False: 29.7k]
  ------------------
  344|  1.44M|                    dist = (unsigned)(here->val);
  345|  1.44M|                    op &= 15;                   /* number of extra bits */
  346|  1.44M|                    dist += (unsigned)hold8 & ((1U << op) - 1);
  347|       |#ifdef INFLATE_STRICT
  348|       |                    if (dist > dmax) {
  349|       |                        strm->msg = (z_const char *)
  350|       |                            "invalid distance too far back";
  351|       |                        state->mode = BAD;
  352|       |                        break;
  353|       |                    }
  354|       |#endif
  355|  1.44M|                    hold8 >>= op;
  356|  1.44M|                    bits -= op;
  357|  1.44M|                    Tracevv((stderr, "inflate:         distance %u\n", dist));
  358|  1.44M|                    op = (unsigned)(out - beg); /* max distance in output */
  359|  1.44M|                    if (dist > op) {            /* see if copy from window */
  ------------------
  |  Branch (359:25): [True: 2.82k, False: 1.43M]
  ------------------
  360|  2.82k|                        op = dist - op;         /* distance back in window */
  361|  2.82k|                        if (op > whave) {
  ------------------
  |  Branch (361:29): [True: 440, False: 2.38k]
  ------------------
  362|    440|                            if (state->sane) {
  ------------------
  |  Branch (362:33): [True: 440, False: 0]
  ------------------
  363|    440|                                strm->msg = (z_const char *)
  364|    440|                                    "invalid distance too far back";
  365|    440|                                state->mode = BAD;
  366|    440|                                break;
  367|    440|                            }
  368|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  369|       |                            if (len <= op - whave) {
  370|       |                                do {
  371|       |                                    *out++ = 0;
  372|       |                                } while (--len);
  373|       |                                continue;
  374|       |                            }
  375|       |                            len -= op - whave;
  376|       |                            do {
  377|       |                                *out++ = 0;
  378|       |                            } while (--op > whave);
  379|       |                            if (op == 0) {
  380|       |                                out = copy_back(out, dist, len);
  381|       |                                continue;
  382|       |                            }
  383|       |#endif
  384|    440|                        }
  385|  2.38k|                        from = window;
  386|  2.38k|                        if (wnext == 0)         /* very common case */
  ------------------
  |  Branch (386:29): [True: 90, False: 2.29k]
  ------------------
  387|     90|                            from += wsize - op;
  388|  2.29k|                        else if (wnext < op) {  /* wrap around window */
  ------------------
  |  Branch (388:34): [True: 987, False: 1.30k]
  ------------------
  389|    987|                            from += wsize + wnext - op;
  390|    987|                            op -= wnext;
  391|    987|                            if (op < len) {     /* end of window, then start */
  ------------------
  |  Branch (391:33): [True: 159, False: 828]
  ------------------
  392|    159|                                zmemcpy(out, from, op);
  ------------------
  |  |  306|    159|#    define zmemcpy memcpy
  ------------------
  393|    159|                                out += op;
  394|    159|                                len -= op;
  395|    159|                                from = window;
  396|    159|                                op = wnext;
  397|    159|                            }
  398|    987|                        }
  399|  1.30k|                        else                    /* contiguous in window */
  400|  1.30k|                            from += wnext - op;
  401|  2.38k|                        if (op > len)
  ------------------
  |  Branch (401:29): [True: 1.35k, False: 1.02k]
  ------------------
  402|  1.35k|                            op = len;
  403|  2.38k|                        zmemcpy(out, from, op); /* from the window */
  ------------------
  |  |  306|  2.38k|#    define zmemcpy memcpy
  ------------------
  404|  2.38k|                        out += op;
  405|  2.38k|                        len -= op;
  406|  2.38k|                        if (len)                /* rest from output */
  ------------------
  |  Branch (406:29): [True: 1.02k, False: 1.35k]
  ------------------
  407|  1.02k|                            out = copy_back(out, dist, len);
  408|  2.38k|                    }
  409|  1.43M|                    else
  410|  1.43M|                        out = copy_back(out, dist, len);
  411|  1.44M|                }
  412|  29.7k|                else if ((op & 64) == 0) {      /* 2nd level distance code */
  ------------------
  |  Branch (412:26): [True: 29.1k, False: 563]
  ------------------
  413|  29.1k|                    here = dcode + here->val + (hold8 & ((1U << op) - 1));
  414|  29.1k|                    goto dodist8;
  415|  29.1k|                }
  416|    563|                else {
  417|    563|                    strm->msg = (z_const char *)"invalid distance code";
  418|    563|                    state->mode = BAD;
  419|    563|                    break;
  420|    563|                }
  421|  1.47M|            }
  422|   773k|            else if ((op & 64) == 0) {          /* 2nd level length code */
  ------------------
  |  Branch (422:22): [True: 764k, False: 9.56k]
  ------------------
  423|   764k|                here = lcode + here->val + (hold8 & ((1U << op) - 1));
  424|   764k|                goto dolen8;
  425|   764k|            }
  426|  9.56k|            else if (op & 32) {                 /* end-of-block */
  ------------------
  |  Branch (426:22): [True: 9.32k, False: 246]
  ------------------
  427|  9.32k|                Tracevv((stderr, "inflate:         end of block\n"));
  428|  9.32k|                state->mode = TYPE;
  429|  9.32k|                break;
  430|  9.32k|            }
  431|    246|            else {
  432|    246|                strm->msg = (z_const char *)"invalid literal/length code";
  433|    246|                state->mode = BAD;
  434|    246|                break;
  435|    246|            }
  436|  2.22M|        } while (in <= last8 && out <= end8);
  ------------------
  |  Branch (436:18): [True: 2.04M, False: 4.19k]
  |  Branch (436:33): [True: 1.99M, False: 45.1k]
  ------------------
  437|       |
  438|       |        /* return the whole bytes not used, leaving fewer than eight bits */
  439|  59.9k|        len = bits >> 3;
  440|  59.9k|        in -= len;
  441|  59.9k|        bits -= len << 3;
  442|  59.9k|        hold = (unsigned long)(hold8 & ((1U << bits) - 1));
  443|  59.9k|        if (state->mode != LEN || out >= end)
  ------------------
  |  Branch (443:13): [True: 10.5k, False: 49.3k]
  |  Branch (443:35): [True: 41.4k, False: 7.92k]
  ------------------
  444|  51.9k|            goto leave;
  445|  59.9k|    }
  446|  15.0k|#endif
  447|       |#if Z_INFLATE_FETCH == 32
  448|       |    /* Fast loop with a 32-bit bit buffer, refilled four bytes at a time
  449|       |       without branches. This needs eleven bytes available at in (three refills
  450|       |       of four bytes, the first two advancing in by up to three each) and
  451|       |       enough room in the output for the longest match plus 15 bytes (an
  452|       |       iteration writes up to two literals or one match, which copy_back() may
  453|       |       overrun by fifteen bytes). A refill leaves at least 24 bits, enough for
  454|       |       a length/literal code and its extra bits (at most 20), or a distance
  455|       |       code (at most 15). The distance code gets its own refill, and its extra
  456|       |       bits another refill, when too few bits are left for them. */
  457|       |    if (!back && strm->avail_in >= 11 && strm->avail_out >= 258 + 15) {
  458|       |        last4 = in + (strm->avail_in - 11);
  459|       |        end4 = out + (strm->avail_out - (258 + 15));
  460|       |        hold4 = (Z_U4)hold;
  461|       |        do {
  462|       |            hold4 |= load32(in) << bits;
  463|       |            in += (31 - bits) >> 3;
  464|       |            bits |= 24;
  465|       |            here = lcode + (hold4 & lmask);
  466|       |            if (here->op == 0) {        /* a literal, and another */
  467|       |                hold4 >>= here->bits;
  468|       |                bits -= here->bits;
  469|       |                TRACE_LITERAL(here);
  470|       |                *out++ = (unsigned char)(here->val);
  471|       |                here = lcode + (hold4 & lmask);
  472|       |                if (here->op == 0 && (LENBITS <= 12 || here->bits <= bits)) {
  473|       |                    hold4 >>= here->bits;
  474|       |                    bits -= here->bits;
  475|       |                    TRACE_LITERAL(here);
  476|       |                    *out++ = (unsigned char)(here->val);
  477|       |                }
  478|       |                continue;
  479|       |            }
  480|       |          dolen4:
  481|       |            op = (unsigned)(here->bits);
  482|       |            hold4 >>= op;
  483|       |            bits -= op;
  484|       |            op = (unsigned)(here->op);
  485|       |            if (op == 0) {                      /* literal */
  486|       |                TRACE_LITERAL(here);
  487|       |                *out++ = (unsigned char)(here->val);
  488|       |            }
  489|       |            else if (op & 16) {                 /* length base */
  490|       |                len = (unsigned)(here->val);
  491|       |                op &= 15;                       /* number of extra bits */
  492|       |                len += (unsigned)hold4 & ((1U << op) - 1);
  493|       |                hold4 >>= op;
  494|       |                bits -= op;
  495|       |                Tracevv((stderr, "inflate:         length %u\n", len));
  496|       |                hold4 |= load32(in) << bits;    /* for the distance code */
  497|       |                in += (31 - bits) >> 3;
  498|       |                bits |= 24;
  499|       |                here = dcode + (hold4 & dmask);
  500|       |              dodist4:
  501|       |                op = (unsigned)(here->bits);
  502|       |                hold4 >>= op;
  503|       |                bits -= op;
  504|       |                op = (unsigned)(here->op);
  505|       |                if (op & 16) {                  /* distance base */
  506|       |                    dist = (unsigned)(here->val);
  507|       |                    op &= 15;                   /* number of extra bits */
  508|       |                    if (bits < op) {            /* for long distances */
  509|       |                        hold4 |= load32(in) << bits;
  510|       |                        in += (31 - bits) >> 3;
  511|       |                        bits |= 24;
  512|       |                    }
  513|       |                    dist += (unsigned)hold4 & ((1U << op) - 1);
  514|       |#ifdef INFLATE_STRICT
  515|       |                    if (dist > dmax) {
  516|       |                        strm->msg = (z_const char *)
  517|       |                            "invalid distance too far back";
  518|       |                        state->mode = BAD;
  519|       |                        break;
  520|       |                    }
  521|       |#endif
  522|       |                    hold4 >>= op;
  523|       |                    bits -= op;
  524|       |                    Tracevv((stderr, "inflate:         distance %u\n", dist));
  525|       |                    op = (unsigned)(out - beg); /* max distance in output */
  526|       |                    if (dist > op) {            /* see if copy from window */
  527|       |                        op = dist - op;         /* distance back in window */
  528|       |                        if (op > whave) {
  529|       |                            if (state->sane) {
  530|       |                                strm->msg = (z_const char *)
  531|       |                                    "invalid distance too far back";
  532|       |                                state->mode = BAD;
  533|       |                                break;
  534|       |                            }
  535|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  536|       |                            if (len <= op - whave) {
  537|       |                                do {
  538|       |                                    *out++ = 0;
  539|       |                                } while (--len);
  540|       |                                continue;
  541|       |                            }
  542|       |                            len -= op - whave;
  543|       |                            do {
  544|       |                                *out++ = 0;
  545|       |                            } while (--op > whave);
  546|       |                            if (op == 0) {
  547|       |                                out = copy_back(out, dist, len);
  548|       |                                continue;
  549|       |                            }
  550|       |#endif
  551|       |                        }
  552|       |                        from = window;
  553|       |                        if (wnext == 0)         /* very common case */
  554|       |                            from += wsize - op;
  555|       |                        else if (wnext < op) {  /* wrap around window */
  556|       |                            from += wsize + wnext - op;
  557|       |                            op -= wnext;
  558|       |                            if (op < len) {     /* end of window, then start */
  559|       |                                zmemcpy(out, from, op);
  560|       |                                out += op;
  561|       |                                len -= op;
  562|       |                                from = window;
  563|       |                                op = wnext;
  564|       |                            }
  565|       |                        }
  566|       |                        else                    /* contiguous in window */
  567|       |                            from += wnext - op;
  568|       |                        if (op > len)
  569|       |                            op = len;
  570|       |                        zmemcpy(out, from, op); /* from the window */
  571|       |                        out += op;
  572|       |                        len -= op;
  573|       |                        if (len)                /* rest from output */
  574|       |                            out = copy_back(out, dist, len);
  575|       |                    }
  576|       |                    else
  577|       |                        out = copy_back(out, dist, len);
  578|       |                }
  579|       |                else if ((op & 64) == 0) {      /* 2nd level distance code */
  580|       |                    here = dcode + here->val + (hold4 & ((1U << op) - 1));
  581|       |                    goto dodist4;
  582|       |                }
  583|       |                else {
  584|       |                    strm->msg = (z_const char *)"invalid distance code";
  585|       |                    state->mode = BAD;
  586|       |                    break;
  587|       |                }
  588|       |            }
  589|       |            else if ((op & 64) == 0) {          /* 2nd level length code */
  590|       |                here = lcode + here->val + (hold4 & ((1U << op) - 1));
  591|       |                goto dolen4;
  592|       |            }
  593|       |            else if (op & 32) {                 /* end-of-block */
  594|       |                Tracevv((stderr, "inflate:         end of block\n"));
  595|       |                state->mode = TYPE;
  596|       |                break;
  597|       |            }
  598|       |            else {
  599|       |                strm->msg = (z_const char *)"invalid literal/length code";
  600|       |                state->mode = BAD;
  601|       |                break;
  602|       |            }
  603|       |        } while (in <= last4 && out <= end4);
  604|       |
  605|       |        /* return the whole bytes not used, leaving fewer than eight bits */
  606|       |        len = bits >> 3;
  607|       |        in -= len;
  608|       |        bits -= len << 3;
  609|       |        hold = (unsigned long)(hold4 & ((1U << bits) - 1));
  610|       |        if (state->mode != LEN || in >= last || out >= end)
  611|       |            goto leave;
  612|       |    }
  613|       |#endif
  614|       |
  615|       |    /* decode literals and length/distances until end-of-block or not enough
  616|       |       input data or output space */
  617|  70.5k|    do {
  618|  70.5k|        if (bits < 15) {
  ------------------
  |  Branch (618:13): [True: 36.4k, False: 34.1k]
  ------------------
  619|  36.4k|            hold += (unsigned long)(*in++) << bits;
  620|  36.4k|            bits += 8;
  621|  36.4k|            hold += (unsigned long)(*in++) << bits;
  622|  36.4k|            bits += 8;
  623|  36.4k|        }
  624|  70.5k|        here = lcode + (hold & lmask);
  625|  74.0k|      dolen:
  626|  74.0k|        op = (unsigned)(here->bits);
  627|  74.0k|        hold >>= op;
  628|  74.0k|        bits -= op;
  629|  74.0k|        op = (unsigned)(here->op);
  630|  74.0k|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (630:13): [True: 49.1k, False: 24.8k]
  ------------------
  631|  49.1k|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  632|  49.1k|                    "inflate:         literal '%c'\n" :
  633|  49.1k|                    "inflate:         literal 0x%02x\n", here->val));
  634|  49.1k|            *out++ = (unsigned char)(here->val);
  635|  49.1k|        }
  636|  24.8k|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (636:18): [True: 19.9k, False: 4.90k]
  ------------------
  637|  19.9k|            len = (unsigned)(here->val);
  638|  19.9k|            op &= 15;                           /* number of extra bits */
  639|  19.9k|            if (op) {
  ------------------
  |  Branch (639:17): [True: 5.40k, False: 14.5k]
  ------------------
  640|  5.40k|                if (bits < op) {
  ------------------
  |  Branch (640:21): [True: 467, False: 4.93k]
  ------------------
  641|    467|                    hold += (unsigned long)(*in++) << bits;
  642|    467|                    bits += 8;
  643|    467|                }
  644|  5.40k|                len += (unsigned)hold & ((1U << op) - 1);
  645|  5.40k|                hold >>= op;
  646|  5.40k|                bits -= op;
  647|  5.40k|            }
  648|  19.9k|            Tracevv((stderr, "inflate:         length %u\n", len));
  649|  19.9k|            if (bits < 15) {
  ------------------
  |  Branch (649:17): [True: 5.55k, False: 14.4k]
  ------------------
  650|  5.55k|                hold += (unsigned long)(*in++) << bits;
  651|  5.55k|                bits += 8;
  652|  5.55k|                hold += (unsigned long)(*in++) << bits;
  653|  5.55k|                bits += 8;
  654|  5.55k|            }
  655|  19.9k|            here = dcode + (hold & dmask);
  656|  21.2k|          dodist:
  657|  21.2k|            op = (unsigned)(here->bits);
  658|  21.2k|            hold >>= op;
  659|  21.2k|            bits -= op;
  660|  21.2k|            op = (unsigned)(here->op);
  661|  21.2k|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (661:17): [True: 19.6k, False: 1.60k]
  ------------------
  662|  19.6k|                dist = (unsigned)(here->val);
  663|  19.6k|                op &= 15;                       /* number of extra bits */
  664|  19.6k|                if (bits < op) {
  ------------------
  |  Branch (664:21): [True: 368, False: 19.2k]
  ------------------
  665|    368|                    hold += (unsigned long)(*in++) << bits;
  666|    368|                    bits += 8;
  667|    368|                    if (bits < op) {
  ------------------
  |  Branch (667:25): [True: 0, False: 368]
  ------------------
  668|      0|                        hold += (unsigned long)(*in++) << bits;
  669|      0|                        bits += 8;
  670|      0|                    }
  671|    368|                }
  672|  19.6k|                dist += (unsigned)hold & ((1U << op) - 1);
  673|       |#ifdef INFLATE_STRICT
  674|       |                if (dist > dmax) {
  675|       |                    strm->msg = (z_const char *)
  676|       |                        "invalid distance too far back";
  677|       |                    state->mode = BAD;
  678|       |                    break;
  679|       |                }
  680|       |#endif
  681|  19.6k|                hold >>= op;
  682|  19.6k|                bits -= op;
  683|  19.6k|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  684|  19.6k|                op = (unsigned)(out - beg);     /* max distance in output */
  685|  19.6k|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (685:21): [True: 882, False: 18.7k]
  ------------------
  686|    882|                    op = dist - op;             /* distance back in window */
  687|    882|                    if (op > whave) {
  ------------------
  |  Branch (687:25): [True: 379, False: 503]
  ------------------
  688|    379|                        if (state->sane) {
  ------------------
  |  Branch (688:29): [True: 379, False: 0]
  ------------------
  689|    379|                            strm->msg = (z_const char *)
  690|    379|                                "invalid distance too far back";
  691|    379|                            state->mode = BAD;
  692|    379|                            break;
  693|    379|                        }
  694|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  695|       |                        if (len <= op - whave) {
  696|       |                            do {
  697|       |                                *out++ = 0;
  698|       |                            } while (--len);
  699|       |                            continue;
  700|       |                        }
  701|       |                        len -= op - whave;
  702|       |                        do {
  703|       |                            *out++ = 0;
  704|       |                        } while (--op > whave);
  705|       |                        if (op == 0) {
  706|       |                            from = out - dist;
  707|       |                            do {
  708|       |                                *out++ = *from++;
  709|       |                            } while (--len);
  710|       |                            continue;
  711|       |                        }
  712|       |#endif
  713|    379|                    }
  714|    503|                    from = window;
  715|    503|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (715:25): [True: 37, False: 466]
  ------------------
  716|     37|                        from += wsize - op;
  717|     37|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (717:29): [True: 13, False: 24]
  ------------------
  718|     13|                            len -= op;
  719|    500|                            do {
  720|    500|                                *out++ = *from++;
  721|    500|                            } while (--op);
  ------------------
  |  Branch (721:38): [True: 487, False: 13]
  ------------------
  722|     13|                            from = out - dist;  /* rest from output */
  723|     13|                        }
  724|     37|                    }
  725|    466|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (725:30): [True: 255, False: 211]
  ------------------
  726|    255|                        from += wsize + wnext - op;
  727|    255|                        op -= wnext;
  728|    255|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (728:29): [True: 65, False: 190]
  ------------------
  729|     65|                            len -= op;
  730|  1.37k|                            do {
  731|  1.37k|                                *out++ = *from++;
  732|  1.37k|                            } while (--op);
  ------------------
  |  Branch (732:38): [True: 1.31k, False: 65]
  ------------------
  733|     65|                            from = window;
  734|     65|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (734:33): [True: 13, False: 52]
  ------------------
  735|     13|                                op = wnext;
  736|     13|                                len -= op;
  737|    504|                                do {
  738|    504|                                    *out++ = *from++;
  739|    504|                                } while (--op);
  ------------------
  |  Branch (739:42): [True: 491, False: 13]
  ------------------
  740|     13|                                from = out - dist;      /* rest from output */
  741|     13|                            }
  742|     65|                        }
  743|    255|                    }
  744|    211|                    else {                      /* contiguous in window */
  745|    211|                        from += wnext - op;
  746|    211|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (746:29): [True: 103, False: 108]
  ------------------
  747|    103|                            len -= op;
  748|  16.0k|                            do {
  749|  16.0k|                                *out++ = *from++;
  750|  16.0k|                            } while (--op);
  ------------------
  |  Branch (750:38): [True: 15.9k, False: 103]
  ------------------
  751|    103|                            from = out - dist;  /* rest from output */
  752|    103|                        }
  753|    211|                    }
  754|  9.46k|                    while (len > 2) {
  ------------------
  |  Branch (754:28): [True: 8.96k, False: 503]
  ------------------
  755|  8.96k|                        *out++ = *from++;
  756|  8.96k|                        *out++ = *from++;
  757|  8.96k|                        *out++ = *from++;
  758|  8.96k|                        len -= 3;
  759|  8.96k|                    }
  760|    503|                    if (len) {
  ------------------
  |  Branch (760:25): [True: 263, False: 240]
  ------------------
  761|    263|                        *out++ = *from++;
  762|    263|                        if (len > 1)
  ------------------
  |  Branch (762:29): [True: 152, False: 111]
  ------------------
  763|    152|                            *out++ = *from++;
  764|    263|                    }
  765|    503|                }
  766|  18.7k|                else {
  767|  18.7k|                    from = out - dist;          /* copy direct from output */
  768|  1.30M|                    do {                        /* minimum length is three */
  769|  1.30M|                        *out++ = *from++;
  770|  1.30M|                        *out++ = *from++;
  771|  1.30M|                        *out++ = *from++;
  772|  1.30M|                        len -= 3;
  773|  1.30M|                    } while (len > 2);
  ------------------
  |  Branch (773:30): [True: 1.28M, False: 18.7k]
  ------------------
  774|  18.7k|                    if (len) {
  ------------------
  |  Branch (774:25): [True: 3.07k, False: 15.7k]
  ------------------
  775|  3.07k|                        *out++ = *from++;
  776|  3.07k|                        if (len > 1)
  ------------------
  |  Branch (776:29): [True: 1.65k, False: 1.41k]
  ------------------
  777|  1.65k|                            *out++ = *from++;
  778|  3.07k|                    }
  779|  18.7k|                }
  780|  19.6k|            }
  781|  1.60k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (781:22): [True: 1.27k, False: 322]
  ------------------
  782|  1.27k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  783|  1.27k|                goto dodist;
  784|  1.27k|            }
  785|    322|            else {
  786|    322|                strm->msg = (z_const char *)"invalid distance code";
  787|    322|                state->mode = BAD;
  788|    322|                break;
  789|    322|            }
  790|  21.2k|        }
  791|  4.90k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (791:18): [True: 3.45k, False: 1.45k]
  ------------------
  792|  3.45k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  793|  3.45k|            goto dolen;
  794|  3.45k|        }
  795|  1.45k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (795:18): [True: 1.23k, False: 211]
  ------------------
  796|  1.23k|            Tracevv((stderr, "inflate:         end of block\n"));
  797|  1.23k|            state->mode = TYPE;
  798|  1.23k|            break;
  799|  1.23k|        }
  800|    211|        else {
  801|    211|            strm->msg = (z_const char *)"invalid literal/length code";
  802|    211|            state->mode = BAD;
  803|    211|            break;
  804|    211|        }
  805|  74.0k|    } while (in < last && out < end);
  ------------------
  |  Branch (805:14): [True: 59.9k, False: 8.44k]
  |  Branch (805:27): [True: 55.4k, False: 4.49k]
  ------------------
  806|       |
  807|  15.0k|#if Z_INFLATE_FETCH != 8
  808|  67.0k|  leave:
  809|  67.0k|#endif
  810|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  811|  67.0k|    len = bits >> 3;
  812|  67.0k|    in -= len;
  813|  67.0k|    bits -= len << 3;
  814|  67.0k|    hold &= (1U << bits) - 1;
  815|       |
  816|       |    /* update state and return */
  817|  67.0k|    strm->next_in = in;
  818|  67.0k|    strm->next_out = out;
  819|  67.0k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (819:33): [True: 63.6k, False: 3.41k]
  ------------------
  820|  67.0k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (820:34): [True: 21.1k, False: 45.9k]
  ------------------
  821|  45.9k|                                 257 + (end - out) : 257 - (out - end));
  822|  67.0k|    state->hold = hold;
  823|  67.0k|    state->bits = bits;
  824|  67.0k|    return;
  825|  15.0k|}
inffast.c:load64:
   76|  2.60M|local Z_U8 load64(z_const unsigned char FAR *p) {
   77|  2.60M|#ifndef Z_INFLATE_BYTES
   78|  2.60M|    Z_U8 v = 1;
  ------------------
  |  |   56|  2.60M|#    define Z_U8 unsigned long
  ------------------
   79|  2.60M|    if (*(unsigned char *)&v) {
  ------------------
  |  Branch (79:9): [True: 2.60M, False: 0]
  ------------------
   80|  2.60M|        zmemcpy(&v, p, 8);
  ------------------
  |  |  306|  2.60M|#    define zmemcpy memcpy
  ------------------
   81|  2.60M|        return v;
   82|  2.60M|    }
   83|      0|#  ifdef Z_BSWAP64
   84|      0|    zmemcpy(&v, p, 8);
  ------------------
  |  |  306|      0|#    define zmemcpy memcpy
  ------------------
   85|      0|    return Z_BSWAP64(v);
  ------------------
  |  |   65|      0|#    define Z_BSWAP64 __builtin_bswap64
  ------------------
   86|      0|#  endif
   87|      0|#endif
   88|      0|    return (Z_U8)p[0] | ((Z_U8)p[1] << 8) | ((Z_U8)p[2] << 16) |
   89|      0|           ((Z_U8)p[3] << 24) | ((Z_U8)p[4] << 32) | ((Z_U8)p[5] << 40) |
   90|      0|           ((Z_U8)p[6] << 48) | ((Z_U8)p[7] << 56);
   91|  2.60M|}
inffast.c:copy_back:
   98|  1.43M|                                   unsigned len) {
   99|  1.43M|    unsigned char FAR *from = out - dist;
  100|  1.43M|    unsigned char FAR *stop = out + len;
  101|       |
  102|  1.43M|    if (dist >= 16) {                   /* sixteen at a time, no overlap */
  ------------------
  |  Branch (102:9): [True: 396k, False: 1.04M]
  ------------------
  103|  4.28M|        do {
  104|  4.28M|            zmemcpy(out, from, 16);
  ------------------
  |  |  306|  4.28M|#    define zmemcpy memcpy
  ------------------
  105|  4.28M|            out += 16;
  106|  4.28M|            from += 16;
  107|  4.28M|        } while (out < stop);
  ------------------
  |  Branch (107:18): [True: 3.88M, False: 396k]
  ------------------
  108|   396k|        return stop;
  109|   396k|    }
  110|  1.04M|    if (dist >= 8) {                    /* eight at a time, no overlap */
  ------------------
  |  Branch (110:9): [True: 1.40k, False: 1.04M]
  ------------------
  111|  8.06k|        do {
  112|  8.06k|            zmemcpy(out, from, 8);
  ------------------
  |  |  306|  8.06k|#    define zmemcpy memcpy
  ------------------
  113|  8.06k|            out += 8;
  114|  8.06k|            from += 8;
  115|  8.06k|        } while (out < stop);
  ------------------
  |  Branch (115:18): [True: 6.65k, False: 1.40k]
  ------------------
  116|  1.40k|        return stop;
  117|  1.40k|    }
  118|  1.04M|    if (dist == 1) {                    /* a run of one byte, eight at once */
  ------------------
  |  Branch (118:9): [True: 461k, False: 580k]
  ------------------
  119|   461k|#ifdef Z_U8
  120|   461k|        Z_U8 run = *from;
  ------------------
  |  |   56|   461k|#    define Z_U8 unsigned long
  ------------------
  121|   461k|        run |= run << 8;
  122|   461k|        run |= run << 16;
  123|   461k|        run |= run << 32;
  124|  7.36M|        do {
  125|  7.36M|            zmemcpy(out, &run, 8);
  ------------------
  |  |  306|  7.36M|#    define zmemcpy memcpy
  ------------------
  126|  7.36M|            out += 8;
  127|  7.36M|        } while (out < stop);
  ------------------
  |  Branch (127:18): [True: 6.90M, False: 461k]
  ------------------
  128|       |#else
  129|       |        Z_U4 run = *from;
  130|       |        run |= run << 8;
  131|       |        run |= run << 16;
  132|       |        do {
  133|       |            zmemcpy(out, &run, 4);
  134|       |            zmemcpy(out + 4, &run, 4);
  135|       |            out += 8;
  136|       |        } while (out < stop);
  137|       |#endif
  138|   461k|        return stop;
  139|   461k|    }
  140|       |    /* dist 2..7: eight bytes per step, of which the first dist are right;
  141|       |       the next step rewrites the rest. All eight are read before any are
  142|       |       written, since they overlap. */
  143|  68.2M|    do {
  144|  68.2M|#ifdef Z_U8
  145|  68.2M|        Z_U8 v;
  ------------------
  |  |   56|  68.2M|#    define Z_U8 unsigned long
  ------------------
  146|  68.2M|        zmemcpy(&v, from, 8);
  ------------------
  |  |  306|  68.2M|#    define zmemcpy memcpy
  ------------------
  147|  68.2M|        zmemcpy(out, &v, 8);
  ------------------
  |  |  306|  68.2M|#    define zmemcpy memcpy
  ------------------
  148|       |#else
  149|       |        Z_U4 v0, v1;
  150|       |        zmemcpy(&v0, from, 4);
  151|       |        zmemcpy(&v1, from + 4, 4);
  152|       |        zmemcpy(out, &v0, 4);
  153|       |        zmemcpy(out + 4, &v1, 4);
  154|       |#endif
  155|  68.2M|        out += dist;
  156|  68.2M|        from += dist;
  157|  68.2M|    } while (out < stop);
  ------------------
  |  Branch (157:14): [True: 67.6M, False: 580k]
  ------------------
  158|   580k|    return stop;
  159|  1.04M|}

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

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

zcalloc:
  324|    811|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  325|    811|    (void)opaque;
  326|    811|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (326:12): [True: 811, Folded]
  ------------------
  327|    811|                              (voidpf)calloc(items, size);
  328|    811|}
zcfree:
  330|    811|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  331|    811|    (void)opaque;
  332|    811|    free(ptr);
  333|    811|}

